Stanford Online

Stanford CS329A Self-Improving AI Agents | Part 4 | Learning from Feedback with Tools/Code

Published 2026-08-03 · Duration 1:11:13

Summary

This lecture details three advanced methodologies for building self-improving AI agents: ReAct, RLEF, and Constitutional AI. These techniques enable Large Language Models (LLMs) to move beyond simple text generation by incorporating external feedback loops—whether through environment interaction, code execution results, or self-critique. For build engineering, the core takeaway is that robust agentic behavior requires structured methods for grounding reasoning in real-world data and iterative refinement using test feedback.

Download summary

Key takeaways

  1. ReAct: Combining Reasoning and Action 0:03

    The ReAct framework combines Chain-of-Thought (reasoning) with tool-calling actions, creating an interleaved loop (thought $ ightarrow$ act $ ightarrow$ observe). This allows models to ground their reasoning in external knowledge sources, improving performance on tasks like HotpotQA and WebShop. [0:03]

  2. RLEF: Grounding Code LLMs via Execution Feedback 0:12

    RLEF is an end-to-end RL fine-tuning framework for coding agents that uses execution feedback (test pass/fail) as a binary reward signal. It employs a two-tier test strategy, using public tests for inference-time guidance and private tests for training the policy model via PPO. [0:12]

  3. Constitutional AI: Self-Correction through Principles 0:15

    This method improves LLMs by having them critique their own outputs against a set of human-written principles (the 'Constitution'). This generates feedback for training the model's preference model, reducing reliance on constant human labeling. [0:15]

Technical details

  • ReAct Architecture 3s

    The ReAct abstraction facilitates a loop where reasoning traces are generated (left loop) and actions are taken based on those thoughts (right loop). This is crucial for tasks requiring real-world grounding, such as fact-checking (FEVER) or web interaction (WebShop). [0:03]

  • RLEF Training Loop 12s

    The framework uses an iterative feedback cycle where the model generates code $ ightarrow$ public tests provide immediate execution feedback $ ightarrow$ the LLM attempts to fix the solution $ ightarrow$ a private test set determines the final reward for PPO training. This separation prevents overfitting to public test outputs. [0:12]

  • Constitutional AI Process 15s

    The process involves three stages: (1) Supervised fine-tuning on self-critique/revision traces; (2) Training a preference model using the Constitution principles; and (3) Fine-tuning the LLM to maximize adherence to these principles, achieving better helpfulness/harmlessness trade-offs. [0:15]

Mentioned resources

  • HotpotQA (Task Benchmark)
  • FEVER (Task Benchmark)
  • WebShop (Task Benchmark)
  • CodeContests (Benchmark/Dataset)

Channel & topics

Watch on YouTube · Back to latest

This independent, AI-assisted summary is provided for commentary and informational purposes. It may contain errors or omit important context. Please watch the original video for the creator's complete presentation. Video, thumbnail, and related copyrights belong to their respective owners.