Michael Ryan’s Stanford lecture explains how to choose between improving prompts and training model weights. Recorded on October 21 and published on November 17, it extends the earlier DSPy workflow lecture. The slides make the algorithm walkthroughs easy to revisit.

Optimization needs three things: a working system, representative examples and a metric that scores the behavior you want. Ryan frames it as adapting a general model to a specific task. Calendar extraction, for example, needs precise date formats and rules for ambiguous messages.

What each method changes

  • Bootstrapped examples are successful model runs reused as demonstrations in a prompt. Searching different combinations can improve the program without changing its weights.
  • MIPROv2 searches combinations of instructions and demonstrations. Its proposal model uses the program, training examples and successful runs to write candidate instructions.
  • GEPA uses execution traces and feedback to revise instructions. It keeps candidates that excel on different validation examples, so a useful specialist can survive beside the strongest average performer.
  • Weight training changes the model itself. Supervised fine-tuning learns from example outputs; reinforcement learning rewards the student’s attempts. Distillation transfers a teacher’s behavior to a student.

Ryan recommends considering prompt optimization when a model offers only API access, updates are frequent or task executions are expensive. Weight training becomes attractive when prompts grow too long or a capable teacher can train a smaller model. These are decision criteria, not a guarantee that either method will win.

A correct answer can hide a bad example

During the MIPROv2 discussion, a student asks whether successful reasoning traces are checked. Ryan says the demonstrated approach mainly checks the final answer. A mistaken explanation can therefore become a saved demonstration if the metric accepts its output.

Current MIPROv2 documentation confirms the instruction-and-example search. Current GEPA guidance distinguishes training feedback, validation selection and a final test set untouched by either. Keep those roles separate when adapting the lecture.

Try it

On paper, design an event-extraction metric with separate checks for date correctness, missing information and output format. Write one hypothetical output that passes a weak metric despite being wrong. Specify training, validation and final test splits, then choose an optimization target and a budget covering both task and proposal models.

Caveat: the lecture surveys methods and published results; it does not establish which optimizer will improve your task.

Return to the DSPy learning path.