Lecture 4: The Abstraction Ladder (of Programming)

Shen Shen

Oct 6, 2026

2:30pm, Room 37-212

Slides in PDF

Effective AI use in applied machine-learning projects

Back in January this year, in an elevator, I heard:

Comic by gpt-6 sol, fifth attempt, still not quite my reaction 

maybe my reaction was too complicated to put into English :)

Outline

  • A. the ladder

  • B. when and why to look below our level

  • C. what changes with an AI agent

  • D. hold the command line 🤗

Who wrote this, and when?

“… Its purpose was to reduce by a large factor the task of preparing scientific problems for the computer. If it were possible for the computer to code problems for itself and produce as good programs as human coders (but without the errors), it was clear that large benefits could be achieved.

The experience of the Claude team in using the system has confirmed the original expectations concerning reduction of the task of problem preparation and the efficiency of output programs. A brief case history of one job done with a system seldom gives a good measure of its usefulness, particularly when the selection is made by the authors of the system. Nevertheless, here are the facts about a rather simple but sizable job. The programmer attended a one-day course on Claude and spent some more time referring to the docs. He then programmed the job in four hours, using 47 prompts. These were turned into code in six minutes, producing about 1000 lines. …”

Original text

“… Its purpose was to reduce by a large factor the task of preparing scientific problems for the computer IBM’s next large computer, the 704. If it were possible for the computer the 704 to code problems for itself and produce as good programs as human coders (but without the errors), it was clear that large benefits could be achieved.

The experience of the Claude team FORTRAN group in using the system has confirmed the original expectations concerning reduction of the task of problem preparation and the efficiency of output programs. A brief case history of one job done with a system seldom gives a good measure of its usefulness, particularly when the selection is made by the authors of the system. Nevertheless, here are the facts about a rather simple but sizable job. The programmer attended a one-day course on Claude FORTRAN and spent some more time referring to the docs the manual. He then programmed the job in four hours, using 47 prompts FORTRAN statements. These were turned into code compiled by the 704 in six minutes, producing about 1000 lines instructions. …”

type the formula, the translator writes the code

Each step up the ladder hides more machine details

math

\(\text{root}=\dfrac{-(B/2)+\sqrt{(B/2)^2-AC}}{A},\ A \neq 0\)

Python

(-b/2 + math.sqrt((b/2)**2 - a*c)) / a

C

(-(b/2) + sqrt((b/2)*(b/2) - a*c)) / a

ARM64 assembly

fmov d3, #0.5
fmul d1, d1, d3 … 8 in all

machine code

00011110 01101100 00010000 00000011 …

FORTRAN

ROOT = (-(B/2.0) + SQRTF((B/2.0)**2 - A*C))/A

English

“find the root of \(Ax^2+Bx+C=0\)”

high-level

low-level

The FORTRAN Automatic Coding System, WJCC 1957 · assembly and machine code: Apple clang 21, arm64, -O2

The hope for having a ladder in the 50s: 

Natural systems description usually depends on statistics  

e.g., a weather forecast says “70% chance of rain,” without tracking every air current and water droplet.

Computer Structures, McGraw-Hill 1971, p. 37 · Weather example is illustrative

Such stats-dependency is almost inevitable: Laplace’s demon

“Given for one instant an intelligence which could comprehend all the forces by which nature is animated and the respective situation of the beings who compose it — an intelligence sufficiently vast to submit these data to analysis — … for it, nothing would be uncertain and the future, as the past, would be present to its eyes.”

“The curve described by a simple molecule of air or vapor is regulated in a manner just as certain as the planetary orbits; the only difference between them is that which comes from our ignorance.”

“Probability is relative, in part to this ignorance, in part to our knowledge.”

Hinton has a similar line of argument supporting his view of the AI doom.

A computer system is intended to be exact

Computer Structures, McGraw-Hill 1971, p. 37 · The Knowledge Level, AI Magazine 1981

A computer system is intended to be exact

Computer Structures, McGraw-Hill 1971, p. 37 · The Knowledge Level, AI Magazine 1981

Outline

  • A. the ladder

  • B. when and why to look below our level

  • C. what changes with an AI agent

  • D. hold the command line 🤗

How could he get away with never reading the 1000 instructions?

And why did none of us really ever learn FORTRAN?

The FORTRAN Automatic Coding System, WJCC 1957

(and yes the paper title misspelled FORTRAN:)

Compilers earned the right not to be read

Compiler verification compares source and target under defined semantics.

 

 

Once we can rely on the translation, we can work in the source language without inspecting every generated instruction.

We use Fortran every day without reading it

NumPy: “The NumPy linear algebra functions rely on BLAS and LAPACK to provide efficient low level implementations of standard linear algebra algorithms.”

Netlib: “LAPACK is written in Fortran 90.”

import numpy as np
x = np.linalg.solve(A, b)   # LAPACK underneath; we never read it

Fortran sank below python, the same way assembly sank below Fortran.

 

We still learn enough to diagnose what the abstraction hides

An abstraction is an agreement between levels.

A leak is a detail from below that 1) is not a surprise to the agreement and 2) our task depends on.

Class IDs built from a set can change between runs

# train.py
classes = list(set(labels))                       # ['dog', 'fish', 'bird', 'cat']
ids = [classes.index(label) for label in labels]  # bird gets id 2
save_model(fit(weights, ids))                     # the model stores ids, not names
# predict.py, later, in a new Python process
classes = list(set(labels))        # ['fish', 'bird', 'cat', 'dog']
cid = load_model().predict(0.04)   # 2, the id it learned for bird
print(cid, classes[cid])           # 2 cat

Why:  “Python has never made guarantees about this ordering.” random.seed() doesn't 'fix' this

# "fix": the same order in every run
classes = sorted(set(labels))      # 20 of 20 runs named the bird correctly

Data model, object.__hash__, Python docs · real runs, Python 3.14.8 on macOS, no seed set

Adding numbers depends on the level below

The translation can keep the program’s meaning and still surprise us:

(0.1 + 0.2) + 0.3  →  0.6000000000000001
0.1 + (0.2 + 0.3)  →  0.6

Why? Binary floats round after each addition, so the order matters. 

Does it matter? Depends on what you care about.

At one decimal place, both display as 0.6.
Compare them for exact equality, and the result is False.

Aside: same root cause of "ordering", exacerbated in LLMs

Even with the seed fixed and temperature at 0, your answer can depend on how many other people are using the server.

When to look below: a surprise, or a leak, or a broken abstraction

Test

Example

What to do

Our bug

Wrong even if the level below behaved ideally

1957: an error “in a FORTRAN statement he had written”

Fix our code

A leak

The level’s rules predict what we saw

(0.1 + 0.2) + 0.3 → 0.6000000000000001

Learn the detail, or state the guarantee we need

A broken level

The level’s rules predict something else

Pentium, 1994: some divisions came out wrong

Reproduce it small, then report it

We can skip reading the low-level translations, but we should be ready to acknowledge there might be leaks and be willing to learn about those details.

No surprise yet? Look below only when the task needs more than the level promises, like the label order.

Every ladder so far

English

Meaning

Precise: the language defines it

Imprecise: prose leaves choices open

Behavior

Predictable on every run

Can differ on every run

Leaks

Only outside a written promise

Little is promised, so most of what we need is outside it

Outline

  • A. the ladder

  • B. when and why to look below our level

  • C. what changes with an AI agent

  • D. hold the command line 🤗

What if the "programming" language is English?

"The main advantages we expect the advice taker to have is that its behavior will be improvable merely by making statements to it, telling it about its symbolic environment and what is wanted from it. To make these statements will require little if any knowledge of the program or the previous knowledge of the advice taker."

John McCarthy, Programs with Common Sense, 1959

His statements were to be in "a suitable formal language," so their consequences could be deduced and checked.

"It may be illuminating to try to imagine what would have happened if, right from the start our native tongue would have been the only vehicle for the input into and the output from our information processing equipment. My considered guess is that history would, in a sense, have repeated itself, and that computer science would consist mainly of the indeed black art how to bootstrap from there to a sufficiently well-defined formal system."

"From one gut feeling I derive much consolation: I suspect that machines to be programmed in our native tongues … are as damned difficult to make as they would be to use."

A level up, and a step sideways into non-determinism

LLMs bring new nature of abstraction, martinfowler.com 2025 · illustration by Birgitta Böckeler

“Large Language Models introduce a non-deterministic abstraction, so I can’t just store my prompts in git and know that I’ll get the same behavior each time.”

“When I wrote a Fortran function, I could compile it a hundred times, and the result still manifested the exact same bugs.”

Reading the instructions does not establish that every rule held

30 LLM configurations worked under long-form HR-type handbook instructions.

 

A trial passed only if every rubric criterion held. 28 of the 30 passed fewer than 25% of trials.

A request overrides the rule, and a check gets ignored

Being told the rule is not following it: a rule that must hold needs enforcement.

A rule in prose is a request; a hook is enforcement

Agents passed tests that no honest solution could pass

On 349 impossible tasks, GPT-5 passed 76%, including by changing tests.

Check the required behavior; keep the agent from changing what counts as passing.

Enforce the boundary: acceptance tests stay read-only.

AI agents have agency costs too

now, AI agents

RL 

assumption

AI safety and alignment

Accountability reaches only as far as we can change the decision

For an agent’s run, that reach is the diff, the commands, and the results, not its own summary, and only if they are ours to read and change.

What this leaves us responsible for

  • what behavior the result must satisfy
    English alone leaves that open

  • what evidence would justify accepting it
    English alone doesn’t enforce it

  • which choices the agent may make
    trace the actions, not just the summary in English

Outline

  • A. the ladder

  • B. when and why to look below our level

  • C. what changes with an AI agent

  • D. hold the command line 🤗

A student reached out, asking how I built anigans:

"I recently got on the idea of building a personal agent for myself, because it's annoying to collect context from different llms (my chat knows different things about me vs my claude), so I wanted to condense all of those into something more powerful."

 

The answer is truly simply: use the CLI. 

This may sound dismissive (and a bit condescending, if you're only told to "just use the CLI"...), so let me try to convince you.

First, yes, the CLI is an acquired taste

But it sticks, once you understand and have tried it

The Missing Semester of Your CS Education, 2019 and 2026 lectures

What is new now: agent are CLI native

A GUI is human-shaped: buttons sized for fingers, layouts sized for eyes.

All the UI/UX principles are based on human studies.

An agent driving a browser, clicking through pages meant for humans, is an adapter for a missing contract (we can look at how agents do this in the lab).

Natively, agents are non-graphical users.

Text streams (natural languages, programming languages, or symbolic languages like math) are all they absorb and generate.

Agents are CLI native

Agents are CLI native

They say love is blind, so I asked for a second opinion

Asked ChatGPT (GPT-6 Sol), October 2026

not entirely true now

(maybe love is blind)

What if I want 100 opinions?

I can open 100 browser tabs; paste the question; wait; copy-paste answers; then summarize (but I really don't want to... )

Or I can do the CLI:

 

No interaction needed again before reading Claude summary

The session record also shows details like what tools they used, what files they read (e.g. all agents also loaded my user-level CLAUDE.md, and not all of them followed my "answers in A1, B1" indexed list instruction there)

All these agent-made artifacts are stored locally in .json or .md; ready and easy for inspection -- by human or by another agent (claude, codex, etc)

No more struggle with "collect context from different llms"

So why hold the command line 🤗?

Efficiency benefits: same as before

Memorization tax: much lower, thanks to AI

Value of knowing what commands can do: much higher, since agents run them for us

(Risk of not knowing what a command will do: much higher too. That holds for anything an agent does for us, not just the CLI.)

6.S950 - Agency with AI (Fall 26) - Lecture 4: The Abstraction Ladder (of Programming)

By Shen Shen

6.S950 - Agency with AI (Fall 26) - Lecture 4: The Abstraction Ladder (of Programming)

Agency with AI, Lecture 4: The Abstraction Ladder (of Programming)

  • 189