Chatbots and virtual assistants: from scripts to language models
Chatbots evolved from scripted decision trees to conversational systems that use natural language processing and large language models. This article describes the components, the building process, and the role of modern language models.
From scripts to conversational AI
A chatbot is a program that communicates with users through text or voice to answer questions, provide information, or complete tasks. Early chatbots followed predefined rules and decision trees, as IBM's chatbot definition explains. The idea of computer conversation appeared in the 1950s with the Turing Test, and ELIZA in the 1960s used pattern matching to simulate dialogue.
Modern chatbots split into two groups. Rule-based chatbots use buttons, menus, and scripted responses, while AI chatbots use natural language processing to interpret flexible input, as described in AWS's chatbot overview. Keyword-based chatbots recognize specific words and reply with predetermined answers, but they can only handle topics already programmed.
AI chatbots connect to knowledge bases and business applications to retrieve information and complete transactions. They can also pass complex conversations to human agents, as noted in the same IBM and AWS sources.
How conversational AI works
Conversational AI is a broad technology that powers chatbots, virtual agents, and assistants. It combines natural language processing with machine learning in a feedback loop, according to IBM's conversational AI page. The process has four steps: input generation, input analysis, dialogue management, and reinforcement learning.
Input generation receives text or speech. Text input is analyzed with natural language understanding (NLU), while speech input uses automatic speech recognition plus NLU. Dialogue management formulates a response using natural language generation (NLG), and reinforcement learning refines responses over time.
Machine learning algorithms improve the system as they receive more data. AWS's conversational AI page explains that NLU understands user intent and context, while NLG creates coherent, humanlike sentences. These technologies allow chatbots to handle sarcasm, metaphors, and varied sentence structures.
Building a conversational AI
Development starts with frequently asked questions (FAQs). These define the intents, or goals, that users express. IBM's conversational AI page suggests listing common questions and then teaching the system alternative phrasings for each intent.
After defining intents, developers add entities, which are the nouns or keywords that surround the intents. Example phrasings might include "log in" or "reset password" for the intent of account access. Analytics and support teams can help find the actual phrasings that customers use.
The system can then route users to relevant information or complete transactions. It can also be integrated with existing customer service workflows, as AWS describes for call centers and CRM systems.
Language models and modern chatbots
Recent chatbots are powered by large language models (LLMs) that generate dynamic responses. The Stanford Speech and Language Processing textbook covers transformers, pretraining, and post-training, which are the basis of these models. Transformers process entire sequences of text, and pretraining on large corpora gives the models general language knowledge.
Post-training adapts a pretrained model to specific tasks or safety requirements. This contrasts with scripted chatbots that only use fixed decision trees. LLM-based chatbots can maintain context across a conversation and handle a wider range of user inputs.
The same language model technology also powers virtual assistants and AI agents that perform transactions or summarize information, as noted in the conversational AI sources.
| Type | How it works | Limitations |
|---|---|---|
| Rule-based | Provides buttons or menus for predetermined questions | Cannot handle unknown factors, difficult to scale, slow to answer |
| Keyword-based | Extracts keywords and replies with scripted responses | Limited to preprogrammed topics, no dynamic response |
| AI-powered | Uses NLP, NLU, and NLG for dynamic responses, often with LLMs | Requires more data and processing power, may need guardrails |
Frequently asked questions
What is the difference between a chatbot and conversational AI?
Conversational AI is a broad technology category that enables systems to understand and respond to human language. A chatbot is one specific application of that technology, along with virtual agents and AI assistants.
How does a team start building a conversational AI?
A team begins with a list of frequently asked questions from customers or support staff, then defines these as intents and adds example phrasings. They also identify entities, which are the key nouns or keywords around those intents.
What are intents and entities in conversational AI?
Intents are the goals expressed in a user's input, such as logging in to an account. Entities are the relevant nouns or keywords that provide context, like the account number or the action to reset a password.
Can a rule-based chatbot answer complex questions?
No. Rule-based chatbots only follow predefined menus and scripts, so they cannot handle questions outside their programmed response set. AI chatbots with large language models can address varied and complex queries.