Back to blog

Tuesday, July 7, 2026

Lilian Weng Maps the Path to Recursive Self-Improvement — and It Starts with the Harness, Not the Weights

cover

Here's the question that keeps AI researchers up at night: what happens when a model gets good enough to improve the system that runs it?

I.J. Good called it the "ultraintelligent machine" back in 1965 — a system smart enough to design an even smarter successor, creating a runaway feedback loop. For sixty years it was philosophy. Lilian Weng's post from July 4, 2026 makes it engineering.

Her core thesis cuts through the hype: near-term recursive self-improvement (RSI) won't come from models rewriting their own weights. It will come from models optimizing their harness.

What's a Harness?

Weng defines the harness as "the system surrounding a base model that orchestrates execution and decides how the model thinks and plans, calls tools and acts, perceives and manages context, stores artifacts, and evaluates results."

Think of it as the operating system for the model. The model is the CPU — raw compute, trained capability. The harness is the kernel, the scheduler, the filesystem, the process manager, and the permission layer all in one. And just like a real OS, getting the harness right matters as much as the hardware.

The proof is already here. Claude Code, Codex, OpenCode, Cursor — they all run on broadly similar models. The difference in capability comes from the harness: the tool definitions, the context management, the loop structure. The coding agent harness has effectively stabilized into a consensus interface:

  • File system tools: glob, grep, read, write, edit, apply_patch
  • Shell execution: bash or PowerShell
  • Git/IO: git_status, git_diff, git_commit
  • External context: MCP tools, Skills
  • Web search: web_search, web_fetch, browser tools
  • Agent delegation: spawn_agent, resume_agent, wait_agent, interrupt_agent

This isn't a theoretical framework. It's what every coding agent developer reaches toward independently. Weng's contribution is naming the pattern and charting where it's going.

The Key Harness Patterns

Weng identifies three design patterns that keep recurring in successful agent systems:

1. Workflow Automation. Goal-oriented loops: Plan → Execute → Observe/Test → Improve → Repeat. Karpathy's autoresearch repo is the canonical minimal example. The model analyzes its own trajectories and failure cases, then adjusts.

2. Filesystem as Persistent Memory. This is one I've seen tripped up repeatedly in practice. Long-horizon agents produce massive artifacts — logs, diffs, trajectories, experimental results. The temptation is to stuff this into context. Don't. Files are durable. Context windows are not. Weng's formulation is sharp: "Learning how to read, write, and edit the file system (commonly via bash commands) is a foundation skill for LLMs."

3. Sub-agents and Backend Jobs. Main agents spawn sub-agents for parallel experiments, isolated by process boundaries. This requires a small runtime: launch, inspect, cancel, merge. The critical design choice is storing sub-agent outputs as files, not transient chat — enabling recovery after interruptions and reasoning over execution history.

The OS analogy runs deeper than metaphor. Harnesses will need permission layers, resource schedulers, and garbage collectors — exactly the things operating systems had to invent 50 years ago.

The Optimization Stack Gets Deeper

Here's where Weng's post really earns its reading time. She maps the progression of the optimization target as models get smarter:

Instructions → Structured Context → Workflow → Harness Code → Optimizer Code

Each step optimizes a richer object. The landscape of research already populating these layers is fascinating:

Context Engineering. ACE (Agentic Context Engineering) treats the model's context as an evolving "playbook" of structured, itemized entries — identifier plus description — to prevent context collapse and brevity bias. MCE (Meta Context Engineering) goes further: bi-level optimization where the meta-level evolves skills for managing context, and the base-level learns the context artifact itself. Crossover on prior skill sets generates better context strategies.

Meta-Harness is the one that made me stop and re-read. It optimizes the code that determines what information is stored, retrieved, and presented. The proposer is itself a coding agent. It's a harness for optimizing harnesses — the RSI loop starting to close on itself. The output is a Pareto frontier of harness candidates.

Workflow Optimization. Hand-crafted workflows like AI Scientist (full paper pipeline from idea to manuscript) and ScientistOne (every claim traceable to evidence via Chain-of-Evidence audits) show what's possible with careful design. But AFlow takes it further: workflows represented as computational graphs with LLM nodes, optimized via Monte Carlo Tree Search. It outperformed both human-designed workflows and ADAS (an earlier meta-agent search) across QA, code, and math benchmarks.

The Self-Improving Harness

The most concrete results come from systems that let the model edit its own harness code.

STOP (Self-Taught Optimizer) is deceptively simple: the model improves the function that improves it. In early experiments, STOP with GPT-4 discovered strategies like genetic algorithms and beam search — human-level insights emerging from recursive self-optimization. The critical finding, though, is a caution: STOP improved performance with GPT-4 but degraded with weaker models like GPT-3.5 and Mixtral. Recursive structure alone isn't enough. The base model must be capable enough to improve the mechanism. Below that threshold, the loop degrades.

Self-Harness (a paper submitted to the ICLR 2026 RSI workshop) runs a model through a tight loop: Weakness Mining → Harness Proposal → Validation. The model runs on a held-in dataset, clusters its own failures by signature, proposes targeted harness edits, and validates them on both held-in and held-out splits. The acceptance rule is deliberately conservative: a candidate is accepted only if it improves at least one split without degrading the other.

The results are striking and clean:

ModelHeld-Out (Initial)Held-Out (Self-Harness)Gain
MiniMax M2.540.5%61.9%+21.4 pp
Qwen3.5-35B-A3B23.8%38.1%+14.3 pp
GLM-542.9%57.1%+14.2 pp

No split degraded in any model. And the gains on held-out tasks — tasks the model never saw during proposal — prove the edits target reusable execution mechanisms, not test-set overfitting.

What makes Self-Harness particularly compelling is the qualitative side. It doesn't add generic instructions. It discovers targeted fixes for each model's specific failure profile. MiniMax needed better artifact and loop management. Qwen needed dependency prechecking and retry discipline. GLM-5 needed persistent environment state across sessions. A human could arrive at these fixes, but not at the rate or specificity Self-Harness achieves automatically.

Evolutionary Search takes a different approach. The Darwin Gödel Machine (DGM) lets an agent modify its own editable harness code repository, using mutation and selection. Results on Claude 3.5 Sonnet: SWE-bench Verified from 20% to 50%, Polyglot from 14.2% to 30.7%. The limitation is evaluation — evolution works brilliantly when scoring is objective and fast, but struggles with domains where quality is slow, ambiguous, or heuristic-based.

The Seven Challenges That Keep This Honest

Weng closes with seven open challenges. They're worth reading in full, but here are the ones that should keep agent developers awake:

Weak and Fuzzy Evaluators. The biggest bottleneck to RSI isn't the model — it's the evaluator. "Research taste," novelty, and long-term scientific value are fundamentally hard to measure. If you can't score improvement, you can't optimize for it. This is the Achilles heel of the entire approach.

Context and Memory Lifecycle. Context engineering must become a core component of intelligence, not just a software layer. We don't have good theories for how context should grow, compress, and decay over long agent lifetimes.

Negative Results. The literature is biased toward success. Models trained on this data struggle to know when to abandon a hypothesis. The ability to say "this approach is not working" and pivot is a skill, and it's one current systems lack.

Joint Optimization of Harness and Weights. A few papers (SIA) have attempted to combine harness evolution with model weight updates in one loop. Weng is candid: "I would consider the direction interesting, but the evidence provisional." Training stability and Goodhart effects are unresolved.

Why This Matters Right Now

If you're building agents in 2026, Weng's post is a map of the territory. The key takeaway: the harness is the leverage point.

The model you're running today is probably capable enough to improve its own operating context — if you build the loop. The research shows this works today, not in some speculative AGI future. Self-Harness runs on off-the-shelf models. STOP runs on GPT-4. DGM runs on Claude 3.5 Sonnet. The tools exist. The patterns are identified.

The question Weng leaves us with is whether we can build the evaluators, the safety layers, and the theoretical understanding to let these loops run safely at scale. The harness that improves itself needs governance that lives outside the improvement loop — permission and security layers that cannot be edited by the system they govern.

That's the engineering challenge of the next two years. And it's exactly the kind of problem that makes this field worth working in.


Source: Harness Engineering for Self-Improvement — Lilian Weng (Lil'Log) Related: Self-Harness: Harnesses That Improve Themselves (arXiv:2606.09498)