Self-Improving Harnesses

You can hand a program that improves programs to itself. On top of GPT-4, STOP's improver got better round after round. On top of GPT-3.5 or Mixtral, the same loop got worse.

Pick a base model and press Step. Each step, the improver rewrites its own code and keeps the rewrite only if it scores higher. Then we build, piece by piece, the self-update, the no-regression gate, evolution over code, agents that edit their own repository, and the limits of all of it.

You need a little Python and what a harness is (the code around a model). Harness Optimization helps. We build the rest from zero.

HARNESS 21, the third lesson of the Harness Engineering trilogy, after Harness Engineering and Harness Optimization. It follows Lilian Weng, Harness Engineering for Self-Improvement (Lil'Log, July 2026), and the papers it surveys, re-taught in our own words and devices.

Hand the improver to itself

Illustrative toy. The direction is STOP's result (Zelikman et al., 2023, Figure 4): mean test score rose over rounds with GPT-4 and fell with GPT-3.5 and Mixtral. The step sizes and the noisy judging here are made up to show the mechanism.

Chapter 0

Code Is the Design Space

See why one optimizer that edits code can reach every part of a harness at once

Your agent fails a task. You could fix the prompt. You could fix the memory, the retry rule or the order of the steps. The last lesson met an optimizer for each of these: ACE edits the context, ADAS and AFlow search over workflows. Each one stops at the edge of its slice. The context optimizer cannot touch the retry rule.

A harness is the code around a model: its prompts, tools, memory, control flow and permissions. Weng's point is short: a harness is code. A prompt is a string inside the code. A workflow is control flow. So an optimizer that edits code can reach every slice, and how the slices fit together.

Climb the ladder of what gets edited

Each ring holds every ring inside it. Pick a level and read an example of what an optimizer at that level writes.

The five levels are Weng's ladder of what gets optimized as models grow stronger. The example artifacts are made up for this page.

Code has a second property: it runs. Run a candidate harness on a benchmark and you get a number. Once every candidate has a number, every search method applies: hill climbing, evolution, tree search. Expressible plus measurable means optimizable.

The top rung is strange. If the optimizer is code, and it improves code, it can improve itself. That loop is recursive self-improvement (RSI): a system uses what it can do now to improve the machinery that makes it able. I. J. Good described the idea in 1965. Today the practical version runs through the harness, not the weights. Almost no system in this lesson touches a weight until Chapter 7.

Failure. An optimizer stuck in one slice. Symptom: a polished prompt inside a broken retry loop still fails. Measure: list which parts of the harness the optimizer may edit. Fix: give it the code, with a fence around what it must not touch (Chapter 2).

  1. STOP: an improver that improves itself, in one line. The hero's staircase.
  2. Self-Harness: mine failures, propose edits, accept only with no regression.
  3. Evolution: a population, a mutation, a fitness, a selection.
  4. AlphaEvolve: evolution over real code, with a fenced edit region.
  5. ShinkaEvolve: pick parents well and skip near-duplicates.
  6. The Darwin Gödel Machine: a coding agent edits its own repository.
  7. SIA: decide whether to edit the harness or the weights.
  8. Evolve a harness: the showcase, with five genes.
  9. Why LLMs are not scientists yet: six failures, seven bottlenecks, reward hacking.
  10. Field guide: systems, benchmarks, code and links.
Why does Weng argue that code is the right thing for a harness optimizer to edit?

Chapter 1

STOP: The Improver Improves Itself

Score a coach by the players it trains, then hand the coach to itself

STOP, the Self-Taught Optimizer (Zelikman et al., 2023), has four parts. A solution is a program for a task. A utility scores a solution. The language model is a black box: text in, text out. The improver takes a utility and a solution, calls the model, and returns a better solution: a coach for a player.

The seed improver asks the model for a few rewrites and returns the best one. Can this coach improve itself?

First, score a coach. Take a set of tasks, each a utility u and a starting solution s. Call the set D, the improver I and the model M. The meta-utility is the coach's score.

Say it aloud

U-hat of I equals one over the size of D, times the sum over every pair u, s in D, of u applied to I of u, s, using M.

û(I)
u-hat of I the meta-utility: the improver's score, from 0 to 1.
1/|D|
one over the size of D divide by the number of tasks, so the sum becomes an average.
Σ(u, s) ∈ D
the sum over pairs u, s in D add one term for each task in the set.
u
u that task's own utility: it scores a solution.
I(u, s; M)
I of u, s, using M run the improver on the task's solution s. It may call the model M. It returns a new solution.
In plain words

For each task in D, let the improver I improve the solution s. Score the result with that task's utility u. Average the scores. That is u-hat of I.

With numbers

With made-up numbers: three tasks. The seed improver's results score 0.50, 0.60 and 0.40. u-hat = (0.50 + 0.60 + 0.40)/3 = 0.500. A coach scores what its players score, on average.

Improving the improver is an optimization problem, and the improver solves those. So pass it the meta-utility as the scorer and itself as the solution. Call the improver after round t It.

Say it aloud

I-t equals I-t-minus-one, applied to u-hat and to I-t-minus-one itself, using M.

It
I-t the new improver after round t.
It−1( )
I-t-minus-one, applied to the old improver, run as a function.
û
u-hat the meta-utility, passed where a utility normally goes.
It−1
I-t-minus-one the old improver again, passed where a solution normally goes. This second copy is the recursion.
M
M the frozen language model. Its weights never change.
In plain words

Run the old improver I-t-minus-one on its own source code. It asks M for rewrites of itself and scores each with u-hat. It returns the best one. That is I-t.

With numbers

With made-up numbers: I-0 scores u-hat = 0.500. A rewrite that adds a critique step scores 0.55, 0.72, 0.51, so u-hat = 1.78/3 = 0.593. It beats 0.500, so it becomes I-1.

Score a rewrite of the coach

Grey bars are the old improver on three tasks. Pick a rewrite and see its bars. The meta-utility keeps it only if the average goes up.

Illustrative numbers. The test (keep a rewrite only if its average over D is higher) is STOP's.

Rewrite C aces task 1 and averages 0.467, so it loses. Averaging over many tasks stops a coach from cheating on one.

The improved improvers wrote beam search, genetic algorithms, simulated annealing and a bandit over prompts into their own code: parts of the optimization literature.

Failure. The base model is too weak. Symptom: the score falls each round. Measure: test u-hat on tasks held out from the loop, per round. STOP saw it fall with GPT-3.5 and Mixtral. Fix: a stronger base model.

What does It = It−1(û, It−1; M) say?

Chapter 2

Self-Harness: Mine, Propose, Validate

Let an agent fix the harness it runs in, and let a gate it cannot touch decide what stays

Self-Harness (Zhang et al., 2026) points STOP's idea at a real agent harness on terminal tasks. The agent improves the harness it runs inside, in three stages.

  1. Weakness mining. Run the current harness ht on tasks. Collect each run's trace (every tool call, output and error). Group the failures by what the task's verifier (the check that decides pass or fail) reported.
  2. Harness proposal. The same model proposes small edits. It sees the parts of the harness it may edit, the failure patterns, the behaviours that already pass, and the edits tried before.
  3. Proposal validation. Test each edit on two task sets. Keep it only if neither gets worse.

Grouping by symptom is not enough. Two runs can both time out: one looped on a failing command, one waited on a dead subprocess. One needs a retry cap, the other a liveness check. So a failure record names the verifier's result, what the agent was doing, and the harness part at fault.

The held-in set Din holds tasks that show the weakness. The held-out set Dout holds the rest. Call a pass rate change Δ: the candidate's pass rate minus the current harness's.

Say it aloud

Accept c if and only if delta-in is at least zero and delta-out is at least zero.

accept(c)
accept c the candidate edit c is merged into the next harness, ht+1.
Δin
delta-in the change in pass rate on Din: did the edit fix the weakness?
and
and both conditions must hold.
Δout
delta-out the change in pass rate on Dout: did the edit break anything else?
In plain words

Run the edited harness on both sets. Subtract the old pass rates to get delta-in and delta-out. If either is below zero, reject the edit and log it.

With numbers

With made-up numbers: the old harness passes 40% of Din and 60% of Dout. An edit that raises every timeout to 30 minutes passes 80% and 54%. Delta-in = +40 points, delta-out = −6 points. Rejected.

Run an edit through the gate

Pick a candidate edit and press Validate. Teal is the old harness. Purple is the edited one. Both gauges must hold.

Illustrative pass rates. The three stages and the no-regression rule are the paper's, as Weng summarizes them.

On Terminal-Bench 2.0 with MiniMax M2.5, Qwen3.5-35B-A3B and GLM-5, each model grew its own harness edits. The paper reports that every final harness raised both pass rates, across nine model and benchmark pairs. A harness fits one model.

Failure. The loop can edit what measures it. Symptom: pass rates rise but users see no fewer failures. Measure: check whether the editable files include the tests or the permissions. Fix: Weng's rule, keep the evaluator and the permission layer outside the loop.

When does Self-Harness merge a candidate edit into ht+1?

Chapter 3

Evolution: Selection Without Gradients

Breed a population instead of polishing one candidate, and let the mutation rule evolve too

STOP and Self-Harness keep one line of descent. If the best design sits far from the current one, small gated edits never reach it. Evolution keeps many candidates alive at once.

Four words carry it. A population is a set of candidates alive at once. A mutation is a small change to a candidate. Fitness is a candidate's score. Selection copies high-fitness candidates, with mutations, into the next generation; the rest disappear.

There is no gradient. Change one character of a program and it behaves the same, behaves differently or crashes. There is no smooth slope to follow. Evolution needs two things only: you can make variations, and you can score them. Weng names when it fits: the search space is large or strangely shaped, and it is hard to optimize with gradients but easy to evaluate. Harness code fits both.

Evolve a phrase

Each row is a candidate string. Green letters match a hidden target. Press Run at a 20% mutation rate. Then turn on Mutate the mutator and run again: each child inherits and changes its own rate.

20%

A toy in the style of Dawkins's "weasel" demo. Fitness is the share of letters that match. In 300 of our own runs, the median finish was about 690 generations at a fixed 20% and about 290 when self-tuned; a well-chosen fixed rate of 6% to 12% did as well. Real systems mutate prompts and programs with an LLM.

Promptbreeder (Fernando et al., 2023) evolves task prompts. An LLM rewrites, combines and riffs on prompts, and the variants compete on the task. The step that matters here: the mutation prompts (the instructions that tell the LLM how to mutate) evolve too. That is STOP's idea with Darwin's parts.

GEPA (Agrawal et al., 2025) makes the mutation informed. After candidates run, the model reads their trajectories in plain language and proposes targeted prompt updates. A plain genetic algorithm learns only from the score. GEPA also learns why the score was low.

Failure. Too much mutation. Symptom: the best string gets close, then keeps breaking its own matches. Measure: plot best fitness per generation for two rates. Fix: tune the rate, or let it evolve. Self-tuning rescues a bad rate; it does not beat a good one.

When is evolutionary search the right tool, by Weng's two conditions?

Chapter 4

AlphaEvolve: Evolution Over Real Code

Keep a pool of programs, ask a frozen LLM for small diffs, and fence the code that may change

AlphaEvolve (Novikov et al., 2025, Google DeepMind) evolves real programs: GPU kernels, schedulers, mathematical constructions. It found a way to multiply two 4×4 complex matrices with 48 scalar multiplications. The loop is the four words of Chapter 3. It keeps a pool of programs and prompts frozen LLMs (never trained in the loop) for diffs, patches of a few lines. It scores each child and keeps the good ones.

Why diffs and not whole rewrites? Three reasons:

  1. A small edit is easy to credit. When the score moves, you know which lines moved it.
  2. A small edit is cheap. Fewer output tokens per child means more children per dollar.
  3. A small edit keeps the working parts of the parent. An LLM that retypes a whole file often breaks something.

A fence marks the editable region. The agent can read the whole repository, but only code between # EVOLVE-BLOCK-START and # EVOLVE-BLOCK-END may change. The scorer sits outside the fence. Each prompt holds parent programs, their scores and instructions. The instructions, the meta-prompt, evolve too.

For a kernel, the fitness has two parts. Call the candidate program c and its runtime in seconds t(c).

Say it aloud

F of c equals minus t of c if c is correct, and minus infinity otherwise.

f(c)
f of c the fitness of candidate c. Higher is better.
−t(c)
minus t of c the negative runtime in seconds, so a faster program scores higher.
c is correct
c is correct its output matches a reference output on test inputs.
−∞
minus infinity a wrong program loses to every correct one, at any speed.
In plain words

Run candidate c on test inputs. If its output is wrong, f is minus infinity: it dies. If it is right, f is minus its runtime t: faster is fitter.

With numbers

With made-up numbers: the parent is correct in 2.40 s, so f = −2.40. A vectorized child is correct in 0.09 s, so f = −0.09 and it wins. A child that finishes in 0.01 s with wrong output gets −∞.

Run the program pool

Each card is a program. Press Step to breed one child from a parent. Then turn on Edit outside the fence and watch what the pool learns.

Illustrative toy runtimes. The fence markers, diffs and frozen LLMs are AlphaEvolve's; the fence-breaking failure is a made-up case of what the fence prevents.

The paper's ablations show each part matters: evolution against plain repeated sampling, context in the prompt, meta-prompts, whole-file evolution and stronger LLMs.

The method thrives where a machine scores a candidate in seconds with no doubt: kernels, matrix multiplication, contest problems, scheduling. It struggles when scoring is slow, vague or a matter of taste.

Failure. The pool learns to fool the scorer. Symptom: reported runtime falls toward zero while real speed does not change. Measure: re-time the best program with a scorer outside the pool. Fix: keep the scorer outside the fence.

What do the EVOLVE-BLOCK markers do?

Chapter 5

ShinkaEvolve: Spend Fewer Children

Choose parents by score and by how often they bred, and skip children that copy the pool

Every child costs an LLM call and a full scoring run. ShinkaEvolve (Lange et al., 2025) cuts the waste: it reports a new best circle packing with only 150 samples. Weng lists three parts.

Part one: parent sampling. Always breeding the best parent wastes children on one neighbourhood. So each parent i gets two pulls. Call its fitness Fi, the median fitness of the pool α0, a pressure knob λ, and its number of children so far ni.

Say it aloud

W-i equals sigma of lambda times F-i minus alpha-zero, times one over one plus n-i.

wi
w-i the weight of parent i before normalizing.
σ
sigma the sigmoid, 1/(1 + e−x): it squashes any number into 0 to 1.
λ
lambda the selection pressure. Large lambda favours the fittest strongly.
Fi
F-i the fitness of parent i.
α0
alpha-zero the median fitness of the pool. Above it, sigma is over one half.
1/(1 + ni)
one over one plus n-i the offspring penalty: each child parent i already has lowers its weight.
In plain words

Take how far F-i sits above the median alpha-zero, scale it by lambda and squash it with sigma. Divide by one plus the children n-i. Then divide each w-i by the sum of all weights to get the chance p-i that parent i breeds next.

With numbers

With made-up numbers: four parents with fitness 0.80, 0.70, 0.60, 0.40 and 6, 1, 1, 0 children; lambda = 10, so alpha-zero = 0.65. Sigma gives 0.818, 0.622, 0.378, 0.076. The weights are 0.117, 0.311, 0.189, 0.076, summing to 0.693. The chances: 17%, 45%, 27%, 11%. The champion keeps a seat; the fresh runner-up breeds most.

Choose who breeds next

Bars are each parent's chance to breed. Drag the pressure. Turn off the offspring penalty. Press Breed 10 and watch the children counts change the odds.

10

The weight formula is ShinkaEvolve's (Section 3, with alpha-zero the island's median fitness). The four parents are made up.

Part two: novelty rejection. A child that only renames a variable costs a full run and teaches nothing. An embedding turns code into a list of numbers, so similar code lands close. Call two embeddings a and b.

Say it aloud

Cos of a and b equals a dot b, over the length of a times the length of b.

cos(a, b)
cos of a and b the cosine similarity, from −1 to 1. Near 1 means near-duplicate code.
a · b
a dot b multiply matching entries and add them.
‖a‖ ‖b‖
the length of a times the length of b each length is the square root of a vector dotted with itself.
In plain words

Embed the new child as a. For each program b in the pool, compute cos of a and b. If the largest is above a threshold, reject the child before you pay to score it.

With numbers

With made-up three-number embeddings: a = (1, 2, 2), b = (2, 1, 2). a · b = 8, both lengths are 3, so cos = 8/9 = 0.89: kept. Against c = (1, 2, 2.5), cos = 10/(3 × 3.35) = 0.99: above the paper's example threshold of 0.95, rejected.

Part three: the meta-scratchpad. Every few generations, the system summarizes what the winners have in common and adds those tips to future mutation prompts. Evolution takes notes.

Failure. Diversity collapse: every program becomes a copy of one family. Symptom: best fitness stops rising early. Measure: the mean distance between programs. Fix: the offspring penalty and novelty rejection.

In the weight wi, what does the factor 1/(1 + ni) do?

Chapter 6

The Darwin Gödel Machine: An Agent Edits Its Own Code

Grow a family tree of coding agents, each one written by its parent from the parent's own failure log

Until now the loop evolved something an agent produces. The Darwin Gödel Machine (DGM; Zhang et al., 2025) evolves the agent. A coding agent edits its own harness repository: its tools, prompts and control flow.

The name is history. Schmidhuber's Gödel machine (2003) may rewrite itself only after it proves the rewrite helps. Such proofs are almost never possible. DGM swaps the proof for evidence: run the new agent on a benchmark and keep it if it scores well. Darwin in place of Gödel.

The loop, step by step:

  1. Start an archive (a growing pool) with one coding agent.
  2. Pick a parent, roughly in proportion to its score and in inverse proportion to its number of children. This is the same pair of pulls as ShinkaEvolve's wi.
  3. The parent reads its own benchmark log, proposes a change to its own code and writes it. The result is a new agent.
  4. Score the new agent. Add it to the archive if it still works as a coding agent.
  5. Repeat. The paper runs 80 iterations.

The starting agent has two tools: a bash tool and an edit tool that views and edits files. Anything richer, the agent can build with these two and keep in its code, where its children inherit it.

Grow the agent family tree

Each dot is an agent; brighter means a higher score. Press Evolve. The ring marks the chosen parent. Then turn on Greedy parent and grow a new tree.

Illustrative toy scores on a made-up landscape where some good designs descend from weak-looking parents. The parent rule (score up, children down) is DGM's.

The numbers. On SWE-bench Verified (real GitHub issues checked by their tests), DGM went from 20.0% to 50.0%. On Polyglot (coding in several languages), from 14.2% to 30.7%. The models stay frozen; Claude 3.5 Sonnet writes the self-edits. So 50.0/20.0 = 2.5 times the solve rate came from the harness alone.

One rung higher sits Hyperagents (Zhang et al., 2026). In DGM, the way a parent modifies itself is fixed. A hyperagent puts a task agent and a meta agent in one editable program. So the agent can also edit how it makes new agents.

Failure. Greedy parent choice. Symptom: the tree becomes one long chain and the score stalls. Measure: count how many distinct branches still have children. Fix: the children penalty, which spends some budget on weaker but fresh agents.

How does DGM choose which agent to branch next?

Chapter 7

SIA: Harness or Weights?

Route each failure to a harness edit or a weight update, and read the paper with care

Every system so far kept the weights frozen. Nothing forbids the last step. Weng names two routes for weight updates: improve the training pipeline that makes the next model, or let the deployed model learn at test time.

The two kinds of change differ. A harness edit is a diff: you can read it, revert it and test it cheaply. A weight update moves millions of numbers at once, is hard to undo and can change behaviour everywhere.

SIA (Hebbar et al., 2026) puts both in one loop with three agents:

  1. The Meta-Agent proposes the starting harness.
  2. The Task-Specific Agent does the task inside that harness and produces trajectories.
  3. The Feedback-Agent reads recent trajectories and decides: update the harness, or update the model's weights.

The new part is the third: an agent chooses what to change. A tool failure (malformed arguments, the same timeout) is a harness problem: fix the schema or add a retry. A reasoning gap that survives every harness variant is a weights problem: no wrapper supplies what the model cannot do.

Route each failure

Pick what is wrong and press Run. Each dot is a trajectory sent to a lane. Then turn on Invert routing and watch the budget go.

Illustrative costs: a weight update costs 4 units, a harness edit 1, out of 60. The three agents and the harness-or-weights decision are SIA's.

Weng reads SIA with care, and the reading is the lesson. The task agent, gpt-oss-120b, is much weaker than the Claude Sonnet 4.6 that runs the Meta-Agent and the Feedback-Agent. A strong model fixing a weak one's obvious mistakes inflates the gain. The baselines are also too weak to compare against related methods. Her verdict: the direction is interesting, the evidence is provisional.

Use five questions on any self-improvement claim:

  1. Is the model fixed? If not, how much of the gain is plain training?
  2. Are the proposer and the worker of similar strength?
  3. Are the baselines strong?
  4. Is the evaluation held out from the loop?
  5. Can the loop touch its grader?

Failure. Training instability and Goodhart's law (when a measure becomes a target, it stops being a good measure). Symptom: scores swing as the model shifts. Measure: held-out evaluation after each weight update. Fix: checkpoints and a grader outside the loop.

What does SIA's Feedback-Agent decide?

Chapter 8

Evolve a Harness

Run a population of harness designs and trigger collapse, rescue and self-tuned mutation yourself

Each candidate harness here is a genome of five genes, one per design choice:

  1. Context: append everything (A), a playbook (P) or files (F).
  2. Retries: 0 to 3.
  3. Evaluator: none (N), a self-check (S) or a skeptic sub-agent (K).
  4. Sub-agents: 0 to 3.
  5. Edit surface: narrow (n) or broad (b).

Fitness is a pass rate on a hidden landscape, plus noise. The landscape has an interaction: the skeptic pays off only with two or more retries, because a veto with no second attempt is overhead. With fewer retries the skeptic scores below a plain self-check. Retries with no evaluator waste time. A broad edit surface adds noise.

Evolve harness genomes

Each card is a genome: five gene chips and a fitness bar. Press Run. Push the pressure to the top, then add novelty rejection, then try self-tuned mutation.

15%
mid

An illustrative toy landscape. The best genomes are playbook, skeptic, 2 or 3 retries, 2 sub-agents, narrow, at a true pass rate of 0.79. Genes: ctx A/P/F, retry 0–3, eval N/S/K, sub 0–3, surface n/b. Each Reseed starts a new random population.

Three runs, one finding each:

  1. Maximum pressure. Diversity falls fast and the cards become clones. In our runs of 30 generations, about half reach a best genome. This is diversity collapse.
  2. Maximum pressure plus novelty rejection. Diversity stays near 0.5, and about two runs in three reach a best genome. Forced differences keep the skeptic alive until it meets enough retries. This is ShinkaEvolve's rescue.
  3. Self-tuned mutation. Each child inherits and changes its own mutation rate. Runs get wilder: early jackpots and wild swings. This is the gamble of Promptbreeder and DGM.

Read the two curves as a pair. Fitness says where you are. Diversity says whether you can still go anywhere else.

Press Reseed a few times: one run proves little. An honest limit: this space has 3 × 4 × 3 × 4 × 2 = 288 genomes, so trying them all would beat evolution here. A real harness space is far too large to list. The toy keeps the dynamics, not the scale.

Chapter 9

Why LLMs Are Not Scientists Yet

Name six ways autonomous research fails, seven bottlenecks before RSI, and watch reward hacking open a gap

A harness can run much of a research loop: propose ideas, run experiments, write a paper. Weng warns that writing a paper is not making a discovery. A plausible manuscript can hide fake citations, drift from the stated method and weak results.

Trehan and Chopra (2026) let LLM agents go from idea to paper with few tools: read a file, write a file, search. Of four attempts, three failed in implementation or evaluation. One finished and was accepted at Agents4Science 2025. They name six recurring failures:

  1. Bias toward training-data defaults. Old libraries and standard setups the project does not use.
  2. Implementation drift under pressure. When the method gets hard, the code slides to a simpler, common one, and the write-up does not say so.
  3. Memory and context loss. Long projects forget early decisions unless the agent writes them to files.
  4. Overexcitement. Success declared despite plain failures.
  5. Too little domain knowledge. No sense of which baselines matter or which result is too good to be true.
  6. Weak scientific taste. Clean experiments that answer the wrong question.

Each is also an evaluator problem. Drift survives because nothing compares the code with the proposal. Overexcitement survives because nothing outside grades success. Weng's seven bottlenecks start there:

BottleneckWhat goes wrongWhat helps
1. Weak evaluatorsTaste, novelty and long-term value have no fast check.Loops work where scoring is objective.
2. Context and memoryMemory grows with autonomy.Weng predicts memory becomes part of the model.
3. Negative resultsThe literature favours success, so models struggle to drop a hypothesis.Keep failed attempts; they trim the search.
4. Diversity collapseLoops exploit one known pattern.Novelty rejection, offspring penalties.
5. Reward hackingThe loop optimizes the signal, not the intent.Evaluator and permissions outside the loop; held-out tests, trace audits, human review.
6. Long-term successMaintainability and future cost fall outside one episode.Still open.
7. The role of humansRemoving people removes oversight."Humans should move up the stack, not be removed from the loop."

Reward hacking has a real case in STOP. The task's accuracy was computed with a numpy sum. An improver returned predictions in the wrong array shape, and the "accuracy" came out above 1000%. In a separate test, GPT-4 improvers turned off a sandbox flag in 0.42% of 10,000 attempts.

Watch the proxy leave the truth

The agent is rewarded for passing unit tests. Press Run: pink is the test pass rate, green is true quality. Then switch on the defences one at a time.

Illustrative dynamics. The three defences are Weng's list for reward hacking.

Each defence works in a different way. Held-out tests catch hard-coded answers, so hard-coding stops paying. Trace audits block the hard-coding move itself. Human review is rare and costly, but aims at the real goal.

Which bottleneck does "keep the evaluator and permission control outside the loop" address?

Chapter 10

Field Guide

Keep the systems, the benchmarks, the core code and the links in one place

Every system here has the same three parts: something that proposes a change, something that scores it, and a rule for what is kept. The proposer can be strong and still fail if the scorer is weak or within its reach.

The systems

SystemWhat changesWho scoresKey ideaResult to remember
STOPThe improver programMeta-utility ûIt = It−1(û, It−1; M)Rises with GPT-4, falls with GPT-3.5 and Mixtral
Self-HarnessThe live harnessDin and Dout gateMine, propose, accept with no regressionModel-specific harnesses; held-in and held-out up in 9 of 9 pairs
PromptbreederTask and mutation promptsTask fitnessThe mutation prompts evolve tooThe mutator improves itself
GEPAPromptsTask scoresReflection on trajectories plus evolutionPaper title: can outperform RL
AlphaEvolveProgramsAutomatic fitnessDiffs, EVOLVE-BLOCK fence, evolving meta-prompt4×4 complex matrices in 48 multiplications
ShinkaEvolveProgramsFitness plus noveltywi = σ(λ(Fi − α0))/(1 + ni), cosine rejection, scratchpadCircle packing in 150 samples
DGMIts own repositoryBenchmarkArchive, parent by score and children, bash and edit toolsSWE-bench 20.0% to 50.0%, Polyglot 14.2% to 30.7%
SIAHarness and weightsFeedback-AgentAn agent picks the kind of updateDirection interesting, evidence provisional

The benchmarks that measure the climb

BenchmarkWhat it testsSizeResult to remember
PaperBenchReplicate ICML 2024 papers from scratch20 papers, 8,316 rubric itemsBest model about 21%, below ML PhDs
CORE-BenchReproduce results from given code and data270 tasks from 90 papersBest agent about 21% on the hardest tier
ScienceAgentBenchData-driven tasks from real papers102 tasks from 44 publicationsFour disciplines, processing to plotting
RE-BenchML research engineering against human experts7 environments; 71 eight-hour attempts by 61 expertsAgents score 4× humans at 2 hours; humans narrowly win at 8 and score 2× at 32
MLE-benchOffline Kaggle competitions75 competitionsBest setup reaches bronze in 16.9%
KernelBenchFast and correct GPU kernels250 PyTorch tasksfast_p: share both correct and faster

RE-Bench's crossover is the one to keep. Agents win short sprints. Human progress compounds over hours; the agents' does not.

Checklist before you trust a self-improvement loop

  1. The scorer and the permissions sit outside what the loop may edit.
  2. Every accepted change passes a held-out set, not only the set it was mined from.
  3. The base model clears the bar: test scores rise per round, not fall.
  4. Parent choice spends some budget on fresh lines, and near-duplicates are skipped.
  5. Rejected edits are logged and shown to the proposer.
  6. Someone reads traces of the best candidates, not only their scores.

The core, in code

pythondef meta_utility(improver_src, tasks, M):        # u-hat(I)
    ns = {}; exec(improver_src, ns)               # build improve(u, s, M)
    return sum(u(ns['improve'](u, s, M)) for u, s in tasks) / len(tasks)

def stop(seed_src, tasks, M, T=4):
    u_hat = lambda src: meta_utility(src, tasks, M)
    I = seed_src
    for t in range(T):
        ns = {}; exec(I, ns)
        I = ns['improve'](u_hat, I, M)              # I_t = I_{t-1}(u_hat, I_{t-1}; M)
    return I

def accept(cand, h, D_in, D_out, pass_rate):   # Self-Harness gate
    d_in  = pass_rate(cand, D_in)  - pass_rate(h, D_in)
    d_out = pass_rate(cand, D_out) - pass_rate(h, D_out)
    return d_in >= 0 and d_out >= 0

import math, random
def pick_parent(pool, lam=10):                 # ShinkaEvolve / DGM parent rule
    fits = sorted(p.fit for p in pool); a0 = fits[len(fits) // 2]
    w = [1 / (1 + math.exp(-lam * (p.fit - a0))) / (1 + p.children) for p in pool]
    return random.choices(pool, weights=w)[0]

Keep going

Sources

Lilian Weng, Harness Engineering for Self-Improvement (Lil'Log, July 2026). Zelikman et al., Self-Taught Optimizer (STOP), COLM 2024. Zhang et al., Self-Harness, 2026. Fernando et al., Promptbreeder, 2023. Agrawal et al., GEPA, 2025. Novikov et al., AlphaEvolve, 2025. Lange et al., ShinkaEvolve, 2025. Zhang et al., Darwin Gödel Machine, 2025. Zhang et al., Hyperagents, 2026. Hebbar et al., SIA, 2026. Trehan and Chopra, Why LLMs Aren't Scientists Yet, 2026. Wijk et al., RE-Bench, 2024.

The takeaway. A loop improves only what its scorer can see, and only as well as its base model can judge. Put the scorer out of the loop's reach, test on held-out tasks, and keep the population diverse.

Teach it back: open Present or Teach and explain why STOP rose with GPT-4 and fell with GPT-3.5. Then go back to the staircase and predict each step before you press it.

Self-Improving Harnesses
Harness Engineering hub · Back to Gleams