CS285 Deep Reinforcement Learning (Berkeley)
Website ↗Code ↗Video ↗Slides (PDF) ↗
TL;DR. Sergey Levine’s graduate deep RL course at UC Berkeley. The current edition is Spring 2026 (CS 185/285). It has a full LLM-RL lecture (Lecture 14) and an LLM-RL homework (HW4: GRPO versus GR-REINFORCE on small math tasks). Its most recent full set of recordings is Fall 2023, and the lecture numbers differ between the two editions. Use the Spring 2026 slides and homework, the Fall 2023 videos, and the mapping below.
Why it matters now. CS285 gives the theory that Spinning Up skips: why importance sampling is needed, why it is only a first-order approximation, and why clipping is a heuristic. HW4 is a ready-made, graded path from policy gradients to GRPO on a language model.
Course facts (checked)
Section titled “Course facts (checked)”- Spring 2026 site: rail.eecs.berkeley.edu/deeprlcourse has 25 lectures, slides at
static/slides/lec-N.pdf, five homeworks (imitation learning, policy gradients, Q-learning and actor-critic, LLM RL, offline RL), and two default final projects (offline-to-online RL and LLM RL). - Recordings: the course page points to the Fall 2023 playlist (99 videos, each lecture split into parts; Fall 2023 site). The page’s separate “recorded” link opens an older playlist from the course’s CS294-112 era, so do not use it for the numbers here.
- No timestamps here. The Fall 2023 videos only have YouTube’s automatically generated chapters, so the links below go to the start of part 1 of each lecture.
- HW4 starter code: homework_spring2026/hw4. It runs on Modal H100s; the handout says it can be done in about 8 H100 hours.
Lecture map (Spring 2026 slides → Fall 2023 video → site pages)
Section titled “Lecture map (Spring 2026 slides → Fall 2023 video → site pages)”The Fall 2023 match is by topic (my mapping). Content changed between editions; Spring 2026 Lecture 14 in particular has no single Fall 2023 counterpart.
Key ideas on the LLM path
Section titled “Key ideas on the LLM path”- L5–L6: variance reduction. Reward-to-go and baselines lower variance without bias; the critic and GAE trade some bias for less variance.
- L9: off-policy policy gradients. Reusing data needs importance weights. The practical version ignores the change in state distribution, which is only valid when the new policy stays close to the old one. The slides then clip the importance weights and add entropy regularisation, which gives PPO. They also note that on-policy policy gradient suits LLM training, where sample efficiency matters less than an unbiased gradient.
- L10: why small steps. Policy gradient is viewed as approximate policy iteration with a bound on how much the state distribution can change. This motivates natural gradient and TRPO; the slides call PPO with clipping “a heuristic approximation” to PPO with a KL constraint.
- L14: LLM RL. The lecture compares a one-step view (the completion is one action) with a token-level view, compares REINFORCE with the importance-sampled (PPO) estimator, and covers value baselines with GAE (the value head is not trained on the prompt). It names baselining without a value function GRPO, adds the reference KL, presents Bradley–Terry reward models (the same model as Elo ratings), and contrasts verifiers with process rewards.
HW4 (LLM RL) in brief
Section titled “HW4 (LLM RL) in brief”- Tasks: format copy, a debugging task where the model copies an integer into XML (+1.0 correct, +0.2 answer tag, +0.1 strict XML); and math hard, a filtered level-5 subset of MATH with a 512-example held-out evaluation.
- Advantage: group-normalised, , with the population standard deviation.
- GR-REINFORCE: sequence-averaged log-probability times the advantage, plus β·KL; one optimizer step per batch.
- GRPO: token-level clipped ratios, averaged within each completion and then across the minibatch, with each batch reused for two PPO epochs.
- KL estimator: with .
- Required runs: GRPO and GR-REINFORCE on both tasks, plus a GRPO hyperparameter study on format copy. The handout recommends reading DeepSeekMath, Dr. GRPO, DAPO and GSPO.
Worked example: one HW4-style update on the search toy
Section titled “Worked example: one HW4-style update on the search toy”Prompt: a question that needs one search. Sample a group of four completions with rewards [1, 0, 0, 1] (two searched and answered correctly; two answered blind and were wrong).
- Advantage. μ = 0.5 and the population std is σ = 0.5, so A = [+1, −1, −1, +1] (ignoring the small ε).
- GR-REINFORCE. The loss is . Each correct completion’s average log-probability is pushed up and each wrong one pushed down, with equal weight per completion whatever its length.
- GRPO’s second epoch. After one update, suppose the token “search” in completion 1 has ratio 1.3 with ε = 0.2. Since A = +1 is positive and 1.3 is above 1.2, the clipped term is the minimum, so this token contributes no gradient.
- KL term. If the policy has made “answer immediately” half as likely as the reference does (πθ = 0.25, πref = 0.5), the per-token KL estimate is k̂ ≈ 0.307, and the β·k̂ term pulls back towards the reference.
- In MDP terms: the one-step view treats each completion as one action from the prompt state. The token-level view would let a critic learn that “evidence in context” (s₁) is worth 0.9, which is what PPO’s value head and GAE provide and GRPO does without.
Limitations
Section titled “Limitations”- No Spring 2026 recordings are linked from the course page (as of this check), so the videos lag the slides by more than two years. In particular, the LLM content in Spring 2026 Lecture 14 is newer than Fall 2023 Lecture 21.
- The course is broad. About half the lectures (model-based RL, multi-task, theory, midterm reviews) are off the LLM path.
- HW4 requires GPU credits (Modal H100) and uses toy-scale math tasks; it does not cover tool use or multi-turn agents.
Connections
Section titled “Connections”- Before: Spinning Up Part 3 for code-level intuition; David Silver L1–L7 for tabular basics.
- After: the Lambert course L3–L5 and the RLHF book Ch 6–7 for RLHF and reasoning-RL practice; Dr. GRPO and DAPO for the loss-aggregation choices HW4 makes.
- Hub: Course map.
Questions to think through
These questions have no single right answer. Write or say your answer before you open the hints. Mark a question once you could defend your answer in a reading group.
- Derive / compute
HW4 estimates the per-token KL to the reference model with k̂ = exp(Δ) − Δ − 1, where Δ = log πref − log πθ and tokens are sampled from πθ. Show that k̂ is unbiased for KL(πθ ∥ πref) and never negative, then evaluate it and the naive estimate −Δ for a token with πθ = 0.25, πref = 0.5 and for one with πθ = 0.5, πref = 0.25.
What a strong answer covers
- E over πθ of exp(Δ) = Σ πθ · πref / πθ = Σ πref = 1, so E[k̂] = 1 − E[Δ] − 1 = E[log πθ − log πref], which is the KL.
- With x = exp(Δ), k̂ = x − log x − 1, which is at least 0 for all x greater than 0, with equality only at x = 1.
- πθ = 0.25, πref = 0.5: Δ = ln 2 ≈ 0.693, so −Δ ≈ −0.693 (a negative "KL") while k̂ = 2 − 0.693 − 1 ≈ 0.307.
- πθ = 0.5, πref = 0.25: Δ ≈ −0.693, so −Δ ≈ 0.693 and k̂ = 0.5 + 0.693 − 1 ≈ 0.193.
- Both estimators are unbiased; k̂ has lower variance and no negative per-token values, which matters when it is used as a loss term.
- Mechanism
In HW4, GR-REINFORCE takes one optimizer step per rollout batch, while GRPO reuses each batch for two PPO epochs with clipped token-level ratios. Using Lectures 9–10, explain why GR-REINFORCE needs no importance ratio, why GRPO does, and what the clip does for positive and negative advantages.
What a strong answer covers
- GR-REINFORCE computes the gradient at the parameters that generated the data, so it is the on-policy policy gradient and needs no correction.
- After GRPO's first optimizer step the data is from an older policy, so each token needs the ratio πθ / πold (importance sampling).
- Lecture 9 ignores the change in the state distribution (a first-order approximation that holds while the policies stay close), which is why updates must stay small.
- With A greater than 0 the objective stops rewarding ratios above 1 + ε; with A less than 0 it stops rewarding ratios below 1 − ε; the min keeps the pessimistic term.
- Lecture 10 calls clipping a heuristic approximation to the KL-constrained update, so clipping alone is not a guarantee.
- What if…
HW4 asks for at least five extra GRPO runs on format copy (changing PPO epochs, KL coefficient up and down, clip threshold, and gradient accumulation). Predict what each change does to reward, KL and clip fraction, and say which metric you would trust to compare runs.
What a strong answer covers
- More PPO epochs or no gradient accumulation means more optimizer steps per batch: faster early reward, larger KL and clip fraction, and more risk of instability.
- Smaller KL coefficient lets the policy drift further from the reference (KL rises); larger coefficient slows learning and keeps outputs close to the reference.
- Smaller clip ε raises the clip fraction and slows each update; larger ε lets ratios move more, risking instability.
- Compare runs on the evaluation curves, not the rollout reward, which the handout warns fluctuates a lot between iterations; use several settings to find where performance starts to degrade.
- Connect
Lecture 14 contrasts treating a whole completion as one action with treating each token as an action, and calls baselining without a value function "GRPO". Connect these two choices to the search toy and to what PPO, GRPO and the GAE page each assume.
What a strong answer covers
- One-step view: the prompt is the state and the completion is one action with one reward, which is a contextual bandit; group statistics give the baseline.
- Token view: each token is an action in a deterministic MDP whose state is the prefix, which needs per-token credit (a value head and GAE, as in PPO).
- Search toy: one-step treats "search then answer" as one action rewarded 0.9 or −0.1; token view lets a critic value s₁ separately (V*(s₁) = 0.9).
- GRPO gives every token of a completion the same group-normalised advantage; Lecture 14 also notes the value head should not be trained on prompt tokens.
- Critique
The HW4 math hard reward gives +1.0 for a correct boxed answer, +0.1 for containing the substring for a boxed answer, and +0.1 when only a relaxed last-number parser is correct. The handout says such extra terms help exploration. Critique this reward from a reward-hacking point of view.
What a strong answer covers
- The format bonus pays for a surface feature, so a policy can collect it without solving anything; it is a proxy that Goodhart's law applies to.
- The bonuses are small next to +1.0, which limits the damage, but in groups where every completion is wrong they become the only learning signal.
- The relaxed-parser bonus rewards answers in the wrong format and may teach the model that format does not matter.
- Checks: track the format-only reward rate, the correct-answer rate on held-out evaluation, and samples; anneal or drop shaping once accuracy rises.
- Design
Plan a four-week CS285 route for an IR researcher who wants to do LLM RL for search agents. Say which Spring 2026 slide decks and which Fall 2023 videos to use, what to skip, and where HW4 fits.
What a strong answer covers
- Week 1: Lecture 4 (RL basics) and Lecture 5 (policy gradients), with Fall 2023 Lectures 4 and 5 for video.
- Week 2: Lecture 6 (actor-critic, GAE) and Lectures 9–10 (advanced policy gradients, PPO), with Fall 2023 Lectures 6 and 9.
- Week 3: Lecture 14 (LLM RL) with Fall 2023 Lecture 21 and the Eric Mitchell RLHF guest lecture; then HW4 on format copy and math hard.
- Week 4: Lecture 19 (exploration) and Lecture 17 (offline RL, forward vs reverse KL) for the open problems; skip model-based RL and the midterm reviews.
- Note that Fall 2023 numbering differs from Spring 2026, and the slides are the current version.