← govind p lal
AI and ML Bootcamp · Lecture 16 · lecture notes

Reasoning Models, DeepSeek R1 and RLVR with GRPO

In short — How did reasoning models like OpenAI o1 and DeepSeek R1 come about? This lecture covers test-time scaling, the R1-Zero and R1 training recipes, RL with verifiable rewards (RLVR), and advantage from a group of sampled responses.">GRPO, the algorithm that removes PPO's value model. It ends with a failed hands-on run on a tiny model.

Test-time scaling and the reasoning era

builds on Lecture 2: Week 1 - AI and ML | Fast-tracking the course of AI | 18/01/2026, Lecture 2: Week 1 - AI and ML | Fast-tracking the course of AI | 18/01/2026

Before Sept 2024, models were fast but not very accurate. A prompt went in and the answer started instantly. Scaling meant more data, more GPUs, bigger models.

Test-time scaling - give the model more compute while it answers, not only while it trains. -> New scaling axis

Example

System 1 vs System 2. System 1 is fast and intuitive: capital of India. System 2 needs deliberate thought: 44 x 11 = 484. Reasoning models behave like System 2.

DeepSeek R1-Zero vs R1

builds on Lecture 14: Week 13 - AI&ML | Fine-tuning - Part 2 | 11/04/2026, Lecture 15: Week 14 - AI&ML | Fine-tuning - Part 3 | 17/04/2026

DeepSeek R1 - open-source equivalent of o1. 671B parameter MoE model. It published the full recipe, so every company could copy it.

R1-ZeroR1
PipelineBase model -> RLBase -> cold-start SFT -> GRPO -> rejection sampling -> final RL
PurposeScience experimentProduction, user-facing
SFTNoneYes (few thousand Q&A examples)
Base modelCold-start SFTfew thousand examplesGRPO RLRejection samplingfilter qualityFinal RL
Full R1 pipeline.

R1-Zero used only two simple rewards.

Aha moment - mid-answer the model says something like 'wait, let me re-evaluate' and restarts its reasoning. It emerged after about 8,000 steps of training. Most people would have stopped at 2,000-6,000.

RLVR: verifiable rewards

builds on Lecture 15: Week 14 - AI&ML | Fine-tuning - Part 3 | 17/04/2026, Lecture 15: Week 14 - AI&ML | Fine-tuning - Part 3 | 17/04/2026

RLVR (Reinforcement Learning with Verifiable Rewards) - can you check the reward deterministically with a program? If yes, no reward model is needed.

RLHFRLVR
Reward sourceLearned reward modelVerifier program
SignalContinuous (0.57, 0.58...)Binary (1 or 0)
Training data for rewardNeeded (human preferences)Not needed
AmbiguitySubjective, approximateNone
LimitWorks broadlyOnly verifiable domains

Does not work for creative writing, open conversation or anything with no ground truth.

Typical reward functions: format reward gives a small bonus (e.g. +0.1) if the response contains think open and close tags. Correctness reward gives a large bonus if the extracted final answer matches ground truth.

!

Format reward is a small nudge. Correctness is the main signal the model learns from.

Does RL add knowledge? Sampling efficiency

builds on Lecture 15: Week 14 - AI&ML | Fine-tuning - Part 3 | 17/04/2026

Pass@k - give the model k attempts at a question and check whether at least one is correct.

GRPO: Group Relative Policy Optimization

builds on Lecture 15: Week 14 - AI&ML | Fine-tuning - Part 3 | 17/04/2026, Lecture 15: Week 14 - AI&ML | Fine-tuning - Part 3 | 17/04/2026, Lecture 15: Week 14 - AI&ML | Fine-tuning - Part 3 | 17/04/2026

PPO recap: ratio of current to old policy, times advantage, clipped between 1-epsilon and 1+epsilon. Advantage - how much better this answer is than average.

The Problem

The Solution

The loss averages over the G responses (1/G summation) using the PPO-style clipped ratio times advantage, minus a KL penalty term (beta) against the reference model.

QuestionPolicy modelG = 8 responsesVerifier8 rewardsMean and stdadvantagesPolicy updateclip + KL penalty
GRPO training step.
PPOGRPO
Models neededPolicy, reference, reward, valuePolicy and reference, plus verifier function
Advantage fromValue modelGroup mean and std
Reward typeAnyBest for verifiable rewards
Compute and hyperparametersHigherLower; groups run in parallel
!

If group size G is 2 or 3, the mean and std are noisy, so the advantage is unreliable. Use a larger group.

RLVR + GRPO fit well: GRPO needs many fast reward evaluations, and verifiers are cheap. Most open reasoning models now use a variant of GRPO.

Hands-on: GRPO on a tiny model fails

builds on Lecture 14: Week 13 - AI&ML | Fine-tuning - Part 2 | 11/04/2026

Setup: GSM8K math data, a system prompt that demands reasoning then a final answer, and several programmatic reward functions (no reward model).

!

RL needs some successful samples to reinforce. A model too small to produce the format gets zero signal. Use a 1.5B model or larger.

Glossary

Test-time scaling
Spending more compute at inference so the model thinks before answering.
R1-Zero
DeepSeek model trained with RL only on a base model, no SFT.
RLVR
Reinforcement learning where rewards come from a programmatic verifier.
GRPO
Group Relative Policy Optimization: PPO-like RL that estimates advantage from a group of sampled responses.
Advantage
How much better a response is than the average response for the same question.
Pass@k
Chance that at least one of k sampled answers is correct.
Value model
Extra model in PPO that predicts expected reward, used for advantage.
KL penalty
Penalty keeping the policy close to the reference model.