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

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 Receive SMS online on sms24.me

TubeReader video aggregator is a website that collects and organizes online videos from the YouTube source. Video aggregation is done for different purposes, and TubeReader take different approaches to achieve their purpose.

Our try to collect videos of high quality or interest for visitors to view; the collection may be made by editors or may be based on community votes.

Another method is to base the collection on those videos most viewed, either at the aggregator site or at various popular video hosting sites.

TubeReader site exists to allow users to collect their own sets of videos, for personal use as well as for browsing and viewing by others; TubeReader can develop online communities around video sharing.

Our site allow users to create a personalized video playlist, for personal use as well as for browsing and viewing by others.

@YouTubeReaderBot allows you to subscribe to Youtube channels.

By using @YouTubeReaderBot Bot you agree with YouTube Terms of Service.

Use the @YouTubeReaderBot telegram bot to be the first to be notified when new videos are released on your favorite channels.

Look for new videos or channels and share them with your friends.

You can start using our bot from this video, subscribe now to LLMs for Agent Builders: Context Engineering | Stanford CS329Z Lecture 2 with Michael Ryan

What is YouTube?

YouTube is a free video sharing website that makes it easy to watch online videos. You can even create and upload your own videos to share with others. Originally created in 2005, YouTube is now one of the most popular sites on the Web, with visitors watching around 6 billion hours of video every month.