Wednesday, February 26, 2014

Create bots with a real brain

BOT libre bots are not like other chat bots. They are not limited to simple response searching, or scripted responses. BOT libre bots have a real brain that functions similar to a human brain.

Their brain stores everything about every conversation, and they are always analyzing everything. When you chat with a bot it remembers what was said, who said it, what it was in response to, when it was said, what the words were in each sentence, and in what order, and which words came before/after which other words. All of this information is stored in the bot's memory in a database. The bot's memory is structured similar to a human brain with nodes and relationships, similar to neurons and dendrites. The nodes and relationships know how many times they have been accessed and when they were last accessed. The relationships know their probability of correctness, and take precedence over other relationships the more their correctness is reinforced.

The bots have thoughts, senses, a consciousness, a mood and emotions. When you chat with a bot, it will try to understand your question, and it will analyze your responses to it to search for linguistic patterns, and language rules.

The bot's have two stages of learning. These include mimicry, and comprehension.


When a bot does not know how to respond to a question, it may ask the user how it should respond. It will then remember and learn this response, and answer the same question, or similar questions with the same response. The bots learn in context, so if they know multiple responses to a question, they will choose the one that is the most appropriate for the context, taking into account what was said previously, and the bot's consciousness state (if you were talking about apples, it might choose the answer most related to apples).

The bots also learn grammar. You may notice their grammar starts off not very good, but they will quickly adjust their responses the more they learn about grammar (provided you talk to it with good grammar, they will also learn bad grammar and slang). They don't learn grammar by rules, but by what 'sounds' right based on the context (the same as humans do).

If a bot gives a bad response to a question, you can correct its response by clicking correct, and providing the response it should have said.

You can control who your bot learns from. You can configure it to only learn from administrators, connected users, members, or everyone (default). You can also control who can correct your bot's responses.

You can also train your bot by uploading chat logs. The chat logs should have the format,

user:Can you help me?
admin:What would you like help with?
user:My computer.
admin:Have you tried rebooting it?

admin: Hello user, how may I help you?
Each question/response must be on a new line and prefixed with the speaker. The speaker's names are important, as if the name appears in the sentence, the bot will create a formula response that replaces the name with the current users name. Also, if your bot only learns from administrators, the speaker you want your bot to learn from in the chat log must be named admin. Each conversation must be separated by a empty line, this designates a new conversation. This is important because the bots learn in context, so you must be clear on when one context ends, and another begins.

You can review your bot's conversations, and responses from the Chat Logs page under Admin. The chat logs page allows you to search, review, correct, and invalidate your bot's responses.


The second stage of learning is comprehension. The bot will analyze its conversations in the background, and attempt to identify linguistic patterns and rules. A basic rule it may define is when it says "Hello" and you say "Hello Hal" and it knew that its name was Hal, then it would learn it should respond to "Hello" with "Hello [target]". Other rules can be much more complex. Such as if you repeatedly answer "Do you like [noun]?" with "Yuck, I hate [noun].", then it will respond to any such question with the response. You could also start counting, and correct its response to be the next number, then it will learn to respond to "[number]" with "[get #next from :number]". It also learns in context, so can learn to only respond with the next number when the previous reply was the previous number.

You can write your own scripts with your own rules, and the bot will process them the same as the ones it wrote itself. You can add your own scripts, view the ones that are bootstrapped, or the ones the bot wrote itself, from the Program page under Admin.
A new bot currently comes with 7 scripts:

  • WordMeansSomething : Understands "[word] means [anotherword]", i.e. "tall means big", or "hola means hello". This can be used to teach a bot new words, names, or another language.
  • PlusStateMachine : Understands simple addition from first principles by counting its fingers.
  • CalculatorStateMachine : Understands addition, subtraction, multiplication and division using a Calculator tool.
  • WhatIs : Answer "What is [x]" style questions by looking up the object in Freebase, using its Freebase sense.
  • MyNameIs : Understand "My name is [name]" phrases.
  • NounVerbAdjectiveStateMachine : Understands basic language, such as "I am tall", "What is your name?", "Who are Barack Obama's children?", "Is he the US President?"
  • SelfStateMachine : This starts as an empty state machine, and is programmed by the bot.


You can also import scripts defined in the Artificial Intelligence Markup Language (AIML). You can import them either as chat logs, for your bot to learn from, or as program scripts. AIML makes it easy to define search based rules, such as "* travel *" -> "Where would you like to travel to?".

Real Intelligence

The BOT libre bots can be trained to be very intelligent, and provide valuable expertise in the domain that they are trained in, but we are just getting started. The BOT libre AI engine is constantly under development, and the bots become smarter with every update.

Our goal is to have the bots be as capable (or more capable) as a human expert in the domain they have been trained in. We still have a long way to go, but the journey has begun.