Skip to main content
Framework

Grow-and-Refine

An expand-first, then-deduplicate context maintenance mechanism

Grow-and-Refine is ACE's second key mechanism: maintaining context with an expand-first, then-refine rhythm, allowing the Playbook to continuously absorb new knowledge without becoming redundantly bloated.

Two Phases

Grow (Expand)

Bullets with new ids are appended directly; existing bullets update counters in place

Refine (Deduplicate)

Compares semantic embeddings to prune duplicate bullets

Trigger Timing

StrategyTriggerSuitable Scenario
ProactiveExecutes immediately after each delta mergeAccuracy-sensitive, requires low-latency refinement
LazyExecutes when context window is about to overflowLatency-sensitive, tolerates occasional redundancy

Deduplication Implementation

Compares bullet content via semantic embedding similarity:
for bullet_new in delta:
  for bullet_old in playbook:
    if cosine_sim(bullet_new, bullet_old) > threshold:
      merge_or_drop(bullet_new)
Deduplication is at the semantic level, independent of LLM judgment, maintaining determinism and reproducibility.

Relationship to Delta Updates

  • Delta updates ensure each modification is minimized
  • Grow-and-Refine ensures no bloat during long-term evolution
Together they support sustained Playbook growth:
New experience → Delta append/update → Grow-and-Refine deduplication → Stable Playbook

Comparison with Full Rewriting

DimensionFull RewriteGrow-and-Refine
Update granularityEntire contextSingle bullet
Information retentionOften loses detailsRetains detailed knowledge
Computational costRegenerates every timeOnly requires embedding + counting
Result stabilityHigh varianceIncremental, predictable

Long Context Does Not Mean High Cost

Production KV cache reuse, compression, and offloading reduce the amortized cost of long context:
  • Identical prefixes can be reused, avoiding repeated prefill
  • Sparsification and quantization compress KV cache
  • KV cache can be loaded from disk/remote storage
This provides engineering feasibility for ACE to use longer Playbooks.
After understanding both mechanisms, see ACE's performance on real benchmarks: Agent Benchmark Results.