Reasoning & looping
Overview
Mohit Iyyer explains test-time scaling through reasoning and looping: models can spend more inference compute by generating chain-of-thought tokens or by repeatedly running selected transformer layers. DeepSeek R1 Zero demonstrates that GRPO with verifiable rewards on final answers, without supervised reasoning examples or a reward model, can improve AIME 2024 accuracy from 15.6% to 71% while producing reasoning traces thousands of tokens long.
Key takeaways
- DeepSeek R1 Zero used GRPO with correctness rewards on final answers, without SFT, human demonstrations, or a reward model, and improved AIME 2024 accuracy from about 15.6% to 71%.
- Answer-only rewards align reinforcement learning with task success while allowing the model to discover its own reasoning strategies, but they do not guarantee that its visible chain of thought faithfully reflects its internal computation.
- Longer chain-of-thought generation increases inference compute and gives the model room to reuse intermediate results as context; DeepSeek R1 Zero traces grew to thousands of tokens during training.
- Majority voting cannot solve problems for which a base model produces no correct samples, even with thousands of attempts; reasoning training can enable solutions that sampling alone never finds.
- Looping spends extra inference compute by repeatedly applying selected transformer layers, but requires training for repeated hidden-state distributions rather than simply rerouting an off-the-shelf model.
- Reasoning-effort settings often act as token budgets, while raw reasoning traces are valuable for distillation and therefore create model-security and leakage risks.
Chapters
- Test-time scaling increases inference compute while keeping the trained model fixed, unlike Chinchilla-style scaling of parameters and training data.
- OpenAI's o1 introduced models that reason before answering; DeepSeek R1 later described a simple approach combining chain-of-thought generation with reinforcement learning and verifiable rewards.
- Two approaches to test-time compute are longer reasoning traces and looping selected transformer layers.
- For an $80 jacket discounted by 15%, direct decoding can return $68, while chain of thought explicitly computes 15% of 80 as 12 and then subtracts.
- Generated reasoning tokens are fed back as context, letting the model store intermediate values in its input rather than relying only on hidden states.
- Longer reasoning can decompose a complicated task into smaller steps, at the cost of additional forward passes.
- Zero-shot chain of thought adds an instruction such as “think step by step” to the prompt.
- Few-shot chain of thought provides demonstrations that show reasoning before the final answer.
- Both methods can improve math problem solving, but they rely on the pretrained model's existing capabilities and do not update its parameters.
- The training goal is to increase the probability of reasoning traces that lead to correct answers and reduce the probability of traces that lead to errors.
- Final answers may be verifiable with tools such as calculators or code unit tests, but there is usually no exact, verifiable sequence of reasoning steps.
- A process reward model or human ratings could evaluate individual reasoning steps, but collecting those labels is costly.
- Supervised fine-tuning on expert solutions requires people capable of solving difficult problems and producing coherent reasoning, limiting the amount and breadth of data.
- Token-level SFT loss treats reasoning tokens and final-answer tokens as similarly important, even when task success depends mainly on the answer being correct.
- For long chains of thought, loss can be dominated by matching the reasoning text, so a polished trace can score well despite an incorrect final answer.
- In answer-only RL, the reward is based on whether the extracted final answer is correct, for example 1 for correct and 0 otherwise.
- This approach requires no human annotations of reasoning and aligns the reward with the task outcome.
- Because the model is not told how to think, it can explore different strategies, including unconventional traces, as long as they produce correct answers.
- A reasoning trace is not guaranteed to faithfully reveal the computation inside the model, which remains an interpretability challenge.
- DeepSeek R1 Zero skipped supervised fine-tuning and used GRPO with verifiable rewards on final answers, without human demonstrations or a reward model.
- On AIME 2024, the pretrained model solved about 15.6% of problems; after GRPO, accuracy reached 71%.
- Reasoning traces grew to thousands of tokens during training, and longer outputs accompanied rising reward, illustrating test-time scaling through extended generation.
- The later DeepSeek R1 added instruction tuning and preference-based post-training to support broader tasks beyond math.
- A typical assistant format places reasoning between think tags and the final response in an answer block.
- The reward checker evaluates the final answer, while a separate format reward in DeepSeek R1 Zero penalizes outputs that omit the required structure.
- Thinking text uses ordinary tokens; when an answer is correct, the policy update increases the probability of the full response, including its reasoning trace.
- Direct RL depends on the pretrained model being able to follow the output format; a weaker model may need supervised formatting examples first.
- Low, medium, or high reasoning effort generally corresponds to allowing the model fewer or more tokens before it must answer.
- For Qwen, an inference harness can impose a reasoning-length cap and insert an end-of-thinking marker when the budget is exhausted.
- The exact implementations used by OpenAI, Anthropic, and Google are not public, but may use similar limits.
- The S1 model illustrates another control method: repeatedly adding a “wait” cue can prompt additional reasoning until a token budget is reached.
- OpenAI's o1 provided summaries rather than raw reasoning tokens, partly because successful traces could be valuable training data for competitors.
- Chain-of-thought distillation can transfer more intermediate information than training on final answers alone.
- A reported Anthropic safeguard bug allowed a smaller Claude model to reveal a larger model's hidden reasoning after a model switch, highlighting risks from leakage and distillation.
- DeepSeek reasoning traces can try a strategy, recognize that it is not progressing, and backtrack to explore another approach.
- Answer-only rewards permit this messy exploration because the model is judged on the final result rather than on whether its intermediate steps look polished.
- The DeepSeek paper highlighted traces with an “aha” moment after failed attempts, showing that search-like behavior can emerge from reinforcement learning.
- A simple test-time baseline generates many independent answers, such as 100 samples, and selects the majority response.
- Voting cannot recover a correct answer if a base model never generates one; on some hard synthetic multi-step problems, even thousands of samples can all be wrong.
- Sampling can improve aggregate accuracy, but it may be less compute-efficient than one trained reasoning model and a long reasoning trace.
- Independent samples can run in parallel with enough GPUs, while autoregressive reasoning generates tokens sequentially.
- Instead of generating more tokens, a looped transformer spends extra compute by feeding hidden states through selected layers multiple times.
- For example, the output of layer 4 can be routed back into layer 3, repeating that block before continuing to later layers.
- The number of loops can serve as an inference-time compute budget, with more loops allocated to harder problems.
- An off-the-shelf transformer is not expected to benefit from arbitrary layer looping because each layer was trained to receive a particular distribution of hidden states from the preceding layer.
- Looped models therefore need pretraining or post-training that exposes them to repeated computation; middle transformer layers are often used.
- Reinforcement learning can help train the model to use more loops on harder problems, and looping can be combined with generated chain of thought.
Transcript excerpt
0:00 Um so today we are going to be talking about reasoning models. So we basically finished our um exploration into different RL algorithms that are used for um post-raining. Um so we talked about um reinforce with verifiable rewards and how GRPO lets us get a good baseline for this algorithm. We talked uh then about RLHF um and how we can get a reward signal even for non-verifiable tasks uh by training a reward model on human preferences and then optimizing our policy to maximize the expected reward. So today we are going to cover kind of
0:50 um uh a way that we can scale our models um not just through training time compute which we already covered with chinchilla involves like adding more parameters to our model and adding more training data. So here we're going to talk about a different paradigm called test time scaling. So this means we're going to keep our model the same like we've pre-trained it, we've post-trained it. Um, and the thing that we're going to change is how much compute do we use at test time when we're solving like a math problem or a programming problem. Um and we'll see how we can actually control this and uh incentivize
1:39 uh reasoning um that leads to the correct answer using reinforcement learning just all the algorithms that we've uh thought up so far. Okay. Um so broadly today we're going to be covering reasoning models and just as a bit of history um the uh way this came about was a couple years ago um OpenAI released this model called 01 which um uh had this uh you you would ask it a a prompt like a math problem or something and instead of immediately spitting out its response as we've uh discussed in this class, it
This is the start of the transcript. Save this video free for the whole transcript, searchable and time-coded.
In this course
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, Mohit Iyyer.