@qizhengz_alex: Thanks so much for featuring our work, ACE (Agentic Context Engineering) and Meta-Harness! @lilianweng My bet: harness …

X AI KOLs Timeline Papers

Summary

ACE (Agentic Context Engineering) introduces a framework that treats contexts as evolving playbooks, preventing context collapse and improving performance on agent and domain-specific benchmarks. The work highlights the potential of harness engineering as a data engine for model training.

Thanks so much for featuring our work, ACE (Agentic Context Engineering) and Meta-Harness! @lilianweng My bet: harness engineering is not only a test-time technique ---- the traces it produces can also serve as a data engine for model pre-/mid-training. Writing something up on this soon : ) Paper links ACE: https://arxiv.org/abs/2510.04618 Meta-Harness: https://arxiv.org/abs/2603.28052
Original Article
View Cached Full Text

Cached at: 07/07/26, 11:39 PM

Thanks so much for featuring our work, ACE (Agentic Context Engineering) and Meta-Harness! @lilianweng

My bet: harness engineering is not only a test-time technique –– the traces it produces can also serve as a data engine for model pre-/mid-training. Writing something up on this soon : )

Paper links ACE: https://arxiv.org/abs/2510.04618 Meta-Harness: https://arxiv.org/abs/2603.28052


Agentic Context Engineering: Evolving Contexts for Self-Improving Language Models

Source: https://arxiv.org/html/2510.04618 Qizheng Zhang1∗, Changran Hu2∗, Shubhangi Upasani2, Boyuan Ma2, Fenglu Hong2, Vamsidhar Kamanuru2, Jay Rainton2, Chen Wu2, Mengmeng Ji2, Hanchen Li3, Urmish Thakker2, James Zou1, Kunle Olukotun1 1Stanford University2SambaNova Systems, Inc.3UC Berkeley {qizhengz,kunle}@stanford.edu[email protected] ace-agent/aceace-agent.github.io∗Equal contribution

Abstract

Large language model (LLM) applications such as agents and domain-specific reasoning increasingly rely oncontext adaptation: modifying inputs with instructions, strategies, or evidence, rather than weight updates. Prior approaches improve usability but often suffer from brevity bias, which drops domain insights for concise summaries, and from context collapse, where iterative rewriting erodes details over time. We introduce ACE (AgenticContextEngineering), a framework that treats contexts as evolving playbooks that accumulate, refine, and organize strategies through a modular process of generation, reflection, and curation. ACE prevents collapse with structured, incremental updates that preserve detailed knowledge and scale with long-context models. Across agent and domain-specific benchmarks, ACE optimizes contexts both offline (e.g.,system prompts) and online (e.g.,agent memory), consistently outperforming strong baselines: +10.6% on agents and +8.6% on finance, while significantly reducing adaptation latency and rollout cost. Notably, ACE could adapt effectively without labeled supervision and instead by leveraging natural execution feedback. On the AppWorld leaderboard, ACE matches the top-ranked production-level agent on the overall average and surpasses it on the harder test-challenge split, despite using a smaller open-source model. These results show that comprehensive, evolving contexts enable scalable, efficient, and self-improving LLM systems with low overhead.

1Introduction

Refer to captionFigure 1:Overall Performance Results.Our proposed framework, ACE, consistently outperforms strong baselines across agent and domain-specific tasks.Modern AI applications based on large language models (LLMs), such as LLM agents(yao2023react;yang2024swe)and compound AI systems(zaharia2024compoundGS), increasingly depend oncontext adaptation. Instead of modifying model weights, context adaptation improves performance after model training by incorporating clarified instructions, structured reasoning steps, or domain-specific input formats directly into the model’s inputs. Contexts underpin many AI system components, including system prompts that guide downstream tasks(opsahl2024optimizing;agrawal2025gepa), memory that carries past facts and experiences(suzgun2025dynamic;xu2025mem), and factual evidence that reduces hallucination and supplements knowledge(asai2024self).

Adapting throughcontextsrather thanweightsoffers several key advantages. Contexts are interpretable and explainable for users and developers(wei2022chain;wang2022self), allow rapid integration of new knowledge at runtime(lewis2020retrieval;borgeaud2022improving), and can be shared across models or modules in a compound system(khot2022decomposed). Meanwhile, advances in long-context LLMs(peng2023yarn)and context-efficient inference such as KV cache reuse(gim2024prompt;yao2025cacheblend)are making context-based approaches increasingly practical for deployment. As a result, context adaptation is emerging as a central paradigm for building capable, scalable, and self-improving AI systems.

Despite this progress, existing approaches to context adaptation face two limitations. First,brevity bias: many prompt optimizers prioritize concise applicable instructions over comprehensive accumulation. For example, GEPA(agrawal2025gepa)highlights brevity as a strength, but such abstraction can omit domain-specific heuristics, tool-use guidelines, or common failure modes that matter in practice(gao2025prompt). This objective aligns with validation metrics in some settings, but often fails to capture the detailed strategies required by agents and knowledge-intensive applications. Second,context collapse: methods that rely on monolithic rewriting by an LLM often degrade into shorter, less informative summaries over time, causing sharp performance declines (Figure2). In domains such as interactive agents(trivedi2024appworld;patil2024gorilla;zhang2024caravan), domain-specific programming(ye2023generating;zhang2025adaptive;zhang2025accelopt;mang2025frontiercs), and financial or legal analysis(loukas2022finer;guha2023legalbench;wang2025finlora), strong performance depends on retaining detailed, task-specific knowledge rather than compressing it away.

As applications like agents and knowledge-intensive reasoning demand greater reliability, recent work has shifted toward saturating contexts with abundant, potentially useful information(jiang2025putting;chung2025long;chen2025flora), enabled by advances in long-context LLMs(peng2023yarn;mao2024lift).We argue that contexts should function not as concise summaries, but as comprehensive, structured playbooks that are detailed, inclusive, and rich with domain insights.Unlike humans, who often benefit from concise generalization, LLMs are more effective when provided with long, detailed contexts and can distill relevance autonomously(jiang2025putting;liu2025selfelicit;suzgun2025dynamic). Thus, instead of compressing away domain-specific heuristics and tactics, contexts should preserve them, allowing the model to decide what matters during inference time.

To address these limitations, we introduceACE(AgenticContextEngineering), a framework for comprehensive context adaptation in both offline settings (e.g.,system prompt optimization) and online settings (e.g.,test-time memory adaptation). Rather than compressing contexts into distilled summaries,ACEtreats them as evolving playbooks that accumulate and organize strategies over time. By design,ACEincorporates a modular workflow of generation, reflection, and curation, while adding structured, incremental updates guided by a grow-and-refine principle. This design preserves detailed, domain-specific knowledge, prevents context collapse, and yields contexts that remain comprehensive and scalable throughout adaptation.

We evaluateACEon two categories of LLM applications that most benefit from comprehensive, evolving contexts: (1)agents(trivedi2024appworld), which require multi-turn reasoning, tool use, and environment interaction, where accumulated strategies can be reused across episodes; and (2)domain-specific benchmarks, which demand specialized tactics and knowledge, like financial analysis(loukas2022finer;wang2025finlora). Our key findings are:

  • ∙\bulletACEconsistently outperforms strong baselines, yielding average gains of 10.6% onagentsand 8.6% ondomain-specific benchmarks, across both offline and online adaptation settings.
  • ∙\bulletACEis able to construct effective contextswithoutlabeled supervision, instead leveraging execution feedback and environment signals, key ingredients for self-improving LLMs and agents.
  • ∙\bulletOn the AppWorld benchmark leaderboard(AppWorldLeaderboard),ACEsurpasses the top-1-ranked production-level agent IBM-CUGA(marreed2025towards)(powered by GPT-4.1) while using an open-source model (DeepSeek-V3.1).
  • ∙\bulletACErequires significantly fewer rollouts and achieves lower adaptation latency than existing adaptive methods, demonstrating that scalable self-improvement can be achieved with both higher accuracy and lower cost.

2Background and Motivation

2.1Context Adaptation

Context adaptation (or context engineering) refers to methods that improve model behavior by constructing or modifying inputs to an LLM, rather than altering its weights. The current state of the art leveragesnatural language feedback(shinn2023reflexion;yuksekgonul2024textgrad;agrawal2025gepa). In this paradigm, a language model inspects the current context along with signals such as execution traces, reasoning steps, or validation results, and generates natural language feedback on how the context should be revised. This feedback is then incorporated into the context, enabling iterative adaptation. Representative methods include Reflexion(shinn2023reflexion), which reflects on failures to improve agent planning; TextGrad(yuksekgonul2024textgrad), which optimizes prompts via gradient-like textual feedback; GEPA(agrawal2025gepa), which refines prompts iteratively based on execution traces and achieves strong performance, even surpassing reinforcement learning approaches in some settings; and Dynamic Cheatsheet(krause2019dynamic), which constructs an external memory that accumulates strategies and lessons from past successes and failures during inference. These natural language feedback methods represent a major advance, offering flexible and interpretable signals for improving LLM systems beyond weight updates.

2.2Limitations of Existing Context Adaptation Methods

Brevity Bias

A recurring limitation of context adaptation methods isbrevity bias: the tendency of optimization to collapse toward short, generic prompts. Gao et al.(gao2025prompt)document this effect in prompt optimization for test generation, where iterative methods repeatedly produced near-identical instructions (e.g.,, “Create unit tests to ensure methods behave as expected”), sacrificing diversity and omitting domain-specific detail. This convergence not only narrows the search space but also propagates recurring errors across iterations, since optimized prompts often inherit the same faults as their seeds. More broadly, such bias undermines performance in domains that demand detailed, context-rich guidance—such as multi-step agents, program synthesis, or knowledge-intensive reasoning—where success hinges on accumulating rather than compressing task-specific insights.

Refer to captionFigure 2:Context Collapse.Monolithic rewriting of context by an LLM can collapse it into shorter, less informative summaries, leading to sharp performance drops.

Context Collapse

In a case study on the AppWorld benchmark(trivedi2024appworld), we observe a phenomenon we callcontext collapse, which arises when an LLM is tasked with fully rewriting the accumulated context at each adaptation step. As the context grows large, the model tends to compress it into much shorter, less informative summaries, causing a dramatic loss of information. For instance, at step 60 the context contained 18,282 tokens and achieved an accuracy of 66.7, but at the very next step it collapsed to just 122 tokens, with accuracy dropping to 57.1—worse than the baseline accuracy of 63.7 without adaptation. While we highlight this through Dynamic Cheatsheet(suzgun2025dynamic), the issue is not specific to that method; rather, it reflects a fundamental risk of end-to-end context rewriting with LLMs, where accumulated knowledge can be abruptly erased instead of preserved.

Refer to captionFigure 3:Example ACE-Generated Context on the AppWorld Benchmark(partially shown). ACE-generated contexts contain detailed, domain-specific insights along with tools and code that are readily usable, serving as a comprehensive playbook for LLM applications.

3Agentic Context Engineering (ACE)

We present ACE (AgenticContextEngineering), a framework for scalable and efficient context adaptation in both offline (e.g.,system prompt optimization) and online (e.g.,test-time memory adaptation) scenarios. Instead of condensing knowledge into terse summaries or static instructions, ACE treats contexts as evolving playbooks that continuously accumulate, refine, and organize strategies over time. Inspired by the agentic design of Dynamic Cheatsheet(suzgun2025dynamic), ACE introduces a structured division of labor across three roles (Figure4): theGenerator, which produces reasoning trajectories; theReflector, which distills concrete insights from successes and errors; and theCurator, which integrates these insights into structured context updates. This mirrors how humans learn: experimenting, reflecting, and consolidating, while avoiding the bottleneck of overloading a single model with all responsibilities.

Refer to captionFigure 4:TheACEFramework.Inspired by Dynamic Cheatsheet, ACE adopts an agentic architecture with three specialized components: a Generator, a Reflector, and a Curator.To address the limitations of prior methods discussed in §2.2(notablybrevity biasandcontext collapse) ACE introduces three key innovations: (1) a dedicatedReflectorthat separates evaluation and insight extraction from curation, improving context quality and downstream performance (§4.6); (2) incrementaldelta updates3.1) that replace costly monolithic rewrites with localized edits, reducing both latency and compute cost (§4.7); and (3) agrow-and-refinemechanism (§3.2) that balances steady context expansion with redundancy control.

As shown in Figure4, the workflow begins with the Generator producing reasoning trajectories for new queries, which surface both effective strategies and recurring pitfalls. The Reflector critiques these traces to extract lessons, optionally refining them across multiple iterations. The Curator then synthesizes these lessons into compactdelta entries, which are merged deterministically into the existing context by lightweight, non-LLM logic. Because updates are itemized and localized, multiple deltas can be merged in parallel, enabling batched adaptation at scale. ACE further supports multi-epoch adaptation, where the same queries are revisited to progressively strengthen the context.

3.1Incremental Delta Updates

A core design principle of ACE is to represent context as a collection ofstructured, itemized bullets, rather than a single monolithic prompt. The concept of a bullet is similar to the concept of a memory entry in LLM memory frameworks like Dynamic Cheatsheet(suzgun2025dynamic)and A-MEM(xu2025mem), but builds on top of that and consists of (1)metadata, including a unique identifier and counters tracking how often it was marked helpful or harmful; and (2)content, capturing a small unit such as a reusable strategy, domain concept, or common failure mode. When solving new problems, the Generator highlights which bullets were useful or misleading, providing feedback that guides the Reflector in proposing corrective updates.

This itemized design enables three properties: (1)localization, so only the relevant bullets are updated; (2)fine-grained retrieval, so the Generator can focus on the most pertinent knowledge; and (3)incremental adaptation, allowing efficient merging, pruning, and de-duplication during inference.

Rather than regenerating contexts in full, ACE incrementally produces compactdelta contexts: small sets of candidate bullets distilled by the Reflector and integrated by the Curator. This avoids the computational cost and latency of full rewrites, while ensuring that past knowledge is preserved and new insights are steadily appended. As contexts grow, this approach provides the scalability needed for long-horizon or domain-intensive applications.

3.2Grow-and-Refine

Beyond incremental growth, ACE ensures that contexts remain compact and relevant through periodic or lazy refinement. In grow-and-refine, bullets with new identifiers are appended, while existing bullets are updated in place (e.g.,incrementing counters). A de-duplication step then prunes redundancy by comparing bullets via semantic embeddings. This refinement can be performed proactively (after each delta) or lazily (only when the context window is exceeded), depending on application requirements for latency and accuracy.

Together, incremental updates and grow-and-refine maintain contexts that expand adaptively, remain interpretable, and avoid the potential variance introduced by monolithic context rewriting.

4Results

Our evaluation ofACEshows that:

  • ∙\bulletEnabling High-Performance, Self-Improving Agents.ACE enables agents to self-improve by dynamically refining their input context, both in offline and online settings. It boosts accuracy on the AppWorld benchmark by up to 17.1% by learning to engineer better contexts from execution feedback alone, without needing ground-truth labels. (§4.3)
  • ∙\bulletLarge Gains on Domain-Specific Benchmarks.On complex financial reasoning benchmarks, ACE delivers an average performance gain of 8.6% over strong baselines by constructing comprehensive playbooks with domain-specific concepts and insights. (§4.4)
  • ∙\bulletEffective by Design.Ablation studies confirm our design choices are key to success, with components like the Reflector, multi-epoch refinement, and incremental delta update each contributing substantial performance gains. (§4.6)
  • ∙\bulletLower Cost and Adaptation Latency.ACE achieves these gains efficiently, reducing adaptation latency by 86.9% on average, while requiring fewer rollouts and lower token dollar costs. (§4.7)

4.1Tasks and Datasets

We evaluateACEon two categories of LLM applications that benefit most from evolving contexts: (1)LLM agent, which require multi-turn reasoning, tool use, and environment interaction; with ACE, agents can accumulate and reuse strategies across episodes and environments; and (2)domain-specific reasoning, which demand mastery of specialized concepts and tactics; we focus on financial analysis as a main case study, and show additional results on medical reasoning and text-to-SQL.

  • ∙\bulletLLM Agent: AppWorld(trivedi2024appworld)is a suite of autonomous agent tasks involving API understanding, code generation, and environment interaction. It provides a realistic execution environment with common applications and APIs (e.g.,email, file system) and tasks of two difficulty levels (normal and challenge). A public leaderboard(AppWorldLeaderboard)tracks performance, where, at the time of submission, the best system achieved only 60.3% average accuracy, highlighting the benchmark’s difficulty and realism.
  • ∙\bulletDomain-Specific Reasoning: Financial, Medical, and Text-to-SQL BenchmarksWe use finance as our main case study in §4.4. For financial analysis, we focus on FiNER(loukas2022finer)and Formula(wang2025finlora), which test LLMs on financial reasoning tasks that rely on the eXtensible Business Reporting Language (XBRL).FiNERrequires labeling tokens in XBRL financial documents with one of 139 fine-grained entity types, a key step for financial information extraction in regulated domains.Formulafocuses on applying financial concepts and performing computations to answer queries,i.e.,numerical reasoning. Beyond finance, we evaluate on two additional domain tasks from StreamBench(wu2024streambench): DDXPlus(fansi2022ddxplus)(medical reasoning) and BIRD-SQL(li2023can)(text-to-SQL).

Evaluation Metrics

For AppWorld, we follow the official benchmark protocol and reportTask Goal Completion(TGC) andScenario Goal Completion(SGC) on both the test-normal and test-challenge splits. For FiNER, Formula and DDXPlus, we follow the original setup and report accuracy, measured as the proportion of predicted answers that exactly match the ground truth. For BIRD-SQL, we use GPT-4o-mini(gpt4omini)under LLM-as-a-judge(zheng2023judging).

All datasets follow the original train/validation/test splits. Forofflinecontext adaptation, methods are optimized on the training split and evaluated on the test split with pass@1 accuracy. Foronlinecontext adaptation, methods are evaluated sequentially on the test split: for each sample, the model first predicts with the current context, then updates its context based on that sample. The same shuffled test split is used across all methods.

4.2Baselines and Methods

Base LLM

The base model is evaluated directly on each benchmark without any context engineering, using the default prompts provided by dataset authors. For AppWorld, we follow the officialReAct(yao2023react)implementation released by the benchmark authors, and build all other baselines and methods on top of this framework.

In-Context Learning (ICL)(agarwal2024many)

ICL provides the model with task demonstrations in the input prompt (few-shot or many-shot). This allows the model to infer the task format and desired output without weight updates. We supply all training samples when they fit within the model’s context window; otherwise, we fill the window with as many demonstrations as possible.

MIPROv2(opsahl2024optimizing)

MIPROv2 is a popular prompt optimizer for LLM applications that works by jointly optimizing system instructions and in-context demonstrations via bayesian optimization. We use the official DSPy implementation(DSPyMIPROv2), settingauto="heavy"to maximize optimization performance.

GEPA(agrawal2025gepa)

GEPA (Genetic-Pareto) is a sample-efficient prompt optimizer based on reflective prompt evolution. It collects execution traces (reasoning, tool calls, intermediate outputs) and applies natural-language reflection to diagnose errors, assign credit, and propose prompt updates. A genetic Pareto search maintains a frontier of high-performing prompts, mitigating local optima. Empirically, GEPA outperforms reinforcement learning methods such as GRPO and prompt optimizers like MIPROv2, achieving up to 10–20% higher accuracy with as much as 35× fewer rollouts. We use the official DSPy implementation(DSPyGEPA), settingauto="heavy"to maximize optimization performance.

Dynamic Cheatsheet (DC)(suzgun2025dynamic)

DC is a test-time learning approach that introduces an adaptive external memory of reusable strategies and code snippets. By continuously updating this memory with newly encountered inputs and outputs, DC enables models to accumulate knowledge and reuse it across tasks, often leading to substantial improvements over static prompting methods. A key advantage of DC is that it does not require ground-truth labels: the model can curate its own memory from its generations, making the method highly flexible and broadly applicable. We use the official implementation released by the authors(Suzgun2025_DynamicCheatsheet_code)and set it to use thecumulativemode (DC-CU).

ACE (ours)

ACE optimizes LLM contexts for both offline and online adaptation through an agentic context engineering framework. To ensure fairness, we use the same LLM for the Generator, Reflector, and Curator (non-thinking mode of DeepSeek-V3.1(deepseekai2024deepseekv3technicalreport)), preventing knowledge transfer from a stronger Reflector or Curator to a weaker Generator. This isolates the benefit of context construction itself. We additionally evaluate ACE with other backbone LLMs in the appendix, where we observe consistent gains. We adopt a batch size of 1 (constructing a delta context from each sample). We set the maximum number of Reflector refinement rounds and the maximum number of epoch in offline adaptation to 5.

4.3Results on Agent Benchmark

MethodGT LabelsTest-NormalTest-ChallengeAverageTGC↑\uparrowSGC↑\uparrowTGC↑\uparrowSGC↑\uparrowDeepSeek-V3.1-671B as Base LLMReAct63.742.941.521.642.4Offline AdaptationReAct+ ICL✓64.3+0.664.3_{{\color[rgb]{0.1328125,0.546875,0.1328125}\definecolor[named]{pgfstrokecolor}{rgb}{0.1328125,0.546875,0.1328125}+0.6}}46.4+3.546.4_{{\color[rgb]{0.1328125,0.546875,0.1328125}\definecolor[named]{pgfstrokecolor}{rgb}{0.1328125,0.546875,0.1328125}+3.5}}46.0+4.546.0_{{\color[rgb]{0.1328125,0.546875,0.1328125}\definecolor[named]{pgfstrokecolor}{rgb}{0.1328125,0.546875,0.1328125}+4.5}}27.3+5.727.3_{{\color[rgb]{0.1328125,0.546875,0.1328125}\definecolor[named]{pgfstrokecolor}{rgb}{0.1328125,0.546875,0.1328125}+5.7}}46.0+3.646.0_{{\color[rgb]{0.1328125,0.546875,0.1328125}\definecolor[named]{pgfstrokecolor}{rgb}{0.1328125,0.546875,0.1328125}+3.6}}ReAct+ GEPA✓64.9+1.264.9_{{\color[rgb]{0.1328125,0.546875,0.1328125}\definecolor[named]{pgfstrokecolor}{rgb}{0.1328125,0.546875,0.1328125}+1.2}}44.6+1.744.6_{{\color[rgb]{0.1328125,0.546875,0.1328125}\definecolor[named]{pgfstrokecolor}{rgb}{0.1328125,0.546875,0.1328125}+1.7}}46.0+4.546.0_{{\color[rgb]{0.1328125,0.546875,0.1328125}\definecolor[named]{pgfstrokecolor}{rgb}{0.1328125,0.546875,0.1328125}+4.5}}30.2+8.630.2_{{\color[rgb]{0.1328125,0.546875,0.1328125}\definecolor[named]{pgfstrokecolor}{rgb}{0.1328125,0.546875,0.1328125}+8.6}}46.4+4.046.4_{{\color[rgb]{0.1328125,0.546875,0.1328125}\definecolor[named]{pgfstrokecolor}{rgb}{0.1328125,0.546875,0.1328125}+4.0}}ReAct+ ACE✓76.2+12.5{\color[rgb]{0,0,0}\definecolor[named]{pgfstrokecolor}{rgb}{0,0,0}\pgfsys@color@gray@stroke{0}\pgfsys@color@gray@fill{0}\mathbf{76.2}}_{{\color[rgb]{0.1328125,0.546875,0.1328125}\definecolor[named]{pgfstrokecolor}{rgb}{0.1328125,0.546875,0.1328125}\mathbf{+12.5}}}64.3+21.4{\color[rgb]{0,0,0}\definecolor[named]{pgfstrokecolor}{rgb}{0,0,0}\pgfsys@color@gray@stroke{0}\pgfsys@color@gray@fill{0}\mathbf{64.3}}_{{\color[rgb]{0.1328125,0.546875,0.1328125}\definecolor[named]{pgfstrokecolor}{rgb}{0.1328125,0.546875,0.1328125}\mathbf{+21.4}}}57.3+15.8{\color[rgb]{0,0,0}\definecolor[named]{pgfstrokecolor}{rgb}{0,0,0}\pgfsys@color@gray@stroke{0}\pgfsys@color@gray@fill{0}\mathbf{57.3}}_{{\color[rgb]{0.1328125,0.546875,0.1328125}\definecolor[named]{pgfstrokecolor}{rgb}{0.1328125,0.546875,0.1328125}\mathbf{+15.8}}}39.6+18.0{\color[rgb]{0,0,0}\definecolor[named]{pgfstrokecolor}{rgb}{0,0,0}\pgfsys@color@gray@stroke{0}\pgfsys@color@gray@fill{0}\mathbf{39.6}}_{{\color[rgb]{0.1328125,0.546875,0.1328125}\definecolor[named]{pgfstrokecolor}{rgb}{0.1328125,0.546875,0.1328125}\mathbf{+18.0}}}59.4+17.0{\color[rgb]{0,0,0}\definecolor[named]{pgfstrokecolor}{rgb}{0,0,0}\pgfsys@color@gray@stroke{0}\pgfsys@color@gray@fill{0}\mathbf{59.4}}_{{\color[rgb]{0.1328125,0.546875,0.1328125}\definecolor[named]{pgfstrokecolor}{rgb}{0.1328125,0.546875,0.1328125}\mathbf{+17.0}}}ReAct+ ACE✗75.0+11.375.0_{{\color[rgb]{0.1328125,0.546875,0.1328125}\definecolor[named]{pgfstrokecolor}{rgb}{0.1328125,0.546875,0.1328125}+11.3}}64.3+21.4{\color[rgb]{0,0,0}\definecolor[named]{pgfstrokecolor}{rgb}{0,0,0}\pgfsys@color@gray@stroke{0}\pgfsys@color@gray@fill{0}\mathbf{64.3}}_{{\color[rgb]{0.1328125,0.546875,0.1328125}\definecolor[named]{pgfstrokecolor}{rgb}{0.1328125,0.546875,0.1328125}\mathbf{+21.4}}}54.4+12.954.4_{{\color[rgb]{0.1328125,0.546875,0.1328125}\definecolor[named]{pgfstrokecolor}{rgb}{0.1328125,0.546875,0.1328125}+12.9}}35.2+13.635.2_{{\color[rgb]{0.1328125,0.546875,0.1328125}\definecolor[named]{pgfstrokecolor}{rgb}{0.1328125,0.546875,0.1328125}+13.6}}57.2+14.857.2_{{\color[rgb]{0.1328125,0.546875,0.1328125}\definecolor[named]{pgfstrokecolor}{rgb}{0.1328125,0.546875,0.1328125}+14.8}}Online AdaptationReAct+ DC (CU)✗65.5+1.865.5_{{\color[rgb]{0.1328125,0.546875,0.1328125}\definecolor[named]{pgfstrokecolor}{rgb}{0.1328125,0.546875,0.1328125}+1.8}}58.9+16.0{\color[rgb]{0,0,0}\definecolor[named]{pgfstrokecolor}{rgb}{0,0,0}\pgfsys@color@gray@stroke{0}\pgfsys@color@gray@fill{0}\mathbf{58.9}}_{{\color[rgb]{0.1328125,0.546875,0.1328125}\definecolor[named]{pgfstrokecolor}{rgb}{0.1328125,0.546875,0.1328125}\mathbf{+16.0}}}52.3+10.852.3_{{\color[rgb]{0.1328125,0.546875,0.1328125}\definecolor[named]{pgfstrokecolor}{rgb}{0.1328125,0.546875,0.1328125}+10.8}}30.8+9.230.8_{{\color[rgb]{0.1328125,0.546875,0.1328125}\definecolor[named]{pgfstrokecolor}{rgb}{0.1328125,0.546875,0.1328125}+9.2}}51.9+9.551.9_{{\color[rgb]{0.1328125,0.546875,0.1328125}\definecolor[named]{pgfstrokecolor}{rgb}{0.1328125,0.546875,0.1328125}+9.5}}ReAct+ ACE✗69.6+5.9{\color[rgb]{0,0,0}\definecolor[named]{pgfstrokecolor}{rgb}{0,0,0}\pgfsys@color@gray@stroke{0}\pgfsys@color@gray@fill{0}\mathbf{69.6}}_{{\color[rgb]{0.1328125,0.546875,0.1328125}\definecolor[named]{pgfstrokecolor}{rgb}{0.1328125,0.546875,0.1328125}\mathbf{+5.9}}}53.6+10.753.6_{{\color[rgb]{0.1328125,0.546875,0.1328125}\definecolor[named]{pgfstrokecolor}{rgb}{0.1328125,0.546875,0.1328125}+10.7}}66.0+24.5{\color[rgb]{0,0,0}\definecolor[named]{pgfstrokecolor}{rgb}{0,0,0}\pgfsys@color@gray@stroke{0}\pgfsys@color@gray@fill{0}\mathbf{66.0}}_{{\color[rgb]{0.1328125,0.546875,0.1328125}\definecolor[named]{pgfstrokecolor}{rgb}{0.1328125,0.546875,0.1328125}\mathbf{+24.5}}}48.9+27.3{\color[rgb]{0,0,0}\definecolor[named]{pgfstrokecolor}{rgb}{0,0,0}\pgfsys@color@gray@stroke{0}\pgfsys@color@gray@fill{0}\mathbf{48.9}}_{{\color[rgb]{0.1328125,0.546875,0.1328125}\definecolor[named]{pgfstrokecolor}{rgb}{0.1328125,0.546875,0.1328125}\mathbf{+27.3}}}59.5+17.1{\color[rgb]{0,0,0}\definecolor[named]{pgfstrokecolor}{rgb}{0,0,0}\pgfsys@color@gray@stroke{0}\pgfsys@color@gray@fill{0}\mathbf{59.5}}_{{\color[rgb]{0.1328125,0.546875,0.1328125}\definecolor[named]{pgfstrokecolor}{rgb}{0.1328125,0.546875,0.1328125}\mathbf{+17.1}}}

Table 1:Results on the AppWorld Agent Benchmark (DeepSeek-V3.1-671B as the Base LLM).“GT labels” indicates whether ground-truth labels are available to the Reflector during adaptation. We evaluate the ACE framework against multiple baselines on top of the officialReActimplementation, both for offline and online context adaptation.ReAct+ ACE outperforms selected baselines by an average of 10.6%, and could achieve good performance even without access to GT labels.#### Analysis: AppWorld

As shown in Table1, ACE consistently improves over strong baselines on AppWorld. In the offline setting,ReAct+ ACE outperforms bothReAct+ ICL andReAct+ GEPA by significant margins (12.3% and 11.9%, respectively), demonstrating that structured, evolving, and detailed contexts enable more effective agent learning than fixed demonstrations or single optimized instruction prompts. These gains extend to the online setting, where ACE continues to outperform prior adaptive methods such as Dynamic Cheatsheet by an average of 7.6%.

In the agent use case, ACE remains effective evenwithoutaccess to ground-truth labels during adaptation:ReAct+ ACE achieves an average improvement of 14.8% over theReActbaseline in this setting. This robustness arises because ACE leverages signals naturally available during execution (e.g.,code execution success or failure) to guide the Reflector and Curator in forming structured lessons of successes and failures. Together, these results establish ACE as a strong and versatile framework for building self-improving agents that adapt reliably both with and without labeled supervision.

Notably, on the latest AppWorld leaderboard (as of September 20, 2025; Figure5),ReAct+ ACE (59.4% average) matches the top-1-ranked IBM CUGA (60.3%)111We mention IBM CUGA as a rough contextual reference to show that ACE operates in a similar performance range on the AppWorld leaderboard. It is not used as a methodological baseline, and we do not make direct comparisons. CUGA’s internal design differs from ACE’s context-adaptation focus, and all baselines are evaluated under identical setups to isolate methodological effects rather than agent-engineering choices., a production-level GPT-4.1–based agent(marreed2025towards), despite using the much smaller open-source model DeepSeek-V3.1. With online adaptation,ReAct+ ACE even surpasses IBM CUGA by 8.4% in TGC and 0.7% in SGC on test-challenge, underscoring the effectiveness ofACEin building comprehensive and self-evolving contexts for agents.

4.4Results on Domain-Specific Benchmark

Table 2:Results on Financial Analysis Benchmark (DeepSeek-V3.1-671B as the Base LLM).“GT labels” indicates whether ground-truth labels are available to the Reflector during adaptation. With GT labels, ACE achieves consistent improvements in both offline and online settings, highlighting the advantage of structured and evolving contexts for domain-specific reasoning. However, we also observe that in the absence of reliable feedback signals (e.g.,ground-truth labels or execution outcomes), both ACE and other adaptive methods such as Dynamic Cheatsheet may degrade, suggesting that context adaptation depends critically on feedback quality.#### Analysis: Finance Benchmark

As shown in Table2, ACE delivers strong improvements on financial analysis benchmarks. In the offline setting, when provided with ground-truth answers from the training split, ACE surpasses ICL, MIPROv2, and GEPA by clear margins (an average of 10.9%), showing that structured and evolving contexts are particularly effective when tasks require precise domain knowledge (e.g.,financial concepts, XBRL rules) that goes beyond fixed demonstrations or monolithic optimized prompts. In the online setting, ACE continues to exceed prior adaptive methods such as DC by an average of 6.2%, further confirming the benefit of agentic context engineering for accumulating reusable insights across specialized domains.

Moreover, we also observe that when ground-truth supervision or reliable execution signals are absent, both ACE and DC may degrade in performance. In such cases, the constructed context can be polluted by spurious or misleading signals, highlighting a potential limitation of inference-time adaptation without reliable feedback. This suggests that while ACE is robust under rich feedback (e.g.,code execution results or formula correctness in agent tasks), its effectiveness depends on the availability of signals that allow the Reflector and Curator to make sound judgments. We return to this limitation in §5.

Analysis: Medical and Text-to-SQL Benchmark

While this subsection focuses on finance as a detailed case study, ACE is not finance-specific: we also see consistent gains on other domain-specific tasks, including medical reasoning and text-to-SQL, suggesting that the same playbook-style context adaptation transfers across domains. Full results are reported in Appendix §A.2.

4.5Generalization across LLMs

Table1and Table2use our default backbone (DeepSeek-V3.1), but ACE is not specific to this model. We can swap in other LLMs without changing the algorithm or prompts, and still see consistent gains on AppWorld and Finance benchmarks. Appendix §A.1reports full results on GPT-OSS-120B, GPT-5.1, and Llama-3.3-70B-Instruct, where ACE improves over the corresponding base agents or models. These results suggest ACE is a generalizable method for test-time context evolution across LLM families.

4.6Ablation Study and Sensitivity Analysis

Ablation Study

Table3reports ablation studies on AppWorld, analyzing how individual design choices ofACEcontribute to effective context adaptation. We examine three factors: (1)the Reflector with iterative refinement, our addition to the agentic framework beyond Dynamic Cheatsheet, (2)multi-epoch adaptation, which refines contexts over training samples multiple times, and (3)offline warmup, which initializes the context through offline adaptation before online adaptation begins. Additionally, we study the effect ofincremental context updateand why it is a key enabler for ACE’s performance gain in Appendix §A.5.

MethodGT LabelsTest-NormalTest-ChallengeAverageTGC↑\uparrowSGC↑\uparrowTGC↑\uparrowSGC↑\uparrowDeepSeek-V3.1 as Base LLMReAct63.742.941.521.642.4Offline AdaptationReAct+ ACE w/o Reflector or multi-epoch✓70.8+7.170.8_{{\color[rgb]{0.1328125,0.546875,0.1328125}\definecolor[named]{pgfstrokecolor}{rgb}{0.1328125,0.546875,0.1328125}+7.1}}55.4+12.555.4_{{\color[rgb]{0.1328125,0.546875,0.1328125}\definecolor[named]{pgfstrokecolor}{rgb}{0.1328125,0.546875,0.1328125}+12.5}}55.9+14.455.9_{{\color[rgb]{0.1328125,0.546875,0.1328125}\definecolor[named]{pgfstrokecolor}{rgb}{0.1328125,0.546875,0.1328125}+14.4}}38.1+17.538.1_{{\color[rgb]{0.1328125,0.546875,0.1328125}\definecolor[named]{pgfstrokecolor}{rgb}{0.1328125,0.546875,0.1328125}+17.5}}55.1+12.755.1_{{\color[rgb]{0.1328125,0.546875,0.1328125}\definecolor[named]{pgfstrokecolor}{rgb}{0.1328125,0.546875,0.1328125}+12.7}}ReAct+ ACE w/o multi-epoch✓72.0+8.372.0_{{\color[rgb]{0.1328125,0.546875,0.1328125}\definecolor[named]{pgfstrokecolor}{rgb}{0.1328125,0.546875,0.1328125}+8.3}}60.7+17.860.7_{{\color[rgb]{0.1328125,0.546875,0.1328125}\definecolor[named]{pgfstrokecolor}{rgb}{0.1328125,0.546875,0.1328125}+17.8}}54.9+13.454.9_{{\color[rgb]{0.1328125,0.546875,0.1328125}\definecolor[named]{pgfstrokecolor}{rgb}{0.1328125,0.546875,0.1328125}+13.4}}39.6+18.039.6_{{\color[rgb]{0.1328125,0.546875,0.1328125}\definecolor[named]{pgfstrokecolor}{rgb}{0.1328125,0.546875,0.1328125}+18.0}}56.8+14.456.8_{{\color[rgb]{0.1328125,0.546875,0.1328125}\definecolor[named]{pgfstrokecolor}{rgb}{0.1328125,0.546875,0.1328125}+14.4}}ReAct+ ACE✓76.2+12.576.2_{{\color[rgb]{0.1328125,0.546875,0.1328125}\definecolor[named]{pgfstrokecolor}{rgb}{0.1328125,0.546875,0.1328125}+12.5}}64.3+21.464.3_{{\color[rgb]{0.1328125,0.546875,0.1328125}\definecolor[named]{pgfstrokecolor}{rgb}{0.1328125,0.546875,0.1328125}+21.4}}57.3+15.857.3_{{\color[rgb]{0.1328125,0.546875,0.1328125}\definecolor[named]{pgfstrokecolor}{rgb}{0.1328125,0.546875,0.1328125}+15.8}}39.6+18.039.6_{{\color[rgb]{0.1328125,0.546875,0.1328125}\definecolor[named]{pgfstrokecolor}{rgb}{0.1328125,0.546875,0.1328125}+18.0}}59.4+17.059.4_{{\color[rgb]{0.1328125,0.546875,0.1328125}\definecolor[named]{pgfstrokecolor}{rgb}{0.1328125,0.546875,0.1328125}+17.0}}Online AdaptationReAct+ ACE✗67.9+4.267.9_{{\color[rgb]{0.1328125,0.546875,0.1328125}\definecolor[named]{pgfstrokecolor}{rgb}{0.1328125,0.546875,0.1328125}+4.2}}51.8+8.951.8_{{\color[rgb]{0.1328125,0.546875,0.1328125}\definecolor[named]{pgfstrokecolor}{rgb}{0.1328125,0.546875,0.1328125}+8.9}}61.4+19.961.4_{{\color[rgb]{0.1328125,0.546875,0.1328125}\definecolor[named]{pgfstrokecolor}{rgb}{0.1328125,0.546875,0.1328125}+19.9}}43.2+21.643.2_{{\color[rgb]{0.1328125,0.546875,0.1328125}\definecolor[named]{pgfstrokecolor}{rgb}{0.1328125,0.546875,0.1328125}+21.6}}56.1+13.756.1_{{\color[rgb]{0.1328125,0.546875,0.1328125}\definecolor[named]{pgfstrokecolor}{rgb}{0.1328125,0.546875,0.1328125}+13.7}}ReAct+ ACE + offline warmup✗69.6+5.969.6_{{\color[rgb]{0.1328125,0.546875,0.1328125}\definecolor[named]{pgfstrokecolor}{rgb}{0.1328125,0.546875,0.1328125}+5.9}}53.6+10.753.6_{{\color[rgb]{0.1328125,0.546875,0.1328125}\definecolor[named]{pgfstrokecolor}{rgb}{0.1328125,0.546875,0.1328125}+10.7}}66.0+24.566.0_{{\color[rgb]{0.1328125,0.546875,0.1328125}\definecolor[named]{pgfstrokecolor}{rgb}{0.1328125,0.546875,0.1328125}+24.5}}48.9+27.348.9_{{\color[rgb]{0.1328125,0.546875,0.1328125}\definecolor[named]{pgfstrokecolor}{rgb}{0.1328125,0.546875,0.1328125}+27.3}}59.5+17.159.5_{{\color[rgb]{0.1328125,0.546875,0.1328125}\definecolor[named]{pgfstrokecolor}{rgb}{0.1328125,0.546875,0.1328125}+17.1}}

Table 3:Ablation Studies on AppWorld.We study how particular design choices ofACE(iterative refinement, multi-epoch adaptation, and offline warmup) could help high-quality context adaptation.

Robustness to Reflection Quality

ACEis robust to reflection quality: it remains effective with a much weaker Reflector and shows only modest additional gains from stronger reflectors, and it degrades gracefully under noisy/harmful reflections, staying above the base model except under fully adversarial updates every iteration. Full experiment results are in Appendix §A.4.

Sensitivity to Hyperparameter Choice

ACE’s gains are stable across a wide range of reasonable hyperparameter settings (e.g.,Reflector refinement rounds, number of adaptation epochs, and grow-and-refine thresholds): performance changes are modest, and ACE consistently remains above the corresponding baselines. Full discussion and detailed results are reported in Appendix §A.6.

4.7Cost and Speed Analysis

Due to its support for incremental, “delta” context updates and non-LLM-based context merging and de-duplication,ACEdemonstrates particular advantages in reducing the cost (in terms of the number of rollouts or the amount of dollar cost for token ingestion/generation) and latency of adaptation.

As examples, on the offline adaptation of AppWorld, ACE achieves 82.3% reduction in adaptation latency and 75.1% reduction in the number of rollouts as compared to GEPA (Table4(a)). On the online adaptation of FiNER, ACE achieves 91.5% reduction in adaptation latency and 83.6% reduction in token dollar cost for token ingestion/generation as compared to DC (Table4(b)).

(a)Offline(AppWorld).

(b)Online(FiNER).

Table 4:Cost and Speed Analysis.We measure the context adaptation latency, number of rollouts, and dollar costs ofACEagainst GEPA (offline) and DC (online).#### Fine-Grained Cost Analysis

We conduct a fine-grained cost analysis ofACEand GEPA (as a representative baseline). On AppWorld,ACEis substantially cheaper during offline adaptation, reducing input/output token usage by80.8%/83.6%vs. GEPA:ACEavoids GEPA’s prompt-validation loop and replaces repeated full rewrites with localized delta updates. At evaluation time, whileACEmay use morerawinput tokens due to a richer playbook, this does not necessarily translate to higherbilledserving cost because a large fraction of the context is reused by KV caching; we quantify this effect in the next paragraph. Full results, including a component-wise token breakdown for both methods, are in Appendix §A.3.

KV Cache Reuse: Longer Context≠\neqHigher Serving Cost

AlthoughACEproduces longer contexts than methods such as GEPA, this does not translate to linearly higher inference cost or GPU memory usage. Modern serving infrastructures are increasingly optimized for long-context workloads through techniques such as the reuse(gim2024prompt;yao2025cacheblend), compression(liu2024kivi;liu2024cachegen), and offload(lee2024infinigen;li2025continuum)of KV cache. These mechanisms allow frequently reused context segments to be cached locally or remotely, avoiding repetitive and expensive prefill operations. Ongoing advances in ML systems suggest that the amortized cost of handling long contexts is likely to decrease, making context-rich approaches likeACEincreasingly practical in deployment. In our prompt-caching study with the OpenAI API (GPT-5.1), we find thatACEachieveshigh cache reuse:91.8%of input tokens are served from cache during evaluation stage, which reduces billed input-token cost by82.6%relative to counting raw context tokens.

5Discussion

Implications for Online and Continual Learning

Online and continual learning are key research directions in machine learning for addressing issues like distribution shifts(koh2021wilds;gulrajani2021domain)and limited training data(pan2010survey;hutchinson2017overcoming;zhuang2019transfer).ACEoffers a flexible and efficient alternative to conventional model fine-tuning, as adapting contexts is generally cheaper than updating model weights(brown2020gpt3;lester2021prompttuning;li2021prefixtuning;hu2021lora). Moreover, because contexts are human-interpretable,ACEenablesselective unlearning(cao2015unlearning;bourtoule2021sisa;liu2024rethinkingllmunlearning), whether due to privacy or legal constraints(gdpr2016art17;ccpa1798_105), or when outdated or incorrect information is identified by domain experts. These are promising directions for future work, whereACEcould play a central role in advancing continuous and responsible learning.

Limitations and Challenges

A limitation ofACEis its reliance on a reasonably strong Reflector: if the Reflector fails to extract meaningful insights from generated traces or outcomes, the constructed context may become noisy or even harmful. In domain-specific tasks where no model can extract useful insights, the resulting context will naturally lack them. This dependency is similar to Dynamic Cheatsheet(suzgun2025dynamic), where the quality of adaptation hinges on the underlying model’s ability to curate memory. We also note that not all applications require rich or detailed contexts. Tasks like HotPotQA(yang2018hotpotqa)often benefit more from concise, high-level instructions (e.g.,how to retrieve and synthesize evidence) than from long contexts. Similarly, games with fixed strategies such as Game of 24(suzgun2025dynamic)may only need a single reusable rule, rendering additional context redundant. Overall,ACEis most beneficial in settings that demand detailed domain knowledge, complex tool use, or environment-specific strategies that go beyond what is already embedded in model weights or simple system instructions.

Acknowledgement

We thank the anonymous reviewers and area chair for their constructive feedback, which improved this paper. Qizheng Zhang is supported by NSF award CNS-2211384 and DARPA award TFAWI-HR00112520038. We also thank Lakshya A Agrawal, Xuekai Zhu, Yuhan Liu, Junchen Jiang, and Azalia Mirhoseini for helpful discussions.

Ethics Statement

This work does not raise specific ethical concerns. Our contributions focus on developing algorithms and system frameworks for effective context adaptation in large language models (LLMs). All experiments are conducted on publicly available benchmarks with open-source models, without involving human subjects, sensitive data, or privacy-related information. No potential conflicts of interest are present.

Reproducibility Statement

Our code is available atgithub.com/ace-agent/ace. We provide detailed descriptions of our experimental setup, including datasets, benchmarks, evaluation metrics, baselines, and hyperparameter choices. Additional details, such as prompts for large language models and extended experimental settings, are included in the appendix. With this information, readers with reasonable computational resources should be able to reproduce our results.

References

Appendix AExtended Results

A.1Generalization across Different LLMs

ACEis a model-agnostic framework that operates on execution traces and contextual deltas, and does not rely on any architectural or training-specific features of DeepSeek-V3.1 (the default backbone we use in the main text). We evaluatedACEwith three additional models of varying size, cost, and capability: GPT-OSS-120B (Table5and7), GPT-5.1 (Table6and8), and Llama-3.3-70B-Instruct (Table9). In each case, the Generator, Reflector, and Curator were all switched to the new model without changes to the algorithm.

Analysis

Across all four LLM families we tested (DeepSeek-V3.1, GPT-OSS-120B, GPT-5.1, and Llama-3.3-70B-Instruct),ACEconsistently improves performance over both the base LLM/agent, GEPA, and other baselines, often by 5 to 12 points depending on the task and supervision setting. The relative gains ofACEremain stable even when switching to models that differ significantly in size, cost, and training recipe, andACEdelivers benefits with or without ground-truth labels, validating the robustness of its context adaptation mechanism. The online variant reliably achieves the strongest performance across all models.

We note that the magnitude of improvement can vary across model families: for example, Llama-3.3-70B-Instruct shows smaller gains compared to GPT-5.1 or GPT-OSS-120B. This is expected sinceACErelies on the quality of intermediate reflections and calibrations, and smaller or weaker models naturally generate noisier feedback. Even in these cases, however,ACEremains beneficial, demonstrating that the framework is broadly applicable while still reflecting the inherent capability limits of the underlying LLM, as we discussed in the “Limitations and Challenges” paragraph in §5.

MethodGT LabelsTest-NormalTest-ChallengeAverageTGC↑\uparrowSGC↑\uparrowTGC↑\uparrowSGC↑\uparrowGPT-OSS-120B as Base LLMReAct54.833.934.515.134.6Offline AdaptationReAct+ GEPA✓56.0+1.256.0_{{\color[rgb]{0.1328125,0.546875,0.1328125}\definecolor[named]{pgfstrokecolor}{rgb}{0.1328125,0.546875,0.1328125}+1.2}}33.9+0.033.9_{{\color[rgb]{.5,.5,.5}\definecolor[named]{pgfstrokecolor}{rgb}{.5,.5,.5}\pgfsys@color@gray@stroke{.5}\pgfsys@color@gray@fill{.5}+0.0}}40.1+5.640.1_{{\color[rgb]{0.1328125,0.546875,0.1328125}\definecolor[named]{pgfstrokecolor}{rgb}{0.1328125,0.546875,0.1328125}+5.6}}20.9+5.820.9_{{\color[rgb]{0.1328125,0.546875,0.1328125}\definecolor[named]{pgfstrokecolor}{rgb}{0.1328125,0.546875,0.1328125}+5.8}}37.7+3.137.7_{{\color[rgb]{0.1328125,0.546875,0.1328125}\definecolor[named]{pgfstrokecolor}{rgb}{0.1328125,0.546875,0.1328125}+3.1}}ReAct+ACE✓61.3+6.5{\color[rgb]{0,0,0}\definecolor[named]{pgfstrokecolor}{rgb}{0,0,0}\pgfsys@color@gray@stroke{0}\pgfsys@color@gray@fill{0}\mathbf{61.3}}_{{\color[rgb]{0.1328125,0.546875,0.1328125}\definecolor[named]{pgfstrokecolor}{rgb}{0.1328125,0.546875,0.1328125}\mathbf{+6.5}}}39.3+5.4{\color[rgb]{0,0,0}\definecolor[named]{pgfstrokecolor}{rgb}{0,0,0}\pgfsys@color@gray@stroke{0}\pgfsys@color@gray@fill{0}39.3}_{{\color[rgb]{0.1328125,0.546875,0.1328125}\definecolor[named]{pgfstrokecolor}{rgb}{0.1328125,0.546875,0.1328125}\mathbf{+5.4}}}40.3+5.8{\color[rgb]{0,0,0}\definecolor[named]{pgfstrokecolor}{rgb}{0,0,0}\pgfsys@color@gray@stroke{0}\pgfsys@color@gray@fill{0}\mathbf{40.3}}_{{\color[rgb]{0.1328125,0.546875,0.1328125}\definecolor[named]{pgfstrokecolor}{rgb}{0.1328125,0.546875,0.1328125}\mathbf{+5.8}}}20.9+5.8{\color[rgb]{0,0,0}\definecolor[named]{pgfstrokecolor}{rgb}{0,0,0}\pgfsys@color@gray@stroke{0}\pgfsys@color@gray@fill{0}\mathbf{20.9}}_{{\color[rgb]{0.1328125,0.546875,0.1328125}\definecolor[named]{pgfstrokecolor}{rgb}{0.1328125,0.546875,0.1328125}\mathbf{+5.8}}}40.5+5.9{\color[rgb]{0,0,0}\definecolor[named]{pgfstrokecolor}{rgb}{0,0,0}\pgfsys@color@gray@stroke{0}\pgfsys@color@gray@fill{0}\mathbf{40.5}}_{{\color[rgb]{0.1328125,0.546875,0.1328125}\definecolor[named]{pgfstrokecolor}{rgb}{0.1328125,0.546875,0.1328125}\mathbf{+5.9}}}ReAct+ACE✗58.3+3.558.3_{{\color[rgb]{0.1328125,0.546875,0.1328125}\definecolor[named]{pgfstrokecolor}{rgb}{0.1328125,0.546875,0.1328125}+3.5}}41.1+7.2{\color[rgb]{0,0,0}\definecolor[named]{pgfstrokecolor}{rgb}{0,0,0}\pgfsys@color@gray@stroke{0}\pgfsys@color@gray@fill{0}\mathbf{41.1}}_{{\color[rgb]{0.1328125,0.546875,0.1328125}\definecolor[named]{pgfstrokecolor}{rgb}{0.1328125,0.546875,0.1328125}\mathbf{+7.2}}}39.6+5.139.6_{{\color[rgb]{0.1328125,0.546875,0.1328125}\definecolor[named]{pgfstrokecolor}{rgb}{0.1328125,0.546875,0.1328125}+5.1}}18.7+3.618.7_{{\color[rgb]{0.1328125,0.546875,0.1328125}\definecolor[named]{pgfstrokecolor}{rgb}{0.1328125,0.546875,0.1328125}+3.6}}39.4+4.839.4_{{\color[rgb]{0.1328125,0.546875,0.1328125}\definecolor[named]{pgfstrokecolor}{rgb}{0.1328125,0.546875,0.1328125}+4.8}}Online AdaptationReAct+ DC (CU)✗49.4−5.449.4_{{\color[rgb]{1,0,0}\definecolor[named]{pgfstrokecolor}{rgb}{1,0,0}-5.4}}33.9+0.033.9_{{\color[rgb]{.5,.5,.5}\definecolor[named]{pgfstrokecolor}{rgb}{.5,.5,.5}\pgfsys@color@gray@stroke{.5}\pgfsys@color@gray@fill{.5}+0.0}}30.8−3.730.8_{{\color[rgb]{1,0,0}\definecolor[named]{pgfstrokecolor}{rgb}{1,0,0}-3.7}}18.2+3.118.2_{{\color[rgb]{0.1328125,0.546875,0.1328125}\definecolor[named]{pgfstrokecolor}{rgb}{0.1328125,0.546875,0.1328125}+3.1}}33.1−1.533.1_{{\color[rgb]{1,0,0}\definecolor[named]{pgfstrokecolor}{rgb}{1,0,0}-1.5}}ReAct+ACE✗60.7+5.9{\color[rgb]{0,0,0}\definecolor[named]{pgfstrokecolor}{rgb}{0,0,0}\pgfsys@color@gray@stroke{0}\pgfsys@color@gray@fill{0}\mathbf{60.7}}_{{\color[rgb]{0.1328125,0.546875,0.1328125}\definecolor[named]{pgfstrokecolor}{rgb}{0.1328125,0.546875,0.1328125}\mathbf{+5.9}}}44.6+10.744.6_{{\color[rgb]{0.1328125,0.546875,0.1328125}\definecolor[named]{pgfstrokecolor}{rgb}{0.1328125,0.546875,0.1328125}+10.7}}43.2+8.7{\color[rgb]{0,0,0}\definecolor[named]{pgfstrokecolor}{rgb}{0,0,0}\pgfsys@color@gray@stroke{0}\pgfsys@color@gray@fill{0}\mathbf{43.2}}_{{\color[rgb]{0.1328125,0.546875,0.1328125}\definecolor[named]{pgfstrokecolor}{rgb}{0.1328125,0.546875,0.1328125}\mathbf{+8.7}}}20.1+5.0{\color[rgb]{0,0,0}\definecolor[named]{pgfstrokecolor}{rgb}{0,0,0}\pgfsys@color@gray@stroke{0}\pgfsys@color@gray@fill{0}\mathbf{20.1}}_{{\color[rgb]{0.1328125,0.546875,0.1328125}\definecolor[named]{pgfstrokecolor}{rgb}{0.1328125,0.546875,0.1328125}\mathbf{+5.0}}}42.2+7.6{\color[rgb]{0,0,0}\definecolor[named]{pgfstrokecolor}{rgb}{0,0,0}\pgfsys@color@gray@stroke{0}\pgfsys@color@gray@fill{0}\mathbf{42.2}}_{{\color[rgb]{0.1328125,0.546875,0.1328125}\definecolor[named]{pgfstrokecolor}{rgb}{0.1328125,0.546875,0.1328125}\mathbf{+7.6}}}

Table 5:Results on the AppWorld Agent Benchmark (GPT-OSS-120B as the Base LLM).“GT labels” indicates whether ground-truth labels are available to the Reflector during adaptation. We evaluate theACEframework against multiple baselines on top of the officialReActimplementation, both for offline and online context adaptation.Table 6:Results on the AppWorld Agent Benchmark (GPT-5.1 as the Base LLM).“GT labels” indicates whether ground-truth labels are available to the Reflector during adaptation. We evaluate theACEframework against multiple baselines on top of the officialReActimplementation, both for offline and online context adaptation.Table 7:Results on Financial Analysis Benchmark (GPT-OSS-120B as the Base LLM).“GT labels” indicates whether ground-truth labels are available to the Reflector during adaptation.Table 8:Results on Financial Analysis Benchmark (GPT-5.1 as the Base LLM).“GT labels” indicates whether ground-truth labels are available to the Reflector during adaptation.MethodGT LabelsFiNER (Acc↑\uparrow)Llama-3.3-70B-Instruct as Base LLMBase LLM62.5Offline AdaptationGEPA✓59.41−3.0959.41_{{\color[rgb]{1,0,0}\definecolor[named]{pgfstrokecolor}{rgb}{1,0,0}-3.09}}ACE✓64.9+2.4{\color[rgb]{0,0,0}\definecolor[named]{pgfstrokecolor}{rgb}{0,0,0}\pgfsys@color@gray@stroke{0}\pgfsys@color@gray@fill{0}\mathbf{64.9}}_{{\color[rgb]{0.1328125,0.546875,0.1328125}\definecolor[named]{pgfstrokecolor}{rgb}{0.1328125,0.546875,0.1328125}\mathbf{+2.4}}}ACE✗64.2+1.764.2_{{\color[rgb]{0.1328125,0.546875,0.1328125}\definecolor[named]{pgfstrokecolor}{rgb}{0.1328125,0.546875,0.1328125}+1.7}}Online AdaptationDC✗59.0−3.559.0_{{\color[rgb]{1,0,0}\definecolor[named]{pgfstrokecolor}{rgb}{1,0,0}-3.5}}ACE✗63.6+1.1\mathbf{63.6}_{{\color[rgb]{0.1328125,0.546875,0.1328125}\definecolor[named]{pgfstrokecolor}{rgb}{0.1328125,0.546875,0.1328125}\mathbf{+1.1}}}

Table 9:Results on Financial Analysis Benchmark (Llama-3.3-70B-Instruct as the Base LLM).“GT labels” indicates whether ground-truth labels are available to the Reflector during adaptation.

A.2Beyond Finance: Additional Domain Tasks

We evaluateACEon two additional domain tasks from StreamBench(wu2024streambench)under the non-streaming setting (i.e.,offline adaptation): DDXPlus(fansi2022ddxplus)for medical reasoning (Table10) and BIRD-SQL(li2023can)for Text-to-SQL generation (Table11). ForACE, we perform offline adaptation using 1000 randomly sampled training examples. For GEPA, we use the same 1000 examples for training, and reserve a separate validation set of 500 examples for BIRD-SQL or 372 examples for DDXPlus (StreamBench provides 1372 train/val examples for DDXPlus in total). All other settings follow the main-text configuration unless stated otherwise.

Analysis

On DDXPlus,ACEsubstantially improves over the base LLM, rising from 75.2 to 90.2 accuracy (+15.0). In contrast, GEPA yields a much smaller gain (76.4,+1.2). This suggests thatACE’s test-time evolving context transfers well to multi-step, domain-heavy diagnostic reasoning. On BIRD-SQL,ACEalso improves consistently over the base model on all splits, achieving better overall average (52.9,+5.1). The gains are driven mainly by the Simple subset (53.5,+7.1). While GEPA yields larger gains on Moderate and Challenging,ACEstill improves over the base model on both splits. Overall, these results indicate thatACEgeneralizes beyond finance to both knowledge-intensive reasoning and structured code generation tasks.

Table 10:Results on Medical Reasoning Benchmark (DeepSeek-V3.1-671B as the Base LLM).We use DDXPlus from StreamBench.Table 11:Results on Text-to-SQL Benchmark (DeepSeek-V3.1-671B as the Base LLM).We use BIRD-SQL from StreamBench.

A.3Fine-Grained Cost Analysis

We perform a fine-grained cost analysis ofACEand GEPA for both theadaptationandevaluationstages (offline adaptation setting), using AppWorld as a representative application. ForACE, we run offline adaptation with 1 epoch and 1 reflector refinement round. While increasing the number of epochs or refinement rounds will increase cost, the qualitative trends below should remain:ACEavoids expensive validation-time re-evaluation and performs localized updates rather than repeated full rewrites. For GEPA, we use the official DSPy implementation(DSPyMIPROv2)withauto="heavy"to maximize optimization strength.

Adaptation Stage

Across adaptation (Table12and Table13),ACEreduces input-token usage by 80.8% relative to GEPA (204.1M→\rightarrow39.3M) and output-token usage by 83.6% (1.87M→\rightarrow0.31M). This gap is primarily driven by (1) GEPA’s prompt-validation loop, which repeatedly evaluates candidate prompts on a held-out validation set (57 queries), incurring substantial additional LLM calls and validation tokens, and (2)ACE’s incremental context updates, which replace full prompt rewrites with localized Generator-Reflector-Curator updates.

Evaluation Stage

At evaluation time (Table14and Table15),ACEuses morerawinput tokens per query than GEPA due to its richer, more actionable playbook. However, output-token usage is similar (115.0 vs. 101.8), and the number of rollouts is comparable across methods. Moreover, under modern prompt/KV-caching infrastructures, the additional input tokens can be largely amortized: using OpenAI’s default prompt caching, 91.8% ofACE’s input tokens are served from cache, resulting in an 82.6% reduction in billed input-token cost (see §4.7).

Table 12:Adaptation-Stage Aggregate Cost Statistics on AppWorld.The percentages compareACE(total) against GEPA (total).Table 13:Adaptation-Stage Average Cost Statistics on AppWorld.The percentages compareACE(total) against GEPA (total).Table 14:Evaluation-Stage Aggregate Cost Statistics on AppWorld.The percentages compareACEagainst GEPA.Table 15:Evaluation-Stage Average Cost Statistics on AppWorld.The percentages compareACEagainst GEPA.

A.4Robustness to Reflection Quality

We conduct two analyses to evaluateACE’s sensitivity to reflection quality. Unless otherwise noted, experiments are run on FiNER withACEoffline adaptation.

Using Weaker Reflector Models

To test whetherACErequires a strong reflector, we vary the Reflector across three models with substantially different capability: GPT-OSS-120B, DeepSeek-V3.1-671B, and GPT-5.1 (Table16). Across all choices,ACEconsistently improves over the base LLM, including when the Reflector is much weaker. While stronger reflectors yield larger gains, the method remains effective across a wide range of reflector strengths.

Robustness to Noisy or Harmful Reflector Feedback

We further stress-testACEwith actively harmful reflector outputs by injecting adversarial or conflicting bullets: we invoke a “harmful” reflector that is explicitly instructed to inject harmful reflection once everyXXadaptation steps, where largerXXmeans less frequent corruption (Table17).ACEis robust to moderate noise levels: performance degrades gradually as corruption becomes more frequent and stays above the base LLM except in the extreme case of injecting harmful updates every iteration. This suggests thatACE’s update mechanism tolerates substantial noise in the reflection stream, with failures emerging only under intentionally adversarial conditions.

Takeaway and Mitigation

ACEis not highly sensitive to reflector quality: (1) weaker reflectors still provide substantial gains, (2) moderate noise or conflicting updates are largely tolerated, and (3) performance drops below the base model only under sustained adversarial corruption. In practice,ACE’s bullet-point analyzer (“grow-and-refine”; §3.2), which merges and deduplicates semantically similar bullets and can filter entries flagged as potentially harmful via metadata, serves as a first line of defense against context noise. Additional safeguards (e.g.,contradiction detection, prompting the Curator to prioritize high-confidence updates, or periodic pruning of outdated entries) are compatible extensions that could further improve playbook compactness and consistency(zhou2024defending).

Table 16:Weaker Reflector Models on FiNER.We vary the Reflector while keeping the Generator/Curator fixed. Parentheses report deltas vs. the base LLM.Table 17:Robustness to Noisy or Harmful Reflector Feedback on FiNER.We invoke a harmful reflector once everyXXadaptation steps. Parentheses report deltas vs. the base LLM.

A.5Ablation on Incremental Context Update

In this ablation, we run offline context adaptation on AppWorld usingACEwith and without incremental context updates, and evaluate on the test-normal split with DeepSeek-V3.1. We find that incremental updates are critical: by preserving useful information that would otherwise be lost to context collapse, they account for a large share ofACE’s gains.

Table 18:Ablation on Incremental Context Updates (AppWorld, DeepSeek-V3.1).We run offline context adaptation withACEwith/without incremental updates and evaluate on test-normal. Improvements are relative toReAct.

A.6Sensitivity Analysis on Hyperparameter Choice

Reflection Iterations

This parameter trades off (1) extracting enough high-quality insights from the inference traces and (2) avoiding “overthinking” that introduces noisy or unnecessary updates. Empirically, 5 rounds offers a good balance. On AppWorld, 1 round under-extracts useful strategy fragments and leaves clear headroom, while too many rounds (e.g.,10) can degrade performance.

Table 19:Effect of Reflection Iterations (AppWorld, DeepSeek-V3.1).We report test-normal results under offline context adaptation. Improvements are relative to runningReActwithoutACE.

Deduplication Threshold

This controls how aggressively newly extracted insights are merged with existing entries. On FiNER, performance changes only mildly across the tested range, suggestingACEis robust to moderate variation in dedup aggressiveness.

Table 20:Effect of Deduplication Threshold (FiNER, DeepSeek-V3.1).

Pruning Trigger (Maximum Context Length)

This threshold determines whenACEmerges and prunes older or low-utility entries to prevent unbounded growth. It balances (1) retaining enough accumulated context to improve learning from experience and (2) keeping the context compact to reduce cost and limit noise. On FiNER, performance is stable from 10K to 100K tokens, indicatingACEdoes not require finely tuned length thresholds; pruning mainly removes stale or harmful fragments while preserving core reusable strategies.

Table 21:Effect of Pruning Trigger (FiNER, DeepSeek-V3.1).Overall,ACEis not highly sensitive to these hyperparameters: reasonable choices (e.g.,3-5 reflection rounds, 50-90% dedup threshold, and 10K-100K pruning triggers) consistently yield strong performance.

Appendix BExtended Related Work

B.1Agent Memory

A growing body of work explores how agents can accumulate experience from past trajectories and leverage external (often non-parametric) memory to guide future actions. AgentFly(zhou2025agentfly)presents an extensible framework where memory evolves continuously as agents solve tasks, enabling scalable reinforcement learning and long-horizon reasoning across diverse environments. AWM (Agent Workflow Memory)(wang2024agent)induces reusableworkflows,i.e.,structured routines distilled from past trajectories, and selectively injects them into memory to improve efficiency and generalization in web navigation benchmarks. A-MEM(xu2025mem)introduces a dynamically organized memory system inspired by the Zettelkasten method: each stored memory is annotated with structured attributes (e.g.,tags, keywords, contextual descriptions) and automatically linked to relevant past entries, while existing entries are updated to integrate new knowledge, yielding adaptive and context-aware retrieval. Agentic Plan Caching(zhang2025cost)instead focuses on cost efficiency by extracting reusable plan templates from agent trajectories and caching them for fast execution at test time.

Together, these works demonstrate the value of external memory for improving adaptability, efficiency, and generalization in LLM agents. Our work differs by tackling the broader challenge ofcontext adaptation, which spans not only agent memory but also system prompts, factual evidence, and other inputs underpinning AI systems. We further highlight two fundamental limitations of existing adaptation methods:brevity biasandcontext collapse; and show that addressing them is essential for robustness, reliability, and scalability beyond raw task performance. Accordingly, our evaluation considers not only accuracy but also cost, latency, and scalability.

Appendix CExtended Discussions

C.1ACE vs. GEPA

Scope and ObjectiveBoth GEPA and ACE improve model or agent behavior by adaptingcontextat test time (rather than updating model weights), but they are designed for different forms of adaptation. GEPA treats adaptation asprompt evolution: it iteratively proposes and selects improved instruction prompts using rollout trajectories and reflective feedback, aiming to maximize a task evaluator under a rollout budget. ACE targets settings where performance depends on accumulating and preservingmany granular, reusable insightsover long horizons. For multi-turn agents (e.g.,AppWorld), the model must retain step-by-step procedures and tool-use rules across an interaction. For domain-specific and knowledge-intensive benchmarks (e.g.,FiNER, Formula), accuracy depends on keeping many specific rules, edge cases, and domain concepts that are difficult to compress into a single instruction prompt without losing detail.

Update Mechanism and RepresentationGEPA updates context by generating and selectingnew prompt variantsin an evolutionary loop, where each candidate is a full prompt optimized end-to-end. ACE instead represents context as a structured, itemized Playbook and appliesincremental delta updates: the Curator writes only the new insight, and we merge it into the Playbook with simple deterministic logic. This avoids repeated full-prompt rewrites, helps keep earlier rules stable over long runs, and enables fine-grained bookkeeping (e.g.,de-duplication, targeted refinement, and tracking which entries helped or harmed accuracy).

C.2ACE vs. Dynamic Cheatsheet (DC)

Scope and ObjectiveBoth DC and ACE collect reusable insights at test time, but they are aimed at different settings. DC is mainly evaluated on single-turn reasoning benchmarks (e.g.,AIME, Game-of-24, GPQA) where each query is independent. In this regime, improvements often come from saving short, reusable heuristics and executable artifacts (e.g.,code snippets) that help on later problems. ACE focuses on settings where the details and high-fidelity guidenace need to stick around. For multi-turn agents (e.g.,AppWorld), the model must remember step-by-step procedures and tool-use rules across an interaction. For domain-specific and knowledge-intensive benchmarks (e.g.,FiNER, Formula), accuracy depends on keeping many specific rules, edge cases, and domain concepts, which are hard to compress without losing information.

Update MechanismDC updates its memory by rewriting the cheatsheet as a whole, either by regenerating the full cheatsheet each step (DC-CU) or by writing a new summary from retrieved examples (DC-RS). With repeated full rewrites, the model tends to shorten and compress what was written before. This can cause context collapse, which means that useful domain-specific details get dropped over time or disappear suddenly (§2.2). ACE avoids full rewrites by using incremental delta updates. The Curator only writes the new insight, and we merge it into a structured and itemized Playbook with simple deterministic logic. This keeps earlier rules stable over long runs and also makes it easier to track which items helped, remove duplicates, and refine entries. In our ablations (§4.6), removing delta updates leads to a large drop on AppWorld (-11.7% TGC and -27.8% SGC on test-normal), showing that delta updates are a core part of our method.

Appendix DAppWorld Leaderboard Snapshot (09/2025)

Refer to captionFigure 5:The AppWorld leaderboard as accessed on 09/2025.

Appendix EThe Use of Large Language Models (LLMs)

This work focuses on developing algorithms and system frameworks for effective context adaptation in large language models (LLMs). Accordingly, our experiments employ LLMs for the empirical evaluation of the proposed methods. For paper preparation, we used LLMs only to polish writing (e.g.,correcting grammatical errors), and not to generate new text from scratch.

Appendix FPrompts

Refer to captionFigure 6:ICL-baseline Generator prompt on AppWorldRefer to captionFigure 7:Dynamic Cheatsheet Generator prompt on AppWorldRefer to captionFigure 8:GEPA prompt on AppWorldRefer to captionFigure 9:ACE Generator prompt on AppWorldRefer to captionFigure 10:ACE Reflector prompt on AppWorldRefer to captionFigure 11:ACE Curator prompt on AppWorldRefer to captionFigure 12:ACE Generator prompt on FINERRefer to captionFigure 13:ACE Reflector prompt on FINERRefer to captionFigure 14:ACE Curator prompt on FINER

Lilian Weng (@lilianweng): new post on harness engineering for AI self-improvement: https://t.co/XNCycrAZbM

It is hard to forecast how much the future of RSI will rely on harnesses. Likely harness engineering will evolve in the direction of self-improvement and enable auto-research, and, in turn, smarter

Similar Articles

@astaxie: Today the group discussed how to learn Harness. For Harness Engineering, I'm studying these two resources: 1. https://github.com/walkinglabs/learn-harness-engineering… to understand the core mechanisms of each Harness…

X AI KOLs Timeline

A project-based course repository on Harness Engineering for AI coding agents, covering environment setup, state management, verification, and control mechanisms to make AI coding agents work reliably. The course synthesizes best practices from OpenAI and Anthropic on building effective harnesses for long-running agents.

HarnessX: A Composable, Adaptive, and Evolvable Agent Harness Foundry

Hugging Face Daily Papers

HarnessX is a foundry for composable, adaptive, and evolvable AI agent harnesses that uses compositional primitives and trace-driven evolution to improve agent performance. Across five benchmarks, it achieves an average gain of +14.5% (up to +44.0%), demonstrating that runtime interface evolution is a complementary lever to model scaling.