Manuscript Offprint

arXiv:2611.09218

BOXBOX: Recursive Harness Self-Improvement for Long-Running Performance Optimization

Yuhao Tan, Hanyun Jiang, Fangkai Yang, Yuan Yao, Taolue Chen, Bo Qiao, Yu Kang, Lu Wang, Pu Zhao, Xiaoxing Ma, Qingwei Lin

Open access. PaperVantage converted this article to text, so layout and figures may differ from the original.

ABSTRACT

Automated harness optimization improves agents by learning from trajectories and task feedback. Existing offline methods use reference answers to optimize harnesses for reuse on held-out tasks. However, many real-world tasks are open-ended, while long runs expose new difficulties that offline-optimized harnesses may not address. To study harness optimization in these settings, we introduce PERFRACE, a benchmark for long-running performance optimization of software projects, and investigate whether agents can use task-specific experience to recursively improve their harnesses during an ongoing task. To this end, we introduce BOXBOX, which enables agent-triggered harness revision and kernel-managed hot reloading while preserving execution context. We evaluate BOXBOX on PERFRACE under matched test-time budgets, comparing it with Frozen Harness, offline Harness Evolution, and Harness Scaling. BOXBOX achieves higher speedup with more efficient use of task time and model cost, reaching a Speedup@4h of 1.70×1.70\times, compared with 1.54×1.54\times for the strongest baseline.

Figure

(a) Task performance

(b) Cost efficiency

Figure 1: Performance of BOXBOX and baselines on 50 PERFRACE test tasks, with three runs per method and task. Curves show aggregate best-so-far correct speedup against task time (a) and mean cumulative model cost per run (b), sampled at matching task times, with shaded bands indicating 95% fixed-task run-resampling intervals. BOXBOX achieves higher speedup with greater time and cost efficiency than the baselines.

1 INTRODUCTION

Large language model (LLM) agents interact with their environment through harness that determines both the available actions and the observations they receive (Yang et al., 2024; Merrill et al.,

2026; Lin et al., 2026). Recent studies have shown that harness design can substantially affect agent performance and behavior, even when the underlying model is fixed (Lin et al., 2026; Wang et al., 2026b). These findings have motivated automatic optimization of agent harness, in which an optimizer analyzes agent trajectories and evaluation feedback, proposes modifications to the harness, and evaluates the resulting agent on benchmark tasks.

Existing offline harness optimization methods (Park et al., 2026; Zhang et al., 2026b; Lin et al., 2026; Wang et al., 2026b) often use reference answers or task-completion feedback to diagnose failures, and revise harnesses to improve performance on held-out tasks. This setup aligns with existing agent benchmarks that evaluate whether an agent completes a specified task (Jimenez et al., 2024; Merrill et al., 2026; Froger et al., 2026).

However, many real-world tasks are open-ended and long-running, making end-state evaluations alone insufficient to capture how agents progress throughout these runs. Moreover, this setting poses two challenges for offline harness optimization. First, open-ended tasks make it difficult to identify useful harness revisions, as they may lack clear criteria for diagnosing what needs improvement. Prior evaluations show that harness evolution does not reliably improve performance without unit-test feedback (Wang et al., 2026b). Second, continued execution exposes new task-specific difficulties that may limit the generalization of harness revisions learned from other tasks (Nie et al., 2026; Wang et al., 2026b).

To study harness optimization in these settings, we introduce PERFRACE, a benchmark for optimizing performance of real-world software projects. Our experiments show that offline Harness Evolution (HE) underperforms Frozen Harness on PERFRACE (Figure 1), with no consistent improvement during training or validation (Appendix A.2), consistent with prior findings of unreliable gains and limited generalization (Wang et al., 2026b).

Nevertheless, the current task's trajectory can reveal difficulties encountered during execution and provide task-specific evidence for harness revision (Nie et al., 2026). We therefore investigate whether an agent can use this experience to improve its own harness during the ongoing task, making harness optimization an online, task-specific process. Existing methods allocate budget between task execution and harness optimization through an outer loop, with harness updates scheduled by predefined triggers or a separate meta-agent (Wang et al., 2026b; Liu et al., 2026; Zhang et al., 2026c). However, external control limits the task-solving agent's ability to respond to emerging difficulties. First, despite observing task progress, the agent cannot decide whether to spend its remaining budget on task execution or harness revision. Second, updates occur between task attempts or execution segments, delaying their use in the ongoing task.

To address these limitations, we introduce BOXBOX 1^{1} to support agent-triggered revision of the full executable harness through kernel-managed hot reloading. When requested, the kernel pauses task execution and launches an agent review session to diagnose difficulties from the trajectory and revise the harness. After validation, it resumes the task with preserved execution context under the revised harness, which governs both subsequent execution and future reviews, enabling recursive harness improvement. We evaluate BOXBOX on PERFRACE against Frozen Harness, offline Harness Evolution and externally controlled Harness Scaling under matched task budgets, comparing best-so-far correct speedup and model cost. BOXBOX achieves a Speedup@4h of 1.70×1.70\times, compared with 1.44×1.44\times for Frozen Harness, 1.28×1.28\times for Harness Evolution, and 1.54×1.54\times for Harness Scaling.

Our main contributions are summarized as follows:

• We introduce PERFRACE, a benchmark for evaluating agents on open-ended performance optimization tasks, tracking correctness-preserving improvements to real-world software throughout task execution.

• We present BOXBOX, which combines agent-triggered, full-harness revision from task-specific experience with kernel-managed hot reloading of the runtime while preserving execution context.

• Our experiments show that BOXBOX achieves higher best-so-far correct speedup with greater time and cost efficiency than the evaluated baselines, supporting harness optimization as part of an agent's own capabilities.

1^{1}Named after the F1 radio call “box, box,” requesting a pit stop for repairs and adjustments during the race.

RELATED WORK

Automated harness optimization. Prior work has extensively studied the automated optimization of prompts for LLM-based systems (Zhou et al., 2023; Pryzant et al., 2023; Yuksekgonul et al., 2025; Khattab et al., 2024; Agrawal et al., 2025). Subsequent work extends automated optimization to agents, using execution trajectories and task feedback to improve their memory, skills, and workflows (Zhao et al., 2024; Zhang et al., 2025; Ni et al., 2026; Hu et al., 2024; Zhang et al., 2024). Meta-Harness and AHE further extend automated optimization to executable harness code, using trajectories and evaluation feedback to guide iterative revisions (Lee et al., 2026; Lin et al., 2026).

Building on this setting, offline methods revise harnesses using reference answers or task-completion feedback from training tasks, aiming to improve held-out performance (Park et al., 2026; Zhang et al., 2026b; Lin et al., 2026). However, an evaluation finds unreliable gains without unit-test feedback and limited transfer from reusable harnesses, but reports gains from Harness Scaling, which alternates task attempts and harness revisions at test time (Wang et al., 2026b).

Following this task-specific direction, JIT-Agent synthesizes a tailored harness for each task before execution begins (Zhang et al., 2026a). TTHE further explores harness optimization without reference answers, using trajectories and execution-derived feedback to revise executable harnesses on unlabeled test batches (Nie et al., 2026). Continual Harness moves harness optimization into ongoing task execution through an outer loop that periodically invokes a refiner while preserving the task state (Karten et al., 2026). In BoxBOX, the task-solving agent decides when to allocate its remaining budget to full-harness revision, while a separate kernel manages runtime hot reloading and preserves execution context.

Long-Horizon and Open-Ended Agent Evaluation. Existing agent benchmarks cover diverse capabilities but commonly evaluate tasks with explicit end states, reporting task success, pass rates, or final artifact quality (Mialon et al., 2023; Liu et al., 2024b; Jimenez et al., 2024; Xie et al., 2024; Merrill et al., 2026; Sun et al., 2026). Recent iterative optimization benchmarks evaluate solution quality but still use reference implementations, human performance, or reference outputs for task construction or scoring (Chan et al., 2025; Lyu et al., 2026; Imajuku et al., 2025; Xu et al., 2026; Mang et al., 2025; Zhu et al., 2026). Closer to our setting, Frontier-Eng and FrontierSWE support iterative optimization of engineering designs and software projects, with tasks curated from established problems and expert contributions (Chi et al., 2026; Chu et al., 2026).

In contrast, PERFRACE constructs long-running performance optimization tasks from real-world software projects and workloads without requiring reference optimizations. Its construction pipeline provides a scalable way to continually source new tasks from public software projects.

Benchmarks for Performance Optimization. Shypula et al. (2024) introduce PIE for evaluating LLMs' ability to make performance-improving edits to single-file competitive programming solutions while preserving functional correctness. Subsequent benchmarks broaden the optimization domains to GPU kernels, general-purpose numerical programs, and algorithmic redesign, while retaining function- or file-level optimization tasks (Du et al., 2024; Huang et al., 2024; Liu et al., 2024a; Waghjale et al., 2024; Ouyang et al., 2025; Press et al., 2025).

GSO and SWE-Perf extend evaluation to repository-level performance optimization, deriving tasks and human reference optimizations from GitHub commits and pull requests (Shetty et al., 2025; He et al., 2026). SWE-ficiency and FormulaCode further incorporate a targeted workload per task and multiple community-maintained workloads, respectively (Ma et al., 2026; Sehgal et al., 2026).

These repository-level benchmarks construct tasks around a targeted performance test, whereas real performance engineering starts from an end-to-end workload and discovers bottlenecks through profiling. PERFRACE adopts this workload-first formulation, leaving agents to identify and implement correctness-preserving improvements without a known target patch.

References (100)

Couldn't load all references. Reload the page to try again.