Saturday, March 28, 2009

Bot Training I: Lingustic Targets

The construction of a chat robot has a video game metaphor. The botmaster writes some AIML, then reads the conversation logs with the resulting bot. Spotting places in the dialog where the bot breaks down, the botmaster writes new AIML to improve the broken dialog, and then repeats this cycle again and again. When we find an opportunity to improve the bot's response in the conversation log, we call that a “target”. Thus authoring the chat bot becomes a process of identifying targets and “filling them up” with new AIML content. The more content, the
more AIML categories created the higher you “score” in this video game metaphor.

Pandorabots has taken the game metaphor a step further and automated the process of finding targets. How do we know when the bot gives an incorrect, vague, or imprecise response? In AIML, the answer is simple: whenever the input pattern contains a wildcard (* or _character). If the input pattern contains no wildcards, then thematch was exact, and in most cases, the bot can formulate an exact reply. If there are wildcards, then the bot by definition only recognized part of what the client said.

(The above describes the situation only to a first order approximation. Strictly speaking, we should consider the input <pattern>, <that> and <topic>. Only if all three contain no wild cards is there truly an exact match. If for example the <pattern> is YES and the <that> pattern is thewildcard *, it is a potential target, because we can make a more exact response by taking into account a <that> value. But as happens many times with AIML, it is simpler to explain a principle of the language by thinking about the input <pattern> in isolation and ignoring the details of <that> and <topic> until later. The extension of the principle to <that> and <topic> is a matter of bookkeeping.)

Strictly speaking, a Target consists of two things: an input, and an AIML category that it matches. For example, the input HE IS STRONG together with the category

<category>
<pattern>HE IS *</pattern>
<template>I did not know he is.</template>
</category>

form a Target. Let's call the input the “Target input” and the category the “Target category”. The Target input “He is strong” together with the Target category above give the botmaster to create a
new, more specific category:

<category>
<pattern>HE IS STRONG</pattern>
<template>Does he work out?</template>
</category>

Pandorabots Targeting algorithm scans the conversation logs, re-classifying the inputs into the AIML Graphmaster, and finds matches. When the matches contain a wildcard, the algorithm saves the input and the matched category on a list of matches. As we might expect, there is a Zipf distribution over the Target categories. Usually there is one category, typically the ultimate default category with <pattern>*</pattern& gt;, associated with more Target inputs than any other category. Then there is a second most activated category, and a third, and so on, down to a long tail of Target categories with only one Target input each.

Using the Targeting algorithm, the botmaster can have quite an enjoyable afternoon building his bot by “filling up lingusitic targets” and accumulating category-count points. To use the Targeting algoritm, the botmaster first selects the conversation logs for analysis. Then by choosing the “Find Targets” option, the botmaster generates a list of Target categories, each with a link to the associated Target inputs. The program provides a direct link from the Target inputs to the Pandorabots Training section, so that the botmaster can efficiently move from Targets to writing new categories.

No comments:

Post a Comment