Chatbots & Dialogue Systems
Understanding Conversations: Key Concepts
Have you ever wondered what makes a conversation flow? It's more than just exchanging words; it's a complex dance of understanding, responding, and acknowledging each other. Let's break down some key elements:
Turns in Conversation
Conversations are structured in turns, where each participant gets a chance to speak. Knowing when to start and stop talking is crucial. For example, if a system is performing the role of speaker, it should know when the user makes a correction.
Spoken dialogue systems also need to detect when a user has finished speaking, which is a task called endpoint detection and it can be tricky due to noise or pauses within a turn.
The Power of Speech Acts
Each utterance in a dialogue is a kind of action. These are commonly referred to as speech acts or dialogue acts. Here are some major classes:
- Constatives: Statements that commit the speaker to something being the case (e.g., answering, claiming, confirming, denying, stating).
- Directives: Attempts to get the listener to do something (e.g., advising, asking, forbidding, inviting, ordering, requesting).
- Commissives: Committing the speaker to some future action (e.g., promising, planning, vowing, betting, opposing).
- Acknowledgments: Expressing attitude towards the listener (e.g., apologizing, greeting, thanking, accepting an acknowledgment).
Asking a dialogue system to do something (like "Set an alarm for 7 AM") is a DIRECTIVE. Stating a constraint (like "I need to travel in May") is a CONSTATIVE. Saying "Thank you" is an ACKNOWLEDGMENT.
Establishing Common Ground: Grounding
For a conversation to succeed, participants must agree on what they both understand. This shared understanding is called the common ground. Speakers achieve this by grounding each other's utterances, essentially acknowledging that the listener has understood.
For example, saying "OK" after someone speaks is a way of grounding. Repeating what the other person says or asking clarifying questions also demonstrates understanding.
Navigating Dialogue Structure: Subdialogues
Conversations aren't always linear; they often contain subdialogues. Questions set up expectations for answers, and proposals are followed by acceptance or rejection. These pairs, called adjacency pairs, help systems decide what actions to take.
Correction subdialogues are very common, where the question interrupts the prior discourse, so the agent answer the question and also realize that the client would probably like to change their plan.
Sometimes, a clarification question can form a subdialogue between a request and a response. This is especially common in dialogue systems where speech recognition errors causes the system to have to ask for clarifications or repetitions.
Taking the Lead: Initiative
In a conversation, one participant might control the flow. We call this conversational initiative. In normal human interactions, initiative shifts back and forth. Some dialogue systems use system-initiative, where the system asks questions and the user can’t do anything until they answer it, or user-initiative where the user specify and the system passively responds.
Reading Between the Lines: Inference and Implicature
People often communicate more than they explicitly say. Implicature refers to these subtle inferences that listeners draw. For example, if someone mentions a meeting while discussing travel plans, the listener might infer that the meeting is the reason for the travel.
Task-Based Dialogue Systems: Frame-Based Approach
Many dialogue systems are designed to help users achieve a specific task, such as making a reservation. These systems often use a frame-based approach, where a frame is a knowledge structure representing the details of the user's task. Each frame consists of slots, which can take on specific values.
Frames and Slot Filling
The goal of a task-based system is to fill the slots in the frame with the user's intended values. A hotel reservation system needs dates and locations; an alarm clock system needs a time. These questions are pre-written templates to extract information from the user.
For example, a frame for booking air travel might include slots like "ORIGIN CITY," "DESTINATION CITY," "DEPARTURE DATE," and "DEPARTURE TIME."
In addition to slot-filling, the system must determine the domain (e.g., airlines, alarm clock, calendar) and the user intent (e.g., Find a Movie, Show a Flight, Remove a Calendar Appointment).
For a user utterance like "Show me morning flights from Boston to San Francisco on Tuesday", a system might build a representation like:
- DOMAIN: AIR-TRAVEL
- INTENT: SHOW-FLIGHTS
- ORIGIN-CITY: Boston
- DEST-CITY: San Francisco
- ORIGIN-DATE: Tuesday
- ORIGIN-TIME: morning
Evaluating Task-Based Dialogue
Task error rate or task success rate: the percentage of times the system booked the right plane flight, or put the right event on the calendar.
Another metric is the slot error rate, the percentage of slots filled with the correct values. The formula to compute it is:
Slot Error Rate for a Sentence = (# of inserted/deleted/subsituted slots) / (# of total reference slots for sentence)
In addition, we can measure efficiency costs like the length of the dialogue in seconds or turns.
Enhancing Dialogue: Dialogue Acts and Dialogue State
For more complex interactions, we can use dialogue acts and dialogue state.
Dialogue Acts Explained
Dialogue acts represent the intention behind an utterance. These acts can be general or designed for specific tasks.
Example of dialogue acts:
- HELLO(task = find, type = restaurant)
- INFORM(food = Italian, near = museum)
- REQUEST(phone)
- CONFIRM(pricerange = moderate)
- BYE()
Tracking the Conversation: Dialogue State
The dialogue-state tracker determines the current state of the frame (the fillers of each slot) and the user's most recent dialogue act. The dialogue-state includes the entire state of the frame at this point, summarizing all of the user's constraints.
Example
| User | Information |
|---|---|
| I’m looking for a cheaper restaurant | inform(price=cheap) |
| Thai food, somewhere downtown | inform(price=cheap, food=Thai, area=centre) |
In addition, detecting correction acts is quite important for a dialogue system, since if a dialogue system misrecognizes or misunderstands an utterance, users will repeat or reformulate the utterance.
Deciding What to Say: Dialogue Policy
The dialogue policy decides what dialogue act to generate. It helps the system determine when to answer questions, ask for clarification, and so on. This involves content planning, choosing which arguments to include with the dialogue act.
A system might use an explicit confirmation act to confirm with the user, like "Is that correct?". When using an implicit confirmation act, a system repeats the system’s understanding as part of asking the next question.
Bringing Words to Life: Natural Language Generation
Once a dialogue act is chosen, we need to generate the text of the response. This is called sentence realization. The process starts by specifying the act and arguments and training on examples of representation/sentence pairs from a corpus of labeled dialogues. We can delexicalize the training examples by replacing specific slot value words in the training set with a generic placeholder token representing the slot.
Chatbots: Mimicking Human Conversation
Chatbots are systems designed to carry on extended conversations, mimicking the unstructured chats of human interaction.
Training Chatbots: Data and Architecture
Chatbots are typically trained on large language model training data, including web content, news sites, Wikipedia, and books. Additionally, dialogue data is often added, including datasets created specifically for chatbot training.
Common datasets include Topical-Chat, the EMPATHETICDIALOGUES, and the SaFeRDialogues dataset.
The most common architecture uses the standard causal language model, where the model predicts each word given all the prior words. Alternatively, an encoder-decoder architecture can be used, where the entire conversation up to the last turn is presented to the encoder, and the decoder generates the next turn.
Fine-Tuning for Quality and Safety
Further fine-tuning is used to improve the quality of the dialogue and ensure safety. Speakers of the language are given an initial prompt and instructions to have high-quality, safe dialogues.
Discriminative data can be added to downweight low-quality or harmful responses. A model can be trained to predict turn-level safety and quality values, by training on human-labeled ratings.
Retrieval-Augmented Chatbots
Modern chatbots are often trained to perform retrieval (calls to search engines) as a component of generating a response. This can be done by incorporating a fake dialogue participant that simulates search queries and results.
Reinforcement Learning from Human Feedback
A more sophisticated method uses reinforcement learning to learn to match human preferences for generated turns. In RLHF, the system samples two possible turns from the language model, and humans label which one is better. This data is used to train a dialogue policy and the language model.
Evaluating Chatbots
Chatbots are evaluated by humans, who assign a score. This can be done through participant evaluation, where the human who chatted with the chatbot rates it on various dimensions, or observer evaluation, where a third party reads a transcript of the conversation and assesses the system's performance.
One example is the acute-eval metric, where annotators compare two separate human-computer conversations and choose the system that performed better on engagingness, interestingness, humanness, and knowledgability.
Designing Effective Dialogue Systems
Dialogue system design is closely linked with Human-Computer Interaction (HCI), especially for task-oriented dialogues. The design of dialogue strategies, often called voice user interface design, generally follows user-centered design principles:
- Study the user and task: Understand users and their tasks through interviews and analysis of similar systems.
- Build simulations and prototypes: Use Wizard-of-Oz systems, where a human "wizard" simulates the system's responses, to test out architectures before implementation.
- Iteratively test the design on users: Use an iterative design cycle with embedded user testing to refine the system based on user feedback.
It is important to incorporate value sensitive design, in which we carefully consider during the design process the benefits, harms and possible stakeholders of the resulting system.
Ethical Considerations in Dialogue System Design
Ethical issues are paramount in designing artificial agents. Safety of users, prevention of verbal attacks and harmful stereotypes, and protection of privacy are all critical considerations.
It is important to mitigate problems of abuse and toxicity, and to use value sensitive design to carefully consider possible harms in advance. Getting informed consent from participants and working with Institutional Review Boards (IRB) are crucial steps.
Comments
Post a Comment