Today we are releasing the first step of our vision for conversational bots: an early beta of Bot Engine.
Since we joined Facebook 15 months ago, the Wit community grew from 6,000 to 21,500 developers. Many of you are already making bots, leveraging Wit to parse messages into structured, actionable data. We are also building Facebook M, your personal assistant in Messenger. We’ve learned a lot in the process.
Making a bot seems easy until you try. And then, the curse of combinatorics bites you. Understanding the user intent is a necessary step, but that’s not enough. How should the bot respond? What actions should it perform? What question should it ask? This is the problem we are trying to help solve with Bot Engine. Here is how:
Key concept 1: Stories
To make a bot, there are two schools: rules or machine learning. (Everybody claims rules are bad and their bot is powered by AI, but when you really look under the hood, the core is often imperative.)
Machine learning is of course more desirable, but the problem is the training dataset. Training a Wit intent with a dozen examples works well, and it’s easy to leverage the community to get more examples. But in order to entirely learn the business logic of a bot of medium complexity, we would need many, many thousands of example conversations.
Rules (or any kind of imperative approach, including plain script/program) are kind of the opposite. The good thing with rules is, you can have a demo working after you write two rules. As long as you follow the script carefully, your bot will work and your audience will be impressed. But as you discover new “paths” in the dialog, you’ll add more and more rules, until one day everything collapses. You’re doomed by the curse of combinatorics. Any new rule conflicts with old rules that you totally forgot the reason for. Your bot cannot improve anymore.
Bot Engine is trained with Stories. Stories are example conversations. On top of user’s and bot’s messages, Stories also contain the bot actions:
When you create your bot, you just start with a few stories that describe the most probable conversations paths. At this stage, Bot Engine will build a machine learning model that deliberately overfits the stories dataset. Practically, it means that stories will behave almost like rules. It enables you to start beta testing your bot and collect conversations. You will then turn these conversations into new stories (exactly like you turn logs into new expressions in the original Wit). The more stories you have, the better the model becomes. Unlike rules, Stories can ignore each other; when you discover a new use case, you can add a new story without the need to take into account all previous stories.
With this approach, we are trying to get the best of both worlds: rules when you get started and don’t have much data, and AI once your dataset grows.
Key concept 2: Action
Trained by Stories, Bot Engine predicts the next action your bot may execute at each step of the conversation. This action is executed on your side, with your code. We’ve made this decision because we believe that developers need total freedom of platform and execution scope for their bot’s actions. You should be able to use any programming language of your choice and call any API you need. That wouldn’t be practical if actions were executed on our side.
An action typically modifies the context of the conversation. You pass the new context to Bot Engine when you need to predict the next action.
Actions also help relieve the pressure on the machine learning model: they encapsulate some business logic that would require a huge dataset to learn end-to-end. It enables Wit to train efficient models before you have hundreds of Stories.
Key concept 3: Inbox
In line with the original Wit philosophy, we think that you really discover your users’ expectations and logic only after you release a first version of your bot. As a result, the initial build should be as lightweight as possible, and the platform optimized around continuous learning and improvement based on actual usage.
In Bot Engine, we are extending the concept of the Wit Inbox to the conversation logs: we will provide an easy way to turn logs into new Stories. This is the learning loop. Each time you add a new Story, your bot’s models are rebuilt in real time.
We are trying to solve a very hard problem, and we are not pretending that we have the definitive solution. There are many kinds of bots, and many different ways to address the problem. This is an early beta: our hope is that you won’t hesitate to contact us when you are trying to do something that doesn’t seem to be well handled. We are committed to spend a significant amount of time supporting the community and learning more about the problem.
While at first glance it may look easier to just use scripts, AIML, or slot-based workflow templates to build bots, we believe that these approaches soon lead to bottlenecks. Bot Engine might not be as easy as putting a few rules together in a basic bot, but it’s designed to handle scaling complexity with simplicity (special dedication to our hero Rich Hickey), as additional stories don’t need to comply with a complex net of existing rules.
Some of us at Wit have been building bots for 15 years. We’ve tried many things that don’t work, and we’re still looking for what could work. Please give Bot Engine a try, and give us your feedback!
Alex Lebrun & Team Wit
Note: If you already have a Wit app
- First of all, thanks! We are thrilled to continue to serve you.
- Your existing app will continue to work as before. The
/message API is unchanged.
- You won’t have the
Stories tab in your existing app. We’ll add a migration process very soon.
- If you create a new app, you’ll get the
Stories tab. You will also notice a change in the Console: we’ve merged the concepts of intents and entities under an
Understanding tab, and slightly updated the training UX.