Source-linked AI summary
Agentic Context Engineering: Evolving Contexts for Self-Improving Language Models
Qizheng Zhang, Changran Hu, Shubhangi Upasani, Boyuan Ma, Fenglu Hong, Vamsidhar Kamanuru, Jay Rainton, Chen Wu, Mengmeng Ji, Hanchen Li, Urmish Thakker, James Zou, Kunle Olukotun
TL;DR
LLM applications increasingly need context adaptation, but brevity bias and context collapse can discard detailed strategies. ACE addresses this by treating contexts as evolving playbooks updated through generation, reflection, curation, and incremental refinement. Across agent and domain-specific benchmarks, it improves performance while reducing adaptation latency and rollout cost, including strong AppWorld results with a smaller open-source model.
Problem
Existing context adaptation methods can favor concise prompts that omit domain-specific detail, while monolithic rewriting can sharply compress contexts and erase accumulated information.
Method
ACE treats contexts as evolving playbooks and updates them through Generator, Reflector, and Curator roles with structured incremental changes.
Results
ACE consistently outperforms strong baselines, with average gains of 10.6% on agents and 8.6% on domain-specific benchmarks across offline and online adaptation.
Takeaways & Limitations
ACE supports self-improving LLM applications using execution feedback without labeled supervision while requiring fewer rollouts and lower adaptation latency.
Takeaways & Limitations
A documented AppWorld failure case shows full rewriting collapsing 18,282 tokens to 122 and reducing accuracy below the no-adaptation baseline.
Abstract
from arXiv · showhide
Large language model (LLM) applications such as agents and domain-specific reasoning increasingly rely on context 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 (Agentic Context Engineering), 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.
1 INTRODUCTION
Context adaptation improves LLM applications by modifying inputs instead of weights, but existing methods can discard detailed domain strategies through brevity bias. ACE treats contexts as evolving playbooks and reports gains across agents and domain-specific benchmarks with lower adaptation cost.
- Context adaptation modifies LLM inputs with instructions, reasoning steps, or evidence rather than changing model weights.
- Brevity bias can omit domain-specific heuristics, tool-use guidance, and failure modes needed by agents and knowledge-intensive applications.
- ACE uses generation, reflection, curation, and structured incremental updates to preserve detailed knowledge while adapting contexts offline and online.
- 10.6% average gains on agents and 8.6% on domain-specific benchmarks were reported across offline and online adaptation settings.
- ACE constructs effective contexts without labeled supervision by using execution feedback and environment signals.
- ACE requires fewer rollouts and achieves lower adaptation latency than existing adaptive methods.
2 BACKGROUND AND MOTIVATION
Context adaptation methods modify LLM inputs using natural-language feedback, but brevity bias and full-context rewriting can erase useful knowledge. These limitations motivate richer contexts that preserve detailed, domain-specific strategies.
- 2.1 CONTEXT ADAPTATION: Context adaptation improves model behavior by constructing or modifying LLM inputs rather than altering model weights.
- 2.1 CONTEXT ADAPTATION: Natural-language feedback from execution traces, reasoning steps, or validation results supports iterative context revision.
- 2.2 LIMITATIONS OF EXISTING CONTEXT ADAPTATION METHODS: Brevity bias collapses optimization toward short, generic prompts that omit domain-specific detail and can propagate recurring errors.
- 2.2 LIMITATIONS OF EXISTING CONTEXT ADAPTATION METHODS: At AppWorld step 60, a context of 18,282 tokens reached 66.7 accuracy, then collapsed to 122 tokens and 57.1 accuracy, below the 63.7 baseline.
- 2.2 LIMITATIONS OF EXISTING CONTEXT ADAPTATION METHODS: Context collapse reflects a broader risk of end-to-end rewriting, where accumulated knowledge can be abruptly erased rather than preserved.
- 2.2 LIMITATIONS OF EXISTING CONTEXT ADAPTATION METHODS: Contexts should function as comprehensive, structured playbooks that preserve domain-specific heuristics and tactics for inference-time selection.
3 AGENTIC CONTEXT ENGINEERING (ACE)
ACE organizes context adaptation as a modular workflow that generates, critiques, and curates structured updates. Incremental, itemized context changes preserve knowledge while supporting scalable refinement and efficient adaptation.
- 3 AGENTIC CONTEXT ENGINEERING (ACE): ACE divides adaptation across a Generator, Reflector, and Curator that produce trajectories, extract lessons, and integrate structured updates.
- 3 AGENTIC CONTEXT ENGINEERING (ACE): ACE adds incremental delta updates and a grow-and-refine mechanism to address brevity bias and context collapse.
- 3 AGENTIC CONTEXT ENGINEERING (ACE): The Generator produces reasoning trajectories, the Reflector extracts lessons, and the Curator merges compact deltas deterministically into existing context.
- 3 AGENTIC CONTEXT ENGINEERING (ACE): Structured bullets provide localization, fine-grained retrieval, and incremental merging, pruning, and de-duplication.
- 3 AGENTIC CONTEXT ENGINEERING (ACE): Incremental delta contexts preserve past knowledge while reducing the latency and computational cost of full rewrites.
- 3 AGENTIC CONTEXT ENGINEERING (ACE): Grow-and-refine appends new bullets, updates existing ones in place, and prunes redundancy proactively or when the context window is exceeded.
- 3 AGENTIC CONTEXT ENGINEERING (ACE): Incremental updates and grow-and-refine maintain adaptive, interpretable contexts while avoiding variance from monolithic rewriting.
4 RESULTS
ACE improves agent and domain-specific benchmark performance across offline and online adaptation while reducing adaptation costs. It also supports label-free adaptation, transfers across models and domains, and remains robust under varied reflection quality and hyperparameters.
- Agent benchmarks: 12.3% and 11.9% gains over ReAct + ICL and ReAct + GEPA, respectively, are reported offline on AppWorld.Online, ACE outperforms Dynamic Cheatsheet by an average of 7.6%.
- Agent benchmarks: 14.8% average improvement over the ReAct baseline is achieved without ground-truth labels during agent adaptation.ACE uses execution signals such as code success or failure to form structured lessons from successes and failures.
- Agent benchmarks: 59.4% average AppWorld performance matches IBM CUGA’s 60.3% despite using the smaller open-source DeepSeek-V3.1 model.With online adaptation, ReAct + ACE surpasses IBM CUGA by 8.4% in TGC and 0.7% in SGC on test-challenge.
- Domain-specific benchmarks: 10.9% average offline improvement over ICL, MIPROv2, and GEPA is observed on financial analysis benchmarks with ground-truth answers.Online ACE exceeds Dynamic Cheatsheet by an average of 6.2%, and gains also appear on medical reasoning and text-to-SQL tasks.
- Cost and robustness: ACE’s gains remain stable across reasonable hyperparameter settings and degrade gracefully with noisy reflections, except under fully adversarial updates every iteration.Ablations identify iterative refinement, multi-epoch adaptation, offline warmup, and incremental context updates as contributing design choices.
- Cost and robustness: 82.3% lower adaptation latency and 75.1% fewer rollouts than GEPA are achieved on offline AppWorld adaptation.For online FiNER adaptation, ACE reduces latency by 91.5% and token dollar cost by 83.6% versus Dynamic Cheatsheet; localized delta updates avoid repeated full rewrites.
5 DISCUSSION
ACE is presented as a flexible alternative to weight updates for online and continual learning, but its benefits depend on reflector quality and task demands.
- ACE offers a potentially cheaper alternative to conventional model fine-tuning by adapting contexts rather than updating model weights.The discussion connects this approach to online and continual learning under distribution shifts and limited training data.
- ACE depends on a reasonably strong Reflector to extract meaningful insights from traces and outcomes.Poor reflection can produce contexts that are noisy or harmful, especially when no model can extract useful domain insights.
- ACE is most beneficial for tasks requiring detailed domain knowledge, complex tool use, or environment-specific strategies.Tasks favoring concise instructions or fixed strategies may gain little from richer contexts.
ETHICS STATEMENT
The paper reports no specific ethical concerns because it develops context-adaptation algorithms and evaluates them on public benchmarks with open-source models.
- The experiments use publicly available benchmarks and open-source models without human subjects, sensitive data, or privacy-related information.
- The authors report no potential conflicts of interest.
REPRODUCIBILITY STATEMENT
ACE is described with reproducible implementation details and evaluated across multiple backbone models under standardized benchmark setups. The reported analyses indicate consistent gains, although improvement magnitude varies across model families.
- The paper provides code, benchmark and metric descriptions, baseline details, hyperparameters, prompts, and extended experimental settings for reproduction.It states that readers with reasonable computational resources should be able to reproduce the results.
- ACE operates on execution traces and contextual deltas without architectural or training-specific dependence on DeepSeek-V3.1.The Generator, Reflector, and Curator can all be switched to another model without changing the algorithm.
- Across four LLM families, ACE consistently improves over base models or agents, GEPA, and other baselines, often by 5 to 12 points.The relative gains remain stable across models differing in size, cost, and training recipe, with or without ground-truth labels.
- Improvement magnitude varies across model families, with Llama-3.3-70B-Instruct showing smaller gains than GPT-5.1 or GPT-OSS-120B.The paper attributes this variation to differences in the quality of intermediate reflections and calibrations.
A.2 BEYOND FINANCE: ADDITIONAL DOMAIN TASKS
Beyond finance, ACE is evaluated on medical reasoning and text-to-SQL tasks, where it improves over base models and demonstrates transfer to domain-heavy reasoning and structured code generation.
- Experimental Setup: The additional evaluation uses DDXPlus for medical reasoning and BIRD-SQL for text-to-SQL under offline adaptation.ACE adapts offline with 1000 randomly sampled training examples; GEPA uses the same training examples plus a separate validation set.
- Medical Reasoning: ACE raises DDXPlus medical-reasoning accuracy from 75.2 to 90.2 (+15.0), while GEPA reaches 76.4 (+1.2).The result is presented as evidence that evolving context transfers to multi-step, domain-heavy diagnostic reasoning.
- Text-to-SQL: On BIRD-SQL, ACE achieves an overall average of 52.9 (+5.1) over the base model.The gains are mainly driven by the Simple subset, where ACE reaches 53.5 (+7.1).
- Text-to-SQL: ACE improves over the BIRD-SQL base model on both Moderate and Challenging splits, although GEPA gains more on those splits.
A.3 FINE-GRAINED COST ANALYSIS
ACE lowers offline adaptation cost through localized updates that avoid GEPA’s repeated validation and full rewrites, while richer evaluation contexts are partly offset by caching.
- Adaptation Stage: 80.8% lower input-token usage and 83.6% lower output-token usage make ACE substantially cheaper than GEPA during AppWorld adaptation.ACE decreases input tokens from 204.1M to 39.3M and output tokens from 1.87M to 0.31M.
- Adaptation Stage: ACE’s adaptation savings come from avoiding GEPA’s prompt-validation loop and replacing full rewrites with localized Generator-Reflector-Curator updates.
- Evaluation Stage: At evaluation, ACE uses more raw input tokens per query because its playbook is richer and more actionable.
- Evaluation Stage: 82.6% lower billed input-token cost results when 91.8% of ACE’s input tokens are served from cache, despite similar output-token usage and comparable rollout counts.
A.4 ROBUSTNESS TO REFLECTION QUALITY
ACE remains effective across substantially different reflector strengths and tolerates moderate harmful or conflicting feedback, with failures emerging only under repeated adversarial corruption.
- Reflector Strength: ACE improves over the base LLM with GPT-OSS-120B, DeepSeek-V3.1-671B, and GPT-5.1 reflectors, although stronger reflectors yield larger gains.
- Noisy Feedback: Performance degrades gradually as harmful reflector updates become more frequent and remains above the base LLM except when corruption occurs every iteration.
- Takeaway and Mitigation: ACE is not highly sensitive to reflector quality: weaker reflectors help, moderate noise is tolerated, and sustained adversarial corruption causes the observed failure condition.
A.5 ABLATION ON INCREMENTAL CONTEXT UPDATE
Incremental context updates are critical to ACE’s AppWorld gains because they preserve useful information that full rewriting would lose through context collapse.
- Ablation Result: Incremental updates account for a large share of ACE’s gains on AppWorld test-normal with DeepSeek-V3.1.
- Mechanism: The updates preserve useful information that would otherwise be lost to context collapse.
A.6 SENSITIVITY ANALYSIS ON HYPERPARAMETER CHOICE
ACE’s performance is generally robust to reasonable hyperparameter choices, while reflection iterations require balancing insight extraction against noisy or unnecessary updates.
- Reflection Iterations: Five reflection rounds provide a good balance on AppWorld, whereas one round under-extracts strategies and ten rounds can degrade performance.
- Deduplication Threshold: FiNER performance changes only mildly across tested deduplication thresholds, indicating robustness to moderate deduplication variation.
- Pruning Trigger: FiNER performance remains stable with pruning triggers from 10K to 100K tokens, as pruning removes stale or harmful fragments while preserving useful context.
- Overall Sensitivity: Reasonable settings of 3-5 reflection rounds, 50-90% deduplication thresholds, and 10K-100K pruning triggers consistently yield strong performance.
- Context Representation: ACE uses a structured Playbook with incremental delta updates, enabling deduplication, targeted refinement, and tracking of entries’ effects on accuracy.