Academy / Pre-AI Chatbot Tricks
← Back to Neverot

Pre AI Chatbot Tricks

How chatbots seemed real before modern AI dropped.
Pre AI Chatbots
Time period
1966 to early 2010s
Field
Computer science, linguistics
Famous examples
ELIZA, PARRY, A.L.I.C.E., MegaHAL, Cleverbot
Main idea
To use rules, timing tricks and randomness instead of complex models
Related
Modern AI Concepts (what replaced these tricks)

Before Large Language Models (LLMs), which is what people now just call "AI", chatbots relied on pattern matching tricks, decision trees and regex. This article covers many of the techniques, a lot of which are still being used in the "modern" AI tools.

Contents
  1. Pattern matching / reflection (ELIZA)
  2. Mood / belief states (PARRY)
  3. Pattern trees (A.L.I.C.E. and AIML)
  4. Markov chains
  5. Retrieval matching
  6. Monte Carlo / weighted randomness
  7. Deflection / stalling
  8. Behavioral texture (typing delay and typos)
  9. Are these still being used?
  10. Glossary
  11. Links
  12. References

1. Pattern matching / reflection (ELIZA)

ELIZA was built by Joseph Weizenbaum in 1966. ELIZA pretended to be a therapist. It would match keywords against a set of rules and build replies with no real comprehension involved.

The main trick was called reflection: swap "I" for "you" and "my" for "your," then hand part of the sentence back as a question.

You: I am sad about my job. ELIZA: Why are you sad about your job?

It's the oldest trick in the book, and still extremely effective. Any bot that echoes a word or phrase back at you is using it.

2. Mood / belief states (PARRY)

PARRY (Kenneth Colby, 1972) simulated a person with paranoia. It had a bank of "moods" like fear or anger, and would increase or decrease the likelihood of those responses using pattern matching.

Same question, different reply, depending on where the hidden "mood" happened to be.

3. Pattern trees (A.L.I.C.E. and AIML)

A.L.I.C.E. stored its rules in AIML (Artificial Intelligence Markup Language): patterns with wildcards, where more specific matches win over the general ones, and a way to reference the bot's last reply.

PatternTemplate
MY NAME IS *Nice to meet you, ⭐.
I LIKE *Why do you like ⭐?
*(fallback, when nothing else matches)

The ELIZA pattern could scale to thousands of hand-written rules.

4. Markov chains

A A Markov chain will track which words will follow other words in a body of text. To generate a reply, the bot will start with a word which could be pulled from your message, and then it will keep picking the next word by probability.

MegaHAL is a famous example. the grammar holds up fine; the sentence as a whole often does not. This created the genre's reputation for weird fricken replies.

5. Retrieval matching

Instead of generating text, a retrieval-based bot will index a large text of real sentences (movie subtitles / chats) and return the closest match to what you sent.

Has good grammar because a human wrote every line, but it is only as good as the amount of predefined text. If there aint a lot of text you get a bunch of off-topic replies.

6. Monte Carlo and weighted randomness

Monte Carlo methods are named after the Monte Carlo casino and coined by physicists Stanislaw Ulam and John von Neumann, probably a couple of degenerate gamblers, while they were working on nuclear weapons research at the Los Alamos research facility in the late 1940s. The core idea was that when a problem was too complex to solve cleanly, or too random, lets run it many times with random inputs and use the spread of outcomes as an estimate. It has since become a major tool for physics, finance, and computing wherever random sampling can be used. Think sports scores.

Chatbots could use the same methodology. Keep a pool of replies and roll the dice to pick among them, roll the dice on whether to reply at all, even roll dice on how many characters pile into a conversation. Yatzee Baby.

Obviously this isnt generating real speech, but it can be the glue that will stop a rule-based bot from repeating the same line every time, breaking the roleplay.

7. Deflection and stalling

Loebner Prize bots learned that "I don't understand" will break the (this is a human) illusion. So they decided to turn the question back on the user; change the subject with a joke, or be distracted/confused.

8. Behavioral texture (typing delay and typos)

This one aint about the language, more about the timing and small imperfections.

This is absolutely huge for creating "real, half-distracted human." behaviour.

9. Are these still being used?

Modern AI models language are way better at generating fluent, context-aware text instead of picking from rules or canned pools. But a lot of these tricks are still used by all of these "modern" AI tools.

See also

Glossary
Chatbot
A program that can have a text "conversation" with a human.
Keyword
A word that a program will search for to decide how to respond.
Markov chain
A model that will predict the next word from probabilities based on the previous word(s).
Pattern matching
Comparing the input text against a list of patterns to find one that works.
Regex
Short for "regular expression," a syntax for describing text patterns to search for & match real text, using wildcards, character classes and repetition.
Reflection
Swapping text like "I/my" for "you/your" so the reply sounds like it is directed at the user.
Retrieval
Returning the closest match from a bunch of text samples, instead of creating a new sentence.
Wildcard
A symbol (often *) meaning "match anything," which would be used inside a pattern.
References
  1. Weizenbaum, J. (1966). "ELIZA - A Computer Program For the Study of Natural Language Communication Between Man and Machine." Communications of the ACM, 9(1), 36-45. doi.org/10.1145/365153.365168
  2. Colby, K. M., Hilf, F. D., Weber, S., & Kraemer, H. C. (1972). "Artificial Paranoia." Artificial Intelligence, 2(1), 1-25. doi.org/10.1016/0004-3702(71)90002-6
  3. Wallace, R. (2009). "The Anatomy of A.L.I.C.E." Background on A.L.I.C.E. and the AIML pattern format. en.wikipedia.org/wiki/Artificial_Linguistic_Internet_Computer_Entity
  4. "MegaHAL": Markov-chain chatbot by Jason Hutchens. en.wikipedia.org/wiki/MegaHAL
  5. "Loebner Prize": annual Turing-test chatbot competition. en.wikipedia.org/wiki/Loebner_Prize
  6. Turing, A. M. (1950). "Computing Machinery and Intelligence." Mind, 59(236), 433-460. The imitation-game framing these bots were built to pass. doi.org/10.1093/mind/LIX.236.433