强化学习:从多臂老虎机到 Q-learning

Reinforcement Learning: From Bandits to Q-learning

To understand RLHF/RLVR, first understand Q-learning — zero gym, a world you build in pure numpy

6 labs8 AI-mentored sessions~4 hoursBilingual · EN / 中
Start learning →

About this course

You hear RLHF, RLVR and agentic RL every day — and they all stand on the same
foundation: one value-update rule, and the eternal explore-vs-exploit dilemma.
This is a build-it-yourself course: no gym, no GPU. Every world — a 10-armed
bandit, a 4x4 grid, a cliff edge, a shape-shifting maze — is one you assemble in
pure numpy; every algorithm is one you complete by filling in its most critical
lines, then actually run and watch converge in your own sandbox. You will watch
epsilon-greedy lift the optimal-arm hit rate from 36% to 81%, watch V-values take
shape sweep by sweep as policy arrows point to the goal, watch SARSA and
Q-learning develop two personalities at the cliff edge, then hand your agent a
world model so it can practice in imagination. The course follows the knowledge
skeleton of Sutton & Barto, but every session is an original hands-on script
written for the online sandbox: formulas typeset, algorithms drawn, key knobs
draggable. The final stop lands in the present: with the policy gradient and
reward model you built by hand, you will see exactly what RLHF/RLVR optimizes.

What you'll learn

  • Hand-implement epsilon-greedy and UCB, and quantify the explore-for-long-term-gain trade-off
  • Derive value iteration from the Bellman equation and watch V-values converge and policy arrows form on a grid
  • Implement model-free Q-learning and SARSA, and explain the on-policy vs off-policy personalities at the cliff edge
  • Equip an agent with a world model (Dyna-Q/Dyna-Q+) and watch 50 planning steps compress convergence by an order of magnitude
  • Swap tables for function approximation, trigger the deadly triad's divergence yourself, then build a neural Q-network in pure numpy
  • Write REINFORCE and a Bradley-Terry reward model, and explain how RLHF/RLVR extends exactly this foundation

Syllabus

1Tabular RL: from Bandits to TD Control3 sessions
  • 1Multi-Armed Bandits: Explore vs Exploit30 minStart →
  • 2Gridworld: Value Iteration — Watch V-Values Take Shape30 minStart →
  • 3Q-learning at the Cliff30 minStart →
2The Model-Free Family: Monte Carlo, TD & SARSA3 sessions
  • 1Monte Carlo Prediction30 minStart →
  • 2TD(0): Learning at Every Step30 minStart →
  • 3SARSA vs Q-learning: Two Personalities at the Cliff30 minStart →
3Models & Planning: Dyna-Q, Practicing in Imagination2 sessions
  • 1Dyna-Q: Real Experience + Imagined Experience30 minStart →
  • 2Changing Worlds: Dyna-Q+ and the Exploration Bonus30 minStart →
4From Tables to Function Approximation: Generalization, the Deadly Triad & Neural Q0 sessions

Sessions are on the way.

5Policy Gradient: Skip the Values, Learn the Policy0 sessions

Sessions are on the way.

6The Bridge to RLHF/RLVR: When RL Meets Language Models0 sessions

Sessions are on the way.

Same series · 人工智能全透析

AI, End to End

Synthesized from the best material across the web — rebuild the core of AI from scratch, the efficient way.