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.
Compares bullet content via semantic embedding similarity:
Production KV cache reuse, compression, and offloading reduce the amortized cost of long context:
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
| Strategy | Trigger | Suitable Scenario |
|---|---|---|
| Proactive | Executes immediately after each delta merge | Accuracy-sensitive, requires low-latency refinement |
| Lazy | Executes when context window is about to overflow | Latency-sensitive, tolerates occasional redundancy |
Deduplication Implementation
Compares bullet content via semantic embedding similarity:
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
Comparison with Full Rewriting
| Dimension | Full Rewrite | Grow-and-Refine |
|---|---|---|
| Update granularity | Entire context | Single bullet |
| Information retention | Often loses details | Retains detailed knowledge |
| Computational cost | Regenerates every time | Only requires embedding + counting |
| Result stability | High variance | Incremental, 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