Log On
     
 





ERP

ERP

[13:45] <+Anna|bot> Maybe I could do it for you.
[13:45] <@erp> Could i have to do it?
[13:45] <+Anna|bot> I think you could, if you put your mind to it.
[13:45] <@erp> If you want to put a pot head?
[13:45] <+Anna|bot> OK, I will put a pot head.
[13:45] <@erp>  Are you a pot head.
[13:45] <+Anna|bot> Am I a pot head? Maybe
[13:45] <@erp> Maybe if you give them head.
[13:46] <+Anna|bot> Perhaps. I think I do.
[13:46] <@erp>  Do you think i do.
[13:46] <+Anna|bot> Not that I know of.


Welcome to ERP's mind. E.R.P. stands for Enhanced Realistic Personality. ERP is nothing more then allot of code pounded and hacked into an Eggdrop (www.eggheads.org). It's a project I've been working on for almost over a year, because well, I'm bored allot. Also one day I decided that Wyatt ERP was a cool name if you said it out loud; as I had that thought it just so happened that ERP kicked out 10 people in an IRC chat room for spamming, so the name stuck. He's my gunslinger, so I decided to give him a mind.

So I looked around for 'chatterbots' for eggdrops for IRC. Many are out there, but they to me are pretty damn dumb. They must have idiots for the panel of judges, maybe the go and grab the first bum they find on the street and stick him as a judge. If these 'award-winning' AI programs could actually remember my name right away without being pre-programmed, all would be well.

Maybe there are other forms of AI out in the wild or in private that I haven't seen, but MegaHAL was the most promising that I could find. It's chaotic and it's random. It also is like a child's mind from someone who hasn't looked at the code. I've noted and studied children who are just learning, and also have taken psych courses in school, and ALSO approach certain conditions within my job with the notion that "I do not know anything, I must mimic and react to what I perceive". Of course with work and school there are obvious goals that are always predetermined, (fix it, get good grades, make it work better) but with childhood there is no 'set reason' why interpretation and interaction is necessary except for the basics of life like getting food and warmth. Only once a goal is ascertained can all the knowledge of all the reactions to input be put to some determined use.

Basically MegaHAL appealed to me for the sole reason that it doesn't think, it reacts. It observes, then picks the best response which it ranks highest. It begins in chaos, it slowly grows with input as does a child throughout its lifespan. It's lacking is that there is no "goal".

ERP is based off of MegaHAL and some other AI I found around the web, and believe it or not an old Apple ][e chess program. ERP is a bot. Bots are not human. But, I call him "he" for the hell of it. Without going too much into detail, its a toy that I made while waiting for a long map compile. He is in irc.enterthegame.com #wfa, most of the time kicking people who post porn or spam. He is also compiled within a Windrop (Eggdrop built on a cygwin emulator), compiled by me off of most of the eggdrop source code out in the world. He just ops people, has over 6,000 quotes in a database, a !seen database with over 20k nicks/hostmasks, and logfiles that go over 300mb. He's been active and logging for over a year now. Its just a tool to see what people talk about, at any one day the channel #wfa has over 80 people in it. Unfortunately, most of them idle, but with this environment it is a great place to test his advancements. Sometimes I can tweak a little code, and all of a sudden he gets 'smarter' to those that observe him.

ERP has three faults:

  1. Who's on first syndrome. This is likened to an old radio running routing where words like 'who' becomes an object and can take on contradictory meanings.
     
  2. "Mob Rules" syndrome. Currently ERP is limited to his responses in that he spits a response, then he ranks the reply to his response. Unfortunately he does not fork each reply to each person and segregate them. Two people replying with two different responses can confuse him.
     
  3. Identity crisis. For a twisted example that drove me to drink, look here. This problem is that the usual "I think, therefore I am, and my name is ERP" not actually meaning anything. It can also be attributed to a side-effect of the "who's on first" syndrome. ERP understands that "ERP is", but ERP doesn't understand that "ERP is I" when questioned directly; its almost a third-person relationship. Like Golumn in the hobbit. This is the one major shortcoming. Using the gseen code, it may be possible to store answers to certain responses into his brain per user and further have a little fun with the clients, which is what I am attempting to do but failing miserably for lack of time.

One day I set him loose on the kids after testing it with no dictionary, and no training file, and from 2am to 6am on his first public exposure, he learned 837 words. These words were mostly faggot, god, homosexual, gay, ghey, sex, etc. Too many replies from a group of people seemed to shatter his brain into a mush of nonsensical blabber. The next day some talk made sense, but for the most part too much valuable time would be necessary to repair the damage so I backed up his personality and started over. Hey, the kids like it. So without further ado, here is my little contribution: MegaERP! Its raw foundation, well, it's just MegaHAL with a few tweaks.

Background on megaHAL:

Abstract (from megahal.net, before I got my hands on it)

Conversation simulators are computer programs which give the appearance of conversing with a user in natural language. Alan Turing devised a simple test in order to decide whether such programs are intelligent. In 1991, the Cambridge Centre for Behavioural Studies held the first formal instantiation of the Turing Test. In this incarnation the test was known as the Loebner contest, as Dr. Hugh Loebner pledged a $100,000 grand prize for the first computer program to pass the test. In this paper we give a brief background to the contest, before describing in detail the workings of MegaHAL, the primary author's entry to the 1998 Loebner contest.

1. Introduction

Alan Turing was a brilliant British mathematician who played a great role in the development of the computer. The imitation game, nowadays known as the Turing test, was devised by Turing as a method for deciding whether or not a computer program is intelligent.

The Turing test takes place between an interrogator and two subjects. The interrogator communicates with these subjects via a computer terminal, and must decide which is a human being and which is a computer program. The human being helps the interrogator to make the correct identification, while the computer program attempts to trick the interrogator into making the wrong identification. If the latter case occurs, the computer program is said to be exhibiting intelligence (Turing, 1992).

One of the great advantages of the Turing test is that it allows the interrogator to evaluate almost all of the evidence that we would assume to constitute thinking (Moor, 1976). For instance, the interrogator can pose hypothetical situations in order to ask the subjects how they would react.

Alan Turing died in 1954, a decade before conversation simulators such as ELIZA emerged. It is indeed unfortunate that he did not live to witness his test being performed. One cannot help but think that he would have been disappointed.

2. The Loebner Contest

Apart from a few limited tests performed by programmers of conversation simulators (Colby, 1981), the Turing test was not formally conducted until 1995. Although the inaugural Loebner contest, held in 1991, was touted as the first formal instantiation of the Turing test, it was not until 1995 that it truly satisfied Turing's original specifications (Hutchens, 1996).

The first Loebner contest was held on the 8th of November 1991 in Boston's Computer Museum. Because this was a contest rather than an experiment, six computer programs were accepted as subjects. Four human subjects and ten judges were selected from respondents to a newspaper advertisement; none of them had any special expertise in Computer Science (Epstein, 1992).

The original Turing test involved a binary decision between two subjects by a single judge. With ten subjects and ten judges, the situation was somewhat more complex. After months of deliberation, the prize committee developed a suitable scoring mechanism. Each judge was required to rank the subjects from least human-like to most human-like, and to mark the point at which they believed the subjects switched from computer programs to human beings.

If the median rank of a computer program exceeded the median rank of at least one of the human subjects, then that computer program would win the grand prize of $100,000[1]. If there was no grand prize winner, the computer program with the highest median rank would win the contest with a prize of $2000.

3. Conversation Simulators

Since its inception, the Loebner contest has primarily attracted hobbyist entries which simulate conversation using template matching; a method employed by Joseph Weizenbaum in his ELIZA conversation simulator, developed at MIT between 1964 and 1966. Put simply, these programs look for certain patterns of words in the user's input, and reply with a pre-determined output, which may contain blanks to be filled in with details such as the user's name.

Such programs are effective because they exploit the fact that human beings tend to read much more meaning into what is said than is actually there; we are fooled into reading structure into chaos, and we interpret non-sequitur as whimsical conversation (Shieber, 1994).

Weizenbaum was shocked at the reaction to ELIZA. He noticed three main phenomenon which disturbed him greatly (Weizenbaum, 1976):

  1. A number of practising psychiatrists believed that ELIZA could grow into an almost completely automatic form of psychotherapy.
     
  2. Users very quickly became emotionally involved---Weizenbaum's secretary demanded to be left alone with the program, for example.
     
  3. Some people believed that the program demonstrated a general solution to the problem of computer understanding of natural language.

Over three decades have passed since ELIZA was created. Computers have become significantly more powerful, while storage space and memory size have increased exponentially. Yet, at least as far as the entrants of the Loebner contest go, the capabilities of conversation simulators have remained exactly where they were thirty years ago. Indeed, judges in the 1991 contest said that they felt let down after talking to the computer entrants, as they had had their expectations raised when using ELIZA during the selection process.

4. MegaHAL

In 1996 the primary author entered the Loebner contest with an ELIZA variant named HeX, which was written during his spare time in under a month. Apart from the lure of the prize money, a major motivation for the entry was a desire to illustrate the shortcomings of the contest (Hutchens, 1996). A considerably more powerful program, SEPO, was entered the following year, where it was placed second. We believe this to be indicative of a gradual improvement in the quality of the contestants.

The program submitted to this year's contest, MegaHAL, uses a significantly different method of simulating conversation than either HeX or SEPO, and we dedicate the remainder of this paper to describing its workings.

The resulting string of symbols[2] is used to train two 4th-order Markov models (Jelinek, 1986). One of these models can predict which symbol will following any sequence of four symbols, while the other can predict which symbol will precede any such sequence. Markov models express their predictions as a probability distribution over all known symbols, and are therefore capable of choosing likely words over unlikely ones. Models of order 4 were chosen to ensure that the prediction is based on two words; this has been found necessary to produce output resembling natural language (Hutchens, 1994).

4.1 Markov Modelling

MegaHAL is able to construct a model of language based on the evidence it encounters while conversing with the user. To begin with, the input received from the user is parsed into an alternating sequence of words and non-words, where a word is a series of alphanumeric characters and a non-word is a series of other characters. This is done to ensure not only that new words are learned, but that the separators between them are learned as well. If the user has a habit of putting a double space after a full stop, for instance, MegaHAL will do just the same.

The resulting string of symbols[2] is used to train two 4th-order Markov models (Jelinek, 1986). One of these models can predict which symbol will following any sequence of four symbols, while the other can predict which symbol will precede any such sequence. Markov models express their predictions as a probability distribution over all known symbols, and are therefore capable of choosing likely words over unlikely ones. Models of order 4 were chosen to ensure that the prediction is based on two words; this has been found necessary to produce output resembling natural language (Hutchens, 1994).

4.2 Generating Candidate Replies

Using a Markov model to generate replies is easy; Shannon was doing much the same thing by flipping through books back in 1949 (Shannon, 1949). However, such replies will often be nonsensical, and will bear no relationship to the user's input.

MegaHAL therefore attempts to generate suitable replies by basing them on one or more keywords from the user's input. This explains why two Markov models are necessary; the first model generates a sentence from the keyword on, while the second model generates the remainder of the sentence, from the keyword back to the beginning.

Keywords are obtained from the users input. Frequently occurring words, such as "the", "and" and "what", are discarded, as their presence in the input does not mean they need to be present in the output. The remaining words are transformed if necessary---"my" becomes "your" and "why" becomes "because", for example. What remains is used to seed the output.

4.3 Selecting a Reply

MegaHAL is able to generate many hundreds of candidate replies per second, each of which contain at least one keyword. Once a small time period has elapsed, the program must display a reply to the user. A method is needed for selecting a suitable reply out of the hundreds of candidates.

I(w|s) = -log P(w|s) - Equation 1

MegaHAL chooses the reply which assigns the keywords the highest information. The information of a word is defined in Equation 1 as the surprise it causes the Markov model. Hence the most surprising reply is selected, which helps to guarantee its originality. Note that P(w|s) is the probability of word w following the symbol sequence s, according to the Markov model.

The algorithm for MegaHAL proceeds as follows:

  • Read the user's input, and segment it into an alternating sequence of words and non-words.
  • From this sequence, find an array of keywords and use it to generate many candidate replies.
  • Display the reply with the highest information to the user.
  • Use the user's input to update the Markov models, so that MegaHAL can learn from what the user types.

This sequence of steps is repeated indefinitely, which allows the program to learn new words, and sequences of words, as it converses with the user.