Joseph Weizenbaum's Original ELIZA

Most people who know anything about Joseph Weizenbaum's ELIZA at the level of the program code think that it was written in Lisp and that it has been floating around since the publication of Weizenbaum's 1966 CACM paper. However, surprisingly, the ELIZA program itself was never published, and it wasn't written in Lisp, but in a now-obscure language called MAD-SLIP running on an IBM 7094 computer at MIT. Until now, the ELIZA source code has been missing, presumed by many to be lost, and because many alternate versions have been created over the years, the original source code remained undiscovered.


Weizenbaum's ELIZA was intended as a general conversational agent. It interpreted a separate, domain-specific script that determined its style of conversation. The most well-known script is called "DOCTOR". This is the one that carries on the well-known "Rogerian therapist" conversations that appear in Weizenbaum's 1966 paper, and which are most commonly associated with the name "ELIZA." Indeed, the name "ELIZA" has basically come to mean “the ELIZA agent running the DOCTOR script.” ELIZA can be seen as the precursor of many of the conversation interfaces and chatbots that we have become so familiar with today, such as Siri, but it worked over a much more clunky typewriter-based console.


As Weizenbaum (1967: 475) explains, “From one point of view, an ELIZA script is a program and ELIZA itself an interpreter. From another perspective, ELIZA appears as an actor who must depend on a script for his [sic] lines. The script determines the contextual framework within which ELIZA may be expected to converse plausibly." In Contextual Understanding by Computers (CACM, 1967), he writes: "The first program to which I wish to call attention is a particular member of a family of programs which has come to be known as DOCTOR. The family name of these programs is ELIZA. This name was chosen because these programs, like the Eliza of Pygmalion fame, can be taught to speak increasingly well. DOCTOR causes ELIZA to respond roughly as would certain psychotherapists (Rogerians). ELIZA performs best when its human correspondent is initially instructed to "talk" to it, via the typewriter, of course, just as one would to a psychiatrist."


However, only the DOCTOR script appears in the 1966 paper, not the ELIZA code that interprets that script, although the algorithm is described in great detail. The common misconception that ELIZA was originally written in Lisp arose because shortly after the publication of the 1966 paper, Bernie Cosell wrote a version in Lisp, based upon the description of the algorithm in the 1966 paper. Cosell's version used a version of the published script, but he never saw the original ELIZA.


The language of the original ELIZA was MAD-SLIP. MAD (“Michigan Algorithm Decoder”) was an Algol-like programming language, available on many common large computers at that time. Weizenbaum added list-processing functionality to MAD, creating MAD-SLIP ("Symmetric LIst Processor," Weizenbaum, 1963), a Lisp-like language embedded in MAD. Indeed, adding to the Lisp/MAD-SLIP confusion, the published DOCTOR script, an appendix to the 1966 paper, is parenthesized exactly like a Lisp S-expression, the way one would if one were writing a Lisp program.**


(Re)Discovery of the Original ELIZA


In hopes of discovering the original source code for ELIZA, I recently went [remote] spelunking in Weizenbaum's archives, held by MIT. I was aided by MIT archivist Myles Crowley. This exploration succeeded spectacularly! We found a set of files labeled "Computer Conversations," and the first file folder we opened included a complete source code listing of ELIZA in MAD-SLIP, with the DOCTOR script attached!


I contacted Dr. Weizenbaum's estate for permission to open-source this code, and they granted this permission under a Creative Commons CC0 public domain license.


Here is the real true original ELIZA (reading notes, below); You are among the first to see this code in over half a century!

ORIGINAL_ELIZA_IN_MAD_SLIP_CC0_For_Resease.pdf

I want to thank Myles Crowley, Special Archival Librarian, MIT Libraries, who was my spelunking guide. As well as (alphabetically), David M. Berry (d.m.berry@sussex.ac.uk), Anthony Hay (anthony.hay.1@gmail.com), and Peter Millican (peter.millican@hertford.ox.ac.uk) who studied the code, participated in discussion of the project, and helped to create this page. We all thank the estate of Dr. Joseph Weizenbaum for permitting the original ELIZA to be open-sourced! Pm Weizenbaum was especially helpful in managing the open-sourcing of the code with Dr. Weizenbaum's estate, and in her careful editing of this page.


'Jeff Shrager May 23, 2021


References


Weizenbaum, J. (1963). Symmetric List Processor. Communications of the ACM, 6(9), 524-536.


Weizenbaum, J. (1966). ELIZA: A computer program for the study of natural language communication between man and machine. Communications of the ACM, 9, 36-45.

This paper remains under ACM copyright, and so is inaccessible, except to members or for purchase. However there are numerous versions of the PDF online.


Weizenbaum, J. (1967). Contextual Understanding by Computers, Communications of the ACM, Volume 10, Number 8, August, 1967, rtro.de/eliza61


Weizenbaum, J. (1984). Computer Power and Human Reason: From Judgment to Calculation, London: Penguin.


** Interesting additional context can be found here: https://computerhistory.org/blog/the-promise-of-the-doctor-program-early-ai-at-stanford/

SOME NOTES ON READING THE CODE


Note that the ELIZA main program actually starts on page 9 of the PDF (the 4th page of actual MAD-SLIP code), and continues to the end. It is only around 230 lines long. The code before that appears to be a set of sub-functions.


To my eye, the code originally looked like gibberish. There are no comments and only a few helpful labels that provide signposts to what's going on. However, once you learn a little about how to read MAD and SLIP, it becomes a bit easier.


A 1961 computer primer for the MAD language, by Elliott Organick, can be found here:


https://hdl.handle.net/2027/mdp.39015021689271

And just knowing a few abbreviations will help a lot. Most importantly, keywords are abbreviated as follows:


W'R WHENEVER (if)

O'E OTHERWISE (else)

E'L END OF CONDITIONAL (endif)

T'O TRANSFER TO (goto)

OR W'R OR WHENEVER (else if)

T'H <label> THROUGH <label> (loop until label)

F'N <var> FUNCTION RETURN <var> (return <var>)

E'N END OF FUNCTION


Boolean expressions read like Fortran:

.E. equal

.NE. not equal

.L. less than

.LE. less than or equal to

.G. greater than

.GE. greater than or equal to


Dollar signs ($) indicate string constants.


So, for example, this:


W'R WORD .E. $.$ .OR. WORD .E. $,$ .OR. WORD .E. $BUT$


Is saying, essentially:


When WORD == "." or "," or "BUT"


To take a more interesting example, one of the things that the 1966 paper is vague about is the memory mechanism, describing it as a "certain counting mechanism is in a particular state." We found that this refers to LIMIT, which cycles from 1 to 4 and then starts at 1 again. When there is no keyword match (IT equals 0) and LIMIT is 4 and there are stored memories, then you get the oldest previously stored memory:

W'R IT .E. 0

W'R LIMIT .E. 4 .AND. LISTMT.(MYLIST) .NE. 0

OUT=POPTOP.(MYLIST)

TXTPRT.(OUT,0)

IRALST.(OUT)

T.O START


List processing functions such as POPTOP and LISTMT were added to MAD to create MAD-SLIP. Here's a copy of a paper on SLIP (as embedded in Fortran):


https://github.com/jeffshrager/elizagen/blob/master/eliza/Slip/p524-weizenbaum.pdf


Interestingly, there is a GNU SLIP for C++, in use as recently as 2014 (although the language seems to have been modernized):


https://www.gnu.org/software/gslip/manual/UserManual.pdf

Regarding the DOCTOR script, note that it is not pretty-printed and so is hard to follow. It appears to be very slightly different from the published script. For example, PERHAPS is missing the (DON'T YOU KNOW) clause, but there seems to be a (DON'T YOU KNOW) clause dangling free after the MAYBE rule. So it's likely that we have a very slightly different version from the one that created the published conversations.


On 2014-12-20, Jeff Barnett provided this interesting historical note about the original ELIZA:

The original Eliza was moved to the ANFS Q32 at SDC (one of the (D)ARPA block grant sites) in the mid 1960's. The programmer responsible was John Burger who was involved with many early AI efforts. Somehow, John talked to one of the Playboy writers and the next thing we knew, there was an article in Playboy much to Weizenbaum's and everybody else's horror. We got all sorts of calls from therapists who read the article and wanted to contribute their "expertise" to make the program better. Eventually we prepared a stock letter and phone script to put off all of this free consulting.

The crisis passed when the unstoppable John Burger invited a husband and wife, both psychology profs at UCLA, to visit SDC and see the Doctor in action. I was assigned damage control and about lost it when both visitors laughed and kept saying the program was perfect! Finally, one of them caught their breath and finished the sentence: "This program is perfect to show our students just exactly how NOT to do Rogerian* therapy. *I think Rogerian was the term used but it's been a while.

A little latter [sic] we were involved in the (D)ARPA Speech Understanding Research (SUR) Program and some of the group was there all hours of day and night. Spouses and significant others tended to visit particularly in the crazy night hours and kept getting in our way. We would amuse them by letting them use Eliza on the Q32 Time Sharing System. One day, the Q32 became unavailable in those off hours for a long period of time. We had a Raytheon 704 computer in the speech lab that I thought we could use to keep visitors happy some of the time. So one weekend I wrote an interpretive Lisp system for the 704 and debugged it the next Monday. The sole purpose of this Lisp was to support Eliza. Someone else adopted the Q32 version to run on the new 704 Lisp. So in less than a week, while doing our normal work, we had a new Lisp system running Eliza and keeping visitors happy while we did our research.

The 704 Eliza system, with quite a different script, was used to generate a conversation with a user about the status of a computer. The dialogue was very similar to one with a human playing the part of a voice recognition and response system where the lines are noisy. The human and Eliza dialogues were included/discussed in A. Newell, et al., "Speech Understanding Systems; Final Report of a Study Group," Published for Artificial Intelligence by North-Holland/ American Elsevier (1973). The content of that report was all generated in the late 1960s but not published immediately.

The web site, http://www.softwarepreservation.org/projects/LISP/, has a little more information about the Raytheon 704 Lisp. The SUR program was partially funded and on-going by 1970.

[Ed. note: I think that this is the Playboy article referred to: http://blog.modernmechanix.com/computers-their-scope-today/ -- Jeff@20210619)