Reinforcement learning

Reinforcement learning from first principles up to the methods training today's reasoning models. The foundations pages derive each algorithm and implement it in PyTorch and JAX behind a language switcher, runnable on gymnasium environments. The language-model pages cover the algorithms that fine-tune LLMs with rewards and preferences, and the library walkthroughs read the codebases that run this at scale, verl and TRL, the same way the open source chapters read vLLM and PyTorch.

Featured page

GRPO: the algorithm behind reasoning models

How group relative policy optimization drops PPO's value network by normalizing rewards within a group of sampled completions, the KL-to-reference term, a worked numeric example, and the loss implemented in PyTorch and JAX.

Read the page →

Foundations

The core algorithms, derived and implemented on classic control environments. Each later method is a repair of the one before it.

RL for language models

The algorithms that turn rewards and preferences into better models, from the RLHF pipeline to the methods behind reasoning training.

Libraries

Deep walkthroughs of the codebases that run LLM reinforcement learning at scale: how to use them and how to read them.

Planned: OpenRLHF, CleanRL as the single-file reference implementations, and gymnax for JAX-native environments.