This article was originally published on QBox’s blog, prior to Cyara’s acquisition of QBox. Learn more about Cyara + QBox.
Learning how to build and scale a chatbot can seem like a daunting task—but it doesn’t need to be! In this blog, our Data Model Analyst Alison Houston shares best practice.
Discover how Cyara can help you develop better quality chatbots with our conversational AI optimization platform.
If you’re about to embark on your first chatbot build journey, or if you have a few chatbots under your belt and just about to start your next one, just knowing how and where to start can seem like a big obstacle. But don’t worry, the steps outlined below should help you create a solid foundation on which to build your first (or next) chatbot, one that will respond to customer requests effectively and accurately.
After the initial planning to define your chatbot’s purpose and goals, the work starts with mapping out your intents and entities and ends with… well, actually there is no end, because a chatbot will need continuous monitoring, adjusting, training—and scaling if you’re successful—throughout its life.
Mapping Your Model
You’ll need access to real customer logs, FAQs, support inboxes, or databases as a starting point. This data won’t necessarily be used as your training data, but as a guide to your chatbot intents.
The data will need to be divided into categories (which may not be intents at this stage) and these might also need to split into sub-categories. If you can’t obtain this, you might need the help of a subject-matter expert to create an initial set of typical customer questions for the domain.
Map each question to a category using Excel. Sub-categories will then start to evolve, creating your intents and entities. For example, a chatbot for a bank might have a category for LENDING, which could then have sub-categories for LOANS and MORTGAGES.
And then within the MORTGAGES, you might have further sub-categories for mortgage types (and the specific mortgage types—repayment/interest only—would then be the entity), and so on. Here’s an example of what your intent-mapping document might look like:
As you build your map, consider how questions will be asked, and if they will be asked in a similar way. Look to group them within the same intent and use entities for the variables, as we’ve done in the examples above (mortgage types and loan types).
Doing this will also help to futureproof your chatbot. If, for example, new mortgage or loan types are created by the bank in future, they can easily be included simply by adding new values to the existing entities and with minimal new training data needed.
Your mapping document will continue to evolve and there may be multiple versions through the build stage. The first one you attempt will probably look totally different to your latest version.
Once you’re happy with the mapping document and all the main questions have been categorised, you’ll be ready to start building your chatbot in your chosen NLP provider, using the intents and entities decided at this mapping stage.
Start with creating a small model. Prioritise your intents and add them in phases. As a guide, aim for about 40 intents initially. Build out each intent with a set of utterances. If you have example data (i.e. real customer logs), you can refer to this to help you devise utterances, but only use it as a guide.
It’s important to keep utterances short, concise, and relevant to the intent. Most NLP providers recommend at least five utterances per intent, having 15 to 20 will give better results. If you’re looking for best practice and guidance on utterance generation, check out this blog.
Tips for Building Good Intent Training Data:
- Aim to have no more than five key concepts within an intent. For example, an intent about how to contact a company might have these five key concepts:
- Contact details
- Email address
- Telephone number
- Website address
- Company address
- Aim to have at least three utterances per key concept, and vary these utterances as much as possible to ensure they cover multiple ways that customers might ask them.
- Avoid repeated patterns within your utterances, such as, “Can I have your contact details,” “Can I have your telephone number,” “Can I have your website address.” These repeated patterns will train your model to think the key concept is “Can I have your” and this is likely to cause problems within other intents.
- A thesaurus is an invaluable tool for ensuring you include synonyms in your utterances. For example, instead of having all your training questions contain “apply,” have some with “application,” “request,” and so on.
As you build out your intents, you may need to revisit your mapping document and make further changes, either by merging or separating intents, or perhaps by adding more entities.
Scaling Your Chatbot
Fast forward a few months…
Once your chatbot has stabilized, teething problems have been resolved and you’ve optimized its performance, you can start to scale it. This should be a gradual process if you have a lot of new intents to add. Prioritize the new intents and add them in batches of 20 to 40 maximum at a time.
Go back to your mapping document and map these new intents in the same way as before. You may well find you can utilize some of your existing intents by creating entities to provide new content, rather than just adding all new intents.
You could also try testing new intent questions within your existing bot (before adding the new intents) and see if they’re returning an existing intent with high confidence. Again, you may well be able to make use of entities rather than adding new intents.
Allow time in between each scaling phase to carefully monitor your bot. Scaling tends to generate regression, so it’s vitally important to keep checking your chatbot’s performance.
Summary
The key to building a great chatbot is to start with a good base, using a mapping document. Start small and gradually build up your chatbot’s scope. Once it’s live, carry on monitoring and improving your chatbot with regular training before you attempt scaling, and then do it gradually.
Find out more
Get in touch to find out how Cyara can make your chatbot building and scaling journey more efficient.