Terry Winograd’s SHRDLU. CC-BY-SA-4.0

The Illusion of Intelligence

Early AI, Rule-based systems, SHRDLU, and rational agents, and my experience coding a simple blocks world

The 1960’s were a time of great expectations in the still youthful artificial intelligence community. AI was not yet industry-ready, but did not fail to capture the attention of both the scientific and public community.

Machine learning, although first suggested in a paper by Alan Turing in 1950, did not come to fruition until the availability of abundant computing power in the 90’s and 2000’s. For most of AI’s 75 year history, artificial intelligence was not machine learning, but rule-based or expert systems. The entire goal was not necessarily to make a self-learning machine, but an algorithm that could act rationally based on the information it gathers.

Achieving rationality is the overarching goal of artificial intelligence. This goal, to create a rational agent, is understandably hard. One of the most intimidating problems in a variety of cases is the value alignment problem, where the rational decision might not always be the best one for our situation. For example, a sophisticated enough robot could easily win chess by bribing it’s opponent or causing distraction — the challenge is to contain the algorithm’s possible solutions to the scope of the problem. We want our robot to win chess by playing chess.

The value alignment problem becomes less intimidating if you explicitly tell the algorithm what to do when encountering a specific solution. A set of rules for any problem it may encounter, and a corresponding action. This way of AI, which might now seem archaic, was the foundation of what we have today.

Rule-based systems are exactly what they sound like. They are algorithms with hand-coded rules that the machine should follow when faced with any problem it is given.

Rule-based systems are a lot harder to program than can be first thought of. Increasing the size, and the amount of objects in the environment in which your algorithm can interact with, increases the amount of rules you need to hand-program exponentially. Furthermore, you must find an accurate way to know the state of the environment at all times, since this is what you will base all of your laws off of.

A simplified example of a rule-based system would be driving. Say we want to know if we are allowed to drive fast.

Disregarding the fact that real driving would never be able to be handled by a rule-based system, we can learn something from this.

In a rule-based system, our algorithm is constantly checking the environment to see what conditions are true and false. Based on what conditions are true and false, our program follows rules we give it to decide what to do next. We can also note that rule-based systems are dependent on boolean logic to express the state of the environment.

For example, we would give this table, which is called the agent function, to our algorithm as a “rulebook” to decide whether to drive fast depending on the state of our environment. We can infer from this that in rule-based systems, a way of accurately perceiving the environment is integral to success. Our program’s decisions will never be rational if the inputs going into it don’t make sense.

In the late 60’s, Marvin Minsky et al. suggested that the artificial intelligence community shift their research to working in microworlds. Since the real world included too many hidden variables for early AI to feasibly interpret, the next best thing was to create AI that could operate within restricted, digital worlds. In these digital worlds, called microworlds, researchers could focus on programming algorithms that made rational decisions in a slightly more straightforward environment.

SHRDLU, developed in the early 70’s and released to the public eye in 1972 by student Terry Winograd, was hailed as a revolutionary AI algorithm when it first came out. It was one of these many microworld programs, and dealt with a ‘blocks world’ where the program would, when given user input, would stack and move various blocks around an environment.

The specific feature of SHRDLU that caught the public’s attention was it’s apparent ability to understand the human language.

Even fifty years later, SHRDLU is still impressive to watch in action.

The user could give unstructured, human-like speak, and the program could understand and carry out the order, unless there was some factor stopping it.

SHRDLU was one of the most sophisticated rule-based systems built, which gave it the illusion of intelligence. SHRDLU did not know what a “block” was. It just saw that the user was asking for something, checked the environment, and carried out the order if the right booleans were checked.

An example conversation shows how sophisticated the natural language processing ability of SHRDLU appeared to be.

Person: What does the box contain?
Computer: THE BLUE PYRAMID AND THE BLUE BLOCK.
Person: What is the pyramid supported by?
Computer: THE BOX.
Person: How many blocks are not in the box?
Computer: FOUR OF THEM.
Person: Is at least one of them narrower than the one which i told you to pick up?
Computer: YES, THE RED CUBE.
Person: Is it supported?
Computer: YES, BY THE TABLE.

Winograd was the first to speak up about the limitations of the system. There is a limited amount of things a user can ask the program to do, and a limited amount of ways to say it. Although it is a severely boring task to code the rules for (nearly) every possible human input, it is possible within, at the most, a few days of solid rulemaking.

The fact that the rules are hardcoded make a program like SHRDLU hard to apply to any situation greater than the microworld it was programmed for. Chess, a rather restricted game if comparing to the real world, requires about 35¹⁰⁰ handwritten rules (pg 61, Artificial Intelligence, a Modern Approach), which is more than the 10⁸⁵ atoms in the observable universe.

Despite being somewhat archaic in implementation, blocks worlds and rule-based artificial intelligence still holds important lessons on the goals of artificial intelligence, as well as the understanding of logic required for more esoteric subjects.

To better understand blocks, I coded a supremely simple Blocks World program that, albeit simple, echoed the same ‘design philosophy’ as microworlds.

It gave two different positions, and allowed the user to describe what block they wanted to move from where. They would not be allowed to move B, since it is below A.

In spirit of Winograd’s SHRDLU, I created a very simple natural language processing (NLP) algorithm that could infer which block you wanted moved, and wasn’t dependent on any specific syntax. A little demo:

Hint, this NLP program was just a regular expression that searched for ‘B’ or ‘A’ in the text.

The outcome of this program isn’t really important in itself, but the way in which it was reached is. The way this is programmed is rather inefficient. The two blocks were an instance of a class ‘block’, which each had attributes that could be passed as ‘true’ or ‘false’ that determined “where” the block was.

Then, a function checkState would check the state of the entire environment to see which attributes for each block were true. It would return a list of all the different conditions that were true in an environment.

For example, if our configuration looked like this:

The conditions B_on_A , B_on_position_2 , A_below_B , A_on_ground would be True. Notice how these four booleans completely define the environment. We can then, if wanting to move A, check the conditions to see which ones were true.

If we wanted to move A, we would see that the B_on_A conditional was True, meaning we could not move A. The program would then prompt us to move B beforehand.

The idea of a decision based system is dependent on continually re-assessing the state of the environment with a function that returns a set or true or falses. Our commands then check these true or false statements to see if our wanted command is possible or not dependent on these true or false statements.

Although the use of rule-based systems is becoming increasingly irrelevant, there are a variety of fascinating lessons we can learn about logic, rationality, and intelligence from early AI.

Adam Dhalla is a high school student out of Vancouver, British Columbia, currently in the STEM and business fellowship TKS. He is fascinated with the outdoor world, and is currently learning about emerging technologies for an environmental purpose.

Follow his Instagram, and his LinkedIn. For more, similar content, subscribe to his newsletter here.

15 y old learning about machine learning, as well as a lifelong naturalist. Climate activist in Vancouver. Writer. Visit me @ adamdhalla.com