Summary (Overview)
- Self-HPO is a recursive self-improving framework for coding agents that alternates harness optimization (H-step) and policy optimization (P-step), using the evolving policy itself as the harness proposer.
- The framework improves the average resolve rate from 57.8% to 64.8% across three coding benchmarks (SWE-Bench Verified, Multilingual, and Pro), consistently outperforming policy-only and harness-only baselines.
- Gains generalize to out-of-distribution settings (non-Python languages and diverse repository-level tasks), and the framework improves both reliability (pass@1) and capability frontier (pass@k).
- Ablations show that both optimized components retain gains even when paired with their base counterparts, and their joint gain exceeds the sum of individual gains.
- With a stronger external model (Opus 4.8) as the harness proposer, the same framework yields further performance boosts (up to 71.6% on SWE-Bench Verified).
Introduction and Theoretical Foundation
Background
Large language model (LLM) agents for coding tasks consist of two components:
- Policy model: defines the agent's capability boundary
- Harness: the external scaffold that controls what the model observes, how actions are executed, what feedback is received, and when episodes terminate
The same model may succeed or fail on a problem depending on its harness. Two main lines of research exist:
- Harness optimization: holds policy fixed, searches over prompts, workflows, or agent code
- Policy optimization: holds harness fixed, updates model from successful trajectories or verifiable rewards
Key Insight
Harness and policy are mutually reinforcing:
- A harness tuned for one policy checkpoint may not target the failure modes of an updated policy
- Policy learning remains limited to trajectories elicited by a fixed harness
Previous joint optimization approaches rely on external harness proposers and face the challenge of a moving optimization target as the policy evolves.
Problem Formulation
Given a software-engineering task , a coding agent combines policy with harness . The trajectory is scored by an executable verifier . The expected resolve rate is:
Methodology
Algorithm Overview (Self-HPO)
Starting from base policy , seed harness , and random search set :
- H-step: Keep fixed, use it to propose harness candidates , retain the best-scoring harness on as
- P-step: Freeze , update to on using reinforcement learning
- Next search set: Tasks never resolved during the P-step form
- Loop stops when the hard-task set stabilizes between rounds
H-step: Failure-Conditioned Harness Search
- Self-proposer: The frozen policy acts as both task solver and harness proposer
- The proposer inspects current failures and produces targeted revisions to prompts or executable runtime logic
- Each of search iterations revises the current best harness using accumulated experience
- Evolving search set: Initialized uniformly from , subsequent sets consist of tasks never resolved in any rollout during the preceding P-step
P-step: Policy Optimization under Optimized Harness
- Collects on-policy trajectories over as the policy is updated
- Uses Group Relative Policy Optimization (GRPO) combined with Balanced Adaptive Rollout (BAR) from Orchard
- BAR adaptively draws additional trajectories to construct reward-balanced groups, reducing uninformative zero-variance groups under sparse outcome rewards
Empirical Validation / Results
Main Results
Table 1: Main results (resolve rates with standard deviations over three runs)
| Method | Harness Opt | Policy Opt | SWE-Verified | SWE-Multi | SWE-Pro | Avg. |
|---|---|---|---|---|---|---|
| Base | ✕ | ✕ | 61.0 ± 0.2 | 54.2 ± 0.3 | 58.3 ± 1.2 | 57.8 ± 0.4 |
| Setting 1: External-model setup (Opus 4.8) | ||||||
| SFT | ✕ | √ | 65.0 ± 1.1 | 49.6 ± 0.8 | 49.1 ± 0.6 | 54.6 ± 0.5 |
| Meta-Harness | √ | ✕ | 69.1 ± 1.9 | 56.5 ± 0.9 | 64.8 ± 1.4 | 63.5 ± 0.8 |
| HPO (ours) | √ | √ | 71.6 ± 0.9 | 61.4 ± 0.7 | 66.0 ± 0.5 | 66.3 ± 0.4 |
| Setting 2: Self-improving setup | ||||||
| RLVR | ✕ | √ | 67.5 ± 0.8 | 56.3 ± 1.0 | 61.8 ± 1.3 | 61.9 ± 0.6 |
| Self-Harness | √ | ✕ | 65.2 ± 1.5 | 54.3 ± 0.7 | 60.7 ± 0.9 | 60.1 ± 0.6 |
| Self-HPO (ours) | √ | √ | 69.5 ± 0.9 | 59.7 ± 0.8 | 65.2 ± 1.4 | 64.8 ± 0.6 |
Key Findings
- Joint optimization wins: Self-HPO outperforms RLVR by 2.0 and Self-Harness by 4.3 points on SWE-Verified
- Out-of-distribution generalization: Gains transfer to non-Python languages (SWE-Multi) and diverse tasks (SWE-Pro)
- Harness optimization > SFT distillation: Meta-Harness outperforms SFT by 4.1 points on SWE-Verified and 8.9 points on average
- Alternating optimization drives continued improvement: The second H-step improves the updated policy, and the following P-step provides further gains
Ablation Study (Table 2)
| Configuration | Resolve rate (%) |
|---|---|
| HPO | 71.6 |
| w/ SFT in P-step | 67.2 (-4.4) |
| w/ RFT in P-step | 70.5 (-1.1) |
| w/ Fixed search set in H-step | 70.1 (-1.5) |
| w/ Self-proposer in H-step | 69.5 (-2.1) |
Cross-Evaluation (Table 3)
Cross-evaluating Self-HPO policies and harnesses on SWE-Bench Verified
| 61.0 ± 0.2 | 61.7 ± 1.3 | 64.4 ± 1.1 | |
| 64.3 ± 1.1 | 67.8 ± 1.6 | 68.1 ± 1.0 | |
| 64.5 ± 1.5 | 68.6 ± 0.5 | 69.5 ± 0.9 |
The joint gain (8.5 points) exceeds the sum of individual gains (3.5 + 3.4 = 6.9 points) by 1.6 points.
Additional Analysis
- Pass@k: Self-HPO remains above Base for every from 1 to 8; pass@8 increases from 80.0% to 84.8%
- Pass@1 by difficulty: Gains of 17.2 and 12.9 points on Medium and Easy tasks, 6.1 points on Hard tasks; 2.2-point decrease on already-Resolved tasks
- Training signal: Zero-success rollout groups decline to 6.5% (vs. 11-17% for RLVR), reducing reward sparsity
Case Study: Harness Evolution
The optimized harness adds targeted controls:
- Budget warnings: Alerts the model as step/time limits approach, prompts best-effort submission
- Empty-patch guard: Asks model to include newly created files via
git add -N - Interface verification: Delays first submission to prompt checking API names/signatures
- Fallback submission: Uses sandbox's Git diff when patch fails the apply check
Theoretical and Practical Implications
Theoretical Contributions
- Self-evolving agents: Demonstrates that an agent can use its own policy as a harness proposer without external supervision
- Co-adaptation dynamics: Shows that harness and policy improvements are complementary and super-additive — their joint gain exceeds the sum of individual gains
- Moving target adaptation: The evolving search set mechanism addresses the challenge of optimizing against a moving policy
Practical Implications
- No external model required: Self-HPO achieves strong results without relying on a frontier model as proposer
- Transferable improvements: Gains generalize beyond the training distribution (Python tasks) to other languages and task types
- Reliability + capability: The framework improves both consistency (pass@1) and exploration (pass@k)
- Training efficiency: Reduced zero-success groups during RL suggest more informative gradient signals
Conclusion
Self-HPO introduces a recursive self-improving framework for coding agents that alternates harness and policy optimization. The evolving policy proposes its own harness revisions, learns through RL under the selected harness, and supplies hard tasks for the next round of harness search.
Key takeaways:
- Joint harness-policy optimization consistently outperforms single-component baselines
- The self-improving setup works without external proposers, though external models provide additional gains
- Both components retain value independently, and their combination is super-additive
- The framework improves both reliability and capability frontier
Future directions implied by this work include:
- Extending the framework to more optimization rounds and larger search budgets
- Exploring alternative policy optimization strategies beyond GRPO
- Investigating the applicability to other agent domains beyond coding (e.g., web navigation, computer use)
- Understanding when harness vs. policy optimization provides the greatest marginal benefit at different stages of training
Related papers
- MemDev-Bench: Does Memory Help Code Agents?Benchmarking Memory Systems over Real Repository Histories
Memory improves code agents mainly through finer-grained localization and editing, but noisy history causes regressions by fostering unrevised, misapplied reuse.
- Automating ML for Science: Can Frontier Agents Climb Scientific Hills in the Wild?
Frontier coding agents improve every scientific ML benchmark they attempt, but gains stem from engineering tricks, not scientific insight.
- SWE-Bench Pro V2: A Cleaner, Harder-to-Game Coding Benchmark
SWE-Bench Pro V2 repairs and hardens 642 coding tasks so frontier agents now solve 99.4%, exposing evaluation exploits while keeping a 51-task hard split that separates systems.