Agentic Context Engineering (ACE): A Context Evolution Framework for Self-Improving LLMs
1. Introduction
LLM applications (agents, domain-specific reasoning) increasingly rely on context adaptation — improving performance by modifying inputs (instructions, policies, evidence) rather than updating weights. Existing methods suffer from two recurring problems:
- Brevity bias: optimization collapses into short, generic prompts that discard domain-specific insights (e.g., iterative prompt optimizers repeatedly converging on near-identical generic instructions).
- Context collapse: when an LLM fully rewrites accumulated context each adaptation step, it tends to compress it into shorter, less informative summaries. In an AppWorld case study, a context of 18,282 tokens at 66.7% accuracy collapsed to 122 tokens at 57.1% accuracy in a single step — worse than the 63.7% no-adaptation baseline.
- Generator: produces reasoning trajectories for new queries.
- Reflector: critiques trajectories to extract concrete lessons from successes and errors.
- Curator: synthesizes lessons into compact incremental entries merged deterministically into the existing context via lightweight, non-LLM logic.
- ACE improved accuracy by up to +17.1% without ground-truth labels.
- ReAct + ACE (59.4%) matched the top-ranked IBM CUGA (60.3%, GPT-4.1-based) on the leaderboard; with online adaptation it exceeded CUGA on the harder Test-Challenge split (+8.4% TGC).
- ACE outperformed strong baselines by an average of +10.9% (offline) and beat DC by +6.2% (online).
- AppWorld offline: vs GEPA, -82.3% adaptation latency, -75.1% rollouts.
- FiNER online: vs DC, -91.5% latency, -83.6% token dollar cost.
- Longer context ≠ higher serving cost: KV-cache reuse, compression, and offloading make long-context serving increasingly cheap, so rich evolving playbooks remain practical.
- Online and continual learning: context adaptation is cheaper than weight updates, and since context is human-interpretable, ACE enables selective unforgetting for privacy, legal, or correctness reasons.
2. The ACE Framework
ACE treats context as an evolving playbook, built on the agentic design of Dynamic Cheatsheet, with structured division of labor among three roles:
Generator → Reflector → Curator → Context Playbook
#### Incremental Delta Updates
Context is represented as structured, itemized bullets with metadata (unique IDs, counters of helpful/harmful usage). This enables: 1. Localization — only relevant bullets are updated 2. Fine-grained retrieval — the generator focuses on the most relevant knowledge 3. Incremental adaptation — efficient merging, pruning, and deduplication; deltas can be merged in parallel
#### Grow-and-Refine
New bullets are appended and existing ones updated in place; a deduplication step compares bullets via semantic embeddings to prune redundancy. Refinement can be proactive (after each delta) or lazy (only when the context window is exceeded).
3. Experimental Results
Evaluated with the same LLM (DeepSeek-V3.1, non-thinking mode) for all roles, against baselines including Base LLM, ICL, MIPROv2, GEPA, and Dynamic Cheatsheet (DC).
Agent benchmark (AppWorld):
| Method | Ground Truth | Avg | |---|---|---| | ReAct | - | 42.4 | | ReAct + ICL | ✓ | 46.0 | | ReAct + GEPA | ✓ | 46.4 | | ReAct + ACE | ✓ | 59.4 | | ReAct + ACE | ✗ | 59.5 (with offline warmup) |
Domain-specific benchmarks (FiNER, Formula — XBRL financial reasoning):
| Method | Ground Truth | FiNER | Formula | Avg | |---|---|---|---|---| | Base LLM | - | 70.7 | 67.5 | 69.1 | | GEPA | ✓ | 73.5 | 71.5 | 72.5 | | ACE | ✓ | 78.3 | 85.5 | 81.9 | | ACE | ✗ | 71.1 | 83.0 | 77.1 |
Ablations confirmed that the Reflector with iterative refinement, multi-epoch adaptation, and offline warmup each contribute significantly.
Cost and speed:
4. Discussion
5. Conclusion
ACE resolves brevity bias and context collapse by evolving context as a comprehensive, itemized playbook through modular generation, reflection, and curation, delivering large accuracy gains in agentic and domain-specific tasks while substantially reducing adaptation latency and deployment cost.
> "Context should be a comprehensive, evolving playbook — detailed, inclusive, and rich with domain insights — rather than a terse summary."