Agentic Context Engineering: Evolving Contexts for Self-Improving Language Models | Summary
06 Oct 2025 | Paper Review Context Engineering Agent's Memory Test-Time AdaptationContents
This article explains the key points of Agentic Context Engineering: Evolving Contexts for Self-Improving Language Models.
- 2025-10-06 (arXiv), ICLR 2026
- Zhang, Qizheng, Hu, Changran, Upasani, Shubhangi, Ma, Boyuan, Hong, Fenglu, Kamanuru, Vamsidhar, Rainton, Jay, Wu, Chen, Ji, Mengmeng, Li, Hanchen, et al.
- Stanford University, SambaNova Systems, Inc., UC Berkeley
- Paper
- Github
- Project Page
Summary
- Large language models (LLMs) can lose useful strategies when repeatedly revising their input context, the instructions and knowledge supplied without changing model weights. Using DeepSeek-V3.1 across the principal comparisons, Agentic Context Engineering (ACE), a framework that maintains a structured playbook of reusable strategies, reports average gains of 10.6 percentage points on AppWorld, an interactive coding-agent benchmark, and 8.6 percentage points on financial benchmarks over selected adaptation baselines.
- ACE separates task execution, outcome analysis, and context modification into a Generator that attempts tasks, a Reflector that extracts lessons, and a Curator that proposes additions. It preserves existing entries through localized updates and controls redundancy through grow-and-refine, a mechanism for expanding and periodically refining the playbook; an AppWorld component-removal experiment raises test-normal average performance from 56.9 without incremental updates to 70.3 with them.
- The evidence favors tasks with reusable procedures and reliable feedback: AppWorld adaptation works without ground-truth labels, the reference answers used for supervision, whereas online financial entity recognition without labels falls below the base model. Adaptation can be substantially cheaper, but a separate appendix experiment reports more adaptation rollouts, counted model-generation calls, and more raw evaluation input tokens, so efficiency depends on the experimental and serving conditions.
1 Introduction
The introduction presents context adaptation as modifying instructions, strategies, memory, or factual evidence after model training. These inputs can be inspected, updated at runtime, and shared across model components without changing weights.
- The paper identifies brevity bias, the tendency to replace detailed guidance with short generic instructions, and context collapse, the loss of accumulated information during repeated full-context rewriting.
- Its proposal is to retain detailed strategies in an evolving playbook and let the model select relevant information during execution.
- Figure 1 summarizes selected results: ACE reaches 59.5 on AppWorld, 78.3 on FiNER, a financial numeric entity recognition task, and 76.5 on Formula, a financial numerical reasoning task. These values come from different adaptation conditions.
The panels show selected ACE scores of 59.5 on AppWorld, 78.3 on FiNER, and 76.5 on Formula, each above the displayed baselines. AppWorld uses online ACE without labels, FiNER uses labeled offline ACE, and Formula uses labeled online ACE, so the panels combine different comparison conditions.
2 Background and Motivation
The background connects methods that revise model inputs using natural-language feedback to two failure modes: compression can discard domain detail, and full rewrites can abruptly erase accumulated knowledge. These failures motivate ACE’s itemized representation and incremental update procedure.
2.1 CONTEXT Adaptation
Context adaptation uses execution traces, records of a model’s actions and intermediate results, or validation results to generate textual feedback for revising inputs. The paper situates ACE among Reflexion, which reflects on failures to improve planning; TextGrad, which uses gradient-like textual feedback; GEPA, a Genetic-Pareto prompt optimizer that evolves and selects prompts using reflection; and Dynamic Cheatsheet (DC), an adaptive external memory of strategies and code.
- These approaches adapt behavior through interpretable text while leaving model weights unchanged.
- ACE separates insight extraction from curation and replaces full-context regeneration with localized updates.
2.2 Limitations of Existing CONTEXT Adaptation Methods
Brevity bias can omit specialized rules, tool-use procedures, and failure cases needed for multi-step tasks. The paper demonstrates context collapse through an AppWorld case study in which DC repeatedly rewrites its accumulated context.
- At adaptation step 60, the context contains 18,282 tokens and accuracy is 66.7; at the next step, it shrinks to 122 tokens and accuracy falls to 57.1, below the 63.7 baseline without adaptation.
- The case documents a risk of full-context rewriting, but does not measure how frequently collapse occurs across tasks, models, or independent runs.
The context grows to 18,282 tokens at step 60 before dropping to 122 tokens at the next update. Accuracy falls from 66.7 to 57.1, below the 63.7 result without adaptation, documenting loss of useful accumulated knowledge in the shown AppWorld run.
3 Agentic CONTEXT Engineering (ACE)
The Generator produces task trajectories, sequences of reasoning and actions; the Reflector extracts lessons from successes and errors; and the Curator converts those lessons into structured context additions. Lightweight deterministic logic merges the additions into the existing playbook, preserving entries outside the update.
- The Reflector can refine its analysis over multiple iterations. Offline adaptation, construction of context before test evaluation, can revisit training queries across multiple epochs, or passes through the data.
- Localized updates can be merged in parallel, although the main experiments use batch size 1.
- The partial AppWorld playbook contains relationship-resolution rules, reusable code, and authentication troubleshooting, illustrating the operational details ACE preserves.
The excerpt groups knowledge into strategies and hard rules, useful code snippets and templates, and troubleshooting and pitfalls. Identified entries preserve concrete relationship-resolution rules, artist-aggregation code, and authentication guidance, illustrating the detail retained by the playbook.
Queries and the current playbook feed the Generator; trajectories pass to the Reflector, and extracted insights pass to the Curator. Delta context items update the playbook, while the Reflector can iterate before curation, separating task execution, analysis, and context modification.
3.1 INCREMENTAL Delta Updates
ACE represents context as structured bullets, each containing a unique identifier, counters recording helpful or harmful use, and a small unit of reusable content. Delta contexts, small sets of proposed entry additions or changes, replace regeneration of the entire prompt.
- Identifiers support targeted updates and tracking of which entries helped or misled task execution.
- The paper describes localized editing, retrieval of individual relevant entries, and incremental merging, pruning, and deduplication as benefits of this representation.
- The Generator identifies entries used during a task, providing feedback for the Reflector’s corrective analysis.
3.2 Grow-and-Refine
Grow-and-refine appends bullets with new identifiers and updates existing entries in place, including their counters. Deduplication compares entries through semantic embeddings, numerical representations used to identify similar content, and removes redundant information.
- Refinement can run after each delta or when the context window, the model’s input-length limit, is exceeded.
- The mechanism combines knowledge accumulation with redundancy control while avoiding repeated full-context rewrites.
4 RESULTS
The evaluation examines agent performance, specialized reasoning, component contributions, and adaptation cost. It reports gains of up to 17.1 percentage points over the AppWorld base agent without ground-truth labels and an average adaptation-latency reduction of 86.9% across two highlighted cost comparisons.
- Offline adaptation and online adaptation, updating context after each test prediction, are evaluated separately.
- The financial experiments qualify the claim of effective adaptation without labels by showing failures when feedback is unreliable.
4.1 TASKS and Datasets
AppWorld evaluates autonomous agents that understand application programming interfaces (APIs), interfaces for calling application functions, generate code, and interact with applications on test-normal and test-challenge splits. Financial evaluation uses FiNER, which labels financial-document tokens with one of 139 entity types, and Formula, which applies financial concepts and computations; both involve eXtensible Business Reporting Language (XBRL), a financial reporting format.
- AppWorld reports Task Goal Completion (TGC) and Scenario Goal Completion (SGC), its task-level and scenario-level completion measures, on both test splits.
- FiNER, Formula, and DDXPlus, a medical diagnosis benchmark, use exact-match accuracy. BIRD-SQL evaluates text-to-SQL, generation of Structured Query Language database queries from natural language, using GPT-4o-mini as an LLM-as-a-judge, a model that assesses generated answers.
- Datasets retain their original train/validation/test splits. Offline methods optimize on training data and report pass@1, accuracy from one attempt; online methods predict first and update afterward on the same shuffled test sequence.
4.2 Baselines and Methods
The baselines include the unadapted model, In-Context Learning (ICL), which supplies task demonstrations in the input, MIPROv2, a joint optimizer of instructions and demonstrations, GEPA, and DC in cumulative mode (DC-CU), which rewrites accumulated memory. AppWorld methods share the official ReAct implementation, an agent framework combining reasoning and action.
- ICL uses all training demonstrations when they fit, or as many as the context window permits. MIPROv2 uses Bayesian optimization to select candidate instructions and demonstrations; it and GEPA use official DSPy prompt-optimization implementations with auto=”heavy”.
- ACE uses non-thinking DeepSeek-V3.1 for all three roles, avoiding knowledge transfer from a stronger Reflector or Curator to a weaker Generator.
- Main ACE experiments use batch size 1, at most 5 Reflector refinement rounds, and at most 5 offline adaptation epochs.
4.3 RESULTS on AGENT Benchmark
With DeepSeek-V3.1-671B, offline ACE with ground-truth labels reaches an AppWorld average of 59.4, compared with 42.4 for ReAct, 46.0 for ICL, and 46.4 for GEPA. Offline ACE without labels reaches 57.2, while online ACE without labels reaches 59.5 versus 51.9 for DC-CU.
- The online 59.5 result includes offline warmup, initialization of the playbook before online adaptation; the separate ablation reports 56.1 without warmup.
- Online ACE reaches test-challenge TGC/SGC of 66.0/48.9, but its test-normal SGC of 53.6 is lower than DC-CU’s 58.9. The aggregate advantage does not extend to every metric.
- The September 20, 2025 leaderboard reference places IBM CUGA at 60.3 overall, compared with offline ACE’s 59.4. The paper treats CUGA as a contextual reference rather than a controlled methodological baseline; the scores indicate a similar performance range, not equality.
The shared DeepSeek-V3.1-671B comparison shows offline ACE averages of 59.4 with labels and 57.2 without labels, versus 46.4 for GEPA. Online ACE reaches 59.5 versus 51.9 for DC-CU, with higher test-challenge scores but lower test-normal scenario completion; Table 3 identifies offline warmup as part of the 59.5 condition.
4.4 RESULTS on DOMAIN-Specific Benchmark
With labels, offline ACE achieves 78.3 on FiNER and 85.5 on Formula, averaging 81.9 versus 72.5 for GEPA and 69.1 for the base model. Online ACE with labels averages 76.6 versus 71.8 for DC-CU, while online ACE without labels averages 72.9 versus 65.4 for DC-CU without labels.
- Online ACE without labels falls to 67.3 on FiNER from the base model’s 70.7, while Formula rises from 67.5 to 78.5.
- The authors attribute degradation to misleading signals entering the context when supervision or reliable execution outcomes are unavailable.
- Additional offline experiments evaluate medical diagnosis and text-to-SQL, with conditions and results in A.2.
Labeled offline ACE averages 81.9 across FiNER and Formula, compared with GEPA's 72.5. Online ACE without labels improves Formula to 78.5 but reduces FiNER to 67.3 from the 70.7 base score, showing that the same adaptation procedure can help or harm depending on the task and feedback.
4.5 GENERALIZATION ACROSS Llms
The paper replaces all three ACE role models with GPT-OSS-120B, GPT-5.1, or Llama-3.3-70B-Instruct without changing the algorithm or prompts. The reported results improve over the corresponding base models, with gains varying by model, task, and supervision condition.
- On AppWorld, GPT-OSS-120B rises from 34.6 to 42.2 with online ACE; GPT-5.1 rises from 54.2 to 65.8 on test-normal.
- On FiNER, Llama-3.3-70B-Instruct improves from 62.5 to 64.9 with labeled offline ACE and to 63.6 with online ACE without labels.
- Online ACE has the highest AppWorld averages in these tables, but labeled offline ACE performs better in the financial tables. The appendix’s broader claim that online ACE is strongest across all models therefore needs this task and supervision qualification.
4.6 ABLATION Study and SENSITIVITY ANALYSIS
AppWorld ablations, experiments that remove components to measure their contributions, support benefits from reflection, multiple adaptation epochs, and offline warmup. Offline average performance is 55.1 without both the Reflector and multiple epochs, 56.8 without multiple epochs, and 59.4 with full ACE; online warmup raises the average from 56.1 to 59.5.
- A.5 directly evaluates incremental updates: test-normal average performance is 56.9 without them and 70.3 with them.
- FiNER remains above its 70.7 base accuracy with a weaker Reflector and intermittently harmful updates, but harmful reflection at every adaptation step lowers accuracy to 66.7.
- The tested hyperparameters, settings controlling adaptation, favor 5 reflection rounds by AppWorld average performance and yield closely grouped FiNER scores for context-length triggers from 10K to 100K tokens. These results establish sensitivity within the tested ranges.
Offline averages rise from 55.1 without the Reflector and multiple epochs to 56.8 with the Reflector but no multiple epochs, and to 59.4 with full ACE. Offline warmup raises the online average from 56.1 to 59.5, clarifying a condition behind the headline online result.
4.7 COST and Speed ANALYSIS
Table 4 reports offline AppWorld adaptation latency of 9,517 s for ACE versus 53,898 s for GEPA, an 82.3% reduction, and 357 versus 1,434 rollouts, a 75.1% reduction. For online FiNER, ACE takes 5,503 s versus DC-CU’s 65,104 s and costs $2.9 versus $17.7 in tokens, reductions of 91.5% and 83.6%.
- The separate A.3 analysis uses 1 epoch and 1 Reflector round. It reports 80.8% fewer adaptation input tokens and 83.6% fewer output tokens, but 2,075 ACE rollouts versus 1,455 GEPA rollouts. The PDF does not reconcile these rollout counts with Table 4.
- At evaluation, ACE uses 58,623,267 raw input tokens versus GEPA’s 26,960,675, a 117.4% increase, while rollouts fall from 2,470 to 2,354.
- In the GPT-5.1 prompt-caching study, 91.8% of ACE input tokens are served from cache, reducing billed input-token cost by 82.6% relative to charging all raw tokens at the uncached rate. KV cache reuse, reuse of previously computed attention keys and values, helps explain the serving benefit; the 82.6% figure is not a cost reduction against GEPA.
Offline AppWorld adaptation latency falls from 53,898 s to 9,517 s and rollouts from 1,434 to 357. In the separate online FiNER comparison, latency falls from 65,104 s to 5,503 s and token cost from $17.7 to $2.9. These measurements concern adaptation under the stated tasks and baselines, rather than total serving cost.
5 Discussion
The discussion proposes context adaptation for online and continual learning, updating behavior as experience accumulates. Human-readable entries also permit selective unlearning, removal of particular outdated or incorrect knowledge, which the authors discuss as a future direction without evaluating it experimentally.
- ACE depends on models extracting useful insights from trajectories or outcomes. Failed reflection can create noisy or harmful context.
- The authors identify detailed domain knowledge, complex tool use, and environment-specific procedures as favorable settings.
- Tasks needing concise retrieval guidance or one reusable strategy may benefit less from a large playbook. HotPotQA, a question-answering benchmark requiring evidence from multiple sources, and Game of 24, a fixed-strategy arithmetic game, are discussion examples rather than additional ACE evaluations.
Ethics Statement
The ethics statement declares no specific ethical concerns or conflicts of interest and states that experiments use public benchmarks without human subjects, sensitive data, or privacy-related information. Its description of all experimental models as open-source does not account for the extended GPT-5.1 experiments.
Reproducibility Statement
The authors provide code at https://github.com/ace-agent/ace and describe datasets, evaluation metrics, baselines, and hyperparameters. Extended experiments and role prompts appear in the appendix, documenting the adaptation procedure and experimental settings.
Appendix
- A EXTENDED RESULTS and A.1 GENERALIZATION ACROSS DIFFERENT LLMS provide model-specific tables. GPT-OSS-120B financial accuracy averages 81.2 with labeled offline ACE versus 69.7 for GEPA; GPT-5.1 averages 82.8 versus 73.8. Llama-3.3-70B-Instruct shows smaller FiNER gains, and GPT-5.1 AppWorld results cover test-normal only, limiting comparison with the four-metric DeepSeek-V3.1 average.
- A.2 BEYOND FINANCE: ADDITIONAL DOMAIN TASKS uses 1000 randomly sampled training examples for both ACE and GEPA. GEPA additionally uses 500 validation examples for BIRD-SQL or 372 for DDXPlus. DDXPlus accuracy is 75.2 for the base model, 76.4 for GEPA, and 90.2 for ACE; BIRD-SQL overall scores are 47.8, 52.2, and 52.9, respectively, although GEPA outperforms ACE on the Moderate and Challenging subsets.
- A.3 FINE-GRAINED COST ANALYSIS separates adaptation from evaluation using 1 ACE epoch and 1 Reflector refinement round. Adaptation input/output totals are 39,250,925/307,128 for ACE versus 204,076,096/1,870,188 for GEPA, while rollout totals are 2,075 versus 1,455. During evaluation on 160 queries, ACE uses more raw input tokens and slightly more output tokens than GEPA, making caching conditions material to serving-cost interpretation.
- A.4 ROBUSTNESS TO REFLECTION QUALITY fixes the Generator and Curator to DeepSeek-V3.1 and changes the Reflector: FiNER accuracy is 76.6 with GPT-OSS-120B, 78.3 with DeepSeek-V3.1, and 78.5 with GPT-5.1, versus 70.7 for the base model. Harmful reflection every 5, 10, 25, 50, or 100 steps yields 76.1, 77.0, 77.8, 78.2, or 78.2, respectively; corruption every step yields 66.7. Additional safeguards, including contradiction detection and prioritization of high-confidence updates, are proposed extensions rather than evaluated components.
- A.5 ABLATION ON INCREMENTAL CONTEXT UPDATE evaluates offline DeepSeek-V3.1 on AppWorld test-normal. Without incremental updates, TGC/SGC are 67.3/46.4; with them, they are 76.2/64.3, compared with ReAct’s 63.7/42.9. The averages are 56.9 without incremental updates and 70.3 with them.
- A.6 SENSITIVITY ANALYSIS ON HYPERPARAMETER CHOICE reports AppWorld test-normal averages of 61.3, 65.8, 67.6, and 65.2 for 1, 3, 5, and 10 reflection iterations. FiNER accuracy is 77.0, 73.9, and 78.6 at deduplication thresholds of 50%, 70%, and 90%, and 78.6, 78.4, and 78.3 at pruning triggers of 10K, 50K, and 100K tokens. Pruning results are tightly grouped, while deduplication results span 4.7 percentage points.
- B EXTENDED RELATED WORK and B.1 AGENT MEMORY position ACE alongside AgentFly, continuously evolving agent memory; Agent Workflow Memory (AWM), reusable routines extracted from trajectories; A-MEM, linked and structured memory entries; and Agentic Plan Caching, cached reusable plans. ACE’s stated scope includes system prompts and factual evidence as well as agent memory, with evaluation of accuracy, latency, and cost.
- C EXTENDED DISCUSSIONS compares update representations in C.1 ACE VS. GEPA and C.2 ACE VS. DYNAMIC CHEATSHEET (DC). GEPA evolves and selects complete prompt candidates, DC rewrites a cheatsheet, and ACE emits localized additions merged into an itemized playbook. C.2’s reported 11.7% TGC and 27.8% SGC reductions when removing incremental updates are relative reductions from Table 18’s 76.2 to 67.3 and 64.3 to 46.4, not percentage-point differences.
- D APPWORLD LEADERBOARD SNAPSHOT (09/2025) records the historical leaderboard used for the contextual IBM CUGA comparison, available at https://appworld.dev/leaderboard. E THE USE OF LARGE LANGUAGE MODELS (LLMS) states that LLMs were used in experiments and to polish manuscript writing, without generating manuscript text from scratch.
- F PROMPTS documents the ICL, DC, GEPA, and ACE AppWorld prompts, followed by ACE Generator, Reflector, and Curator prompts captioned for FINER. The templates specify playbook insertion, diagnosis using execution feedback or ground truth, helpful/harmful/neutral entry tags, and structured ADD operations that create new entries. They document communication between roles and additions that avoid full-playbook regeneration.
Brief Thoughts
The clearest contribution is the context update representation: independently addressable entries have direct support from the incremental-update ablation, while the shared model makes the principal baseline comparisons informative. The evidence favors tasks with repeatable procedures and observable outcomes; the FiNER regression without labels makes feedback quality a central implementation concern.
Efficiency requires separate accounting for adaptation and serving. Table 4 reduces rollouts, A.3 increases them, and evaluation consumes substantially more raw input tokens; the caching benefit depends on the reported serving setup. The displayed result tables provide no uncertainty intervals or repeated-run variation, limiting assessment of small score differences.