Stanford CS329A Self-Improving AI Agents | Part 2 | Test-Time Compute Scaling
Overview
Azalia Mirhoseini explains how test-time compute can improve LLM performance without changing model weights, from parallel sampling and verifier-guided search to sequential revision. The lecture covers the power-law scaling found in Large Language Monkeys, the generation-verification gap, outcome and process reward models, and Arkon, an inference-time architecture search system that improved pass-at-one accuracy by an average of 14.1% over GPT-4 and Claude 3.5 Sonnet on reasoning, math, and coding tasks.
Key takeaways
- Parallel sampling can raise coverage according to a power law because benchmarks contain a long tail of problems that models solve only rarely; the same pattern appears across model sizes from 70 million to 70 billion parameters.
- Best-of-N generation only pays off when a selector can find rare correct answers; majority voting and learned rankers often miss solutions that appear just once among thousands of samples.
- Verification is domain-dependent: formal proof tools, coding unit tests, and output-equivalence checks for PyTorch and CUDA can make test-time scaling much more reliable.
- Process reward models can guide beam search by scoring solution steps, while outcome reward models score completed answers; combining these with parallel sampling and sequential revision offers multiple ways to allocate inference compute.
- Additional test-time compute can be more effective than pre-training for easy and medium problems, but larger, more heavily pretrained models still tend to lead on the hardest problems.
- Arkon searches combinations of models and inference operations such as generation, critique, ranking, fusion, and unit-test evaluation, achieving a reported 14.1% average pass-at-one improvement over GPT-4 and Claude 3.5 Sonnet.
Chapters
- Azalia Mirhoseini frames LLM development as pre-training, fine-tuning, and inference, with inference-time methods improving outputs without changing model parameters.
- Pre-training may take months and large GPU clusters, while fine-tuning typically uses far less data and compute.
- The lecture focuses on spending more inference compute to make existing models more useful without additional training.
- The Large Language Monkeys approach samples the same problem repeatedly, then uses a verifier to choose a correct response.
- For coding tasks such as SWE-bench, DeepSeek-V3 can solve more problems after 1,000 samples than models such as Claude 3.5 or o1-preview in the cited comparison.
- Repeated sampling can let smaller or open models approach or surpass stronger models when a reliable selector, such as unit tests, is available.
- Coverage, the fraction of problems solved by at least one sample, follows a power-law relationship with the number of parallel samples.
- Fitted curves predict how many samples and how much compute are needed to reach a target coverage across models ranging from 70 million to 70 billion parameters.
- The power law arises from a long tail of difficult problems with very low pass-at-one probability, even when easier problems are usually solved on the first attempt.
- Formal proof software can check mathematical proofs, while coding tasks can use unit tests as correctness filters.
- For AI-generated CUDA kernels, comparing outputs against the source PyTorch implementation provides a practical equivalence check; KernelBench measures this kind of code generation.
- Language translation between Python, C++, and Java can also be tested by comparing program behavior across inputs.
- Majority voting and learned rankers can fall far short of ideal coverage because correct answers to hard problems may appear only once or a few times among 1,000 or 10,000 samples.
- The generation-verification gap is the difference between how many correct answers a model generates and how many a selector can identify.
- Verifier quality is critical: weak unit-test coverage can accept flawed software, and manual checks of math answers still leave room for verification errors.
- Discussion identifies research directions including combining verifiers, rejecting demonstrably bad answers, and using simulations or tools when exact verification is expensive.
- Parallel sampling generates independent candidate answers, while sequential revision repeatedly improves an initial solution from different angles.
- Outcome reward models score final answers; process reward models score individual reasoning steps and can guide a beam search that expands promising branches.
- A beam-search example samples four candidates per level, uses a process reward model to retain the top two, and then expands those candidates.
- Combining parallel candidates with sequential revision and reward-model selection can improve results, but the best strategy depends on the task and compute budget.
- A cited math study used a 12,000-example training set and 500 test questions, grouping problems into five difficulty bins based on pass-at-one performance.
- Easy problems benefited more from sequential tokens in the reported experiments, while optimal sequential-to-parallel allocation was less clear for the hardest bins.
- Test-time compute can be more favorable than additional pre-training for easy and medium problems, but larger frontier models retain an advantage on the hardest tasks.
- The practical choice depends on repeated inference costs versus the high one-time cost of pre-training, which is inaccessible to many teams.
- Arkon treats inference-time scaling as a design problem: combine available LLMs and inference techniques to maximize answer quality under a call or token budget.
- Its itest optimizer searches over architectures using target benchmarks, candidate models, inference methods, and a held-out evaluation set.
- The framework includes generation, fusion, critique, ranking, verification, and unit-test generation and evaluation as composable operations.
- Fusion gives an LLM the original question plus multiple candidate answers and asks it to synthesize a stronger final response.
- In the reported comparison, fusion improved answer quality beyond oracle selection, which assumes a perfect verifier can identify the best candidate.
- Filtering candidates with a ranker before fusion performed better than fusing all responses directly in the shown experiment.
- The same broad pattern held when candidates came from an ensemble of different models rather than repeated calls to one model.
- For a coding task that checks balanced parentheses, a model can generate tests for odd bracket counts and for matching each closing bracket to the most recent unmatched opening bracket.
- Arkon discovered architectures that combine generation, critique, ranking, and fusion, with multiple stages processing candidates before a final response.
- For coding benchmarks, optimized systems could generate many candidate solutions, create unit tests, and evaluate the candidates against those tests.
- Adding carefully chosen inference layers improved accuracy over using the strongest model once or using it repeatedly with a single fusion layer.
- Arkon uses Bayesian optimization to search architecture configurations more sample-efficiently than greedy or random selection.
- Search constraints include starting with generation, placing a critic before a ranker or fuser, and following unit-test generation with evaluation.
- The optimizer can target objectives such as accuracy, available models, and inference-call budget while reducing the expensive number of configurations tested.
- Arkon produces one final answer, so its reported evaluation emphasizes pass-at-one accuracy rather than selecting from a returned set of candidates.
- An open-source Arkon configuration matched or exceeded contemporary closed-source models across several evaluated tasks.
- Task-specific and general-purpose architectures both performed well; the general-purpose system transferred beyond the tasks used during optimization.
- Across instruction-following, reasoning, math, and coding tasks, Arkon achieved an average 14.1% pass-at-one improvement over GPT-4 and Claude 3.5 Sonnet.
Transcript excerpt
0:05 So today, we are going to talk about inference scaling. We briefly hinted on this in the first lecture, so there are three stages for LLM kind of development. The first one is pre-training. This stage is historically takes a lot more time. It could take several months. A whole lot of GPUs that are used for training these. And then there's the fine tuning step. Usually, this is a less, or historically has been a less compute-intense process. If you are talking about trillions of data, tokens in the pre-training side, on the fine tuning side, this is orders of magnitude less data that we use for fine tuning. And then there is the inference part,
0:52 where we get to use the model. And we are going to see different ways that at inference time, we can make the model be better and become more useful without changing the parameters of the model and without any fine tuning of the models. So let's first start with the Large Language Monkeys paper. Again, you are familiar with the infinite monkey theorem by now because we discussed it on Monday. But to recap, the idea of this paper is that we have an LLM and we have a problem as input. Instead of generating the response for this problem only once, we are going to repeatedly ask the same input problem again and again.
1:41 This could be a number of times, it could be 10 times, 100 times, and so on, and we will see how that affects the performance. And then we are going to have a verifier that can tell us which one of these responses were the correct response, and then that is going to be the output of this system. The reason we like that is that by doing this repeated sampling,
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.