Context Switching in Chatbots

Created in Code
4 min readOct 15, 2019

--

Photo by Arnold Francisca on Unsplash

The ability for a chatbot to switch between contexts is critical for a smooth flowing conversation, a good understanding of what the user is asking and a positive user experience.

Context switching is often something that is forgotten about when a chatbot is being designed and its only once users start testing a chatbot that they realise how important it really is.

Adding context switching after a chatbot has been completed can be difficult, depending on your approach, so it is important to consider it as part of the initial planning process.

What is context switching?

Context switching happens in conversations all the time and as humans we are great at recognising and responding to a switch of context.

This occurs when you are talking about one thing and switch to another subject mid-way through a conversation.

For example, you could be in a perfume store and ask to buy your favourite fragrance. Whilst the assistant is getting that off the shelf you could see some advert for a different brand. When the assistant comes back expecting you to pay for the item they have collected, you instead ask to smell the other brand.

This might sound like a simple interaction and people have interactions like this every day, however, for a chatbot this could be very confusing.

If a chatbot has been designed with a conversation flow where the user selects an item, and then pays for that item, the chatbot would not know what to do it the user suddenly started asking for something else.

You can see this behaviour in some chatbots that are on popular websites, and you can test them by switching context in your conversation to see how they react. This is also a good way to catch out a chatbot that is pretending to be a person.

What is the solution?

There is no easy answer, people switch context constantly during conversations and expecting a chatbot to be intelligent enough to keep up is unrealistic. There are some very intelligent AI’s out there that could probably handle this, but these are outside the reach of most companies not called Google or IBM.

The best solution is to set expectations, create linear conversation paths and have escape actions. The alternative is to create complex conversation paths.

Set expectations

If users know that they are talking to a chatbot and not a person they will respond accordingly. They will use shorter, more direct answers, which can decrease the amount of context switching that a user will do.

If the user knows they are dealing with a chatbot they will also be more understanding when things go wrong, as long as they have a way to resolve them and continue the conversation.

If you try to create a chatbot that sounds human your users will become frustrated when the conversation does not have a natural flow.

Create linear conversation paths

If your users cannot context switch then you will never have a context switching problem.

Rather than trying to make a smart chatbot that can use AI to determine what people want and translate this into an action you should consider making a dumb chatbot that guides users through an interaction.

This can be done by offering users buttons to click. For example, rather than asking your users what they are looking for, offer them a list of options to choose from and make the last option ‘cancel’ or ‘go back’.

Escape actions

“Hello I am Helper Bot, I am still learning, if I appear to be stuck just type ‘restart’ to restart this conversation”

Whilst having text similar to the one above might not seem palatable it can improve user satisfaction. I once worked with a business who had issues with their in-house IT Support chatbot struggling with context switching. As an interim solution we added a message like the one above and we added code to detect this input and reset the conversation.

Customer uptake of the bot and satisfaction with the service increased almost overnight because now users understood what to do if they encountered a fault.

Complex Paths

There is an internet meme that states that “AI is just 1,000,000 if — else statements”. Whilst this isn’t true you can create the appearance of a smart chatbot by using a lot of conditional statements. If you pass every input that a user makes into your chatbot through a conditional statement then you might be able to capture some of the context switching and handle it accordingly.

Using the perfume example, you might have a conversation flow that looks like the below.

Building enough if statements to capture every possibility is theoretically possible but the cost of creating and maintaining such a chatbot may not be worth it.

If you don’t like the idea of IF statements then there is the potential to use machine learning to understand what your users want, and to direct the conversation even in the event of context switching. The issue with this is that it can be expensive to set up, train and maintain. Microsoft LUIS service is an example of this, and whilst it is low cost it could add up on a large deployment.

--

--

Created in Code

C#/ASP.NET — Chatbots, AI, Machine Learning and the Web