Compare sliding-window history with rolling-summary history
Same topic, related formats. Practice these next.
Same topic, related formats. Practice these next.
Sliding window is cheap and deterministic but drops everything past its cutoff; rolling summary keeps long-range continuity at LLM-call cost and risks detail drift.
Picture two ways to remember a long phone call with a friend. Option one: only remember the last five minutes word for word, forget anything before. Option two: keep a rough summary of the whole call updated in your head, plus the last five minutes word for word. Option one is fast and lazy but you lose anything the friend said early in the call, like the address they wanted you to visit. Option two preserves the big picture but the summary gets blurrier each time you update it, and exact details quietly disappear. Most production chatbots cheat: they run option two, plus they jot the address down separately in a notebook so it never gets lost.
Everything you need to truly understand this topic: intuition, mechanics, step by step explanation, code, formulas, and worked example. Click to expand.
Everything you need to truly understand this topic: intuition, mechanics, step by step explanation, code, formulas, and worked example.
Everything important, quickly.
Define both techniques in one sentence each. Walk through the trade-off: simplicity and determinism versus long-range preservation. Cover the failure modes of each. Explain the three-layer production composition. Close with the observability triage that maps failures to layers.
| Property | Sliding window | Rolling summary |
|---|---|---|
| Per-turn LLM cost | Zero (just generation) | Adds summarizer call on refresh |
| Determinism | Fully deterministic | Depends on summarizer model |
| Long-range info | Lost beyond N turns | Preserved at lower fidelity |
| Exact numerics | Preserved within window, lost outside | Drift on every refresh |
| Code/structured artifacts | Preserved within window, lost outside | Paraphrased away |
| Failure shape | Hard cutoff | Soft drift |
| Implementation complexity | Trivial | Moderate (prompt design matters) |
Real products, models, and research that use this idea.
What an interviewer would ask next. Try answering before peeking at the approach.
Red flags and common mistakes that signal junior thinking. Click to expand.
Treating sliding window and rolling summary as mutually exclusive choices. The 2026 production default uses both, plus an extracted-fact store for durable specifics.
The night-before-the-interview bullets. Scan these on the way to the call.
Primary sources. Skim if you want the original framing.