Lesson 78 — Intermediate
Long-Context Strategies
Bade context windows aane se problem khatam nahi hui — cost aur distraction wahi rehte hain. Is lesson mein strategies ka decision table hai: kab full stuffing, kab retrieval, kab summarization, kab hierarchical layers.
Strategy mindset
WHAT
Data shape dekh ke context strategy choose karna: full stuffing, retrieval-over-history, summarization, hierarchical layers, selective loading — default nahi, decision.
WHEN
Corpus window se bada ya cost-effective nahi, lambi conversations, agent runs jo ghante chalein. Ek fixed answer har shape par nahi chalta.
WHERE
Architecture decision — per workload. Real systems mix karte hain: retrieval + rolling summary + pinned facts ek saath.
Bada window zaroori hai kuch kaamon mein (audit, synthesis), par woh strategy ka replacement nahi — uske bawajood cost aur rot rehte hain.
Bade windows se kya nahi solve hota
"Ab toh window itni badi hai" — yeh argument sunne ko milta hai, par mechanism alag hai:
- Cost per call tokens ke saath badhta hai — bada window = har call par zyada kharcha.
- Lost-in-the-middle hat-ta nahi, beech ka area aur bada ho jaata hai.
- Attention dilute: irrelevant aur stale content ab bhi andar baithe hain.
- Latency badhti hai — chhote fast turns chahiye toh bada window ulta padta hai.
- Contradictions wapas aate hain — jo content tum bhoolna chahte the woh bhi window mein hai.
Decision table
Data shape dekh ke line chuno:
- Chhota corpus, poora fit + simple task → stuffing: seedha daalo, sabse aasan, latency low.
- Bada corpus, point queries → retrieval: dhoond ke laao (L4 ka hybrid search + rerank).
- Lambi history, narrative chahiye → summarization: rolling summary + pinned facts (L6.3).
- Huge archive → hierarchical: chunk → section summaries → top summary, layer by layer.
- Multi-view → selective loading: task ke hisaab se view — sirf code files, sirf emails.
chhota corpus -> stuffing (poora andar)
bada corpus -> retrieval (dhoond ke laao)
lambi history -> rolling summary + pinned facts
huge archive -> hierarchical (layer by layer)
multi-view -> selective loading (task ke hisaab se)
More context vs better context
Yehi daily decision hai — kab poora daalo, kab sirf best:
- More: global picture chahiye — audit, comparison, synthesis, uska pura corpus hi dekho.
- Better: point answer chahiye — extraction, QA; precision matter, noise nahi.
- Measure: same eval set par stuffing vs retrieval run karo (L7 mindset) — andaza nahi, number.
Exercise
Question: Bade corpus ko summary layers mein todo — ek shabd, English?
Question: Point queries ke liye relevant parts dhoond kar laana — ek shabd, English?
Question: Critical instructions context ke kahan rakho — shuru aur ___ ke paas? (ek shabd, English)
Common mistakes
- Bade window = RAG khatam: Cost aur rot wahi rehte hain. Window badhi, strategy nahi toh bill hi badha hai, quality nahi.
- Har kaam par poora stuff: Point tasks mein noise precision gira deta hai — zyada context = zyada distraction, zaroori nahi zyada jawab.
- Strategy on autopilot: Default stuffing bina data shape dekhe. Har workload par decision table se ek baar pass karo.
Chhote syllabus ki ek kitab seedha table par — stuffing. Poore syllabus ka library — index se chapter dhoond ke laao. Poori library table par = na chalega, yehi strategy selection hai.
syllabus chhota -> kitab kholo (stuffing)
syllabus poora -> index se chapter dhoondo (retrieval)
purani notes -> summary + marks points pin karo- Q: Bade windows ke baad bhi context engineering kyun? (cost, rot, middle drop, staleness — sab scale par jaate hain)
- Q: Strategy table batao — kis shape par kaunsi? (stuffing/retrieval/summary/hierarchical/selective)
- Q: More vs better kab? (global synthesis vs point precision — eval se decide, assumption se nahi)
- Q: Lost-in-the-middle ko position se kaise manage? (critical start/end par, middle trim/pin karo)
Strategy decision ab clear hai. Agli lesson: tool-heavy agents mein context kaise kha jaate hain — tool context management.