Week 10 — Context Engineering · Memory

Material Where
Lecture notes Chapter 9 · Context Engineering. Chapter 10 · Memory follows separately.
Lab LangGraph: Stored State and Model Context — notebook · Browser preview. Download and upload to Colab.
Papers Lost in the Middle (Liu et al., 2023) (PDF) · LLMLingua (Jiang et al., 2023) (PDF) · MemGPT (Packer et al., 2023) (PDF) · Mem0 (2025) (PDF)

This week

Chapter 9 follows four questions: what is in the model’s context, why does that input need management, how do selection, structuring, and compression change it, and how is the input updated and checked across calls? Lost in the Middle distinguishes input capacity from successful information use. One short input comparison shows the three management operations in sequence. Anthropic’s diagrams support clear instructions and the repeated construction of context. The final section connects these principles to the LangGraph lab; LLMLingua’s algorithm is developed in the paper presentation.

Chapter 10 will develop memory storage, retrieval, and update, including MemGPT and Mem0.

Lab plan

In approximately 80 minutes, continue the Academy arithmetic conversation with a checkpointer, compare stored messages with selected model input, create a running summary, and apply these operations to a small document-QA graph. The notebook contains its data and functions and uses your model API key. Compare full history, recent history, and a summary while holding the evidence fixed.

The complete notebook was checked with scripted model responses; live API answer quality has not been measured for this release. Read the actual requests and results when you run it. Sources and adaptations.