Skip to main content
AmigoFish

LLMs for Agent Builders: Context Engineering | Stanford CS329Z Lecture 2 with Michael Ryan

From Stanford Online · · 1 hr 17 min

The player loads from YouTube only when you click. It uses YouTube's privacy-enhanced mode.

If the video does not play, the owner may have turned off embedding. Watch it on YouTube instead.

Watch on YouTube

Not rated yet

Description

Browse Stanford's online courses in Agentic AI: https://stanford.io/4AIRb2z

Lecture Overview: What do you need to know about how LLMs work to build better AI agents? In this Stanford CS329Z: Engineering AI Agents lecture, Stanford PhD student and DSPy contributor Michael Ryan covers decoding strategies (sampling and temperature), transformer attention (including linear and hybrid attention) and context length, the pretraining-to-post-training pipeline (SFT, RLHF, RLVR), inference (prefill vs. decode and the KV cache) and test-time scaling, structured I/O and constrained decoding, and context engineering, including why stuffing everything into the context window backfires.

Speaker: Michael Ryan

Michael Ryan is a CS PhD student at Stanford University developing human-centered, open-source AI systems that augment human intelligence and reflect the plurality of human values. His contributions to the DSPy open-source project enable developers to optimize multi-stage AI systems, and his algorithms are used for automatic AI prompt optimization at Meta, Google, Dropbox, Amazon, and other organizations.

Chapters: 0:00 Introduction: the LLM stack 3:57 What is a language model? 7:46 Sampling: greedy, top-p, top-k & temperature 16:03 Transformer architecture & self-attention 28:27 Attention vs. recurrence & linear attention 36:01 Pretraining & mid-training 44:21 Post-training: SFT, RLHF & RLVR 47:33 Training LLMs for coding agents 49:11 Q&A: long-horizon data 52:30 Inference: prefill, decode & KV cache 59:56 Reasoning models & test-time scaling 1:04:58 Structured outputs & constrained decoding 1:10:12 Context engineering & context rot 1:16:03 Recursive language models

Course website: https://cs329z.stanford.edu/

Watch the full CS329Z playlist: https://youtube.com/playlist?list=PLPRcF5HR02_U&si=3Z4OYphngcmQ0GIy

Recorded 9/28/2026 in CS329Z: Engineering AI Agents, a graduate course at Stanford University taught by Diyi Yang, Michael Ryan, and John Yang.

#AIAgents #LLM #ContextEngineering

Back to Stanford Online · Report a problem