
Shervine Amidi
Shervine Amidi is an adjunct professor at Stanford University’s Institute for Computational and Mathematical Engineering, where he teaches courses on transformers, large language models, and diffusion models. He co-authors AI study guides and has worked on large language model initiatives in industry.
AI Agents Depend on Retrieval, Tool Use, and a System Harness
AI agents do more than generate plausible responses: they need retrieval to supply relevant information, tools to take action, and a harness to manage context, memory, and execution. In Stanford CME295, adjunct professors Afshine Amidi develops the retrieval account, while Shervine Amidi explains tool use and the surrounding system that lets a model act on a task and use the results.
LLM Systems Trade Memory, Compute and Communication Across Training and Inference
Stanford adjunct professors Afshine and Shervine Amidi argue that building and serving large language models is as much a memory-management problem as a compute problem. Their lecture explains how techniques such as FlashAttention, GPU parallelism and KV-cache optimizations address different bottlenecks, while often trading lower memory use for added communication or computation. The central constraint, they say, is to make models fit and run efficiently without leaving costly hardware underused.
PPO, GRPO, and Distillation Trade Off Credit Assignment and Training Cost
Stanford adjunct professors Afshine and Shervine Amidi compare three post-training methods by how they provide feedback and what training resources they require. PPO uses a learned value function to estimate token-level advantages; GRPO replaces it with comparisons among sampled answers, applying the same completion-level score across tokens in its common outcome-supervised form. On-policy distillation instead compares the student’s predictions on its own generated text with a teacher’s next-token predictions, providing token-level feedback but requiring a teacher.
LLM Training Moves From Next-Token Prediction to Preference and Reasoning
Stanford adjunct professors Shervine and Afshine Amidi argue that training an assistant requires more than teaching a language model to predict the next token. In their account, pretraining builds broad language and code capabilities; midtraining, supervised fine-tuning and preference or reinforcement-learning methods then shape what the model answers and how it behaves. A central challenge is matching each stage’s data and feedback to its goal while controlling costs, long-context demands and the risk of losing capabilities learned earlier.
LLM Design Trades Model Capacity Against Compute Per Token
Large language model design is a question of how to spend computation, not simply how many parameters a model has. In Stanford’s CME295 lecture, adjunct professor Afshine Amidi uses training budgets, sparse expert routing and attention mechanisms to show how designers allocate work across a model and its tokens; decoding choices, in turn, shape how the model generates answers. The distinction is between a model’s total capacity and the computation it uses for each token.
The Transformer Replaced Recurrence With Direct Attention Between Tokens
In the opening lecture of Stanford’s CME295 course on transformers and large language models, adjunct professors Afshine and Shervine Amidi explain how the Transformer offered an alternative to recurrent models. They argue that its use of attention let tokens connect directly across a sequence, rather than relying on a recurrent state to carry information forward one step at a time, and helped put language modelling on a more scalable path.
On-Policy Distillation Trains LLMs on Their Own Generated Responses
Stanford adjunct professors Shervine and Afshine Amidi argue that pretraining gives large language models broad text-prediction ability, but not necessarily the capacity to follow instructions, reason reliably, or work in specialized domains. They position fine-tuning, reinforcement learning, preference optimization, verifier-guided training and distillation as post-training methods for shaping that capability, highlighting on-policy distillation because it lets a stronger teacher assess answers the student model generates itself.
Open Image Models Converge on Flow Matching and DiT Architectures
Stanford adjunct lecturer Shervine Amidi uses Lecture 8 of CME296 to argue that modern visual generation is best understood as a stack of choices for transporting noise into data: the paradigm, representation, architecture, training procedure, and evaluation method. He presents flow matching as the current default for image-generation systems, diffusion transformers as the dominant architectural direction, and latent spaces as a practical compression tradeoff now being challenged by scaled pixel-space models.
Text-to-Image Evaluation Requires Metrics Matched to Specific Failure Modes
Stanford adjunct lecturers Afshine Amidi and Shervine Amidi argue that evaluating text-to-image models starts with separating aesthetic quality from prompt adherence, then choosing metrics suited to the failure being tested. In Lecture 7 of Stanford’s CME296 course on diffusion and large vision models, they treat human ratings, FID, CLIPScore, reference-based measures, multimodal judges, and benchmarks as imperfect instruments rather than substitutes for a universal image-quality score. Their central warning is practical: automated and qualitative evaluations can be useful, but only when their assumptions, calibration, and failure modes are made explicit.
Text-to-Image Training Is Becoming a Problem of Signal Allocation
Stanford adjunct lecturers Shervine Amidi and Afshine Amidi present text-to-image model training as a problem of allocating scarce learning signal across the full model lifecycle, not simply choosing a diffusion or flow-matching loss. In Lecture 6 of Stanford’s CME296 course, they argue that practical training depends on emphasizing hard timesteps, adjusting for resolution, using data curricula and representation alignment, then applying post-training, personalization, and distillation methods to improve control and reduce inference cost.