Stanford CS329A Self-Improving AI Agents | Part 7 | Self-Improvement and Deep Research Agents
Overview
This lecture explores self-improving AI agents, detailing AlphaCode and AlphaCode 2's approaches to competitive programming problem-solving through massive sampling, filtering, and clustering. It then delves into Search-o1 and Agentic RAG for deep research agents, emphasizing iterative retrieval and analysis to overcome knowledge gaps in large reasoning models, contrasting them with simpler retrieval-augmented generation.
Key takeaways
- AlphaCode and AlphaCode 2 significantly advanced AI in competitive programming by employing massive sampling, filtering, and clustering techniques.
- Search-o1 and Agentic RAG improve deep research agents by enabling iterative retrieval, analysis, and integration of external knowledge to overcome LLM knowledge gaps.
- AlphaCode 2 achieved nearly 2x performance gain over AlphaCode by fine-tuning existing LLMs (Gemini Pro) and using a learned scoring model.
- Models often exhibit overconfidence, with probabilities not accurately reflecting correctness, highlighting the need for calibration research.
- Effective deep research agents require more than simple RAG; they need iterative reasoning, document analysis, and the ability to refine searches across multiple turns.
Chapters
- Focus on improving models using search, differentiating between code model sampling and deep research agents.
- AlphaCode and AlphaCode 2 search patterns will be used in homework assignments.
- The core challenge is curating answers from a model's search space.
- Addresses complex coding problems beyond simple autocompletion, aiming for end-to-end solutions.
- AlphaCode ranked in the top 54% of participants in 10 contests, demonstrating AI generalization.
- Differs from human evaluation tasks by requiring problem understanding and reasoning, not just code completion.
- Pre-trained models on GitHub data (700GB) and code contests, using masked language model loss and next token prediction.
- Fine-tuning involved regularization (GOLD) to assign higher probability to meaningful patterns.
- Generated 1 million diverse sample programs per question in Python and C++ using high sampling temperature.
- Filtered samples to those passing provided tests, then clustered them for semantic equivalence.
- Used a separate test input generation model to create new test inputs for unseen problems.
- Submitted a curated subset of solutions to the Codeforces platform for evaluation.
- Achieved an average ranking of 54.3 across 10 competitions, competitive with 28% of participants.
- Variance in performance across different contest IDs is attributed to problem input distribution and selection stage bottlenecks.
- Introduced 10@k metric, measuring submissions from a large sample pool, distinct from pass@k (unlimited attempts).
- Larger models (e.g., 41B parameters) consistently outperform smaller ones (e.g., 9B).
- Increasing the sampling budget (from 1k to 1 million samples) improves performance (10@k).
- Clustering further enhances performance by ensuring diverse solutions are submitted.
- Pass@k measures the percentage of problems solved with k generated samples (unlimited evaluation attempts).
- 10@k measures performance with a fixed number of submissions (10) from a larger sample pool.
- Solve rate scales log-linearly with the sampling budget, even after selection stages.
- Large-scale sampling, filtering, and clustering yield high coverage and novelty.
- Limitations include loss function as a poor proxy for solve rates and weakness in dynamic programming/constructive algorithms.
- Required a large-scale sampling budget, making it computationally expensive.
- Hypothesis: Use existing LLMs (Gemini Pro) instead of pre-training.
- Key changes: fine-tuning Gemini Pro, using multiple AlphaCode 2 models for diverse sampling, and employing a scoring model (reward model) for candidate selection.
- Fine-tuned Gemini Pro on CodeContests V2 and a high-quality scoring dataset.
- Segmented data to fine-tune multiple models for diverse sample generation.
- Split sampling across models, focusing on C++, and randomized temperature/metadata for diversity.
- Filtered out 95% of samples that didn't compile or were incorrect, leaving ~50k samples.
- Aggregated top 10 largest clusters, reranked by a scoring model.
- Achieved a 43% solve rate with 1 million samples, nearly double AlphaCode's 25%.
- High cost of sampling (95% wasted) suggests need for better sampling or prompting.
- Self-refinement (like homework 1) or RL could reduce sampling needs.
- Decomposing complex problems and embedding reasoning (e.g., chain-of-thought) are key for improving model capabilities.
Transcript excerpt
0:05 So today's focus will be very much on improving the models using search. And there can be two kinds of search that we will see. One in code models, where we are sampling a lot and then we are searching based on that, and then deep research style search, which you will see in homework three. So a lot of what we will cover in AlphaCode and AlphaCode 2, those search patterns you will use also in homework. Your homework two is focused on human eval, so this will give you an overview of what to expect in simpler problems and then even more complex problems. And then the agent search, this will be closer to what we will give you in homework three. The broad thing that I want to say with these models
0:55 is that we know that the solutions lie in the search space of the models, but how do you curate the answer out of the search space of what the model outputs is roughly what we are covering today. So let's start with AlphaCode. So the problem we want to solve here is a more complex version of the simple coding agent problem. So if you use a coding agent, what you often get is some form of an autocomplete, where you have a line, and then the coding agent will complete the line for you. So this is closer to a competitive programming problem, where given a competitive programming problem, you're given a problem description
1:42 and then you're given some input and outputs, so you have some a contract in that programming problem, which says that if you give this set of inputs, you should get this set of outputs. And what you want to really solve for is how do we solve these competitive programming problems
This is the start of the transcript. Save this video free for the whole transcript, searchable and time-coded.
Related notes
Summary, takeaways, and chapters were generated by AI from the video's transcript and may contain errors. The video belongs to its creator, Stanford Online.