Self-Evolving AI

An agent that gets better by itself: it tries a task, reads the result, and keeps the changes that help. Run three agents on one task and see when that loop wins and when it fails.

Lecture 1 of “How to AI an AI for Almost Anything”: what a language-model agent is, how it got here in six years, and the four things we can let it rewrite.

Pick an agent, press Run 30 rounds, then drag the feedback noise up. Watch the self-evolving agent climb, then stall when its own feedback cannot be trusted. Then we build, piece by piece, the ideas underneath: prompts, reasoning, reinforcement learning, harnesses and the history of machines that improve themselves.

You need a feel for what a chatbot does and a little Python for the code. We build the rest from zero.

Based on Lecture 1 (Week 1, 9/9) of MIT MAS.S62 How to AI an AI for (Almost) Anything, Fall 2026, taught by Paul Liang with teaching assistant Ao Qu (MIT Media Lab, Multisensory Intelligence group). The lecture slides are linked from the course schedule. Every idea is re-taught here in our own words and devices. Course site

Three ways an agent can change

0.05

A toy, not a benchmark. The task hides a target of six numbers; an agent’s skill is six numbers, and its score is 1 minus 2.5 times the distance to the target (never below 0). The fixed agent never moves. The improved-by-others agent jumps 20% of the way to the target every 6 rounds, as if a lab trained a new release. The self-evolving agent tweaks its skill each round and keeps the tweak only if a noisy test of its own looks better. The noise is the knob; the random numbers are real and seeded per task.

Chapter 0

Why an Agent That Improves Itself

Meet the idea of an AI that changes itself, and see why the loop helps and where it can fail

Picture a night shift with no people on it. At six in the evening you give an AI program a small job: make a language model learn faster. You also give it one page of rules and a clock. Every five minutes it changes the training code, runs the test, and checks the score. If the score is better, it keeps the change. If not, it throws the change away.

You go to sleep. In the morning there are about one hundred finished experiments in a log, and the code is better than when you left. Nobody told the program which change to try. It chose, tested, and kept what worked. That is a real setup from the lecture (we meet it in Chapter 7), and it is the picture to hold for the whole lesson.

The lecture opens with a claim, not a proof

The first slides show where this idea is pointing. Slide 2 is titled AI for Discovery and quotes a claim: an internal model group “arrived at the Navier-Stokes solution in 88 hours, using around 10,000 coordinating AI agents.” We repeat it as the slide’s claim. We did not check it, and the course does not ask you to take it on faith. It sets the mood: people now talk about AI that does research, not only AI that answers questions.

Slide 3 is a video of a computer-use agent, an AI that reads the screen and works the mouse and keyboard the way you do. Slide 4 lists six themes that the lecturer calls new in AI: test-time scaling (spending more computing while the model answers), AI agents and multi-agent systems, user interaction and rich feedback, continual learning, tool use and long-term memory, and reinforcement learning with environment design. Each of those becomes a chapter or a thread in this lesson.

Three plain words: model, agent, loop

A language model is a program that reads text and writes the next piece of text. An agent is a language model wrapped in a loop: it looks at a situation, picks an action such as running a command or searching the web, sees what happened, and goes round again. A self-evolving agent adds one more step to the loop: it also changes something about itself, using what it just learned.

Slide 5 points to a blog post called “Self-Evolving Agents” (link) with a framework diagram. The shape is always the same. Something evolves (the agent). An environment gives it tasks and feedback. Feedback flows back, and the agent updates. The rest of the course asks one question over and over: what exactly do we let the agent change?

Why the loop can help, and why it can fail

Look at the hero at the top of the page once more. Three agents work on the same hidden task. The fixed agent never changes, so its score stays flat. The agent improved by others gets a new release every six rounds, trained by a lab on outside data. The self-evolving agent has no lab. It tweaks itself and uses its own experience to decide whether the tweak helped.

Here is the arithmetic for one task, with every step. The agent’s skill sits at a distance of 0.168 from the target. The score is 1 minus 2.5 times the distance, so the score is 1 − 2.5 × 0.168 = 0.58. A release that moves it 20% of the way closes the gap to 0.168 × 0.8 = 0.134. The new score is 1 − 2.5 × 0.134 = 0.665. Each release is worth about 0.08 here, and the self-evolving agent hopes to find the same gain by itself.

The failure mode shows up in the hero when you drag the noise up. Symptom: the self-evolving line wanders and ends near the fixed line, or below it. Measurement: the read-out counts how many tweaks were kept. At noise 0.20 it often keeps about as many tweaks as it did at noise 0.05, yet most of them are no help, because the test cannot tell good from bad. Fix: make the test cleaner. Average more runs, use a held-out check, or let a stronger judge score the result.

The device below isolates that one decision. A tweak has a true effect. The agent cannot see it. It runs two noisy tests, one for the old version and one for the new, and keeps the new one if its test score is higher. Each test has noise of size σ, so the difference of two tests has a spread of σ times the square root of 2.

Judge a tweak with a noisy test

The bell curve is every measured difference between the new version and the old one. Everything to the right of the dashed zero line gets accepted. Drag the true effect below zero, then raise the noise.

-0.020
0.100

Exact, not simulated: the measured difference is Normal with mean equal to the true effect and spread σ × √2; the shaded share is the Normal cumulative probability above zero. The score scale matches the hero (scores run 0 to 1); the tweak sizes are illustrative.

At the start values the tweak is truly 0.02 worse, and the test is accepting it 44% of the time. That is almost a coin flip. A loop that accepts bad changes this often does not improve. It drifts. Everything later in the lecture, from prompt search to weight training, is a different way to get a trustworthy answer to the single question this device asks: was the change really better?

The lesson follows the lecture in order: the course and its plan (Chapter 1), the six years of language-model progress that made agents possible (Chapters 2 to 5), the long history of self-improving machines (Chapters 6 and 7), the map of today’s self-evolving AI (Chapters 8 and 9), and the open problems (Chapter 10). Chapter 11 is a field guide you can keep.

  1. The course and its four things to evolve: context, harness, model, environment.
  2. Few-shot prompts and instructions: how a model learns a task from its prompt.
  3. Reasoning and acting: chain of thought and ReAct.
  4. Reinforcement learning for reasoning: DeepSeek-R1 and GRPO.
  5. The harness: model plus the code around it, over long tasks.
  6. Early ideas: Good, Gödel, AlphaGo Zero.
  7. Discovery loops: FunSearch, the Darwin Gödel Machine, autoresearch.
  8. What is evolved: the four layers.
  9. How, and how the big ideas relate: three kinds of agent.
  10. Open problems: five question slides, three application areas.
  11. Field Guide: numbers, terms, code, links.
A self-evolving agent keeps a change when its own test says the score went up. What decides whether the loop really improves the agent?

Chapter 1

The Course and Its Four Things to Evolve

Read the syllabus as one question: what part of an AI system do we let the AI rewrite?

Your AI agent keeps forgetting to run the tests before it says it is done. Same mistake, three days in a row. You can fix this in four very different places. You can add one line to the notes it reads. You can give it a tool that runs the tests for it. You can retrain the model. Or you can build a set of tasks that punishes the agent when it skips the tests.

All four fixes work in some cases. They differ in cost, speed and how long they last. This is the whole structure of the course, and the syllabus is built on it. Each of the four modules lets the AI rewrite one of these four places.

The logistics, in one paragraph

The course, MIT MAS.S62 (Fall 2026), is taught by Paul Liang, with Ao Qu as teaching assistant. The class meets for two hours every Wednesday, from 2 to 4 pm. Homework and reading assignments run for two weeks each, and a larger research project runs alongside, done in groups of 2 to 4 with an assigned mentor. The grade is 40% homework (four assignments), 20% reading (four assignments) and 40% project (10% proposal, 10% midterm, 20% final); the absences slide also lists in-class participation at 20%, so check the syllabus for how the two fit. Each student has two 24-hour wildcards, and each team has two for its reports. For-credit enrolment is capped at 20 to 30. Submissions go through Canvas.

What the course wants you to be able to do

The slides list four learning objectives: study recent technical achievements in AI research, improve critical and creative thinking, understand future research challenges, and explore and implement new research ideas. They list four preferred prerequisites too: AI programming and experimentation, an understanding of what modern AI can and cannot do, domain knowledge from outside AI that you bring to your problem, and, as a bonus, past work on self-evolving AI or AI for discovery. This lesson asks for none of that. We build everything from zero.

Four modules, four things to evolve

Module 1, context evolution (weeks 2 to 4, 9/16 to 9/30). The context is the text a model reads before it answers: the prompt, memory notes, tool descriptions and any knowledge you paste in. Here the AI rewrites that text. Topics are prompt optimization, memory, tools and knowledge, then large language models used as optimizers for discovery. Homework 1, due in week 4, is tentatively TextGrad (improving a prompt using written feedback) and OpenEvolve (an open evolutionary coding tool that uses a language model to propose program changes).

Module 2, harness evolution (weeks 5 to 7, 10/7 to 10/21). The harness is the code around the model: the loop, the tools, the memory manager, the way work is split among helpers. Here the AI rewrites that code. Topics are harness components, multi-agent systems and self-evolving harnesses. Homework 2, due in week 7, is tentatively skill evolution (SkillOpt) and a self-generating harness (Meta-Harness).

Module 3, model evolution (weeks 8 and 9, 10/28 to 11/4). The weights are the numbers inside the model that hold what it knows. Here the AI changes them: continual learning (learning new things without forgetting old ones), distillation (a small model learns from a large one), test-time training and self-play. Homework 3, due in week 10, is tentatively test-time training and continual learning methods.

Module 4, environment evolution (weeks 10 and 11, 11/11 to 11/18). The environment is the world that hands the agent tasks and feedback. Here the AI builds it: synthetic data and tasks, generated environments, world models and evolving evaluation and rewards. Homework 4, due in week 12, is tentatively self-generated tasks and PostTrainBench. Weeks 12 and 14 are future topics (AI for discovery, multimodal agents, embodied harnesses, safe evolution), and week 13 holds final presentations. The slides note the plan is subject to change with student interest.

Reading assignments pair with the homework. Each has usually two required papers, some optional ones, and five or six discussion questions. Students write reading notes, scout for extra papers, and prepare discussion points. The stated goal is a survey paper on self-evolving AI, with a clear taxonomy, written jointly across the discussion sessions.

Try the calendar. Choose a module and watch which weeks, homework and project milestones belong to it.

Walk the semester

Bars are lecture weeks, coloured by what the module lets the AI rewrite. Diamonds are homework due dates. Dots are project milestones. Press a module.

Weeks, dates, homework topics and milestones are the lecture’s (slides 10 to 15 and 18). Homework topics are marked tentative on the slides. Homework 3 is due in week 10, after its module ends, and Homework 4 is due in week 12.

The read-out for Harness says that Homework 2 and the midterm presentations both land in week 7. That overlap is on purpose. You build the harness, then show it.

The same failure, four fixes

Go back to the forgetful agent. The context fix is one line in its notes: “Always run the tests before you finish.” It takes seconds and can be undone, but the agent may still ignore the line.

The harness fix is a rule in the loop: the loop refuses to end until a test command has run. It takes an hour and works every time, but only for this kind of task. The model fix is training on many examples that include running tests. It takes the most time and money, and it can break other skills. The environment fix is a task set where skipping the tests loses points. It shapes every later change.

Many failures can be fixed in more than one place. Choosing the cheapest place that works is a skill, and slide 82 turns it into a research question: when should a lesson go into the weights, and when into the harness? We return to it in Chapter 10.

An agent keeps skipping its final check. You change the loop so it cannot finish until a check command has run. Which module’s kind of change is this?

Chapter 2

From Few-Shot Prompts to Following Instructions

See how a model learns a task from examples in its prompt, then learns to follow plain requests

You hand a new colleague a note that says “Translate English to French: cheese”. They might look puzzled. Now you add two lines above it: “sea otter becomes loutre de mer” and “peppermint becomes menthe poivrée”. They get it at once. You did not train them. You showed them the pattern, and they followed it.

Slide 25 starts a second act of the lecture, titled From Language Models to Autonomous Agents: Six Years of Progress. Each slide is a year and a step. We follow it in order, because every step is a tool that the self-evolving systems later in the lecture use.

2020: GPT-3 and learning inside the prompt

Recall what a language model does: it reads a list of tokens (small pieces of text) and gives a probability to every possible next token. The weights are the numbers inside it that hold what it learned. Pretraining sets those weights by showing the model a huge amount of text and nudging it to predict each next token better.

Slide 26 shows the GPT-3 paper (Brown et al., OpenAI, 2020) and draws two loops. The outer loop is pretraining: learning by gradient descent (small repeated weight updates) over unlabelled text. The inner loop is what happens when you use the model: it reads one sequence, such as a few worked examples followed by a new question, and adapts to the task without any weight change. The paper calls this in-context learning: the model picks up the task from the text in its context.

Slide 27 shows the three flavours. Zero-shot gives only the task: “Translate English to French: cheese =>”. One-shot adds one worked example. Few-shot adds several. In each case the model’s job is the same: continue the text. The pattern in the examples makes “fromage” the most likely next word.

This matters for the whole course. Look at what changed and what did not. The weights are frozen. The only thing you edited is the text. So editing text is a way to change behaviour, and an AI can edit text far more cheaply than it can retrain a model. That is the idea behind context evolution, Module 1.

Build the prompt

The box shows the exact text the model reads. The purple lines are your context. The warm word is what the model is most likely to write next. Press a prompt style.

The prompts are the ones on slide 27 (cheese, sea otter, peppermint, plush giraffe). Word counts are of the text shown, not of model tokens, which are usually more numerous. We do not run a model here: “fromage” is the answer the slide shows.

In the box above, the zero-shot prompt is 6 words and the few-shot prompt is 18. You pay for every example in time and money, since the model rereads all of them on every call. That is the price of the trick.

2022: following instructions

A model that only continues text has a problem. Ask it “Explain the moon landing to a 6 year old in a few sentences” and it may carry on the pattern instead of answering. Slide 29 shows this on the same prompt. GPT-3 writes more requests of the same kind: “Explain the theory of gravity to a 6 year old. Explain the theory of relativity to a 6 year old in a few sentences”. It sees a list of homework prompts, so it writes the next one.

Slide 28 shows the fix from the InstructGPT paper (Ouyang et al., OpenAI, 2022). It has three steps. In step 1, people write demonstrations of good answers, and the model is trained on them. This is supervised fine-tuning. In step 2, people rank several answers to the same prompt from best to worst, and a separate reward model learns to predict those rankings. In step 3, the main model is trained to write answers the reward model scores highly, using an algorithm called PPO. The whole recipe is RLHF, reinforcement learning from human feedback. Chapter 4 covers the reinforcement learning part in detail.

Continue, or answer

Same prompt, two models. Press each one and read what comes back.

Both outputs are the ones printed on slide 29, shortened only by removing line breaks. Nothing here is generated live.

The rest of the course takes this as given. When you prompt a modern assistant, it answers. Underneath, the same next-token machine is running. The training added a habit: treat the text as a request, not as a pattern to extend.

The data flow, as code

Few-shot prompting is just string building. The model never sees “examples” as a special thing. It sees one long list of token numbers.

def few_shot(task, examples, query):
    lines = [task]                       # "Translate English to French:"
    for en, fr in examples:              # each example is plain text
        lines.append(f"{en} => {fr}")
    lines.append(f"{query} =>")          # the model continues from here
    return "\n".join(lines)

prompt = few_shot("Translate English to French:",
                  [("sea otter", "loutre de mer"),
                   ("peppermint", "menthe poivrée")],
                  "cheese")
tokens = tokenizer(prompt)               # list of ints, shape (T,)
probs  = model(tokens)[-1]               # shape (V,): one probability per token

A failure to watch for: if all your examples end in the same answer, the model can copy that answer for a new question. Symptom: every output looks the same. Measurement: run your examples as test questions and count how often the first answer repeats. Fix: mix the examples so the answers differ. Later, an agent can search for better examples for you; that is exactly what the first homework does.

You add three worked examples to a prompt and the model now translates well. What changed inside the model?

Chapter 3

Thinking Out Loud, Then Acting

Watch chain of thought and ReAct turn a single answer into a loop of thoughts, actions and observations

A cafeteria has 23 apples. It used 20 to make lunch and bought 6 more. How many apples does it have now? Try to answer in one breath, with no scratch paper. Many people stumble. With a pencil you write “23 minus 20 is 3, plus 6 is 9” and you are done.

A language model has the same problem. It writes one token at a time, and each token comes from one pass through the network. The depth of that pass is fixed. A hard problem may need more steps than one pass can hold. The model needs scratch paper too.

2022: chain of thought

Slide 30 shows the paper by Wei and colleagues (Google Research, 2022). The idea is small. In the example you put in the prompt, show not only the answer but the reasoning steps that lead to it. This is chain-of-thought prompting. The slide compares two prompts on the apples question.

With standard prompting, the example just says “The answer is 11”. The model copies that style and answers “27”, which is wrong. With chain-of-thought prompting, the example walks through its steps (“Roger started with 5 balls. 2 cans of 3 tennis balls each is 6 balls. 5 + 6 = 11.”). The model copies that style and writes: the cafeteria had 23 apples, used 20, so 23 − 20 = 3, bought 6 more, so 3 + 6 = 9. The answer is 9. That is correct.

Why does writing steps help? Each step the model writes becomes part of its context. The next token can read it. So the written steps act as working memory, and the model spends many passes where it had one. A one-token answer uses one pass. The nine-step answer uses about fifty. We count passes, because they are the compute the model spends before it commits to an answer. This idea returns as test-time scaling in Chapter 4.

Slide 31 adds a surprise from Kojima and colleagues (Tokyo and Google Research, 2022). You do not need a worked example at all. Add one sentence, “Let’s think step by step”, and the model starts reasoning. On the slide’s juggler question (16 balls, half are golf balls, half of the golf balls are blue, how many blue balls?) the plain prompt answers 8, which is wrong. The step-by-step prompt writes: 16 balls, half are golf balls, so 8 golf balls, half of those are blue, so 4 blue golf balls. This is zero-shot chain of thought.

2023: reasoning and acting

Chain of thought has a limit. The model reasons only from what it already knows. If a fact is missing or out of date, it makes one up. Slide 32 shows the next step, ReAct (Yao and colleagues, Princeton and Google Research). It lets the model do two things in turns: reason in words, and act by calling a tool such as a search engine. A tool’s reply is called an observation.

The slide draws three designs. Reason only (chain of thought) thinks but never touches the world. Act only acts but never explains its plan. ReAct interleaves both: thoughts guide actions, and observations feed the next thought. The caption on slide 33 says it best: each thought guides the next search, and each observation motivates the next thought.

Slide 33 gives a real trace. The question: aside from the Apple Remote, what other device can control the program the Apple Remote was designed to interact with? Step through it below.

Step a ReAct trace

Warm lines are written by the model. Pink lines are actions the harness runs. Blue lines are observations the tool sends back. Press Next step and watch who writes each line.

The question, thoughts, actions and observations are those on slide 33 (the search result texts are shortened to the part the slide shows). Word counts are of the visible text, not of model tokens. The third thought is written the way the paper’s trace ends: it names the answer.

Notice the division of labour. The model never runs the search. It writes the text Search[Apple Remote] and stops. The harness (the program around the model) reads that line, runs the search, and pastes the result back as an observation. Then it calls the model again with the longer transcript. The loop is ten lines of code.

def react(question, tools, model, max_steps=8):
    transcript = f"Question: {question}\n"
    for step in range(1, max_steps + 1):
        out = model(transcript, stop=["Observation"])   # writes Thought + Action
        transcript += out
        action = parse_action(out)                      # e.g. ("Search", "Apple Remote")
        if action.name == "Finish":
            return action.arg                           # the final answer
        obs = tools[action.name](action.arg)            # the harness runs the tool
        transcript += f"\nObservation {step}: {obs}\n"  # pasted back as text
    return None                                         # ran out of steps

Because the transcript only grows, the context gets longer each round. In the trace above it holds 21 words at the start and 122 by the end. A real tool result can run to thousands. Chapter 5 shows what happens when the transcript no longer fits.

A failure to expect: the model may write an action that does not parse, or loop forever on the same search. Symptom: the step counter climbs and the answer never appears. Measurement: log the steps per task and the share that hit max_steps. Fix: a hard step limit, a clear error message pasted back as an observation, and tool descriptions the model can follow.

In a ReAct loop, which part writes the line “Observation 1: ...originally designed to control the Front Row media center program...”?

Chapter 4

Reinforcement Learning for Reasoning

Compute a group-relative advantage by hand and see how a correctness reward grows reasoning

A student sits a maths test with a strange rule. Nobody checks their working. The grader only checks the final answer: right, or wrong. After each test the student tries again. Over a thousand tests, what do you expect to see? Perhaps the student starts to check their own working, because checking is what turns wrong answers into right ones.

That is close to what happened with DeepSeek-R1 (DeepSeek-AI, 2025), the model on slide 34. It was trained with a correctness reward only: one point for a right final answer, nothing for a wrong one. The slide notes that re-checking its own steps appeared during that training. Nobody wrote it into a prompt. The slide shows a trace where the model writes “Wait, wait. Wait. That’s an aha moment I can flag here” and then re-examines its work.

The idea of reinforcement learning, in plain words

Reinforcement learning (RL) trains a model by trial and reward instead of by copying. The model, called the policy, tries something. A reward number says how well it went. Training then makes the tried behaviour more likely if it earned a high reward, and less likely if it earned a low one. For a language model, “trying” means writing a full answer, called a rollout.

A fair worry: how much should one rollout move the policy? If the reward is 1, is that good or ordinary? You need a baseline to compare with. The number that says “better than expected, by how much” is the advantage. Positive means better than the baseline, negative means worse.

GRPO: the baseline is the group

The older method, PPO (the one used for InstructGPT in Chapter 2), gets its baseline from a second neural network, the value model, which learns to guess the expected reward. That network is as big as the policy, so it costs a lot of memory. Slide 35 shows the alternative from DeepSeekMath (Shao and colleagues, 2024): GRPO, group relative policy optimization. Per the slide, GRPO removes the value network and estimates advantages by comparing rewards across a group of rollouts for the same prompt.

The recipe: for one prompt, sample G answers. Score each one. The group’s average reward is the baseline. Divide by the group’s spread to put the numbers on a common scale.

Ai
The advantage of rollout i: how much better than its group it was, in units of the group’s spread.
ri
The reward of rollout i. With a correctness reward it is 1 for a right answer and 0 for a wrong one.
mean(r)
The average reward of the group. This replaces the value network as the baseline.
std(r)
The standard deviation of the group’s rewards, the typical distance from the mean.

Worked example, every step. A prompt gets 8 rollouts and 3 are right. The rewards are 1, 1, 1, 0, 0, 0, 0, 0. The mean is 3 ÷ 8 = 0.375. The spread is the square root of 0.375 × 0.625, which is 0.484.

A right rollout has advantage (1 − 0.375) ÷ 0.484 = +1.29. A wrong rollout has (0 − 0.375) ÷ 0.484 = −0.77. Training then pushes up the tokens of the three right rollouts and pushes down the tokens of the five wrong ones. Try other groups.

Compute the advantages

Eight rollouts for one prompt. Press a number to flip that rollout between right and wrong, or press a preset. Bars show each advantage: up means push this answer up, down means push it down.

Exact arithmetic with the population standard deviation. Real GRPO adds a tiny constant to the spread so it never divides by zero, clips each update, and adds a penalty for drifting from a reference model; those are left out here to show the one idea.

Flip every rollout to right, or every one to wrong. The advantages all become zero, and the read-out says there is no learning signal. When everyone gets the same reward, nobody is better than the group, so there is nothing to push. This is the main failure mode. Symptom: training stalls on prompts that are too easy or too hard. Measurement: the share of prompts whose group has zero spread. Fix: choose prompts of middling difficulty, and sample a larger group.

More thinking, better answers

Slide 36 shows two charts from OpenAI’s “Learning to Reason with LLMs” (September 2024). Accuracy on the AIME maths exam climbs as RL training compute grows, and it also climbs as test-time compute grows, meaning the model is allowed to think longer before it answers. Both compute axes are logarithmic. We saw the root of this in Chapter 3: more written reasoning is more computation. RL teaches the model to use that room well.

def grpo_advantages(rewards):                 # rewards: list of G floats, one prompt
    G = len(rewards)
    mean = sum(rewards) / G
    std = (sum((r - mean) ** 2 for r in rewards) / G) ** 0.5
    return [(r - mean) / (std + 1e-6) for r in rewards]   # all zeros if every reward is equal

# loss for one prompt, simplified: raise log-probs of high-advantage rollouts
# loss = -sum(A[i] * logprob_of_tokens(rollout[i]) for i in range(G)) / G

From one answer to many turns

So far each rollout is one answer. Slide 37 shows Search-R1 (Jin and colleagues, 2025): RL extended to multi-turn interaction. The model writes a <think> block, then a <search> query. The harness pastes search results in an <information> block. The loop repeats until an <answer> arrives, and the reward is 1 if the answer is right. The example asks which city and state the singer of the fragrance “Curious” was born in, and the model finds McComb, Mississippi. This is Chapter 3’s ReAct loop, now trained instead of prompted. Slide 38 shows the product version, OpenAI’s Deep Research (February 2025).

For more on RL for reasoning, see our CS224R reasoning lesson, policy gradients and test-time compute.

For one prompt, all 8 rollouts get the same reward of 1. What are their GRPO advantages, and what does training do?

Chapter 5

Long-Horizon Agents and the Harness

Separate the model from the harness around it, and see what the harness does when the task runs long

You give a coding agent a bug report. The bug lives somewhere in a project with eighty files. The agent opens a file, reads it, searches for a name, opens another file, edits a line, runs the tests, reads a long error, tries again. An hour later the bug is fixed. Twelve hundred lines of tool output went past along the way.

A language model alone cannot do this. It has no hands, no memory beyond its context, and no way to run anything. What makes it possible is everything wrapped around the model. Slides 39 to 45 name it and ask where it leads.

The model and the harness

The harness is all the code and text around the model that turns it from a text predictor into an agent. Slide 39 lists what it does: context management (deciding what the model sees on each call), memory (notes kept outside the context), tools (commands the model can run) and orchestration (the loop, and splitting work among helpers). We drew the smallest harness in Chapter 3: ten lines that ran a search and pasted back the result.

The slide pictures SWE-agent (Yang and colleagues, Princeton, 2024). A language-model agent works on a computer through an agent-computer interface (ACI): a small set of commands designed for the model, namely a file viewer, a file editor and a code search. A human uses an editor such as VS Code or PyCharm, designed for hands and eyes. The paper’s point, in the slide’s own title, is that a good interface for the agent makes automated software engineering work. Same model, better tools, better results.

Slide 40 shows a Claude Code demo (Anthropic, September 2025): the model reads files, searches code and runs tests inside a terminal. Slide 41 then gives a striking figure from Anthropic’s “When AI Builds Itself” (2026). Code written per contributor at Anthropic increased eightfold this year, and Claude writes approximately 80% of the code merged there. We repeat the slide’s claim; it comes from the company’s own report.

Slide 42 shows a chart from METR, “Measuring AI Ability to Complete Long Software Tasks”. It plots, against model release date, the length of task (measured by how long a human takes) that a model completes with 50% success. The trend climbs from seconds to hours on a logarithmic axis. The reading for us: agents are being asked to work for longer and longer before a person checks in. That is exactly where the harness matters most.

What the harness does when the task runs long

Every model has a context window, the most text it can read in one call. An agent’s transcript grows with each step, as you saw in Chapter 3. Sooner or later it hits the limit. The harness must choose what to do. Here are three simple policies, and the device lets you compare them.

With append everything, nothing is ever removed, and the call fails when the window is full. With truncate, the oldest text is dropped to make room. This is simple, but the oldest text includes the original instruction. With compact and pin, the harness keeps the instruction pinned at the top. When the context passes a threshold, it replaces the old steps with a short summary, plus the last few steps, and sends that on.

Run the agent past its window

The line shows how full the context is after each step. The dashed line is the window. Choose a policy, then drag the number of steps.

30

Illustrative sizes, in thousands of tokens: a 128 window, a 2 instruction, 6 added per step (a 5 tool result and a 1 thought). Compact and pin compacts when the context passes 100, down to the instruction, a 10 summary and the last 4 steps. Real windows and tool outputs vary a great deal.

Run it at 30 steps. Append everything has failed, because 2 + 6 × 22 passes 128. Truncate survives but, from step 22 on, the instruction is gone. The agent is working on a task it can no longer read. Compact and pin stays under the window and keeps the instruction, at the price of a lossy summary.

That price is the symptom to watch. A summary can drop a detail that matters, such as which approach already failed. The measurement is to replay a long run, compact at a fixed point, and compare what the agent does with and without the compaction. The fix is usually to write key facts to a notes file outside the context and let the agent read it back on demand. That is the memory of slide 39.

def build_context(instruction, steps, notes, window=128_000, compact_at=100_000):
    ctx = [instruction] + steps
    if tokens(ctx) > compact_at:
        summary = model("Summarise what was tried and learned:", steps[:-4])
        notes.append(summary)                       # also saved outside the context
        ctx = [instruction, summary] + steps[-4:]   # pinned instruction, summary, recent steps
    assert tokens(ctx) <= window
    return ctx

Automated improvement loops?

Slides 43 to 45 turn a question toward the rest of the course. Slide 43 shows the page “When AI Builds Itself” from Anthropic. Slide 44 shows its section headings, which move from building the first Claude through chatbots, coding agents and autonomous agents to closing the loop. Slide 45 shows OpenAI’s “Research acceleration: The view inside OpenAI” (September 6, 2026). Both ask the same thing: when agents write most of the code that builds the next models, does the loop close?

The slides pose it as a question, with a question mark in the title. We do the same. Chapter 6 gives the idea a history, and Chapter 7 shows loops that already run. See also our lessons on harness engineering, self-improving harnesses and agent memory.

A harness drops the oldest text when the context fills up. After 40 steps the agent works on the wrong goal. What is the most likely cause?

Chapter 6

Self-Improvement Before LLMs: 1965 to 2017

Follow the idea of a machine that improves its own design from Good to Gödel to AlphaGo Zero

Imagine a robot that builds robots. The first one, built by people, is a decent builder. It makes a second robot, a little better at building. The second makes a third. If each robot is better at building than the last, the gap between one generation and the next grows every time.

Slide 46 asks a big question: what is the history of self-evolving AI, and why is it blowing up now? The idea is much older than language models. The lecture picks four landmarks, and they show what stayed hard for sixty years: knowing that a change is really an improvement.

1965: the intelligence explosion

Irving John Good was a British mathematician who worked as a cryptologist at Bletchley Park with Alan Turing. After the war he kept working with Turing on computer design and on Bayesian statistics at the University of Manchester. In 1965 he published “Speculations Concerning the First Ultraintelligent Machine” (slide 47). It proposed an intelligence explosion, driven by machines that recursively improve their own design.

Slide 48 spells out the argument in four steps. A machine has the intellectual ability to design machines. It uses that ability to design a more capable successor. The successor is also better at machine design. So it can contribute to another round of improvement. The chart on the slide shows machines 1, 2, 3, 4 and more, each designed by the one before, with the gap widening each generation, until human level is far behind.

The argument has one hidden knob: how much does being smarter help you design? If a smarter machine is no better at design than a dumb one, you get steady, boring progress. If a smarter machine is proportionally better, growth compounds. If it is better than proportionally, growth runs away. Try it. The device multiplies the capability of each new machine by the gain from its predecessor.

Try an intelligence explosion

Each line is a chain of machines, each built by the one before. The vertical axis is logarithmic: equal steps mean the same multiple. Drag the two knobs.

1.0
0.30

A toy model, not a forecast. Machine 1 has capability 1. Each next machine adds the gain times its own capability raised to the power on the first slider: next = c + gain × cpower. Power 0 is steady progress, power 1 is compounding, above 1 is runaway. Good’s paper does not give these numbers.

With the starting values (power 1, gain 0.30), machine 12 is about 18 times as capable as machine 1: compounding by 30% each time. Slide the power to 0 and machine 12 is only 4.3 times as capable. Slide it to 1.6 and machine 12 is about 400,000 times as capable. Good’s step 3, a successor better at design, is exactly a power above 0.

2003: the Gödel machine

Slide 49 shows Jürgen Schmidhuber’s “Gödel Machines: Self-Referential Universal Problem Solvers Making Provably Optimal Self-Improvements” (IDSIA, 2003). The machine can rewrite any part of its own code, including the part that decides how to rewrite. There is one strict rule, from slide 50: it modifies its own code only when it can prove that the modification is beneficial.

The slide shows the loop as code. Forever: solve problems in the environment, which earns utility (a score). Propose a switch program. Search for a proof that running the switch program gives more utility than carrying on. If a proof is found, execute the switch. It may even rewrite the prover.

The proof rule solves the problem from Chapter 0. A proven change is never a bad change, so noise cannot let one slip in. The cost is that proofs about real programs in real worlds are very hard to find. Most useful changes cannot be proved. The question for the rest of the lecture is what to use instead of proof. Chapter 7 shows one answer: run tests.

2017: AlphaGo Zero and self-play

Go is a board game with more positions than anyone can list. Slide 51 recalls the first AlphaGo, which was trained to imitate the games of human experts before reinforcement learning. Slides 52 and 53 show its successor, AlphaGo Zero (Silver and colleagues, Nature, 2017). The title says it all: “Mastering the Game of Go without Human Knowledge”.

AlphaGo Zero improves through a repeated cycle of self-play, with no human gameplay data. Slide 53 gives the four stages. Play: the network plays itself. Label: record who won and which moves were played. Train: teach the network to predict both. Replace: the better network plays next. The slide’s headline numbers are 0 human games used, 3 days of training on 4.9 million self-play games, and a 100 to 0 score against the AlphaGo that beat Lee Sedol.

def alphago_zero_loop(net):
    while True:
        games = [self_play(net) for _ in range(N_GAMES)]   # PLAY: net plays itself
        data = [(position, who_won, moves) for g in games  # LABEL: winner and moves
                for position in g]
        candidate = train(net, data)                        # TRAIN: predict winner and moves
        if beats(candidate, net):                           # REPLACE: only if it wins
            net = candidate

Why does this work for Go? Because the game itself gives a perfect verdict. A game ends and someone has won. There is no noise in the judgement. The feedback problem from Chapter 0 is solved by the rules of the game. Most real tasks have no such judge, which is why the next chapters spend so long on evaluation.

In the 1965 argument, which step makes the improvement compound, not just continue at a steady pace?

Chapter 7

Search With Code: FunSearch, DGM, autoresearch

Run a propose, evaluate and keep loop, and learn the rule that makes it safe to run overnight

You want a better way to pack items into bins. You cannot write the best rule by hand, but you can test any rule: run it on a thousand packing problems and count the bins it uses. A test like that is worth a lot. If you can score ideas cheaply and honestly, you can let a machine produce a thousand ideas and keep the best.

The last chapter ended with a question: what do we use instead of proof? Slides 54 to 56 answer: use the language model to propose changes, and use a test to decide. Three systems show the pattern, and each one moves the loop closer to improving itself.

2023: FunSearch

FunSearch (Romera-Paredes and colleagues, Google DeepMind, 2023) “combines LLM-generated code with automated evaluation in an evolutionary loop”, as slide 54 puts it. A pretrained language model is shown some of the best programs found so far and asked to write a new one. An evaluator runs each new program and scores it. Good programs go into a database, and become examples in later prompts. The slide reports two results: new constructions for the cap set problem (a puzzle in combinatorics, the maths of counting and arranging) and improved heuristics for online bin packing.

What is being evolved here is a program. The model never changes. The test never changes. Only the pool of candidate programs does. This is the safest form of the loop, because the evaluator is fixed and trustworthy: a program either scores or it does not.

2025: the Darwin Gödel Machine

The Darwin Gödel Machine, or DGM (Zhang and colleagues, 2025; slide 55), takes the loop one step closer to the Gödel machine of Chapter 6. It drops the impossible proof and keeps the self-reference. The thing that gets edited is the coding agent itself, meaning its own code. The loop has four stages: pick a parent from an archive of all agents so far; self-modify, where the parent reads its own benchmark logs, diagnoses a weakness, and edits its own repository; evaluate the child on a coding benchmark (the slide names SWE-bench); and archive the child.

The archive is the clever part. The DGM does not only keep the single best agent. It keeps many, including some that are worse than their parents. A weaker agent can be a stepping stone: its children may open a new path that the best agent would never reach. This is called open-ended evolution.

2026: autoresearch

Slide 56 shows autoresearch, a GitHub repository by Andrej Karpathy (2026). An AI agent follows a plain text file, program.md, to propose ideas, edit code and run experiments that improve language-model pretraining under a fixed compute budget: 5 minutes per experiment, about 100 experiments in one night. The fixed budget is what makes the experiments comparable. A change that wins in 5 minutes beats a change that loses in 5 minutes, on the same clock.

The slide shows the loop in nine steps. Here is our paraphrase in Python. Read the keep-or-reset rule at the bottom. It is the one-line answer to the question from Chapter 0.

def autoresearch(repo, program_md, n_runs=100):
    best = run_baseline(repo)                           # val metric, lower is better
    for _ in range(n_runs):                             # about one night at 5 min each
        idea = agent.propose(program_md, repo.git_log())   # 1-2: read state, pick an idea
        repo.edit("train.py", idea)                        # 2: tune the training script
        repo.commit()                                      # 3
        result = repo.run("train.py", budget_minutes=5)    # 4-5: fixed budget, read the metric
        if result.crashed:                                 # 6: no metric, so read the trace
            agent.read(result.trace)
        log_to_tsv(idea, result)                           # 7: record every run
        if result.metric < best:                           # 8: improved? keep the commit
            best = result.metric
        else:                                              # 9: equal or worse? undo it
            repo.reset_hard()

Now run the loop yourself. The device is a toy landscape. The horizontal axis is one setting you can change. The height is the score. There is a small hill on the left and a tall hill on the right, and the agent starts on the small one. Choose a keep rule, set how bold the proposals are, and press Run 40 rounds.

Run a keep-or-reset loop

The curve is the score of every setting. Dots are kept settings. Each round proposes a nearby setting, scores it, and applies the rule. The line below is the score of the setting the agent is using.

0.06

A toy landscape: a small hill (height 0.6 at 0.25) and a tall hill (height 1.0 at 0.75). Scores are exact and noiseless, as with a fixed compute budget. Proposals add a random step of the chosen size. The archive rule keeps every child within 0.1 of its parent and picks parents weighted toward high scores. The random numbers are seeded, so a reset repeats the run.

Try it. With Keep if better and modest proposals, the loop climbs the small hill and stops. It is stuck: every nearby setting is worse, so every proposal is reset. This is the symptom. The measurement is the flat best-score line. The fix is bolder proposals, or an archive that keeps stepping stones. With bold proposals the loop sometimes lands on the tall hill in one jump. Try Archive with boldness 0.40. A language model is good at exactly these jumps: it can propose a change of kind, not only of degree.

Slide 56 is the sharpest form of the course’s promise and its risk. The agent edits code, and the evaluator is also code. If the agent can edit the evaluator, or train on the test, a gain may be fake. Autoresearch keeps the metric fixed and the budget fixed, and logs every run. That is what a trustworthy self-improving loop needs.

An overnight loop keeps a change only if a fixed 5-minute test gives a better score. Why is the fixed budget important?

Chapter 8

Perspective 1: What Is Being Evolved?

Sort every self-evolving system by the layer it rewrites: context, harness, weights or environment

Open a file on your computer and edit one line. Now imagine you could point at any part of an AI system and say: let the AI rewrite this. You could point at the text it reads. You could point at its tool code. You could point at the weights, or at the tasks it practises on. Each choice gives a different kind of self-evolving AI.

Slide 57 opens the second half of the lecture, “Today’s Landscape of Self-Evolving AI”, and gives three perspectives. The first, on slides 58 to 65, asks what is being evolved? The slides answer with a stack of four layers, built up one at a time.

Four layers, four colours

The page uses one colour for each layer, and you have met all four. Contexts and artifacts: prompts, answers, programs and archives. Memory and harness: memory notes, skills, tools and scaffold code. Model weights: the weights themselves, or small adapters added to them. Environment and tasks: tasks, curricula, environments and the checkers (verifiers) that score answers.

Each layer matches one module of the course, which is why the syllabus has four modules (Chapter 1). Each one has example systems on the slide. Choose a layer below and see its examples, along with how it trades off. The three bars are our own illustrative ratings, from 1 to 5, to make the trade-offs visible. They are not measurements.

Pick what to evolve

The stack on the left is an AI system. The highlighted layer is the one the AI is allowed to rewrite. The bars on the right compare layers. Press a layer.

The layers and the example systems are the slide’s (slides 60 to 64). The ratings, from 1 (low) to 5 (high), are our own rough judgement for teaching: speed is how quickly a change can be made and undone, lasting is how long it helps across tasks, and risk is the chance it harms something else.

Look at the bars as you switch layers. Context changes are fast and cheap and easy to undo, but they help only when the text is read. Weight changes last, but they are slow and can damage other skills. The harness and the environment sit between. There is no best layer. The skill is choosing the cheapest one that fixes the problem, as in Chapter 1.

FunSearch: programs and contexts

Slide 59 repeats the FunSearch diagram from Chapter 7 and labels it: in FunSearch, math programs are being evolved. The prompt holds earlier programs, and the output is a new program that goes into a database. DSPy and PromptBreeder, named on slide 60 for the same layer, evolve prompts. The model and the harness stay fixed.

Meta-Harness: the harness

Slide 61 shows Meta-Harness (Yoonho Lee and colleagues, 2026) and says: the agent harness is being evolved. The diagram has three numbered steps. A coding agent proposes new harness code, reading a filesystem that holds earlier harness code. The proposed harness is evaluated on tasks. Then all the logs, meaning proposed code, reasoning traces and evaluation scores, are stored back in the filesystem. The next round starts with that whole history. Voyager and the DGM (Chapter 7), named on slide 62, belong to the same layer.

Absolute Zero: the weights, and the tasks

Slide 63 shows Absolute Zero (Zhao and colleagues, 2025): model weights are being evolved. One language model plays two roles. As the proposer it writes a task. As the solver it answers it. An environment, here a code executor, checks the answer and gives the feedback. No human wrote the tasks. The model’s weights are trained on both roles. STaR and DeepSeek-R1 (Chapter 4) are named on slide 64 for this layer.

Slide 65 adds the twist: tasks are also evolved. The proposer is learning too, so the tasks themselves move. That puts Absolute Zero on two layers at once. A worked example shows why this needs care. In the paper, the proposer is rewarded when its task is neither too easy nor too hard. Say it writes a task and the solver tries it 10 times. If the solver gets 10 of 10, the task taught nothing, so the proposer scores 0. If the solver gets 0 of 10, the task is out of reach, so again 0. If the solver gets 3 of 10, the task is learnable and the proposer scores 1 − 0.3 = 0.7. This is the same trap you saw in Chapter 4: a group with no spread gives no signal.

def absolute_zero_round(model, executor, k=10):
    task = model.propose()                          # role 1: write a task, as code plus an input
    solved = [executor.check(task, model.solve(task)) for _ in range(k)]
    p = sum(solved) / k                             # solver's success rate on this task
    r_propose = 0.0 if p in (0.0, 1.0) else 1.0 - p  # learnable tasks pay the proposer
    r_solve = [1.0 if ok else 0.0 for ok in solved]  # a checked answer pays the solver
    return task, r_propose, r_solve                 # both rewards update the same weights

The failure mode for all four layers is the one from Chapter 0. When the AI edits something and the judge cannot tell good from bad, the loop drifts. When the AI also edits the tasks or the checker, the drift can go unseen.

In Meta-Harness, what is the thing being evolved?

Chapter 9

Perspectives 2 and 3: How, and How the Big Ideas Relate

Tell apart an agent improved by others, a self-evolving one and a self-referential one

Two students both get better at chess. The first has a coach who studies the world’s best games, writes a new training plan every month and hands it over. The second plays her own games, studies her own losses and keeps what works. A third student does something stranger: she also rewrites how she studies. Over time, who is improving, and who decides how?

Perspective 1 asked what changes. Perspective 2, on slides 66 to 73, asks how it changes. Perspective 3, on slides 74 to 77, asks how the big ideas around self-evolving AI relate to each other.

A model view: the context as the state

Slide 66 first views the agent as a model. The model has fixed weights, written θ. Its context holds the task, then a think-and-act step, then an observation, then another think-and-act step, and so on. Each new token or observation extends the context. The slide uses the language of a decision process: the state is the context so far, an action is the next token, and a value V(context) says how likely this context is to end in a good result.

Seen this way, self-improvement is simply a way to keep V rising. You can keep adding useful tokens to the context while θ stays fixed: that is what a ReAct agent does as it reads search results. Or you can change θ to a new set of weights θ′ with an update rule. The slide’s picture shows both: a context growing to the right, and an update arrow that turns θ into θ′.

An agent view: who supplies the data, and who owns the rule

Slides 67 to 73 sort agents with two questions. First, where does the data come from: from outside (people and labs), or from the agent’s own experience? Second, who owns the update rule: is it fixed by the designers, or can the agent rewrite it? The answers give three kinds.

The two questions show up directly in code. Only the arguments change.

def improve(agent, data, update_rule):
    return update_rule(agent, data)                    # returns agent v2

# 1. improved by others: outside data, a lab's fixed rule
v2 = improve(v1, data=lab.collect(), update_rule=GRPO)

# 2. self-evolving: its own experience, still a fixed rule
v2 = improve(v1, data=v1.run(tasks).logs, update_rule=GRPO)

# 3. self-referential: its own experience, and the rule is its own code
v2 = improve(v1, data=v1.run(tasks).logs, update_rule=v1.code_that_edits_code)

Try the sort yourself. For each system, read the one-line description and decide which kind it is.

Sort the system

Ask two questions: where does the data come from, and who owns the update rule? Then press a kind.

The grouping is the lecture’s (slides 68, 70 and 72). The one-line descriptions are our short summaries of each system, written for this exercise.

A pattern appears when you sort. The first kind needs a lab. The second needs only a task and a test, which is why it is cheap enough to run overnight. The third needs one more thing: a guard. An agent that rewrites its own improver can, by accident, break the thing that tells good from bad. Symptom: scores rise while real quality falls. Measurement: a held-out test the agent cannot touch. Fix: keep the evaluator outside the agent’s reach, as in Chapter 7.

Perspective 3: how the big ideas relate

Slide 74 draws a map of three ideas inside one another. AI for discovery uses AI to find new knowledge: the slide names AlphaEvolve, AlphaProof and the AI co-scientist. Inside it sits AI for AI research: the same loop, but the domain is AI itself (examples: AI Scientist, AIRA and autoresearch). The slide writes the key sentence next to it: same loop, the domain is AI itself.

When the improved AI is the same one that does the research, this enables recursive self-improvement (Chapter 6’s intelligence explosion, via the Gödel machine, the DGM and HyperAgents). For the gains to last, the map adds a requirement from continual learning (Voyager, Titans and SDFT are examples): what the improver learns must persist in the improver. Without that, each night’s progress would vanish by morning.

Slides 75 to 77 show landing pages of groups working on each corner: LILA Sciences and a project called Discovery Loop (AI for discovery), Oak Lab and Engram (continual learning), and Recursive Superintelligence and Mirendil (AI for AI research toward recursive self-improvement). The slides show the pages; they make no claim about results, and neither do we.

Why it is blowing up now

Slide 46 asked why self-evolving AI is blowing up now. The lecture does not answer in one line, but its own story does, and we can read the answer off the chapters. Models learned to follow instructions (Chapter 2). They learned to reason and to act (Chapter 3). Reinforcement learning made that reasoning stronger (Chapter 4). Harnesses let agents work for hours (Chapter 5). Each step made an agent good enough to be its own proposer in a propose, evaluate, keep loop (Chapter 7).

Two things still limit it. The evaluator must be trustworthy, as Chapter 0 showed. And the gains must persist, which is the continual learning requirement on slide 74. When both hold, the loop in the hero runs by itself. When either fails, it drifts, and you will not see it unless you measure.

An agent runs on its own tasks and keeps the tweaks that score better, using an update procedure its designers fixed. Which kind is it?

Chapter 10

Open Problems: Research Questions and Application Areas

Pick an open problem, read its goal, and see which papers the lecture lists for it

You have a semester, a laptop and a team of three. Which problem do you pick? The last block of the lecture, “Research Ideas and Tasks” (slides 78 to 86), is a menu. Each slide poses a question, states a goal, and lists the papers that frame it. These are also the course’s reading lists, so this chapter is where we cite them.

We teach each paper here by its title and its place in the argument. The course’s reading assignments are chosen from these lists; none are fixed for week 1.

Five research questions

1. Can an AI learn taste? (slide 79). The goal is to move past plausible variations of existing ideas toward spotting valuable directions and making genuinely new discoveries. The slide lists three papers: “Can LLMs Generate Novel Research Ideas?”, a large human study with 100 or more NLP researchers (Si and colleagues, 2024); “HindSight”, which scores idea generation by future impact (Bo Jiang, 2026); and “LLMs Can’t Jump” (Tom Zahavy, Google DeepMind, 2026). Notice the test in the first one: the judges are researchers. Taste is hard to score without people, which is the feedback problem of Chapter 0 again.

2. Can AI automate engineering optimization, and AI research itself? (slide 80). The goal is agents that choose ideas, run experiments and produce validated findings. The five papers are PaperBench (can AI replicate AI research?), Learning to Discover at Test Time, FrontierCS (evolving challenges for evolving intelligence), CORAL (autonomous multi-agent evolution for open-ended discovery, by Ao Qu, Han Zheng, Zijian Zhou and colleagues, MIT and NUS), and EdgeBench (scaling laws of learning from real-world environments, ByteDance Seed). Autoresearch (Chapter 7) is a working example of this question.

3. How do we turn experience into persistent knowledge? (slide 81). An agent’s transcripts are noisy. The goal is to convert them into reusable knowledge that lasts across tasks without piling up errors or causing catastrophic forgetting (new learning wiping out old). The papers include ExpeL (agents as experiential learners), Agentic Context Engineering (evolving contexts), two 2026 papers on self-distillation for continual learning and for RL, and Continual Learning Bench for stateful environments.

4. When do we update the weights, and when the harness? (slide 82). The goal is to decide whether a new lesson belongs in the model or outside it, in prompts, memory, skills, tools and orchestration. The papers are GEPA (reflective prompt evolution can outperform reinforcement learning), Meta-Harness, WHALE (joint harness and weight optimization) and Mem0 (long-term memory for agents).

5. How do we oversee increasingly autonomous systems? (slide 83). The goal is to keep meaningful human control when agents run for long periods, may exceed their supervisors, and may learn to exploit or sidestep their evaluators. The papers are “AI Safety via Debate” (Irving, Christiano and Amodei, 2018), “Weak-to-Strong Generalization” (Burns and colleagues, OpenAI, 2023), Anthropic’s “Agentic Misalignment” (2025) and “CoT Red-Handed”, which stress-tests monitoring of chain-of-thought (Arnav and colleagues, Google DeepMind, 2025).

Three application areas

Slides 84 to 86 apply the same loop to three settings. Science and engineering (slide 84) learns continually from simulations, experiments and real-world feedback; the papers include GeneBench-Pro on genomics reasoning, Coscientist on autonomous chemical research (Boiko and colleagues, 2023), AnalogAgent for analog circuit design, and work on agents coordinating distributed discovery. Personalization (slide 85) adapts to each user’s changing needs: learning personalized agents from human feedback, OpenClaw-RL (“train any agent simply by talking”), MIRIX (multi-agent memory) and StuLife. Multimodal and embodied worlds (slide 86) learn from perception and physical interaction: Self-Evolving Embodied AI, Voyager (Chapter 9), and a multimodal agent with long-term memory.

Explore the map. Each row is a topic. Each dot is one of its listed papers, placed at its year. The list shows only what the slides print.

Browse the reading map

Rows are the eight topics. Each dot is a listed paper at its year. Choose a topic to read its goal and its papers.

    Topics, goals, papers and years are the ones printed on slides 79 to 86. Short titles are ours. Where two papers share a year the dots sit side by side.

    The map shows how young the area is. Almost every dot sits in 2025 or 2026. Only the oversight row reaches back, to 2018. The questions are open because the systems are new.

    Worked example: weights or harness?

    Take question 4 with a concrete case. Your coding agent keeps calling a function that was renamed last month. Fix A is to add one line to its notes: “use the new name”. It costs seconds and takes effect on the next run. Fix B is to retrain on thousands of examples with the new name. It costs hours and money, and it may erase other knowledge. If the fact will change again next month, A is right: facts that change belong outside the weights. If the habit is stable and used on every task, such as always checking a result, B may pay back. The open problem is making this choice automatically, and checking it worked.

    An agent’s tool changed its name last week and will change again next month. Where should the agent’s knowledge of the name live?

    Chapter 11

    Field Guide

    Keep the numbers, the terms, the core loop in code, and the links onward

    A self-evolving AI is a loop with four parts: something to change, a way to propose a change, a test that says whether it helped, and a rule to keep or discard. This lecture followed that loop through six years of language-model progress, sixty years of ideas, four layers to rewrite and a menu of open problems. The hardest part, every time, was the test.

    The week ends with housekeeping. Slide 24 says enrolment decisions come that week, for-credit enrolment is capped at 20 to 30, and listeners are welcome if dedicated. A project preference form follows, with a tentative list of teammates and tentative directions. Slide 22 sets four questions for the room: your name and programme, why self-evolving AI, your research experience, and why this course.

    The numbers worth keeping

    NumberWhat it isWhere from
    88 hours, about 10,000 agentsA claim quoted on the AI for Discovery slide, not checked hereSlide 2
    3 of 8 right: +1.29 and −0.77Group-relative advantages for right and wrong rolloutsChapter 4, our worked example
    8 times, about 80%Growth in code per contributor, and the share of merged code written by Claude, as reported by AnthropicSlide 41
    0 games, 3 days, 4.9 million, 100 to 0AlphaGo Zero: human games used, training time, self-play games, score against the AlphaGo that beat Lee SedolSlide 53
    5 minutes, about 100 runsAutoresearch budget per experiment, and runs in one nightSlide 56
    4 modules, 4 homeworks, 4 readingsContext, harness, model and environment evolutionSlides 10 to 16
    40% / 20% / 40%Homework, reading, project (10 / 10 / 20 inside the project)Slide 14

    The terms, in one line each

    TermPlain meaningChapter
    Self-evolving agentAn agent that changes part of itself from its own experience0
    In-context learningLearning a task from examples in the prompt, with no weight change2
    Chain of thought, ReActWriting steps first; interleaving thoughts, tool actions and observations3
    GRPO, advantageCompare each rollout with its group; better than the group means positive4
    HarnessThe code, tools, memory and loop around a model5
    Intelligence explosionMachines that design better machines, compounding6
    Propose, evaluate, keepThe loop behind FunSearch, the DGM and autoresearch7
    Four layersContext, harness, weights and environment: what the AI may rewrite8
    Improved by others, self-evolving, self-referentialOutside data and a fixed rule; own experience and a fixed rule; own experience and its own rule9

    The core, as code

    One function holds the whole idea. Every system in this lesson is a choice of what layer is, how propose_edit works, and how trustworthy evaluator is.

    def self_evolve(system, layer, evaluator, rounds, budget):
        archive, log = [system], []                      # keep stepping stones, not only the best
        for _ in range(rounds):
            parent = select(archive, log)                # pick who to improve next
            child = propose_edit(parent, layer, log)     # a language model edits ONE layer:
                                                         #   context, harness, weights or environment
            score = evaluator(child, budget)             # fixed, held out, same budget for all
            log.append((child, score))                   # record every attempt, kept or not
            if score > evaluator(parent, budget):        # the test decides, not the proposer
                archive.append(child)
        return max(archive, key=lambda s: evaluator(s, budget))
    

    Before you let an agent rewrite something

    Chapter 0 showed that a noisy test lets bad changes in. These six safeguards come from the chapters since. Tick the ones your loop has and see what is missing.

    Check your loop

    Press each safeguard that your own loop already has.

    A teaching checklist, not a standard. Each item comes from a failure shown earlier: Chapter 0 (noisy test), Chapter 4 (no signal), Chapter 5 (lost goal), Chapter 7 (editable evaluator, fixed budget) and Chapter 9 (self-referential guard).

    Where this sits in the field

    Lecture 2 (week 2, 9/16) goes deeper on the first module: prompt optimization, memory, tools and knowledge. The topics in this lesson connect to our other pages: optimizing agents, self-improving harnesses, harness engineering, RL for reasoning, RLHF and DPO, test-time compute and prompt engineering. Later lectures of this series link back here.

    The takeaway. A self-evolving AI is only as good as the test that decides what to keep. Choose the layer, make the proposals bold, and spend your care on the evaluator.

    Open the Present and Teach pills above to explain this lecture back in your own words. Then go back to the three agents and drag the noise one more time: you now know why the green line falls.

    Credit. This lesson re-teaches Lecture 1 of MIT MAS.S62 How to AI an AI for (Almost) Anything (Fall 2026), taught by Paul Liang with teaching assistant Ao Qu at the MIT Media Lab and MIT EECS (Multisensory Intelligence group). The ideas, structure and cited papers are theirs and their authors’. All explanations, devices and toy numbers here are ours. See the course schedule for the slides, the course site, and the Self-Evolving Agents blog post from slide 5.

    Which single part of the self-evolve loop deserves the most care, according to this lecture?
    How to AI an AI for Almost Anything, Lecture 1
    Course schedule · Back to Gleams