โกOptimizationยทintermediateยทโฑ๏ธ 30โ45mยทโญ 175 XP
M-033Optimize Context Window Packing for RAG
Description
Nebula Corp's RAG system retrieves 10 chunks but naively concatenates them all, often exceeding the LLM's context window and getting truncated. Important information at the end gets cut off. Implement a smart context packer that: estimates token counts, prioritizes the most relevant chunks, and fits as much high-quality context as possible within the token budget โ without exceeding it.
Targets
Cost Target
โค 50
Quality Target
โฅ 80
Current Cost
100
Current Quality
70
Related Lessons
Click Run / Check to validate your solution