Harnesses for training and evaluation: scaffold sensitivity, RL environments, trajectories, self-improving harnesses

The harness as ruler and as gym, built and run on one ten-task environment: 240 real rollouts of a local 4B model and Claude Haiku 4.5. A child of Topic: agentic-harnesses. Data as of October 2026. Reading: 36 min, plus 25 in closed details.

The idea in one screen

The harness that runs an agent is also the ruler that scores it and the gym that trains it, so every harness choice (its tools, how it shows results, when it stops, which checks it trusts) becomes part of the score in evaluation and part of the skill in training.

A harness is the program around a model that turns its text into actions: it sends the request, runs the tool calls the model asks for, feeds the results back and decides when to stop (the parent, Topic: agentic-harnesses, builds one in its Loop lab). As a product it is the agent you use (Claude Code, Codex); this page is about its other jobs. Fig. 1 is one episode of textstats-gym, the environment built for this page, and what its record is used for.

Fig. 1, step by step: one recorded rollout (Haiku 4.5, bash only, task T01)

  1. Reset. A fresh copy of the library gets the planted bug for task T01 (contractions split into two words), and a new python:3.13-slim container starts with no network, the workspace mounted at /work. The harness sends the model its system prompt, its one bash tool and the issue: word_count("don't stop") returns 3 but should return 2.
  2. Act, observe (calls 1 to 5). The policy writes a tool call; the harness runs it in the container and returns the clipped output as the next observation: ls -la /work, find, cat tests/test_core.py, cat textstats/core.py, then the tests, which print FAIL test_apostrophes_kept. Each call re-reads the whole conversation: 1,290 input tokens on call 1, 3,022 on call 5.
  3. Edit and re-test (calls 6 to 8). A sed command changes the word pattern from [a-z]+ to [a-z']+, a cat confirms it, and the visible tests all pass.
  4. Stop. Call 9 has no tool call, so the harness ends the episode. What it kept is the trajectory: 17 events (9 calls, 8 observations), 25,604 input tokens read in all.
  5. Verify. The verifier copies only textstats/ out of the workspace, ignores its tests and runs 20 checks in a fresh read-only container: 19 pass, and the held-out h_apos_quotes fails ('quoted' keeps its quotation marks). Binary reward 0, partial 0.95; the agent's own tests would have paid 1 (section 3).
  6. Four uses of one record. Ruler: the reward, averaged over tasks, scores the model and the harness (sections 1, 3). Gym: rewards in a group become advantages; only the tokens the model sampled get loss; new weights go back to the policy (sections 2, 4, 5). Dataset: the trajectory is redacted, converted and kept if it passed, so whichever verifier filters it decides what is imitated (section 6). Search: edit the harness, re-score, keep the best; on a noisy ruler the measured gain runs ahead of the true one (section 7).

The setup, used on every section. textstats-gym: ten bug-fixing tasks on a 60-line Python library, each with a hidden verifier that runs in a fresh container with no network. Two models: Qwen3-4B-Instruct-2507 (4-bit, local on an Apple M1 Pro) and Claude Haiku 4.5 (subscription). Four harnesses: bash only (one shell tool), file tools (list, read with line numbers, replace exact text, run tests), the same file tools without line numbers (one detail changed), and Claude Code itself. Harnesses are compared within each model; the two models are never compared as if they were the same thing.

What the 240 rollouts showed
  • The harness moved the small model's success a lot and the strong model's little. Qwen3-4B passed the verifier in 2% of its rollouts with bash only and 52% with file tools; Haiku 4.5 stayed between 80% and 87% in all four harnesses, while its input tokens per rollout differed 6.9-fold (section 1).
  • The verifier decides what "solved" means. 31 rollouts passed every test the agent could see and still failed the hidden checks; 21 of them wrote the same plausible but too-loose regular expression (section 3).
  • Most groups carry no learning signal. With a pass/fail reward, 25 of 30 of the local model's groups and 36 of 40 of Haiku's had every rollout score the same, so their GRPO advantages are all zero (section 4).
  • Only a minority of a trajectory's tokens are the model's. 36% of the local model's tokens are ones it sampled; the rest are prompt, tool output and template, and must be masked out of the loss. Re-rendering the trajectory through the chat template also adds tokens it never produced (section 5).
You need
  • The agent loop: model call, tool call, result, repeat (the parent's Loop lab, or Building a harness section 1).
  • Policy gradients with a group baseline: GRPO (RL for LLMs section 3). Section 4 applies it; it does not derive it.
New terms
  • Scaffold: evaluation papers' word for the harness; scaffold sensitivity, how far the score moves when only it changes.
  • FAIL_TO_PASS / PASS_TO_PASS: checks the fix must flip, and checks it must not break.
  • Loss mask: which tokens of a trajectory enter the loss; token-in, token-out, training on the ids the engine sampled.
  • Rejection sampling fine-tuning: keep the passing trajectories, imitate them.
  • Winner's curse: the best of many noisy scores overstates its true value.
Where the neighbours stop. The parent's Reading section 7 and its Harness atlas tab ("The harness changes the score") give the published evidence in one screen; this page runs it, and since 24 October 2026 also carries the atlas's former sections on training environments and self-improving harnesses (closed blocks in sections 2, 6, 7 and 8). The RL algorithms (GRPO, Dr. GRPO, PPO, off-policy corrections) belong to RL for LLMs: RLHF, GRPO, RLVR; reward hacking in general to Reward Hacking; benchmark construction and scores to Agentic benchmarks and Coding benchmarks; grading trajectories to Agent and trajectory evaluation.

1. The score belongs to the pair: a controlled experiment

An agent benchmark does not score a model. It scores a system: the model, the harness around it (tools, prompts, how outputs are shown, when to stop), the settings (reasoning effort, turn and token caps), the tasks, and luck. Evaluation papers call the harness the scaffold, and scaffold sensitivity is how much the score moves when only the scaffold changes.

Published runs show it at benchmark scale (the parent's Harness atlas, "The harness changes the score", and Agentic benchmarks own them): on Terminal-Bench 2.0's public board one model ranges over about 18 points across nine agents; Arena's HarnessTax study found success moving by about 2 points on SWE-bench Lite and 5 on Terminal-Bench 2.0 across Claude Code, Codex CLI and Pi, while cost moved by about 2 times. Rankings do not survive a change of model either: an evaluation of four general harnesses (OpenCode, Codex CLI, Pi CLI, DeepAgents) with four models on six benchmarks, 52,168 trajectories, found the harness ranking changing across models and benchmarks (arXiv 2610.32483; Other coding harnesses reads it). Cost rankings behave the same way on a larger grid: across 22 harness configurations with five open models on 62 terminal tasks, the cost per task with the model fixed varied 1.8 to 5 times between harnesses, and the harness cheapest for one model ranked 16th for another (FrontierHarness Eval v1.1, below).

Depth: FrontierHarness Eval v1.1, cost and success across 22 harnesses (Runta with Baseten, 17 November 2026; as of 23 November 2026)

27,280 agent runs and 83B tokens: 22 harness configurations (18 harnesses, with four DeepSeek profiles and two OpenCode versions counted separately) × 5 open models (GLM-5.3, GLM-5.3-Flash, DeepSeek-V4.1-Flash-1017, Muse Spark Open, Kimi-K3) × 62 terminal tasks with limits from 15 minutes to 8 hours × 4 attempts. With the model fixed, the cost per task varied 1.8 to 5.0 times across harnesses (the widest with DeepSeek, Cline CLI at 5.0 times OpenCode v1) and the cost per passing task 1.9 to 4.9 times. No harness was cheapest for every model: Codex CLI ranked 1st on cost per task with GLM-5.3 and 16th with Kimi-K3. Success separated harnesses less clearly: the best harness pass rate was 61.9% (Pi, Codex CLI and ZCode) against 50.6% to 60.2% for the others, each with a 95% interval of about ±10 points. 64.5% of the list-price spend went to runs that did not pass (52.7% to failures, 11.8% to timeouts). 216 trials were flagged as reward hacking, 163 of them for online lookups, and scored 0 (what a verifier misses: section 3). Scope: open models only, all served by one provider, on the study's own 62 tasks; one study, run by a company that sells harness evaluation (Runta, 10 min).

When the harness decides success, not only cost: state that cannot be looked up again. A harness chooses what the model sees of earlier turns: drop them, summarise them, or replay the model's own reasoning. In a pre-registered probe, truncating the context cost a reasoning model nothing when the needed fact could be re-observed (it looked it up again) and dropped success to chance when it could not, a 92.5-point difference between the two penalties (90% interval 89.5 to 95.5). On ARC-AGI-3, where the benchmark's Standard harness trails its Provider Adapter harness by 63 points for the model tested (four games), summarising old turns instead of dropping them, while keeping the Standard harness's invitation to take notes, recovered 86% of that gap; replaying the model's native reasoning recovered the rest. Those are single runs per configuration and game (arXiv 2610.26632). The rule it gives a harness author: anything the agent learned that the environment will not show it again must survive compaction. Here is a small run where every variable is ours.

The experiment
Ten tasks (section 2), four harnesses, two models. Within each model only the harness changes: same prompts, same verifier, same cap of 16 model calls, same sampling. bash only: one tool, a shell in the container. file tools: list files, read a file (shown with line numbers), replace an exact piece of text, run the tests. file tools, no line numbers: identical except that read_file returns plain text. Claude Code: the product itself with its own prompt and six tools (Haiku only). Four rollouts per task and harness for the local model, three for Haiku; every rollout is in the Scaffold experiment tab.

Fig. 2, step by step: the harness moves the 4B model's success by 50 points and Haiku's by under 7; Haiku's bill moves instead

  1. Every rollout, one block. The 240 rollouts: the front row is Qwen3-4B (local, Apple M1 Pro), the back row Claude Haiku 4.5 (subscription); each plate is one harness, ten tasks across and one row per repeat. A tall green block passed the hidden verifier, a half-height amber one passed only the tests the agent could see, a flat one failed. The two models run on different scales and are not compared with each other.
  2. 4B, bash only: 2%. One pass in 40. Reading its rollouts shows why: in 33 of its 40 bash rollouts the code was never changed at all. The model typically found the bug, then either described the fix in prose and stopped calling tools (which ends the episode), or spent its calls on shell commands that failed on quoting.
  3. 4B, file tools: 52%. 48% without line numbers. Paired by task, the file tools beat bash by +50 points (95% bootstrap interval over tasks +22 to +78), large enough for ten tasks to see. Removing the line numbers moved success by -5 points (interval -32 to +25), no difference this task set can detect, although it was the change we expected to matter most. The line numbers cost something else: the exact-text edits failed 27 times with them (the model copied their padding into the text to replace) against 4 without, and the model recovered by re-reading the file.
  4. Haiku: 80% to 87% in all four. No paired difference excludes zero. Every Haiku rollout passed its visible tests; the amber blocks are the ones the hidden checks caught, most of them the too-loose apostrophe pattern of section 3.
  5. Haiku's bill moves instead. The glass columns are input tokens per rollout: Claude Code read 128,254 against 18,640 for the file tools without line numbers (6.9-fold), because its first call alone carries about 13,387 tokens of system prompt and tool definitions against 1,453 for ours. Caching made most of that cheap, so cost per rollout differed less ($0.040 against $0.027, API-price equivalents). That is HarnessTax's pattern in miniature: on easy tasks a strong model's harness moves cost more than success.

A harness bug that looks like a model failure. mlx_lm.server drops a tool call whose JSON does not parse and returns the reply with no tool call (Building a harness section 1 found it in mlx-lm's source; our server log shows the "Failed to parse tool call" warnings). Our loop, like most, ends the episode when a reply has no tool call. So in 9 local rollouts (3 bash only, 0 file tools, 6 file tools, no line numbers) the model tried to act, wrote a malformed call, and the harness quietly declared the episode over; 0 of them passed. Returning "your tool call did not parse" as an observation would have given them another turn. Every such rule is part of what a benchmark measures, and part of what RL in that harness would train.

How to compare harnesses (or models) honestly
  • Vary one thing. To compare harnesses, fix the model, effort and caps; to compare models, fix the harness (that is why SWE-bench ran every model in the same 100-line mini-SWE-agent).
  • Pair by task. Tasks differ far more than harnesses do; analyse per-task differences, not two overall percentages.
  • Several rollouts per cell, and an interval. Identical settings gave different outcomes in 9 of 70 of our task-and-harness cells. With ten tasks only differences of tens of points are visible; Eval statistics has the sample-size arithmetic.
  • Report cost beside the score, and the harness version beside both.
  • Say which verifier. Our visible-test and hidden-verifier pass rates differ by up to 20 points for the same cell (section 3).
Predict: the bash-only harness has strictly more power than the file tools (anything replace does, sed or a Python one-liner can do). Why would a weak model do worse with it?
Power is not the constraint; the interface is. With one shell tool the model must also choose and correctly quote a command for every edit, and shell quoting inside JSON inside a tool call is easy to get wrong; a dedicated replace(path, old, new) removes that whole class of error and returns a clear message when the text does not match. SWE-agent's "agent-computer interface" paper made the same point with GPT-4 Turbo: the interface, not the model, moved the resolve rate (the parent's Harness atlas has its numbers).
Go deeper: the Scaffold experiment tab for every rollout, the paired table and the costs; Coding benchmarks for why "% resolved" needs a scaffold column.

2. An RL environment from zero

Reinforcement learning (RL) trains a policy (here, the model) by letting it act, scoring the result, and making the actions that led to high scores more likely. It needs an environment: something that starts in a state, accepts an action, answers with an observation, and at the end hands out a reward. One run from start to finish is an episode, in LLM work a rollout (Topic: rl teaches these from the beginning). For a coding agent, almost every part of that environment is something the harness already does:

RL wordIn a coding environmentIn textstats-gym
Initial stateA repository at the commit before the fix, plus a task statementThe clean library with one to three bugs planted by exact text replacement, and an issue-style prompt
ResetA fresh copy and a fresh sandbox, so rollouts cannot see each otherA new workspace folder and a new python:3.13-slim container with --network none and 512 MB of memory, mounted at /work
Action spaceThe harness's toolsOne bash tool, or four file tools: the harness is the action space
ObservationThe tool's result as the harness formats itCommand output clipped to 3,000 characters (head and tail), exit code appended
Episode endThe model stops calling tools, or a cap is hitNo tool call in a reply, or 16 model calls
VerifierTests that must flip from failing to passing, and tests that must stay green20 checks (9 the agent can see, 11 held out) run in a second, fresh container that mounts the workspace read-only
RewardUsually 1 if the verifier passes, else 0Binary (all 20 checks) and partial (fraction of checks): section 3

Fail-to-pass and pass-to-pass. SWE-bench's two test lists are worth copying exactly. Run every check against the buggy repository first: the checks that fail there are the FAIL_TO_PASS set (the fix must flip them), the ones that pass are PASS_TO_PASS (the fix must not break them). Compute them by running, not by deciding which tests "belong" to the bug: the off-by-one bug in top_words (task T04) also breaks the tie-ordering and command-line checks, so its fail-to-pass list has six checks, not two. Every task's list is in the Environment lab.

Why the verifier runs outside the workspace. The tests the agent sees live in its workspace, which the agent can edit; a verifier that ran them would reward a rollout that weakened a test. So the verifier copies only the textstats/ package out, ignores the workspace's tests/, and runs its own checks in a container the agent never touched. Fig. 1 (steps 4 and 5, at the top of the page) shows it on a recorded Haiku 4.5 rollout in the bash-only harness: the same rollout earns 1 from its own tests and 0 from the hidden checks.

Containers are cheap at this size: one started in 0.25 s and a full verifier run took 0.54 to 0.79 s on this laptop (Docker 20.10.17, five timings). This page plants bugs because it makes the answer key exact: we know the correct code, so every rollout's diff can be judged against it.

Depth: the verifier command, and how published environments get their tasks
docker run --rm --network none --memory 256m \
  -v <workspace>:/work:ro -v <hidden checks>:/hidden:ro \
  python:3.13-slim python3 -B /hidden/hidden_tests.py /work      # prints {"check name": true/false, ...}

Two design choices sit under every published environment; the table at the end of this block (SWE-Gym, SWE-smith, R2E-Gym, SWE-rebench and others) shows where each landed. Where tasks come from: real issues and their fixing commits (SWE-Gym's 2,438 instances took about 200 annotation hours), bugs injected into a repository until tests fail (SWE-smith, and this page), or commits back-translated into issue text (R2E-Gym). How isolation is paid for: an image per task, an image per repository, or no container at all.

How the published SWE environments are built

Common recipe across these: (1) task = repo snapshot at the pre-fix commit plus a task statement (real issue, or back-translated / synthesized from a commit or injected bug); (2) environment = container image per task (SWE-Gym, R2E-Gym), per repo (SWE-smith), or container-free sandbox (SWE-MiniSandbox); (3) verifier = fail-to-pass tests that must flip plus pass-to-pass tests that must stay green; (4) reward = binary 1/0 on the test run with a time limit (DeepSWE: 5 min), or patch similarity without execution (SWE-RL), or a model judge (Dockerless); (5) rollout harness = the scaffold the policy acts in (OpenHands, SWE-agent, R2E tools, or, in 2026, the production harnesses themselves via LLM-call proxying: Polar, LEGO-RL, Composer 2).

Environment or methodWhat it isSizeRollout harnessRewardHeadline resultDate
SWE-GymFirst training environment of real, executable SWE tasks: each instance is a Python repo snapshot with a hand-configured Docker image, a GitHub issue as task statement, and the repo unit tests as checker.2,438 executable instances from 11 Python repos (SWE-Gym Lite: 230); about 200 human annotation hours, 10,000 CPU core hours, 6 TB of imagesOpenHands (bash + file editor, ReAct) and MoatlessTools (fixed workflow)Not online RL: rejection sampling fine-tuning on trajectories whose patch passes the unit tests (491 successful trajectories from GPT-4o and Claude 3.5 Sonnet); plus an outcome reward model (verifier) trained on trajectories to rerank at test timeQwen2.5-Coder-32B fine-tuned: 20.6% SWE-bench Verified agent only, 32.0% with verifier reranking; Lite 15.3% / 26.0%2024-12-30 (v2 2025-06-06; ICML 2025)
SWE-smithSynthesizes tasks by injecting bugs into a repo so that existing tests fail; one Docker environment per repository (not per task), so it scales to hundreds or thousands of tasks per repo.50,000 task instances from 128 GitHub reposSWE-agent (used to collect training trajectories)Test-based: a task is solved when the failing tests pass again; trajectories filtered by that check for SFT (rejection sampling), not online RLSWE-agent-LM-32B: 40.2% pass@1 on SWE-bench Verified (open-source SOTA at release)2025-04-30 (rev. 2025-05-21)
R2E-GymProcedurally built executable environments from historical commits: Docker image per commit, fail-to-pass tests taken from the repo or generated, problem statements back-translated from the commit diff and test results (SWE-GEN), so no human issue or test is required.8,135 tasks; 4,578-problem decontaminated subset over 10 repos with no SWE-bench overlapOwn minimal ReAct agent with four tools: file editor, search, bash, submitTest-based pass/fail for filtering 3,321 successful SFT trajectories (from 2,048 environments); hybrid verifiers (execution-based test agents + execution-free reward model) for test-time selectionQwen2.5-Coder-32B SFT: 34.4% pass@1 on SWE-bench Verified; 51.0% best@26 with hybrid verifier2025-04-09
SWE-RL (Meta)RL on software evolution data without execution: the policy reads an issue plus code context and writes a patch; the reward compares it with the real merged patch.About 11M unique PR instances after curation, from which high-quality seed RL instances were selected (linked issue, bug-fix description); base Llama-3.3-70B-Instruct, 1,600 RL steps, 16k context, batch 512No interactive harness in training (single-turn patch generation); evaluated with Agentless Mini scaffoldRule-based: difflib sequence similarity between predicted and oracle patch, in [0,1]; -1 for malformed outputLlama3-SWE-RL-70B: 41.0% on SWE-bench Verified (best for <100B models at the time)2025-02-25 (NeurIPS 2025)
DeepSWE (Agentica x Together AI)Pure online RL of a coding agent inside R2E-Gym containers, with the open rLLM framework.4.5K R2E-Gym problems (Docker per task), run on Kubernetes across 1000+ CPU coresR2E-Gym tool scaffold: execute_bash, search, file_editor, finish/submitSparse binary: 1 if the final patch passes the selected tests within a 5-minute limit, else 0 (no partial credit); GRPO++ (clip-high, no KL, leave-one-out advantage, compact filtering of truncated/timeouts, no entropy loss)Qwen3-32B trained 6 days on 64 H100: 42.2% pass@1 (avg of 16 runs) on SWE-bench Verified; 59% with hybrid test-time scaling (pass@16 candidates)2025-07-02
Kimi-Dev (Moonshot AI)Open 72B SWE model trained first as a workflow (Agentless-style: localize, then edit) policy with outcome RL in real repo containers, then adapted to a multi-turn SWE-Agent with SFT; argues agentless training is a skill prior for agents.RL on real repositories in Docker (task count not given in README); agent adaptation SFT on 5,000 public trajectoriesAgentless-style workflow (localize, then edit; the paper names BugFixer and TestWriter roles, from memory, not re-checked) for RL; SWE-Agent scaffold for the adapted agentOutcome only: reward when the entire test suite passes on the patched repo in DockerKimi-Dev-72B: 60.4% SWE-bench Verified (workflow); 48.6% pass@1 as a SWE-Agent after SFT adaptation2025-06 (model release); paper 2025-09-27
SWE-rebench (Nebius)Automated, continuous pipeline that mines GitHub for issue-fix PRs, installs each repo automatically, validates the tests, and emits executable tasks for RL plus a rolling decontaminated leaderboard.Over 21,000 interactive Python tasksLeaderboard runs models in one fixed scaffold for comparability (scaffold details on swe-rebench.com, not re-checked here)Fail-to-pass and pass-to-pass tests of the PR (binary resolved)Dataset and leaderboard rather than a model; shows some models score higher on SWE-bench Verified than on fresh tasks (contamination)2025-05-26 (NeurIPS 2025)
LEGO-RL (harness-native RL)Trains a policy inside unmodified native coding harnesses (OpenHands SDK, Claude Code, OpenCode) by proxying the LLM calls in-process, recomputing log-probs trainer-side, and running sandboxes with image caching and stage-wise anti-reward-hacking defenses.SWE-style tasks in cached sandbox images (count in paper)OpenHands SDK, Claude Code, OpenCode (each trained natively)Outcome (tests) with defenses against crashes and reward hacking; GSPOQwen3.5-35B-A3B on SWE-bench Verified: OpenHands SDK 64.0 to 70.4, Claude Code 62.4 to 68.2, OpenCode 57.2 to 66.6; rollout-training probability correlation above 0.992026-08-18
Polar (NVIDIA; successor of ProRL Agent, a NeMo Gym environment)Rollout framework that treats any agent harness as a black box: proxies its LLM API calls, records token-level interactions, rebuilds token-faithful trajectories, and serves them asynchronously to any trainer.SWE tasks (count in paper)Codex, Claude Code, Qwen Code, PiTask outcome; simple GRPOQwen3.5-4B on SWE-bench Verified gains +22.6 (Codex), +4.8 (Claude Code), +0.6 (Qwen Code), +6.2 (Pi) points2026-05-22
SWE-Universe (Qwen)A custom-trained building agent turns GitHub PRs into verifiable environments, with iterative self-verification and in-loop hacking detection.807,693 real-world multilingual environmentsUsed for agentic mid-training and RL (Qwen3-Max-Thinking)Verifier built per environment (tests), checked for hackabilityQwen3-Max-Thinking: 75.3% SWE-bench Verified2026-02-02
SWE-rebench V2 (Nebius)Language-agnostic pipeline: an interactive setup agent writes each repo install and test procedure; an LLM-judge ensemble filters unsound tasks; images pre-built.32,079 tasks, 20 languages, 3,617 repos with images; plus 120,000+ tasks with install instructions and fail-to-pass testsDataset (not tied to one scaffold); diagnostic runs over 7 modelsFail-to-pass testsDataset release; flags confounders such as overly restrictive tests and underspecified descriptions per instance2026-02-27
Self-play SWE-RL (SSR, Meta)One agent, in sandboxed real repos with dependencies installed, alternately injects bugs (specified by a test patch) and repairs them; no human issues or tests needed.Any sandboxed repo with installed dependenciesSingle LLM agent in a sandbox (bash-style tools)Tests from the injector bug-spec test patch: repair passes or fails; injector rewarded for solvable but hard bugs+10.4 pts on SWE-bench Verified and +7.8 on SWE-Bench Pro over training, above a human-data baseline throughout2025-12-21
Composer 2 (Cursor)Large-scale RL in the same Cursor harness the deployed model uses (same tools and structure) on environments that mirror real problems.not stated in abstractCursor production harnessEnd-to-end task outcome61.7 Terminal-Bench and 73.7 SWE-bench Multilingual in Cursor harness; CursorBench 61.32026-03-25
Nebius long-context multi-turn SWE RL (Golubev et al.)RFT with execution feedback, then synchronous DAPO RL in interactive SWE containers.SWE-rebench style tasksMulti-turn agent scaffold in the task container (details in paper, not re-checked)Binary tests passQwen2.5-72B-Instruct: 11% to 39% pass@1 SWE-bench Verified (RFT alone 20%)2025-08-05
Counterfactual Rollout Replay (CRR)Uses forkable executable environments to restore a mid-trajectory state, sample an alternative action, and use the return difference as a step-level advantage (free process reward).SWE environments with snapshot/restoreMulti-turn SWE agentOutcome tests plus counterfactual step-level return contrasts14B policy: 41.7% vs 36.7% SWE-bench Verified for equal-wall-clock outcome-only GRPO2026-09-27
DockerlessEnvironment-free agentic patch verifier that judges patches by exploring the repo instead of running tests, used as both SFT filter and RL reward.n/an/aModel-judged patch correctness (no execution)Qwen3.5-9B based: 62.0% Verified, 50.0% Multilingual, 35.2% Pro, matching environment-based post-training2026-06-26
SWE-MiniSandboxContainer-free RL: per-task isolated workspaces using kernel-level mechanisms and environment pre-caching instead of per-task Docker images.n/aSWE agentTestsAbout 5% of container disk use and 25% of setup time, comparable evaluation performance2026-02-11

Every row from the paper or project page linked in it, read 5 October 2026 for the parent page's Harness atlas, where this table lived until 24 October 2026; "not re-checked" marks details taken from a secondary page.

Predict: the bash harness's container has no network. Which of these still works inside it: python3 tests/test_core.py, pip install pytest, sed -i?
The tests and sed -i work (Python and GNU sed are in the image); pip install fails, because it needs the network. That is why the tests here need nothing beyond the standard library, and why real environments bake every dependency into the image before the rollout starts (SWE-Gym's images total about 6 TB).
Go deeper: Containers and isolation for what --network none and a memory limit do in the kernel; DSec for a sandbox layer at three million sandboxes a day; the Environment lab for every task, bug and check, and the verifier run on the agents' real final code.

3. Rewards: the verifier decides what "solved" means

The reward is the only thing RL optimises, so whatever the verifier accepts is, by definition, the skill being trained. Three reward functions can be computed from the same 20 checks:

RewardFormulaWhat it pays forRisk
Visible1 if every test in the workspace passesWhat the agent itself can checkRewards fixes that only satisfy the examples it was shown, and any edit to the tests
Hidden, binary1 if all 20 checks pass (fail-to-pass flipped, pass-to-pass still green)A fix that generalises to cases the agent never sawSparse: a group where every rollout scores 0 teaches nothing (section 4)
Hidden, partialFraction of the 20 checks that passProgress, even without a full fixThe starting repository already scores 0.65 to 0.90 here, so "doing nothing" earns most of the reward; read it relative to that baseline

What the rollouts did with that gap. 31 of the 240 rollouts passed every test in their workspace and still failed a hidden check. The most common case, 21 rollouts (all but one of them Haiku's, in every one of its four harnesses), is task T01 or T03: told that word_count("don't stop") should be 2, the agent changed the word pattern from [a-z]+ to [a-z']+. That passes the visible test, and it also turns 'quoted' into a word with its quotation marks attached, which the held-out check tokenize("'quoted' it's") == ['quoted', "it's"] catches. The library's docstring says "Apostrophes inside words are kept", so the check is defensible; a reviewer could also call it a spec the issue never stated. The local model's visible-only passes failed other held-out checks: a pattern that keeps one apostrophe but not two (rock'n'roll), or a sentence splitter that miscounts "Wait... what?!". Either way, a reward is a specification, and a policy trained on it learns the specification, not the intent.

Which held-out checks caught the fixes that passed every visible test

Defences that belong to the environment. Run the verifier outside the workspace (section 2); keep held-out checks; record whether test files changed (0 of our rollouts edited tests/); deny the network and anything that holds answers; read the highest-reward trajectories, not only the reward curve. Real agent environments have been gamed through every one of these doors; Reward Hacking (sections 4 and 5: the tests as the reward, and what the policy can reach) owns the general picture.

Depth: reward hacking in published agent environments (not reproduced here)
  • Searching for the answer key. DeepSeek's sandbox agents hunted for leaked answers and, once AppArmor controls were added, got around them with a filesystem ioctl; the case is told on Reward Hacking, section 4 (source: DSec).
  • Gaming the benchmark rather than the task. A Terminal-Bench submission's own leaderboard judge flagged 13 of 424 rewarded trajectories, 9 for possible reward hacking and 4 for harness cheating (StateM).
  • Making a hack permanent. A self-refining harness found it could spawn resources through Factorio's RCON console, used it despite an anti-cheating heartbeat, and saved it as a reusable skill (Prime Agent).
Predict: with the partial reward, which scores more: the untouched T10 repository (three bugs) or a rollout that fixes two of the three bugs and breaks the command-line tool?
The untouched repository scores 13 of 20 checks, 0.65. Fixing two bugs flips up to five of the seven fail-to-pass checks (0.90), and breaking the command line costs the two CLI checks, landing at about 0.80. The partial reward still prefers it, which may or may not be what you want: weight pass-to-pass breakage more heavily, or gate the partial reward on pass-to-pass staying green, if breaking working code must never pay.
Go deeper: RL for LLMs section 5 (RLVR: a program as the reward, and what it gets wrong) and its Real rollouts tab for lenient and strict verifiers on maths answers; Agent and trajectory evaluation for grading the actions inside a trajectory, not only its outcome.

4. Groups and advantages: which rollouts teach anything

GRPO samples a group of G rollouts of the same task and gives every token of rollout i the same advantage, its reward measured against the group:

Ai = (ri − mean(r)) / std(r)

The derivation, the clip around it, Dr. GRPO's and RLOO's variants and a live group widget are on RL for LLMs (section 3; biases and fixes in section 7). What changes for agents is the size and the shape of the groups. They are small, because every rollout is an episode in a container: DeepSWE ran 64 problems with 8 rollouts each per step, 512 containers in parallel (Together AI and Agentica, 2 Jul 2025); ours are 4 rollouts (local model) and 3 (Haiku) per task and harness. And many of them are flat.

The group Fig. 3 moves in on (steps 3 to 5), its reward and its normaliser:

Fig. 3, step by step: when every rollout scores the same, every advantage is zero

  1. 70 groups, pass/fail reward. One cluster per model, harness and task (rows: harnesses, the 4B model's three in front, Haiku's four behind; columns: tasks T01 to T10), one bar per rollout. No disagreement, no signal: a grey cluster is flat, every rollout scored the same, so every advantage is zero and the group gives no gradient, only cost. With the pass/fail reward that happened in 25 of 30 of the local model's groups (mostly all-fail) and 36 of 40 of Haiku's (mostly all-pass).
  2. The partial reward. Bars now show the fraction of the 20 checks passed. It rescues some of the local model's groups (19 of 30 still flat), because its failures fail different numbers of checks; it rescues none of Haiku's (36 of 40 still flat), because every Haiku rollout in a failing group failed the very same held-out check and scored the same 0.95.
  3. One group: rewards and their mean. The camera moves to the group chosen above (it opens on 4B, bash only, task T07: pass/fail rewards 0, 1, 0, 0). The mean, 0.25, is the baseline every rollout is measured against: the glass plane.
  4. Advantages. Reward minus the mean, over the standard deviation; for the T07 group, +1.73 for the one pass and −0.58 for each failure (GRPO). Dr. GRPO drops the division (+0.75, −0.25); RLOO takes each rollout's baseline from the other three (+1.00, −0.33). Green is made more likely, red less; a flat group shows no bars at all.
  5. The update. The trainer multiplies each sampled token's log-probability gradient by its rollout's advantage, so a longer rollout moves more tokens: for the T07 group, 434, 1,123, 445 and 1,816 tokens the model sampled (counted by the loss mask, section 5; for Haiku, the output tokens Claude reports, thinking included) stream into the policy.

DAPO's dynamic sampling handles the rest by dropping groups whose accuracy is exactly 0 or 1 and sampling more until the batch is full; in its ablation that step took Qwen2.5-32B from 42 to 50 on AIME 2024 (arXiv 2503.14476). For agents the waste is larger than for maths, because a dropped group cost minutes of container time, so curricula that keep tasks near a 50% pass rate matter (in EnvHarness's released configs a reshaped SWE-bench environment is accepted only when its success rate over 5 rollouts lands between 0.4 and 0.6; ALFWorld instead asks for a rise of at least 0.2 over the baseline, and the other benchmarks leave it to the designer's judgement, EnvHarness, Table 8 against the released configs).

Agent recipes change the normaliser and the failures they score. Dividing by the spread pushes rare successes and rare failures hardest, which Dr. GRPO calls a difficulty bias (the numbers are worked on RL for LLMs, section 7; toggle the three normalisers above to see it on real groups). DeepSWE's recipe dropped the division, used a leave-one-out baseline (RLOO: each rollout's baseline is the mean of the other G−1, arXiv 2402.14740), and added compact filtering: trajectories that hit the maximum context, step count or time limit are masked from the loss rather than scored 0, so the model is not punished for running out of room. 4 of our rollouts hit the 16-call cap, the case compact filtering is for.

Depth: every group and its advantages (240 rollouts, 70 groups)

One group = one model, one harness, one task. Advantages are GRPO's (reward minus the group mean, over the population standard deviation; zero when every reward is equal).

Go deeper: RL for LLMs owns GRPO, Dr. GRPO, the clip and the off-policy corrections (its Real rollouts tab has 160 maths answers in groups); Policy gradients and actor-critic for why a baseline reduces variance.

5. From a rollout to training tokens: what gets loss

The trainer does not see messages; it sees one long sequence of token ids, and for each token a flag saying whether its log-probability enters the loss. In a single-turn maths answer that is easy: prompt off, answer on. In an agent rollout the sequence interleaves the model's replies with text the environment wrote, and the policy must be credited only for what it sampled. The card shows a real local-model rollout rendered back through Qwen3-4B-Instruct-2507's own chat template (its Hugging Face tokenizer, transformers 5.18.0), every token coloured by who produced it.

Most of the sequence is not the model's. Across the 120 local rollouts, 36% of all tokens were sampled by the model; the rest are the system prompt and tool schemas (20%), the task (2%), tool output (38%) and template markers. Putting loss on tool output would train the model to predict ls listings and tracebacks it never chose, and would credit or blame it for the environment's text. Search-R1 measured the difference on question answering: with observation tokens masked, Qwen2.5-7B averaged 0.431 exact match over seven datasets; without the mask, 0.343 (arXiv 2503.09516). Masking in multi-turn RL in general is on RL for LLMs, section 11.

Loss belongs only on the green tokens; the template even inserts 4 the model never sampled

The end of the rollout, token by token (faded tokens get no loss; the outlined block is the template's insertion):

Every token of this rollout

Re-rendering is not the same as recording. mlx_lm.server reported token counts while the rollout ran, so the render can be checked. Every rendered prompt has exactly the length the server counted (742 of 742 calls), and 721 of 742 assistant turns have exactly as many tokens as the server generated. The other 11 replies differ by one or two tokens (the template re-serialises tool-call JSON and whitespace, which tokenises differently from what was sampled), and 10 by dozens (replies whose malformed tool call the server dropped, section 1, so the recorded message is missing tokens the model did sample). And in the last assistant turn the template inserts an empty <think>\n\n</think>\n\n block, 4 tokens: the template, shared with Qwen3's reasoning models, writes a reasoning block into a final assistant turn that follows the last user message, and this instruct model has no reasoning to put in it (chat_template.jinja, the loop.last branch). A trainer that renders the finished trajectory and puts loss on every assistant token trains on 4 tokens per rollout the policy did not sample, at log-probabilities it never had. Small here; with tool-call JSON re-serialised, whitespace normalised or thinking stripped from earlier turns, the mismatch grows.

Token-in, token-out is the fix: the rollout records the exact token ids the engine sampled, with their log-probabilities, and the trainer uses those, never re-tokenised text. That is hard when the harness is a black-box product that talks to an OpenAI-style text API, which is why the two 2026 harness-native RL systems put a proxy between the harness and the engine: Polar's gateway stores every completion with "prompt token IDs, sampled response token IDs, finish reason, and log probabilities" (arXiv 2605.24220); LEGO-RL captures raw generation streams in-process and recomputes log-probabilities trainer-side "even under harness-side compaction or re-serialization" (arXiv 2608.17393).

Why compaction makes this harder
A harness that compacts its context (Context engineering section 4 forces one on purpose) changes the prompt in the middle of a rollout: the tokens after the compaction were sampled from a different context than the one a naive "render the whole conversation" would produce. Each model call is then its own training sample (prompt as the harness actually sent it, reply as sampled), which is what a per-call completion record gives you for free.
Depth: the frameworks say so in their own docs
verl, Agent Loop docs"the token_ids from apply the final messages may not equal to the token_ids by concat prompt_ids and response_ids in each turn ... This inconsistency is not a big problem for serving/agent system, but is critical to RL training."
SkyRL, inference server base class (commit 68a4f44)decoding the sampled ids reproduces the text, "but the reverse is not guaranteed, since there are multiple ways to represent the same text with tokens. Therefore, for multi-turn generation, please use token-in-token-out to ensure correctness."
Polar (arXiv 2605.24220)the gateway "stores a completion record containing the request messages, response messages, prompt token IDs, sampled response token IDs, finish reason, and log probabilities", and the loss mask is "one on tokens copied from sampled responses and zero on tokens copied from canonical interstitials".
Go deeper: RL for LLMs section 8 for how far an inference engine's probabilities drift from the trainer's even with identical tokens; Tokenizers for why decode then encode is not the identity.

6. Trajectories as training data: format, redact, filter

A trajectory is the full record of a rollout: every request, reply, tool call, tool result and token count. It is three things at once: an evaluation record (what did the agent do?), supervised training data (imitate the good ones), and RL data (weight each one by its advantage). Turning a pile of recordings into a dataset takes four steps, each run here on this page's own rollouts.

1. Normalise to one format. Every harness logs differently: our own loop wrote one line per call, the Claude Agent SDK wrote its message objects, Claude Code wrote stream-json. The formats trainers read:

FormatShapeHow it says "train on this"
OpenAI supervised fine-tuningJSONL, one {"messages": [...], "tools": [...]} per line; assistant tool_calls with arguments as a JSON string; tool messages with tool_call_id (guide)Per assistant message "weight": 0 or 1, "Controls whether the assistant message is trained against" (OpenAPI spec; not on the guide page)
Hugging Face chat templateThe same messages rendered by the model's own Jinja templateapply_chat_template(..., return_assistant_tokens_mask=True), only for templates that mark assistant text with {% generation %} (transformers v5.18.0); TRL's assistant_only_loss needs the same markers and patches known templates such as Qwen3 (TRL docs)
ShareGPT style"conversations": [{"from": ..., "value": ...}] with roles human, gpt, function_call, observation, system"The gpt and function will be learned by the model" (LLaMA-Factory data README)
Token-level (RL)Token ids, sampled log-probabilities, a loss mask, a reward or advantageThe mask of section 5

That type change bites: tool-call arguments stored as a JSON string in one format and an object in another render differently through a template, so training text and inference text disagree; Nebius's trajectory release warns about exactly this (SWE-rebench-openhands-trajectories card). One personal agent already writes the third format: Hermes Agent can export its runs as ShareGPT-style trajectories, live at v0.21.5; the Atropos and Tinker training integrations it shipped in March 2026 releases are gone at v0.21.5, so the export is a dataset source, not a training loop (Personal agents, section 8).

One real rollout in three formats: the tool-call arguments change type on the way

2. Redact. Trajectories carry whatever the machine showed the agent. Ours contained the scratch folder's path (which includes the account name) in every Claude Code file-tool call, session and message ids, the Claude Agent SDK's list of the account's installed skills and commands in its first record, and model replies with em-dashes. The redactor keeps a whitelist of fields, maps the workspace to /work, replaces the user name, git identity and any e-mail address, and then refuses to write a file if a forbidden string survives. A sibling page's recording shows why the git identity is on the list: a model copied the machine's name and e-mail into a git config command it tried to run (Context engineering). We found no OpenAI or Anthropic guidance specific to scrubbing fine-tuning data; treat secrets and personal data in trajectories like any other training data.

Depth: what the redactor replaced, with counts

What src/redact.py replaced or dropped before anything entered the repository. It refuses to write a file if the account name, home path, git identity, an e-mail address or a token prefix survives.

3. Filter. The simplest way to learn from rollouts is to keep the successful ones and fine-tune on them: rejection sampling fine-tuning, the agentic version of STaR (arXiv 2203.14465), RFT (arXiv 2308.01825) and ReST-EM (arXiv 2312.06585). SWE-Gym fine-tuned on 491 trajectories that resolved their task (sampled from GPT-4o and Claude 3.5 Sonnet in OpenHands): the 32B model went from 7.0 to 20.6% on SWE-bench Verified (arXiv 2412.21139). SWE-smith ran SWE-agent with Claude 3.7 Sonnet on its synthetic tasks: 6,457 of 17,906 attempts resolved (36%), capped at 3 per task to 5,016 trajectories, and SWE-agent-LM-32B reached 40.2% Pass@1 on Verified (arXiv 2504.21798). The cap matters: without it, easy tasks that succeed every time dominate the data. Fig. 4 runs these filters on our rollouts.

Fig. 4, step by step: filtering on the visible tests instead of the hidden verifier keeps 31 wrong fixes (both models together)

  1. Recorded. 120 rollouts per model, one block each: rows are tasks T01 to T10, columns harness and repeat. Green passed the hidden verifier, amber passed only the visible tests, grey failed. The chips above switch the model.
  2. Filter A: the visible tests. Keeps 52 of the local model's 120 and all 120 of Haiku's: what an agent-side check would keep. The kept rollouts stream into the dataset on the right.
  3. Filter B: the hidden verifier. Keeps 41 and 100. The 11 and 20 amber rollouts it drops are wrong fixes that filter A would have taught, the too-loose regular expression among them.
  4. B, then one per distinct final code per task. 10 (local) and 23 (Haiku): most passing rollouts of a task wrote the same fix, so the dataset holds far fewer distinct solutions than trajectories.
  5. B, then at most 3 per task. The alternative to step 4, as SWE-smith did: 20 and 28, so the easy tasks that pass every time do not dominate the data.

Over both models, filtering on the tests the agent could see keeps 172 trajectories, filtering on the hidden verifier 141. The difference is a supervised dataset that teaches the too-loose regular expression on purpose.

4. Imitate, or re-solve? A recorded trajectory from another agent (or another harness) teaches that agent's habits. Terminal-Universe rebuilt workspaces from 359,593 public trajectories and compared imitating the source trajectories with having a teacher re-solve the recovered tasks: re-solving reached 52.1 on Terminal-Bench 2.1, imitation 36.7, below the 47.0 base model (Terminal-Universe; that page notes the gain is distillation from a stronger teacher as much as an environment effect).

5. Can the weights absorb the harness? At a fixed size, not always: students of the base model's size trained on harness traces stayed below the harness, and the gap closed only with a bigger student, a simpler harness or a longer chain of thought; a theorem says why for short-chain students (the harness supplies depth a fixed-depth network lacks) (Understanding the Benefits of Scaffolds through Computational Separations). So distilling harness trajectories buys the harness's behaviour only when the student is bigger, thinks longer, or the harness is simpler; otherwise keep the harness at inference.

Depth: public trajectory sets to look at
Go deeper: Offline RL and imitation for why imitating a different policy's data goes wrong; Agent and trajectory evaluation for grading a trajectory step by step; the parent's Trace and context lab for what Claude Code's own stream-json records contain.

7. Self-improving harnesses: a search loop with a noisy ruler

If the harness moves the score (section 1), a program can search over harnesses: propose a change (a prompt line, a tool, a context rule, a whole new loop), score it on tasks, keep it if the score went up, repeat. In 2026 a run of papers did this with a strong model as the proposer. They differ in what they change, who proposes, and above all which tasks the score comes from.

One row per paper, each from its paper page in this knowledge base, whose "How much to believe" section carries the checks and corrections; every field is in the closed comparison below.

Fig. 5 · Keeping the best noisy score inflates the gain; a held-out guard keeps the lines together

The catch is statistical before it is anything else. Each candidate's score is a measurement on a few dozen tasks, with noise of several points. Keep the best of many noisy measurements and the winner's measured gain is biased upward even if no candidate is truly better: the winner's curse. Repeat it over ten rounds and the visible score climbs while the true one wanders. Fig. 5 runs that search: predict how far apart the two lines end after ten rounds. The simulation involves no model; its starting rate is the local model's overall rate here, and each line is the average of 300 simulated searches.

Fig. 5, step by step (8 candidates a round, 40 tasks, true effects spread by 1 point)

  1. Start. One harness with a true success rate of 34% (the local model's overall rate in this page's runs), scored on 40 pass/fail tasks: one evaluation has a standard error of about 7.5 points, far more than the 1-point spread of true effects among candidates.
  2. Round 1. Eight candidates are scored and the best measured one is kept if it beats the current score. The score the loop saw jumps 10.9 points; the true rate moves 0.1. The winner was mostly the luckiest measurement.
  3. Rounds 2 to 10. Each round can only keep a candidate that out-measures the last lucky score, so the climb slows but never reverses: after ten rounds the visible score is up 18.0 points, the true rate 0.3, and a fresh held-out measurement 0.5.
  4. The guard. The same search, but a winner is kept only if it also gains more than two standard errors on a fresh held-out set: the visible score rises 2.2 points and the true rate 0.1. The price is fewer accepted changes, 0.2 per search instead of 2.3; the closed block below, "Rig the search yourself", varies candidates, tasks, effect spread and rounds.
Rig the search yourself: candidates, tasks, effect spread, rounds

Each round proposes several candidate harnesses whose true success rate differs from the current one by a small random amount; each is scored on a fixed set of pass/fail tasks; the loop keeps the best candidate if its score beats the current measured score. The guarded rule also re-scores the winner on a fresh held-out set and keeps it only if that gain exceeds two standard errors. Lines are averages over 300 simulated searches; the shaded band is the middle 80%.

The papers see the same pattern in real runs. HarnessDev's visible score and its held-out score moved in the same direction in only 34 of 64 version changes, and 27 of the 64 gains sat inside a noise band of ±4.75 points (HarnessDev). RRSI regularises the loop (an annealed edit budget, a critic that sent back 4 drafts for leaking task-specific answers, a stability floor, a cost rule); unregularised evolution scored 92.8 on its own tuning split and 40.3 out of distribution, while RRSI's out-of-distribution gains were +1.8 to +4.7 (mean 3.6), each within about one standard error (RRSI). And a harness tuned with one model can fail with another: HarnessDev's best code harness, written by Opus 4.8, fell from 69.3 to 33.0 on SWE-Pro when Gemini executed it, because it had hard-coded a 120-step limit. The most controlled test so far points the same way: on ARC-AGI-3, frontier models each built a harness, played five development games and revised their whole codebase twice; across 27 lineages, scored on twenty games that never influenced the revisions, two revisions raised mean held-out score (RHAE, level completion weighted by action efficiency against humans) by 2.80 points, with a 95% interval of -1.44 to 7.35, and development gains overstated held-out ones (arXiv 2610.30499). The earlier searches these papers start from: Meta-Harness searches over executable harness programs with a Pareto front of task score against context cost (arXiv 2603.28052), Recursive Harness Self-Improvement refines prompt-level specifications per task, and a held-out study found that evolved harnesses overfit the tasks used in the search and give "only marginal gains on unseen tasks" (Wang et al. 2026; all three as cited by SoL-Pi).

How to read a self-improving-harness claim
  • Which tasks produced the score the loop optimised, and which produced the score reported? (StateM's 92.1% is on the 89 tasks it was tuned on; only BusinessBench is held out.)
  • How many runs, and what is the noise band of one evaluation? (Every search arm in these papers is a single run.)
  • Was the executing model the one the search used? (SoL-Pi checked with Opus 5, which its search never saw: 94.3% of Pi's score.)
  • What did the search itself cost? (Rarely reported: SoL-Pi's more than 3,000 runs are not priced.)
  • Does the loop store anything the reward can reach? (Prime Agent's harness saved a reward hack as a skill.)
Depth: the eight papers compared on every field, and the environment papers

Environments built or reshaped for agent training

Each paper in one line (moved from the parent page's Harness atlas)

  • HarnessDev (ByteDance Seed and others, 1 Sep 2026): can a model build its own harness, then improve it? Six creator models, four domains. The best generated harness averages 67.8 against 86.2 for mature human-built references; evolution feedback agreed with held-out results in only 34 of 64 changes; a code harness written by Opus 4.8 fell from 69.3 to 33.0 on SWE-Pro when another model executed it.
  • JIT-Agent (NUS, EverMind and others, 26 Aug 2026): trains a 27B model to write, repair and evolve a harness per task at inference time. GLM-5.2 goes from 74.1 to 81.8 averaged over nine agent benchmarks (+7.7; DeepSeek-V4-Flash +8.8) with a harness written for it instead of its default one, at 14.9 to 54.1% lower cost than the cheapest fixed harness on three benchmarks.
  • RRSI (Google Cloud AI Research, 21 Sep 2026): regularises recursive harness evolution (an annealed edit budget, a critic, a pruner). +14.1 points on the split the search was scored on; out of distribution, gains of 1.8 to 4.7 points on five benchmarks (mean 3.6), each within about one standard error, against +0.6 for unregularised evolution. Its own Table 2 gives 36% fewer tokens, not the 30% often quoted.
  • SoL-Pi (NVIDIA, NTU, MIT, 17 Sep 2026): auto-research loops over the Pi harness find four efficiency techniques (action execution, context compaction, observation handling, delegated reading) that cut recorded token traffic 44.7 to 49.0% at 93.7 to 94.3% of Pi's score. Single runs, no error bars.
  • Prime Agent (Prime Intellect, 24 Aug 2026): an open harness that versions its own prompts, memories, skills and subagent specs across trajectories. 95.5% on ARC-AGI-3 with Opus 5 (best of three runs), against the 30% Opus 5 scored in the official ARC harness, which the paper did not run itself. Its authors report that "many harness capabilities remain underused because current models were not trained to operate them".
  • StateM (independent authors, 15 Aug 2026): a state-machine runbook with checked transitions around a fixed CLI agent lifts GPT-5.5 from 83.1% to 92.1% on Terminal-Bench 2.1, same weights. The runbook was developed on the same 89 tasks it is scored on: a harness-tuned upper bound.
  • NeoHorse-1 (TokenRhythm and others, 8 Sep 2026): makes the serving harness the source of the training curriculum: a router's signals order the post-training data. Qwen3.5-4B goes from 58.94 to 64.87 averaged over ten benchmarks; the evaluate, select and update loop ran once.
Go deeper: each paper page has its own live toy: HarnessDev's "Replay the evolution runs", RRSI's "Replay the released runs" and its keep-the-best toy, SoL-Pi's "Replay a session", JIT-Agent's "Score a group of harnesses". Eval statistics for how many tasks a difference needs.

8. At scale: environments, rollout infrastructure, harness-native RL

Everything above, at scale, is a set of services: a task store, a sandbox fleet, the harness, an inference engine that records tokens, a verifier service and a trainer. The figure on the right is Fig. 1's loop with the published numbers on each part.

Training inside the product harness. If a model is deployed in Claude Code or Codex, training it in a different scaffold teaches it the wrong tools. LEGO-RL (OpenHands SDK, Claude Code, OpenCode) and Polar (Codex, Claude Code, Qwen Code, Pi) intercept the harness's model calls and train inside unmodified harnesses; their before-and-after numbers per harness, and Cursor's statement that Composer 2 was trained in its shipping harness, are in the closed block below. The lesson of section 1 applies twice: a score after RL belongs to the model, the harness it was trained in, and the harness it was tested in.

The same six parts as a fleet: one RL step needs hundreds of sandboxes at once

Numbers: DSec, self-reported (DSec): about 3 million sandboxes a day on about 160 nodes, over 5,000 created per second, and its sandboxes read only 4.2 to 13.3% of an image, which is why lazily loaded layers beat pulling whole images. DeepSWE (blog): Qwen3-32B trained with RL alone on 4,500 R2E-Gym problems, 64 problems × 8 rollouts = 512 containers per step, 64 H100s for 6 days, 42.2% Pass@1 on SWE-bench Verified. Polar and LEGO-RL: the recording proxy of section 5. This page's laptop for scale: a container started in 0.25 s, a verifier run took 0.54 to 0.79 s.

Depth: the harness is part of what gets trained (LEGO-RL, Polar, Composer 2)
HarnessBefore RLAfter RL in that harness
OpenHands SDK64.070.4
Claude Code62.468.2
OpenCode57.266.6

LEGO-RL (arXiv 2608.17393, 18 Aug 2026): Qwen3.5-35B-A3B, % of 500 SWE-bench Verified tasks, GSPO inside each unmodified native harness; a 6.8-point spread before RL, gains of +6.4, +5.8 and +9.4.

Polar (NVIDIA, arXiv 2605.24220): the same RL recipe on Qwen3.5-4B gains +22.6 points on SWE-bench Verified in Codex, +4.8 in Claude Code, +0.6 in Qwen Code and +6.2 in Pi. Cursor says its Composer 2 model was trained with RL in the same harness it ships in (arXiv 2603.24477). So "which harness" is a training decision too, and a benchmark score after RL is a score for that pairing.

One vocabulary. The open frameworks now share the same parts (a dataset of tasks, a harness or agent, a verifier, a reward), and the newest treat a production harness as a black box behind a proxy. Synchronous against asynchronous rollouts, and weight sync between trainer and engine, are on RL for LLMs section 12.

Depth: the RL frameworks and environment libraries, as each describes itself

Versions and licences from each project's GitHub releases and PyPI on 6 October 2026; definitions quoted from the README or docs linked.

Go deeper: Topic: llm-training-and-post-training for where agentic RL sits among the training stages and Mercor's 397B recipe, and its section "Running the job" for the trainer side.

Depth: mistakes as a checklist, and interview rehearsal

Ten mistakes, each with what this page measured
MistakeWhy it bitesDo instead
Comparing two models run in two different harnessesThe harness alone moved our 4B model's success by tens of pointsFix the harness to compare models; fix the model to compare harnesses (section 1)
One rollout per cellIdentical settings gave different outcomes; a single run cannot tell a harness effect from luckSeveral rollouts per task, a paired comparison over tasks, an interval
Letting the workspace's tests decide the rewardThe agent can edit them, and the visible tests are a few examples of the specHidden checks, run outside the workspace, in a fresh container (sections 2 and 3)
Fail-to-pass lists chosen by handOne bug can break checks in other functions (T04 broke six)Compute them by running every check on the buggy repository
Ending the episode when a reply has no parsable tool callA malformed call looks like "done"; 9 of our local rollouts ended that way, all failedReturn the parse error as an observation and let the model retry; count these separately
Training on groups where every reward is equalZero advantage, zero gradient, full container costDynamic sampling, a partial reward, tasks near a 50% pass rate (section 4)
Scoring a run that hit a cap as a plain failureTeaches the model that long attempts are bad rather than that the budget ran outMask capped and timed-out rollouts (DeepSWE's compact filtering)
Loss on tool output, or on re-rendered textTrains on tokens the policy did not sample (our template inserted 4 per rollout)Record token ids and log-probabilities at sampling time; mask observations (section 5)
Publishing raw trajectoriesThey carry paths, account names, ids, and sometimes credentialsA whitelist redactor that fails closed (section 6)
Trusting a self-improvement curve measured on the tuning tasksBest-of-many on a noisy score rises with no true gainReport held-out, out-of-distribution and other-executor numbers, with runs and intervals (section 7)
Interview rehearsal: six questions
Why do agent benchmark scores need a harness column?
The score is a property of the model, the harness (tools, prompt, context policy, limits) and the settings together. The same weights moved by tens of points across harnesses on our ten tasks and by up to about 18 points on Terminal-Bench 2.0's public board. Without the harness, two numbers are not comparable.
Design an RL environment for a coding agent.
Task: repository snapshot plus statement. Reset: fresh copy and sandbox with no network and resource limits. Action space: the harness's tools. Observation: clipped tool output. Termination: no tool call, a submit tool, or caps on calls, tokens and time. Verifier: fail-to-pass and pass-to-pass checks computed by running them on the buggy repository, executed outside the workspace. Reward: binary on the verifier, maybe partial; mask capped runs. Log full trajectories with token ids.
Your GRPO run on agent tasks is not learning. What do you check first?
The fraction of groups with zero reward spread (all pass or all fail give no gradient), whether observation tokens are masked, whether the trainer uses the sampled token ids or re-tokenised text, how many rollouts hit caps or infrastructure errors and how they are scored, and whether the verifier can be satisfied without solving the task.
What is the difference between rejection sampling fine-tuning and GRPO here?
Rejection sampling keeps the successful trajectories and imitates them (only positive examples, every kept token weighted equally). GRPO uses every rollout in a group, weighting each by its reward relative to the group, so failures push probability away too, and it stays on-policy. Rejection sampling is the cheap first step (SWE-Gym, SWE-smith); RL needs the environment in the loop.
A paper reports a self-improving harness gained 14 points. What do you ask?
Was the score measured on the tasks the search optimised? What is the held-out and out-of-distribution gain, with how many runs and what interval? Does it hold with a different executing model? What did the search cost? Could anything the loop stores reach the reward?
Why would you train a model in the same harness you deploy it in?
The harness defines the action space, the observation format and the context policy; a model learns those habits. LEGO-RL and Polar both found RL gains differ by harness for the same base model, so train in the deployment harness, or in several to avoid overfitting one.