Best Practices for Designing Effective AI Chatbots

Our expert shares tips for building a chatbot that successfully helps your customers.

Written by Nate MacLeitch
Published on Nov. 08, 2024
A closeup on someone holding a smartphone and working on a laptop with a chatbot icon
Image: Shutterstock / Built In
Brand Studio Logo

Generative AI can enhance natural language processing (NLP) capabilities, helping these tools better understand user preferences, and provide users with more personalized support. As a result, the market for this technology is booming. The global chatbot market was valued at $4.7 billion in 2022 and is projected to grow at a considerable CAGR of 23 percent between now and 2028. 

Still, a 2024 Gartner survey predicts that by the end of 2025, at least 30% of generative AI projects will be abandoned after proof of concept due to poor data quality, inadequate risk controls, escalating costs, or unclear business value.

Companies creating chatbots for their customers must train their AIs with quality data. By carefully thinking through their intended uses, developers can identify relevant, trusted data sources and curate accurate and reliable data. 

This is the first step. They must also put strict guardrails in place to continuously validate the reliability of their data. Implementing fact-checking mechanisms, including a human-in-the-loop approval stage, can significantly reduce the risk of the AI chatbot generating misleading or harmful content. As the AI learns and adapts, the human role is imperative to guide natural conversations and ensure a smooth experience for customers.

Developers must carefully consider their chatbots’ use cases, map out potential conversation scenarios (the more, the better), and continuously test and iterate with safe, reliable data. 

4 Best Practices for Building AI Chatbots

  1. Identify specific use cases.
  2. Map out your story.
  3. Design natural, contextually tuned conversations.
  4. Guard data sources to ensure reliable responses.

More on Artificial IntelligenceWhat Is Artificial Intelligence (AI)?

 

1. Identify Specific Use Cases

What problems are you looking to solve? Are these issues time related, budget related or team related? What tasks should the chatbot be able to handle? 

Perhaps your customer support team has to deal with difficult customers or customers from various cultural backgrounds and struggle to communicate brand values in the most appropriate way. In this case, advanced sentiment analysis will likely be a key feature to build into your chatbot. This NLP technique determines the emotional tone behind chat history, reviews, surveys, web articles and social media.

Over time, it can adjust to the brand voice. It can help recommend responses to help service teams find the right words in a given scenario, allowing them to simply edit, approve, and send. A 2024 survey presented on Medium found that 38 percent of companies were keen to use generative AI-powered chatbots to support with customer service.

Chatbots supporting your marketing efforts, on the other hand, must know which offers are best suited to your consumers. For example, a grocery chain can give customers a tool to ask for recipe recommendations or advice, allowing stores to better understand shoppers’ preferences and provide relevant promotions. For this service to function well, features like preference profiling — creating a system to capture and store customer prerogatives such as any dietary restrictions, allergies, and of course, details about their favorite cuisines and food preferences — will be of considerable value alongside sentiment analysis training. 

Rank the use cases you define in order of priority based on your overall business strategy and goals to ensure effective resource allocation and project direction. The MoSCoW (must-have, should-have, could-have, won't-have) prioritization framework, or weighted scoring by assigning numerical values to criteria like importance, urgency and complexity, can help.

 

2. Map Out Your Story

You should visualize potential interactions with consumers and create conversation diagrams, even with generative AI. A well-defined structure and understanding of potential conversation flow ensures that chatbots stay focused on their intended purpose, creating a coherent and engaging experience. 

And the faster they can solve issues, the better! Consumers are already used to menu-based chatbots with canned responses. If generative AI’s capabilities are to add value for customers, they must intimately understand the products and customer journey. Without knowledge of features, specifications, pricing and availability, chatbots could end up frustrating customers instead.

Business leaders must visualize the different paths a conversation can take based on user input and model the different states (status, contextual, task-based, or emotional) the chatbot can be in. This includes active, idle, error, greeting, question, answer, order placement, search, recommendation, feedback request, or positive and neutral states.

AI builders will use these story diagrams to generate more relevant and accurate training data for the generative AI model by ensuring that it is trained on applicable potential interactions that match the conversation paths. They can also use these story diagrams to steer comprehensive lists of prompts and desired responses, which will help the model learn to generate appropriate and contextually relevant responses automatically.

A chatbot interface
Image: Screenshot by the author.

Developers will consider multiple prompts for the same story diagram. For example, I forgot my password, My account is locked, and I'm having trouble logging in are some alternatives. 

The next step would be to simulate realistic conversations of common questions, challenges and user requests to help the model understand the nuances of human language and behavior. Developers will need to write these scripts themselves, but they can use generative AI in the process with a human-monitored review, edit and approve approach.

 

3. Design Natural, Contextually Tuned Conversations

Human language is prone to errors and inconsistencies, including slang, sarcasm, typos and informal usage. Chatbots must understand users’ intent amid these nuances to extract key details within the message, such as customer or store locations, products, and dates. The ultimate goal is to gather the necessary information to fulfill each request.

Since NLP can handle a multitude of expressions and phrasings, when given a diverse data set, it can identify patterns, translate the meaning behind text, and respond accurately. It works hand in hand with machine learning (ML), which allows the chatbot to learn from conversations and improve over time. By analyzing user interactions and past performance, chatbots can begin to understand more nuanced user requests and optimize dialogue tailored to their preferences. By ensuring it retains context, such as conversation history, user goals and choices made, chatbots can deliver natural and engaging interactions.

A user story for a chatbot
Image: Screenshot by the author.

In the example above, the context provided helped the chatbot identify the scenario two user as a history enthusiast, offering cultural landmarks. The user profile it created for scenario three meant activities suitable for children were more appropriate.

Dialogue flow control, where the chatbot guides the user toward a resolution, works by asking clarifying questions and offering options to finalize a request. In cases where customers leave the chat and return later or send multiple messages to explain the request, however, dialogue state tracking and intent recognition across turns are critical. Looking at the example above, if the user prompted, later in the day: “​​​​​I'm also interested in learning about the history of the city, the chatbot, using dialogue state tracking, would track the user's current state as planning a trip to Paris. The chatbot can then recognize the user’s intent to learn about the history of Paris.

Together, these dialogue management techniques ensure the user doesn’t have to repeat themselves, making them feel heard, understood, and satisfied with their solution.

 

4. Guard Data Sources to Ensure Reliable Responses

Developers must trust that all training data sources are reliable. Chatbots work best with diverse data sets. As such, developers may use external data sources, such as GPS or weather data in the case of a generative AI delivery chatbot, to train their bots. If this is the case, randomize data downloads and validate that no modifications were made between the last data verification and the download time. This ensures that external data sources are not hacked and modified by bad actors between downloads.

Developers must exercise extra care in instances where sensitive information and payments are involved. For example, a developer building a healthcare chatbot to support patient diagnosis may use external data to ensure the chatbot keeps up with the latest medical advancements and regulations.

Limiting data sources to reputable medical journals, databases, and organizations and implementing meticulous data validation at input and output is critical. They must follow the standards for U.S. healthcare providers such as the Health Insurance Portability and Accountability Act (HIPAA). This includes the use of strong encryption protocols, secure APIs, and random verification of the integrity of external data to detect any unauthorized modifications. Developers can also use hashing algorithms to create a digital data fingerprint and detect changes. 

It is also important to check the external data is regularly updated to reflect the latest medical knowledge. Web scraping tools can help here. These tools automatically collect data from various online sources and can be configured to monitor specific sites for changes, and notify chatbot developers using these sources to train their models.

As an extra precaution, regulated industries such as healthcare must isolate patient data from external data sources to minimize the risk of exposure. Strict access controls and a federated learning approach mean companies can collectively train a distributed model without the need to disclose sensitive medical records. Instead, data remains on private servers, processing data from the source, training the model, and encrypting the model’s new configuration ready for sharing.

More on ChatbotsHow We Built a Chatbot That Uses Generative AI

 

Build Better Chatbots

AI chatbots are making exciting progress in elevating response time to customer and patient requests. Their ability to digest information, infer context, and tailor outcomes to the emotional nuances of human language is impressive. Situations where experts struggle to create straightforward conversational maps will require much more human attention, however. In these scenarios, it is much safer to direct users to a human agent. Developers must carefully scope their use cases, conversation maps, and data guardrails, starting with less complex tasks. As ML learns and iterates, the chatbots can begin to take on more advanced interactions.

Explore Job Matches.