# 06 - LLM-era decision / preference-optimisation models (source-grounded research note)

Purpose: raw material for a later interactive lesson on *decision models*. Everything below was read from primary sources on **2026-11-20**.

## 0. Provenance, tags, conventions

**Tags** (every claim carries one):
- `[paper]` read in the paper text (arXiv HTML render or ar5iv render; LaTeX taken from the render's MathML `alttext`). Equation numbers are the paper's own where I saw them.
- `[code]` read in an official / reference repo file at the stated path (GitHub `main`, fetched 2026-11-20 unless a tag is named).
- `[meta]` GitHub repo metadata (license SPDX, last push) from `api.github.com/repos/<repo>`.
- `[computed]` I computed it with Python in this session (numbers in section 8; reproducible with the snippet there).
- `[inferred]` my own reasoning/connection; not stated by a source.
- `[not read]` named but I did **not** read it - do not teach it as fact.

**How read**: arXiv HTML (`arxiv.org/html/<id>`) for 2023+ papers, `ar5iv.labs.arxiv.org/html/<id>` for older ones. I did not look at the figure images, only captions + HTTP HEAD checks of image URLs (section 7). The PPO paper (1707.06347) did **not** render on ar5iv, so it was **not read directly**; PPO's clipped objective is taken from the RLOO paper's restatement and the Tulu 3 hyper-parameter table.

**Library versions seen**: TRL `main`, latest release `v1.18.2` (published 2026-11-19) `[meta]`. TRL configs below were read from `main`, not from the tag. DreamerV3 repo `main` is a rewritten codebase; its config may differ from the paper `[inferred]`.

**Notation** (unified): prompt/state $x$; completion $y$; preferred/dispreferred $y_w, y_l$; policy $\pi_\theta$; reference $\pi_{\text{ref}}$; KL coefficient $\beta$ (DPO/TRL) = $\tau$ (IPO paper); sigmoid $\sigma$; group size $G$; reward $r$ or $R$.

### 0.1 The lens for the lesson: Decision Transformer (DT) vs policy optimisation
- DT `[paper]` (Chen et al., 2021, arXiv 2106.01345v2; code `kzl/decision-transformer`, MIT `[meta]`): feed *returns-to-go* $\widehat R_t=\sum_{t'=t}^{T} r_{t'}$ instead of raw rewards, model trajectories autoregressively with GPT, train by supervised prediction on offline data; at test time choose a target return, and "after executing the generated action ... we decrement the target return by the achieved reward" (ar5iv 2106.01345, lines [112],[117]). Figure 1 caption begins "Decision Transformer architecture" (line [23]; remainder not captured). Fig 4 text: desired target returns and observed returns "are highly correlated" (line [500]).
- Contrast `[inferred]`: **conditioning** (DT: $p(a_t\mid \widehat R_t, s_t,\dots)$, no explicit improvement operator, behaviour is whatever the data + target return implies) vs **optimisation** (RLHF/DPO/GRPO: move $\pi_\theta$ toward higher reward with a KL anchor to $\pi_{\text{ref}}$). Preference methods differ in *where the "return" lives*: in a learned scalar reward model (RLHF), inside the policy log-ratio (DPO, "your LM is secretly a reward model"), in a verifier (RLVR/GRPO), or in a group baseline (GRPO/RLOO). Offline-supervised flavour: DPO/IPO/KTO/ORPO/SimPO train on a *fixed* dataset with a supervised-style loss (like DT) but only DPO/IPO/KTO keep a KL anchor through $\pi_{\text{ref}}$ (KL-regularised reward maximisation, unlike DT); ORPO and SimPO are reference-free supervised contrasts with no explicit KL (see §7.2 and §13) [corrected after critic-1 M5]. The "bandit-to-supervised conversion" (RAFT: SFT on the best-of-$k$) described in the RLOO paper is the closest conditioning-free cousin `[paper]` (arXiv 2402.14740 html lines [141]-[143]).
- A one-line "DT connection" is repeated in each method section below.

---

## 1. Reward models and the Bradley-Terry (BT) preference loss

### 1.1 References
| Item | Reference | Version read | Code / licence |
|---|---|---|---|
| Learned reward from pairwise human preferences in RL | Christiano, Leike, Brown, Martic, et al. (6 authors per arXiv API), *Deep reinforcement learning from human preferences*, NeurIPS 2017 | arXiv 1706.03741 (ar5iv; arXiv lists v4, updated 2023-02-17) | No official code located in this session `[not read]`. Related LM-RLHF code: `openai/lm-human-preferences` (MIT `[meta]`, for Ziegler et al. 2019, not read). |
| BT loss for LM reward model | Ouyang et al. (20 authors per arXiv API), *Training language models to follow instructions with human feedback*, 2022 | arXiv 2203.02155v1 | `openai/following-instructions-human-feedback`: no licence in metadata `[meta]` (model cards/samples; code not read). |
| Reference trainer | Hugging Face TRL `RewardTrainer` | `huggingface/trl` `trl/trainer/reward_trainer.py` | Apache-2.0 `[meta]` |

### 1.2 Equations
Christiano 2017, Eq. 1 and the loss `[paper]` (ar5iv 1706.03741 lines [266],[270]):
$$\hat P[\sigma^1\succ\sigma^2]=\frac{\exp\sum_t \hat r(o^1_t,a^1_t)}{\exp\sum_t \hat r(o^1_t,a^1_t)+\exp\sum_t \hat r(o^2_t,a^2_t)},$$
$$\text{loss}(\hat r)=-\sum_{(\sigma^1,\sigma^2,\mu)\in\mathcal D}\mu(1)\log\hat P[\sigma^1\succ\sigma^2]+\mu(2)\log\hat P[\sigma^2\succ\sigma^1].$$
The paper itself says this "follows the Bradley-Terry model" and is "analogous to the ... Elo ranking system" (lines [271]-[280]) `[paper]`.

DPO paper restatement (Eq. 1, 2) `[paper]` (arxiv.org/html/2305.18290v3 lines [124]/[101] region):
$$p^*(y_1\succ y_2\mid x)=\frac{\exp r^*(x,y_1)}{\exp r^*(x,y_1)+\exp r^*(x,y_2)}=\sigma\big(r^*(x,y_1)-r^*(x,y_2)\big),\qquad
\mathcal L_R(r_\phi,\mathcal D)=-\mathbb E_{(x,y_w,y_l)\sim\mathcal D}\big[\log\sigma(r_\phi(x,y_w)-r_\phi(x,y_l))\big].$$
InstructGPT Eq. 1 `[paper]` (ar5iv 2203.02155 line [154]): the same loss averaged over all $\binom K2$ pairs of a prompt with $K\in[4,9]$ ranked responses:
$$\text{loss}(\theta)=-\frac1{\binom K2}\mathbb E_{(x,y_w,y_l)\sim D}\big[\log\sigma\big(r_\theta(x,y_w)-r_\theta(x,y_l)\big)\big].$$
TRL code `[code]`: `trl/trainer/reward_trainer.py` lines 845/847: `loss = -nn.functional.logsigmoid(rewards_chosen - rewards_rejected [- inputs["margin"]]).mean()`; config `center_rewards_coefficient` (mean-zero reward regulariser) in `reward_config.py`.

### 1.3 Algorithm / data
1. Collect prompts, sample 2..K responses per prompt from the SFT/current policy, humans rank/prefer `[paper]`.
2. Initialise RM from the SFT (or pretrained) LM with a scalar head; minimise BT NLL `[paper DPO §3]`.
3. Because BT is shift-invariant, normalise: InstructGPT adds a bias so labeler demonstrations score mean 0 before RL (line [157]) `[paper]`.
- Data: tuples $(x,y_w,y_l)$. InstructGPT trained all $\binom K2$ comparisons of a prompt as **one batch element** because shuffled pairs overfit after one epoch (lines [149]-[152]) `[paper]`.
- Christiano extras `[paper]` (lines [284]-[302]): ensemble of predictors on bootstrap resamples; $1/e$ of data held out for validation; $\ell_2$ regularisation tuned to keep val loss at 1.1-1.5x train loss; assume **10% chance the human answers uniformly at random** instead of a pure softmax; query selection by ensemble disagreement (which "in some tasks ... actually impairs performance", line [304]).

### 1.4 Hyper-parameters (cited)
- InstructGPT RM: 6B GPT-3 RM, 1 epoch, lr 9e-6, cosine decay to 10% (Appendix; lines [1725]-[1726]); 175B RM "could be unstable" so a single 6B RM was used for all policy sizes (lines [147],[1725]) `[paper]`.
- TRL `RewardConfig` defaults `[code]` (`reward_config.py`, main): `learning_rate=1e-4`, `max_length=1024`, `disable_dropout=True`.

### 1.5 Failure modes
- Reward overfitting after one epoch if comparisons are shuffled `[paper]`; large RM unstable `[paper]`; shift-invariance (needs normalisation) `[paper]`; humans' constant error rate (10% uniform) `[paper]`.
- Reward hacking when a *learned* RM is optimised hard `[paper]` (stated in DeepSeek-R1 as the reason for avoiding neural RMs, see section 6.4).

### 1.6 DT connection `[inferred]`
A scalar reward model is the "return estimator" that DT replaces with *observed* returns-to-go; BT only identifies rewards up to a per-prompt constant, so a DT-style "target return" would need the same per-prompt normalisation.

### 1.7 Numeric example `[computed]`
$r_\phi(x,y_w)=1.5,\ r_\phi(x,y_l)=0.5$: $p=\sigma(1.0)=0.7311$, loss $=-\log\sigma(1.0)=0.3133$. Mis-ordered pair $r_w=0.2,\ r_l=0.9$: $p=\sigma(-0.7)=0.3318$, loss $=1.1032$. With $K=4$ responses InstructGPT averages over $\binom42=6$ pair losses.

### 1.8 Official figures
- Christiano Fig. 1 `[paper]` (ar5iv lines [81]-[85]): "Schematic illustration of our approach: the reward predictor is trained asynchronously from comparisons of trajectory segments, while simultaneously training a policy to optimize the current predicted reward function." Teaches: reward model and policy train **concurrently**; human labels are on short clips. Page: https://ar5iv.labs.arxiv.org/html/1706.03741 (image URL not captured).

---

## 2. RLHF with PPO (InstructGPT; Christiano 2017 lineage)

### 2.1 References / code
- Ouyang et al. 2022, arXiv 2203.02155v1 `[paper]`. Lineage: Christiano 2017, Ziegler 2019, Stiennon 2020 (arXiv 2009.01325v3; cited, **not read**).
- PPO: Schulman et al. 2017, arXiv 1707.06347v2 - **not read directly** (render failed).
- Code: `huggingface/trl` (Apache-2.0 `[meta]`) - PPO trainer is no longer in `trl/trainer/` on main (listing: dpo, grpo, kto, reward, rloo, sft ... `[code]`); `OpenRLHF/OpenRLHF` (Apache-2.0 `[meta]`); `allenai/open-instruct` (Apache-2.0 `[meta]`; used for Tulu 3 PPO/RLVR - see section 9); `verl-project/verl` (Apache-2.0 `[meta]`; repo moved from `volcengine/verl`).

### 2.2 Objective
KL-constrained reward maximisation (DPO Eq. 3) `[paper]`:
$$\max_{\pi_\theta}\ \mathbb E_{x\sim\mathcal D,\ y\sim\pi_\theta(y\mid x)}[r_\phi(x,y)]-\beta\,\mathbb D_{\text{KL}}[\pi_\theta(y\mid x)\,\|\,\pi_{\text{ref}}(y\mid x)].$$
InstructGPT PPO-ptx objective (their Eq. 2) `[paper]` (ar5iv 2203.02155 lines [189]-[192]):
$$\text{objective}(\phi)=\mathbb E_{(x,y)\sim D_{\pi^{\text{RL}}_\phi}}\Big[r_\theta(x,y)-\beta\log\frac{\pi^{\text{RL}}_\phi(y\mid x)}{\pi^{\text{SFT}}(y\mid x)}\Big]+\gamma\,\mathbb E_{x\sim D_{\text{pretrain}}}\big[\log\pi^{\text{RL}}_\phi(x)\big]$$
($\gamma=0$ gives "PPO"). Environment is a **bandit**: a random prompt, one response, one RM reward, episode ends; a per-token KL penalty to SFT is added; value function initialised from the RM (line [187]) `[paper]`.
Token-level PPO clip as restated by RLOO paper `[paper]` (arxiv 2402.14740 html lines [115]-[119]): maximise $\min\big(f\hat A_\lambda,\ \text{clip}_{1-\epsilon}^{1+\epsilon}(f)\hat A_\lambda\big)$ with $f=\pi_\theta(y_t\mid s_t)/\pi_{\text{old}}(y_t\mid s_t)$, $s_t=\{y_{<t},x\}$, advantages by GAE.

### 2.3 Algorithm steps (InstructGPT Fig. 2) `[paper]`
1. SFT GPT-3 on labeler demonstrations (16 epochs, cosine LR, dropout 0.2; line [143]).
2. Sample $K$ outputs per prompt, labelers rank, train 6B RM with BT loss.
3. PPO against the RM with KL-to-SFT and (optionally) pretraining-mix gradients.

### 2.4 Data
Prompts from API Playground + labeler-written; 40 contractors; comparison data on a larger prompt set (lines [30]-[33]); RL on ~31k unique prompts, 256k episodes (line [1730]) `[paper]`.

### 2.5 Hyper-parameters (InstructGPT appendix, lines [1721]-[1734]) `[paper]`
Adam $\beta_1=0.9,\beta_2=0.95$; SFT LR 9.65e-6 (1.3B/6B), 5.03e-6 (175B), batch 32/8; PPO init from SFT-with-10%-pretrain-mix; KL reward coef **$\beta=0.02$**; **256k episodes**; batch 512 per iteration, minibatch 64 (8 minibatches, single inner epoch); constant LR with 10-iteration warmup; EMA of weights decay 0.992; no discount in GAE; value LR 9e-6 (1.3B/6B policies) / 5e-6 (175B); pretraining examples = 8x the RL episodes. $\gamma$ sweep: "greater or equal 20" recovers NLP regressions on the 1.3B model (line [2457]); I did not capture the final $\gamma$ used.
Tulu 3 PPO table (Table 21, lines [2108]-[2162]) `[paper]`: $\gamma$(discount)=1.0, GAE $\lambda$=0.95, clip $\epsilon$=0.2, value-coef $c_1$=0.1, grad-norm 1.0, temperature 1.0, EOS-less penalty -10.

### 2.6 Failure modes
- "Alignment tax": regressions on SQuAD/DROP/HellaSwag/WMT; mitigated by pretraining mix, which beat simply raising KL (lines [45],[295]-[296]) `[paper]`.
- Simple mistakes: false premises accepted, over-hedging (lines [304], Fig. 9) `[paper]`.
- Complexity/instability of PPO for LMs, and critic that must score every token while reward is last-token only `[paper]` (RLOO html line [77]; DeepSeekMath line [715]).

### 2.7 DT connection `[inferred]`
PPO-RLHF is the *opposite pole* from DT: online sampling, scalar reward, policy-gradient improvement with a trust region and KL anchor, versus DT's purely supervised return conditioning.

### 2.8 Numeric example `[computed]`
One token-summed sample: $r=1.2$, $\beta=0.02$, $\log(\pi_{RL}/\pi_{SFT})=+3$ -> shaped reward $1.2-0.02\cdot3=1.14$. Clip table ($\epsilon=0.2$, per-token term $\min(\rho A,\text{clip}(\rho)A)$): $\rho{=}1.3,A{=}{+}1\to1.2$ (clipped, zero grad); $\rho{=}1.3,A{=}{-}1\to-1.3$ (unclipped); $\rho{=}0.7,A{=}{+}1\to0.7$; $\rho{=}0.7,A{=}{-}1\to-0.8$ (clipped).

### 2.9 Official figures
- InstructGPT Fig. 2 `[paper]` (line [34]): "A diagram illustrating the three steps of our method: (1) supervised fine-tuning (SFT), (2) reward model (RM) training, and (3) reinforcement learning via proximal policy optimization (PPO) on this reward model. Blue arrows indicate that this data is used to train one of our models. In Step 2, boxes A-D are samples from our models that get ranked by labelers." Teaches: the canonical 3-stage RLHF pipeline. https://ar5iv.labs.arxiv.org/html/2203.02155
- InstructGPT Fig. 1 (line [26]/[217]): labeler preference vs model size for GPT / GPT-prompted / SFT / PPO / PPO-ptx; teaches 1.3B PPO-ptx preferred to 175B GPT-3.

---

## 3. DPO - Direct Preference Optimization

### 3.1 Reference / code
Rafailov, Sharma, Mitchell, Ermon, et al. (6 authors per arXiv API), *Direct Preference Optimization: Your Language Model is Secretly a Reward Model*, NeurIPS 2023, arXiv 2305.18290 **v3** (updated 2024-07-29) `[paper]`.
Code: **`eric-mitchell/direct-preference-optimization`** (the DPO reference implementation; I did not check whether a `rafailov/` mirror exists), Apache-2.0 `[meta]`, last push 2024-08-11; files `train.py, trainers.py, preference_datasets.py, config/` `[code]`. Production: `huggingface/trl` `trl/trainer/dpo_trainer.py` + `dpo_config.py` (Apache-2.0) `[code]`.

### 3.2 Equations `[paper]` (arxiv.org/html/2305.18290v3 lines [118]-[135])
Optimal KL-regularised policy (Eq. 4): $\pi_r(y\mid x)=\frac1{Z(x)}\pi_{\text{ref}}(y\mid x)\exp\big(\tfrac1\beta r(x,y)\big)$, $Z(x)=\sum_y\pi_{\text{ref}}\exp(r/\beta)$.
Reward re-parameterisation (Eq. 5): $r(x,y)=\beta\log\frac{\pi_r(y\mid x)}{\pi_{\text{ref}}(y\mid x)}+\beta\log Z(x)$; $Z$ cancels in BT, giving Eq. 6.
**DPO loss (Eq. 7):**
$$\mathcal L_{\text{DPO}}(\pi_\theta;\pi_{\text{ref}})=-\mathbb E_{(x,y_w,y_l)\sim\mathcal D}\Big[\log\sigma\Big(\beta\log\frac{\pi_\theta(y_w\mid x)}{\pi_{\text{ref}}(y_w\mid x)}-\beta\log\frac{\pi_\theta(y_l\mid x)}{\pi_{\text{ref}}(y_l\mid x)}\Big)\Big].$$
Gradient (lines [133]-[135]):
$$\nabla_\theta\mathcal L_{\text{DPO}}=-\beta\,\mathbb E\Big[\sigma\big(\hat r_\theta(x,y_l)-\hat r_\theta(x,y_w)\big)\big(\nabla_\theta\log\pi_\theta(y_w\mid x)-\nabla_\theta\log\pi_\theta(y_l\mid x)\big)\Big],\quad \hat r_\theta=\beta\log\frac{\pi_\theta}{\pi_{\text{ref}}}.$$
"higher weight when reward estimate is wrong"; the paper reports a naive (unweighted) version degenerates (line [135]).
Code `[code]` (`eric-mitchell/.../trainers.py::preference_loss`): `logits = pi_logratios - ref_logratios; losses = -F.logsigmoid(beta*logits)*(1-label_smoothing) - F.logsigmoid(-beta*logits)*label_smoothing`; `chosen_rewards = beta*(policy_chosen_logps - reference_chosen_logps).detach()`; log-probs are **sums** over response tokens (`_get_batch_logps`, `average_log_prob=False` default). TRL: `dpo_trainer.py` lines 1466-1467 `per_sequence_loss = -F.logsigmoid(self.beta * delta_score)`.

### 3.3 Algorithm (lines [136]-[138]) `[paper]`
1. For each prompt $x$ sample $y_1,y_2\sim\pi_{\text{ref}}$, label with human preferences -> offline $\mathcal D$ (or reuse a public preference set).
2. $\pi_{\text{ref}}=\pi^{\text{SFT}}$ if available, else maximise likelihood of preferred completions $(x,y_w)$ to get $\pi_{\text{ref}}$.
3. Minimise $\mathcal L_{\text{DPO}}$ with fixed $\beta$. No sampling, no explicit RM, no critic.
Also: Plackett-Luce version in Appendix A.3 `[paper]`.

### 3.4 Hyper-parameters
- Paper (Appendix B, line [742]) `[paper]`: "$\beta=0.1$, batch size of 64 and the RMSprop optimizer with a learning rate of 1e-6 by default. We linearly warmup the learning rate from 0 to 1e-6 over 150 steps. For TL;DR summarization, we use $\beta=0.5$."
- Repo defaults `[code]` (`config/config.yaml`): `lr: 5e-7`, `batch_size: 4`, `optimizer: RMSprop`, `warmup_steps: 150`, `max_grad_norm: 10.0`, `max_length: 512`, `max_prompt_length: 256`, `n_epochs: 1`; `config/loss/dpo.yaml`: `beta: ???` (must be set), `label_smoothing: 0`, `reference_free: false`. **Repo defaults differ from the paper's stated values** - teach the paper's as "paper", not as repo defaults.
- TRL `DPOConfig` (main) `[code]`: `learning_rate=1e-6`, `beta=0.1`, `loss_type=["sigmoid"]`, `max_length=1024`, `label_smoothing=0.0`, `f_divergence_type="reverse_kl"`, `precompute_ref_log_probs=False`, `sync_ref_model=False`.

### 3.5 Failure modes
- Paper's own open questions `[paper]` (line [245]): OOD generalisation vs explicit RM, how reward over-optimisation manifests for DPO, scaling beyond 6B.
- IPO paper: with deterministic/finite-sample preferences BT-DPO can push $\pi(y_l)\to0$ regardless of $\tau$, i.e. KL regularisation becomes ineffective (lines [98]-[101]) `[paper]`.
- Offline, so on-policy drift: the data were sampled from $\pi^{\text{SFT}}$ and the paper adds the "$\pi_{\text{ref}}$ by max-likelihood" patch for that mismatch `[paper]`.
- Length/likelihood artefacts motivate SimPO (length-normalised reward) `[paper]` (SimPO abstract); "likelihood displacement" literature `[not read]`.

### 3.6 DT connection `[inferred]`
DPO is the closest RLHF method to DT's *recipe* (fixed dataset, supervised classification loss, no environment interaction). But the supervised target is a *preference over policy log-ratios*, not an action conditioned on a return; the implicit reward $\beta\log(\pi_\theta/\pi_{\text{ref}})$ plays the role DT gives to the return token.

### 3.7 Numeric example `[computed]` ($\beta=0.1$, sequence-summed log-probs)
| pair | $\log\pi_\theta(y_w)$ | $\log\pi_\theta(y_l)$ | $\log\pi_{\text{ref}}(y_w)$ | $\log\pi_{\text{ref}}(y_l)$ | $\Delta$ | $\beta\Delta$ | loss | grad weight $\sigma(-\beta\Delta)$ | $\hat r_w/\hat r_l$ |
|---|---|---|---|---|---|---|---|---|---|
| A | -12 | -15 | -13 | -14 | $(3)-(1)=2$ | 0.2 | 0.5981 | 0.4502 | +0.1 / -0.1 |
| B | -20 | -18 | -19 | -19 | $(-2)-(0)=-2$ | -0.2 | 0.7981 | 0.5498 | -0.1 / +0.1 |
Batch mean DPO loss $=0.6981$. Pair B (policy has the wrong order) gets the larger gradient weight - the "dynamic importance weight".

### 3.8 Official figures `[paper]`
- Fig. 1 (line [87]): "DPO optimizes for human preferences while avoiding reinforcement learning. ... fit a reward model ... then use RL ... In contrast, DPO directly optimizes for the policy best satisfying the preferences with a simple classification objective, fitting an implicit reward model whose corresponding optimal policy can be extracted in closed form." Image (HTTP 200): https://arxiv.org/html/2305.18290v3/figures/diagrams/teaser.png . Teaches: RLHF two-stage vs one-stage.
- Fig. 2 (line [177]): left = reward-vs-KL frontier (DPO highest for all KL), right = TL;DR win-rate vs temperature (DPO more robust than PPO). Teaches: DPO optimises the same trade-off as PPO but better on that frontier.
- Fig. 3 (line [181]): Anthropic-HH win rates and robustness across sampling temperatures over training.

---

## 4. IPO (Psi-PO), KTO, and why they exist

### 4.1 IPO
**Ref**: Azar, Rowland, Piot, Guo, et al. (7 authors per arXiv API), *A General Theoretical Paradigm to Understand Learning from Human Preferences*, arXiv 2310.12036 **v2** (2023-11-22) `[paper]`. Code: no official repo found; implemented in DPO repo flag `ipo` and in TRL `loss_type="ipo"` `[code]`.
**$\Psi$PO** (lines [69]-[93]): $\max_\pi\ \mathbb E_{y\sim\pi,y'\sim\mu}[\Psi(p^*(y\succ y'\mid x))]-\tau D_{\text{KL}}(\pi\|\pi_{\text{ref}})$; RLHF/DPO are the special case $\Psi=\text{logit}$ (unbounded). IPO takes $\Psi=\text{identity}$. Let $h_\pi(y,y')=\log\frac{\pi(y)\pi_{\text{ref}}(y')}{\pi(y')\pi_{\text{ref}}(y)}$. Population loss (13)/(16): $\mathbb E_{y,y'\sim\mu}\big[(h_\pi(y,y')-\tau^{-1}I(y,y'))^2\big]$ with $I\sim\text{Bernoulli}(p^*(y\succ y'))$. For a pair $(y_w,y_l)$ this is $\big(h_\pi(y_w,y_l)-\tfrac1{2\tau}\big)^2$ - confirmed by DPO-repo code comment "Eq. 17 of arxiv 2310.12036v2": `losses = (logits - 1/(2*beta))**2` `[code]`.
**Hyper-parameter**: $\tau$ (= `beta` in code); no single recommended value captured `[not read]`.
**Failure mode IPO addresses**: DPO overfitting under deterministic preferences (above). **TRL caveat `[code]`** (`dpo_trainer.py` ~line 1472-1480): TRL's `ipo` divides each sequence's log-ratio by its completion length ("not explicitly discussed in the IPO paper; we confirmed this choice with the IPO authors") - so TRL-IPO $\ne$ the equation above.
**Numeric** `[computed]`: same pairs as 3.7, $\tau=0.1\Rightarrow 1/(2\tau)=5$: $(2-5)^2=9$, $(-2-5)^2=49$, mean $29$ (unnormalised form).
**DT connection** `[inferred]`: regression onto a *fixed target margin* $1/(2\tau)$ rather than a classification - closer to "supervised regression to a target return" than DPO's sigmoid.

### 4.2 KTO
**Ref**: Ethayarajh, Xu, Muennighoff, Jurafsky, et al. (5 authors per arXiv API), *KTO: Model Alignment as Prospect Theoretic Optimization*, arXiv 2402.01306 **v5** (updated 2026-09-08; I read the latest HTML; earlier versions' notation may differ) `[paper]`. Code: `ContextualAI/HALOs` (Apache-2.0 `[meta]`, last push 2025-09-30); TRL `trl/trainer/kto_trainer.py` (Apache-2.0) `[code]`.
**Loss (Eq. 8)** `[paper]` (html lines [332]-[342]):
$$L_{\text{KTO}}(\pi_\theta,\pi_{\text{ref}})=\mathbb E_{x,y\sim D}[\lambda_y-v(x,y)],\quad r_\theta=\log\frac{\pi_\theta(y|x)}{\pi_{\text{ref}}(y|x)},\ z_0=\text{KL}(\pi_\theta(y'|x)\|\pi_{\text{ref}}(y'|x)),$$
$$v(x,y)=\begin{cases}\lambda_D\,\sigma\big(\beta(r_\theta-z_0)\big)&y\ \text{desirable}\\ \lambda_U\,\sigma\big(\beta(z_0-r_\theta)\big)&y\ \text{undesirable.}\end{cases}$$
No backprop through $z_0$. Practical $z_0$ estimate: shift outputs in the microbatch to form mismatched pairs, $\hat z_0=\max\big(0,\frac1m\sum_i\log\frac{\pi_\theta(y_j|x_i)}{\pi_{\text{ref}}(y_j|x_i)}\big)$, $j=(i\bmod m)+1$ (lines [356]-[358]); the paper calls it biased but convenient.
**Data**: **unpaired** binary labels (desirable/undesirable) - no pairs needed `[paper]`; claim that a binary signal may suffice came from offline PPO with dummy +1/-1 rewards (line [268]).
**Hyper-parameters**: paper sweeps used AdamW, effective batch 32, grad-clip norm 10, $\lambda_D=\lambda_U=1$; "optimal choice of $\lambda_D,\lambda_U$ might be significantly different" depending on desirable:undesirable ratio (lines [272]-[273]) `[paper]`. Repo: `config/loss/kto.yaml`: `beta: 0.1, desirable_weight: 1.0, undesirable_weight: 1.0`; `config/config.yaml`: `lr: 5e-6, n_epochs: 1, optimizer: AdamW` `[code]`. TRL `KTOConfig`: `learning_rate=1e-6, beta=0.1, loss_type="kto", desirable_weight=1.0, undesirable_weight=1.0, max_length=1024` `[code]`. (Table 1 recommended settings not captured.)
**Failure modes**: offline PPO baseline "hyperparameter sensitivity and training instability" (line [266]); $z_0$ estimator is biased (above) `[paper]`.
**Numeric** `[computed]` ($\beta=0.1,\ z_0=1,\ \lambda=1$): desirable with $r_\theta=3$: $v=\sigma(0.2)=0.5498$, loss $0.4502$; undesirable with $r_\theta=0.5$: $v=\sigma(0.05)=0.5125$, loss $0.4875$.
**DT connection** `[inferred]`: KTO conditions on a *binary label* (desirable/undesirable) as DT conditions on return; the KL "reference point" $z_0$ is an *anchor*, which DT lacks.
**Official figure** `[paper]` Fig. 1 (line [101]): "The utility that a human gets from the outcome of a random variable, as implied by different human-aware losses (HALOs)." Image (HTTP 200): https://arxiv.org/html/2402.01306v5/figures/utility.png . Teaches: prospect-theory value curve (reference point, concave gains, loss aversion) vs DPO/PPO-Clip utilities.

---

## 5. RLOO (REINFORCE Leave-One-Out)

**Ref**: Ahmadian, Cremer, Gall\'e, Fadaee, et al. (8 authors per arXiv API), *Back to Basics: Revisiting REINFORCE Style Optimization for Learning from Human Feedback in LLMs*, ACL 2024, arXiv 2402.14740 **v2** `[paper]`. Code: TRL `trl/trainer/rloo_trainer.py` ("Back to Basics" referenced in docstring, line 119) (Apache-2.0) `[code]`; also OpenRLHF, open-instruct, verl `[meta]`.
**Setup**: KL-shaped sequence reward $R(x,y)=r_\phi(x,y)-\beta\log\frac{\pi_\theta(y|x)}{\pi_{\text{ref}}(y|x)}$ (html line [107]) `[paper]`. Treat the **whole completion as one action** (bandit) rather than per-token MDP.
**Estimator** (lines [133]-[138]) `[paper]`:
$$\frac1k\sum_{i=1}^k\Big[R(y_{(i)},x)-\frac1{k-1}\sum_{j\ne i}R(y_{(j)},x)\Big]\nabla\log\pi(y_{(i)}\mid x),\quad y_{(1..k)}\overset{iid}\sim\pi_\theta(\cdot|x).$$
**Algorithm**: sample $k$ completions per prompt; reward each; baseline of sample $i$ = mean reward of the other $k-1$; vanilla policy-gradient step. No critic, no GAE, no clipping required.
**Claims `[paper]`**: PPO's components are unnecessary for RLHF: vanilla REINFORCE beats PPO by 3.2-20.3% win-rate (line [87]); clipping "rarely necessary" (section 3.2 heading); RLOO beats PPO, DPO, RAFT across datasets/models (line [89]). Figure 1 caption: higher variance-reduction-at-cost-of-bias (low GAE $\lambda$) performs worse than $\lambda=1$; "PPO is unnecessarily complicated" (line [81]).
**TRL defaults `[code]`** (`rloo_config.py`): `learning_rate=1e-6, num_generations=2, beta=0.05, epsilon=0.2, num_iterations=1, normalize_advantages=False, max_completion_length=512, temperature=1.0`. Baseline code `rloo_trainer.py` lines 1755-1757: `baselines = (grouped_sum - grouped_rewards)/(scorable_counts-1); advantages = rewards - baselines`. (TRL's RLOO still keeps a PPO-style clipped surrogate with $\epsilon=0.2$ - differs from the "clipping is rarely necessary" message `[inferred]`.)
**Failure modes**: needs $k\ge2$ online samples (more generation cost) `[paper]`; unclipped REINFORCE is on-policy and unstable if reused for many inner epochs `[inferred]`.
**Numeric** `[computed]` $k=4$, rewards $[1,0,0,1]$: advantages $[+0.667,-0.667,-0.667,+0.667]$; rewards $[1,0,0,0]$: $[+1.0,-0.333,-0.333,-0.333]$. Identity (checked numerically, not from a paper) $A^{\text{RLOO}}_i=\frac k{k-1}(R_i-\bar R)$ `[inferred]`.
**DT connection** `[inferred]`: the baseline is a *self-conditioned return estimate*; contrast with DT, which conditions on a *target* return instead of subtracting an estimated one.
**Official figure**: RLOO Fig. 1 (see above); image filenames not captured (page: https://arxiv.org/html/2402.14740).

---

## 6. GRPO (DeepSeekMath; DeepSeek-R1) and its variants

### 6.1 References / code
- Shao, Wang, Zhu, Xu, et al. (11 authors per arXiv API), *DeepSeekMath: Pushing the Limits of Mathematical Reasoning in Open Language Models*, arXiv 2402.03300 **v3** (2024-04-27) `[paper]` - introduces GRPO.
- DeepSeek-AI (Guo et al. ...), *DeepSeek-R1: Incentivizing Reasoning Capability in LLMs via Reinforcement Learning*, arXiv 2501.12948 **v2** (updated 2026-01-04; the v2 text includes Supplementary sections) `[paper]`.
- Repos: `deepseek-ai/DeepSeek-R1` - MIT `[meta]`; contents are `DeepSeek_R1.pdf, LICENSE, README.md, figures` only: **no training code** `[code]` (directory listing). `deepseek-ai/DeepSeek-Math` - MIT `[meta]` (code licence file `LICENSE-CODE`; model `LICENSE-MODEL`); contents `evaluation, images, replicate ...`: **no RL training code** `[code]`.
- Reference implementations of GRPO (third-party): TRL `grpo_trainer.py` (Apache-2.0), `verl-project/verl` (Apache-2.0), `OpenRLHF/OpenRLHF` (Apache-2.0), `ContextualAI/HALOs` `GRPOTrainer` (Apache-2.0) `[meta]/[code]`.

### 6.2 Objective `[paper]`
DeepSeekMath (Eq. 3 region, html lines [716]-[720]), per-token form:
$$\mathcal J_{\text{GRPO}}(\theta)=\mathbb E_{q\sim P(Q),\{o_i\}_{i=1}^G\sim\pi_{\theta_{\text{old}}}(O|q)}\Big[\frac1G\sum_{i=1}^G\frac1{|o_i|}\sum_{t=1}^{|o_i|}\Big\{\min\Big[\tfrac{\pi_\theta(o_{i,t}|q,o_{i,<t})}{\pi_{\theta_{\text{old}}}(o_{i,t}|q,o_{i,<t})}\hat A_{i,t},\ \text{clip}\big(\cdot,1-\varepsilon,1+\varepsilon\big)\hat A_{i,t}\Big]-\beta\,\mathbb D_{\text{KL}}[\pi_\theta\|\pi_{\text{ref}}]\Big\}\Big]$$
with the unbiased, always-positive KL estimator
$$\mathbb D_{\text{KL}}[\pi_\theta\|\pi_{\text{ref}}]=\frac{\pi_{\text{ref}}(o_{i,t}|q,o_{i,<t})}{\pi_\theta(o_{i,t}|q,o_{i,<t})}-\log\frac{\pi_{\text{ref}}(o_{i,t}|q,o_{i,<t})}{\pi_\theta(o_{i,t}|q,o_{i,<t})}-1 .$$
Outcome-supervision advantage (line [752]): $\hat A_{i,t}=\tilde r_i=\dfrac{r_i-\text{mean}(\mathbf r)}{\text{std}(\mathbf r)}$ for **all tokens** of $o_i$. Process supervision (line [755]): $\hat A_{i,t}=\sum_{\text{index}(j)\ge t}\tilde r_i^{\text{index}(j)}$.
R1 restates a per-sequence version (Eq. 1-3; html lines [130],[135]): $\frac1G\sum_i\big(\min(\frac{\pi_\theta(o_i|q)}{\pi_{\theta_{\text{old}}}(o_i|q)}A_i,\text{clip}(\cdot,1-\varepsilon,1+\varepsilon)A_i)-\beta\mathbb D_{KL}(\pi_\theta\|\pi_{\text{ref}})\big)$, $A_i=\frac{r_i-\text{mean}(\{r_1..r_G\})}{\text{std}(\{r_1..r_G\})}$.
The paper does **not** say whether std is population or sample; TRL uses Bessel-corrected sample std $(n-1)$ with `+1e-4` in the denominator `[code]` (`trl/trainer/utils.py::nanstd`; `grpo_trainer.py` lines 2933-2955).

### 6.3 Algorithm (DeepSeekMath Algorithm 1, lines [723]-[750]) `[paper]`
For iteration $=1..I$: set $\pi_{\text{ref}}\leftarrow\pi_\theta$; for step $=1..M$: sample batch $\mathcal D_b$; $\pi_{\theta_{\text{old}}}\leftarrow\pi_\theta$; sample $G$ outputs per question from $\pi_{\theta_{\text{old}}}$; score with reward model $r_\varphi$; compute group-relative advantages; for $\mu$ inner iterations maximise $\mathcal J_{\text{GRPO}}$; (update $r_\varphi$ via replay). No value network - baseline = group mean (Fig. 4 caption: "GRPO foregoes the value model, instead estimating the baseline from group scores, significantly reducing training resources").

### 6.4 Data
Questions (+ a reward signal): DeepSeekMath used a learned RM (outcome or process); R1-Zero used **rule-based** accuracy reward (boxed answer / compiler test cases) + **format reward** (`<think>...</think>` tags) and explicitly "abstain[ed] from applying neural reward models - whether outcome-based or process-based - to reasoning tasks" because of reward hacking (R1 html lines [148]-[154]) `[paper]`.

### 6.5 Hyper-parameters (all `[paper]` unless noted)
| Source | Setting |
|---|---|
| DeepSeekMath RL (line [768]) | policy LR **1e-6**, KL coef **0.04**, **64** samples/question, max length 1024, training batch 1024 |
| R1-Zero (lines [138]) | LR **3e-6**, KL coef **0.001**, temperature 1, **16** outputs/question, max len 32,768 (-> 65,536 after step 8.2k), 32 questions/step (batch 512), 10,400 steps (~1.6 epochs), reference replaced by latest policy every 400 steps |
| R1 stage-1 RL (line [212]) | same LR/KL/temperature/G; "GRPO clip ratio $\varepsilon$ to **10**" *as printed* (looks unusual vs the usual 0.2 - verify against PDF before teaching) ; 8,192 outputs per rollout split into 16 minibatches, single inner epoch |
| R1 stage-2 RL (line [229]) | temperature 0.7; 1,700 steps; preference-RM rewards only in last 400 steps (more steps -> reward hacking) |
| TRL `GRPOConfig` `[code]` (main) | `learning_rate=1e-6, num_generations=8, max_completion_length=512, temperature=1.0, beta=0.0 (reference model not loaded), epsilon=0.2, epsilon_high=None (DAPO recommends 0.28), num_iterations=1, scale_rewards="group", loss_type="dapo"` (supported: grpo, dr_grpo, dapo, bnpo, cispo, sapo, luspo, vespo), `importance_sampling_level="token"`, `mask_truncated_completions=False` |
| verl example `run_qwen3_8b_fsdp.sh` `[code]` | `adv_estimator=grpo`, actor LR 1e-6, `kl_loss_coef=0.001`, `kl_loss_type=low_var_kl`, `entropy_coeff=0`, rollout `n=5`, train batch 1024, ppo mini-batch 256, max prompt/response 1024/2048 (env-overridable) |
| HALOs `config/loss/grpo.yaml` `[code]` | `beta: 0.01, epsilon: 0.01, sequence_level: true` |
**Note**: TRL's *defaults* (`beta=0`, `loss_type="dapo"`) are not "original GRPO" - to match DeepSeekMath one needs `loss_type="grpo"`, `beta=0.04` `[inferred from the two sources]`.

### 6.6 Failure modes
- **Length bias**: dividing by $|o_i|$ -> shorter correct answers favoured, longer wrong answers penalised less; **difficulty bias**: dividing by group std up-weights too-easy/too-hard questions (Dr. GRPO, Liu et al., arXiv 2503.20783 **v2**, html lines [191],[193]; Fig. 1: removing length and std normalisation) `[paper]`. They also report open-source PPO implementations show the same length normalisation (line [195]).
- **Entropy collapse / reward noise / instability** in naive GRPO (30 AIME points vs 47 for R1-Zero-Qwen-32B, DAPO, arXiv 2503.14476 **v2**, html line [52]); DAPO fixes: Clip-Higher ($\varepsilon_{\text{low}}$ vs $\varepsilon_{\text{high}}$), Dynamic Sampling, token-level loss $\frac1{\sum_i|o_i|}$, Overlong Reward Shaping (section headings lines [24]-[27]; objective lines [105]-[108]) `[paper]`. DAPO config: AdamW, constant LR 1e-6, 20-step warmup, prompt batch 512, 16 responses/prompt, mini-batch 512, max 16,384 + 4,096 soft-punish tokens = 20,480 (lines [201]-[202]) `[paper]`.
- **Neural reward hacking** when a learned RM replaces rules; R1 stage 2 limited to 400 steps for this reason (R1 lines [154],[229],[389]) `[paper]`.
- **Zero-variance groups**: if all $G$ rewards equal, std = 0 and advantage = 0 (TRL logs `is_std_zero`, lines 2955-2956) `[code]`; the "no signal" implication is `[inferred]`.
- Unsuccessful attempts section lists PRM and MCTS (R1 Supplementary G.2 lines [2149]-[2153]) `[paper]` - see section 8.

### 6.7 DT connection `[inferred]`
GRPO's group-normalised advantage is a **rank/z-score of returns within a prompt** - it replaces DT's absolute return conditioning with relative return *comparison*; both avoid a learned value function, but GRPO performs gradient policy improvement online while DT imitates conditionally offline. R1-Zero's emergent long chain-of-thought (reward = verifiable outcome only) is the "optimise, don't condition" extreme.

### 6.8 Numeric examples `[computed]`
Group $G=4$.
| rewards | mean | pop. std | $\hat A$ (pop std, paper form) | sample std ($n{-}1$) | $\hat A$ TRL (sample std + 1e-4) | Dr. GRPO (no std) | RLOO $k{=}4$ |
|---|---|---|---|---|---|---|---|
| $[1,0,0,1]$ | 0.5 | 0.5 | $[+1,-1,-1,+1]$ | 0.5774 | $[+0.8659,-0.8659,-0.8659,+0.8659]$ | $[+.5,-.5,-.5,+.5]$ | $[+.667,-.667,-.667,+.667]$ |
| $[1,0,0,0]$ | 0.25 | 0.4330 | $[+1.7321,-0.5774\times3]$ | 0.5 | $[+1.4997,-0.4999\times3]$ | $[+0.75,-0.25\times3]$ | $[+1.0,-0.333\times3]$ |
| $[0.9,0.1,0.4,0.6]$ (RM scores) | 0.5 | 0.2915 | $[+1.372,-1.372,-0.343,+0.343]$ | - | - | - | - |
KL estimator: $\log\pi_\theta=-1.0,\ \log\pi_{\text{ref}}=-1.2\Rightarrow$ ratio $e^{-0.2}=0.8187$, $k_3=0.8187-\ln0.8187-1=0.0187$; if $\log\pi_{\text{ref}}=-0.8$: $0.0214$. Clip with DAPO $\varepsilon_{\text{high}}=0.28$: $\rho=1.3,A=+1\Rightarrow\min(1.3,1.28)=1.28$.

### 6.9 Official figures `[paper]`
- DeepSeekMath Fig. 4 (line [714]): "Demonstration of PPO and our GRPO. GRPO foregoes the value model, instead estimating the baseline from group scores, significantly reducing training resources." Same figure reused as R1 Fig. 3 (line [611]); image (HTTP 200): https://arxiv.org/html/2501.12948v2/ppo_vs_grpo.png . Teaches: PPO needs policy+value+reward+reference; GRPO drops the value model.
- R1 Fig. 1 (line [157]): (a) AIME accuracy of R1-Zero during RL (pass@1, cons@16 vs human baseline); (b) average response length grows during RL ("naturally learns to solve reasoning tasks with more thinking time"). Teaches: RLVR-driven test-time-compute growth.
- R1 Fig. 2 (line [187]): the multi-stage pipeline (cold-start SFT -> reasoning RL -> rejection-sampling SFT -> second RL for helpfulness/harmlessness); Table 2 "aha moment" (line [162]).
- Dr. GRPO Fig. 1 (line [59]) and Fig. 5 (line [243]): GRPO vs Dr. GRPO objectives; response length keeps growing under GRPO even as reward plateaus.

---

## 7. ORPO and SimPO (brief) - reference-free preference losses

### 7.1 ORPO
**Ref**: Hong, Lee, Thorne, *ORPO: Monolithic Preference Optimization without Reference Model*, arXiv 2403.07691 **v2** `[paper]`. Code `xfactlab/orpo` Apache-2.0 `[meta]` (`main.py`, `src/args.py`).
**Loss** (Eq. 5-7, html lines [129]-[140]) `[paper]`: $\text{odds}_\theta(y|x)=\frac{P_\theta(y|x)}{1-P_\theta(y|x)}$; $\text{OR}_\theta(y_w,y_l)=\frac{\text{odds}_\theta(y_w|x)}{\text{odds}_\theta(y_l|x)}$;
$$\mathcal L_{\text{ORPO}}=\mathbb E_{(x,y_w,y_l)}\big[\mathcal L_{\text{SFT}}+\lambda\,\mathcal L_{\text{OR}}\big],\quad \mathcal L_{\text{OR}}=-\log\sigma\Big(\log\frac{\text{odds}_\theta(y_w|x)}{\text{odds}_\theta(y_l|x)}\Big).$$
SimPO's Table 7 writes ORPO with the length-normalised probability $p_\theta(y|x)=\exp(\frac1{|y|}\log\pi_\theta(y|x))$ (html line [1143]) `[paper, via SimPO]`.
**Algorithm**: single stage, no SFT-then-align split and no reference model; SFT NLL on the chosen answer + odds-ratio penalty (Fig. 2 caption: "assigning a weak penalty to the rejected responses and a strong adaptation signal to the chosen responses", line [96]).
**Hyper-parameters**: SimPO's sweep for ORPO: $\lambda\in\{0.1,0.5,1.0,2.0\}$ (line [1142]) `[paper]`; repo `src/args.py` defaults `[code]`: `lr=2e-5, alpha(lambda)=1.0, num_train_epochs=10, per_device_train_batch_size=2, warmup_steps=5000, optim=paged_adamw_32bit, lr_scheduler=cosine, prompt_max_length=256, response_max_length=1024`. Paper: AdamW/paged AdamW, linear warmup + cosine decay, inputs truncated to 1,024 (HH-RLHF) / 2,048 (UltraFeedback) tokens (line [596]) `[paper]`.
**Failure modes**: SimPO reports ORPO is outperformed by SimPO on AlpacaEval 2/Arena-Hard (line [150]) `[paper]`; "monolithic" training couples SFT strength and preference strength via one $\lambda$ `[inferred]`.
**Numeric** `[computed]` (sum logp $-12$ over 10 tokens, $-15$ over 12 tokens): $p_w=e^{-1.2}=0.3012,\ p_l=e^{-1.25}=0.2865$; log-odds gap $0.0708$; $\mathcal L_{\text{OR}}=0.6584$; $\mathcal L_{\text{SFT}}$ (per-token NLL) $=1.2$; total at $\lambda=1$: $1.8584$.
**Figure**: Fig. 2 (above). Image (HTTP 200): https://arxiv.org/html/2403.07691v2/orpo_main.png (figure-number mapping `[inferred]` from filename `orpo_main`).

### 7.2 SimPO
**Ref**: Meng, Xia, Chen, *SimPO: Simple Preference Optimization with a Reference-Free Reward*, NeurIPS 2024, arXiv 2405.14734 **v3** (2024-11-01) `[paper]`. Code `princeton-nlp/SimPO` MIT `[meta]`; configs in `training_configs/` `[code]`.
**Reward** (html line [179]): $r_{\text{SimPO}}(x,y)=\frac\beta{|y|}\log\pi_\theta(y|x)$. **BT with margin** (Eq. 5, line [185]): $p(y_w\succ y_l|x)=\sigma\big(r(x,y_w)-r(x,y_l)-\gamma\big)$. **Loss** (Table 7, line [1149]):
$$\mathcal L_{\text{SimPO}}=-\mathbb E\Big[\log\sigma\Big(\frac\beta{|y_w|}\log\pi_\theta(y_w|x)-\frac\beta{|y_l|}\log\pi_\theta(y_l|x)-\gamma\Big)\Big].$$
**Hyper-parameters**: search ranges $\beta\in[2.0,2.5]$, $\gamma\in\{0.3,0.5,1.0,1.2,1.4,1.6\}$ (Table 7 lines [1150]-[1151]) `[paper]`; config `llama-3-8b-base-simpo.yaml` `[code]`: `beta: 2.0, gamma_beta_ratio: 0.5` (i.e. $\gamma=\beta\cdot0.5=1.0$ `[inferred]`), `learning_rate: 6.0e-7`, cosine, `warmup_ratio: 0.1`, `num_train_epochs: 1`, `max_length: 2048`, grad-accum 16 x per-device batch 2, base `princeton-nlp/Llama-3-Base-8B-SFT`.
**Failure modes / caveats**: margin too large hurts quality (line [189]: "generation quality initially improves with an increasing target margin b[ut]..." truncated) `[paper]`; IPO has a similar margin but "its full objective is not as effective" (line [190]) `[paper]`.
**Numeric** `[computed]`: $\beta=2,\gamma=1$; $r_w=2\cdot(-12/10)=-2.4$, $r_l=2\cdot(-15/12)=-2.5$; margin $0.1-1=-0.9$; loss $=-\log\sigma(-0.9)=1.2412$.
**Figure**: Fig. 1 (line [106]): "SimPO and DPO mainly differ in their reward formulation, as indicated in the shaded box." Teaches: reference-ratio reward (DPO) vs average-log-prob reward + margin (SimPO). (Image filename not mapped.)
**DT connection (7.1+7.2)** `[inferred]`: dropping $\pi_{\text{ref}}$ removes the KL anchor, leaving a purely *supervised contrast* - the most DT-like objective in the family, at the price of the trust-region guarantee.

---

## 8. Process vs outcome reward models (PRM / ORM)

**Refs**: Uesato, Kushman, Kumar, Song, et al., *Solving math word problems with process- and outcome-based feedback*, arXiv 2211.14275 **v1** (ar5iv) `[paper]`. Lightman, Kosaraju, Burda, Edwards, et al. (10 authors per arXiv API), *Let's Verify Step by Step*, arXiv 2305.20050 **v1** `[paper]`. Data/code: `openai/prm800k` MIT `[meta]` (last push 2023-06-01; contents not read).
**Definitions** `[paper]`: ORM trained "using only the final result of the model's chain-of-thought", PRM "receive[s] feedback for each step" (Lightman line [77]). Uesato: pure outcome supervision gives similar *final-answer* error with less label supervision, but reasoning-step correctness needs process supervision or RMs emulating it; 16.8%->12.7% final-answer error and 14.0%->3.4% trace error (ar5iv lines [19]-[20]).
**PRM800K** (lines [100]-[101]): human labels positive/negative/neutral per step; **800K step labels, 75K solutions, 12K problems**; 4.5K MATH test problems folded into train so evaluation is on the remaining 500.
**Training / scoring** (lines [109]-[110]) `[paper]`: PRM predicts a single correctness token after each step, trained with log-likelihood, one forward pass at test time. **Solution score = probability every step is correct = product of per-step probabilities.**
$$\text{score}_{\text{PRM}}(s)=\prod_{k=1}^{K}p_\theta(\text{step}_k\ \text{correct}\mid x,\text{step}_{\le k})$$
Supervision only up to the *first* incorrect step so ORM and PRM carry comparable information on wrong solutions. Evaluation: best-of-$N$ selection graded by final answer (line [93]); PRM solves 78.2% of a MATH subset (line [81]); active learning gives 2.6x data efficiency (line [85]). Generator is *not* RL-trained in that paper (line [92]).
**Hyper-parameters**: not captured (Appendix F on scoring alternatives `[not read]`).
**Failure modes** `[paper]`: R1's 3 limitations of PRMs for RL (Supplement G.2, lines [2150]-[2152]): (1) fine-grained "step" ill-defined in general reasoning; (2) judging a step is hard, auto-labels poor, manual labels don't scale; (3) a model-based PRM "inevitably leads to reward hacking" and must be retrained. R1 concludes PRMs are good for reranking top-N / guided search but costly inside large-scale RL.
**DT connection** `[inferred]`: a PRM gives a *dense per-step value estimate* (like a return-to-go estimate at every token boundary) - the thing GRPO's process-supervision advantage uses (6.2). An ORM/verifier is the sparse terminal return.
**Numeric** `[computed]`: steps with $p=[0.95,0.90,0.40]$: PRM score $=0.342$ (product, paper's choice). Taking the min step prob. $=0.40$ is an *alternative* aggregator `[inferred]`.
**Official figures**: Lightman Fig. 1 (line [98]) "A screenshot of the interface used to collect feedback for each step in a solution" (https://arxiv.org/html/2305.20050v1/figures/data_interface_simple.png, HTTP 200 - filename mapping `[inferred]`); Fig. 2 (line [104]) two solutions graded by the PRM, green=positive step; Fig. 3 (line [120]) "A comparison of outcome-supervised and process-supervised reward models, evaluated by their ability to search over many test solutions. Majority voting is shown as a strong baseline." (https://arxiv.org/html/2305.20050v1/large_orm_prm.png, HTTP 200 - mapping `[inferred]`). Teaches: per-step reward model beats ORM/majority vote under best-of-$N$.

---

## 9. RLVR (Reinforcement Learning with Verifiable Rewards)

**Ref**: Lambert, Morrison, Pyatkin, Huang, et al. (Ai2), *Tulu 3: Pushing Frontiers in Open Language Model Post-Training*, arXiv 2411.15124 **v5** (2025-04-14) `[paper]` - names and defines RLVR (Section 6). DeepSeek-R1-Zero (6) is the large-scale rule-reward instance. Code: `allenai/open-instruct` Apache-2.0 `[meta]` (RLVR trainers; files not read).
**Objective** (Eq. 7-8, html lines [2216]-[2221]) `[paper]`:
$$\max_{\pi_\theta}\ \mathbb E_{y\sim\pi_\theta(x)}\big[v(x,y)-\beta\,\text{KL}[\pi_\theta(y|x)\|\pi_{\text{ref}}(y|x)]\big],\qquad v(x,y)=\begin{cases}\alpha&\text{if correct}\\0&\text{otherwise.}\end{cases}$$
"RLVR leverages the existing RLHF objective but replaces the reward model with a verification function" (line [2209]); optimiser is PPO; $\alpha=10$ "based on pilot experiments and did not tune it further" (line [2222]).
**Data**: prompts + a deterministic verifier (GSM8K, MATH, IFEval-style constraints) (lines [2223]-[2224]).
**Hyper-parameters** (Table 21, lines [2142]-[2162], RLVR column) `[paper]`: LR 3e-7 (1e-7 for 70B), effective batch 224 (640 for 70B), PPO update iterations $K=4$, response length 2,048 (1,024 for GSM8K), **100,000 episodes** (vs 300,000 for RM-PPO), $\beta$ swept in $\{0.1,0.05,0.03,0.01\}$; final 8B used $\beta=0.05$, warm-up ratio 0.0; final 70B $\beta=0.07$, warm-up 0.07 (table caption, line [2163]). Value model initialised from a general RM works best (line [2282]).
**Findings / failure modes** `[paper]`: targeted gains in GSM8K/MATH/IFEval with other benchmarks maintained (Fig. 19); starting from SFT incurs larger KL than starting from DPO for equal reward (Fig. 20); more KL budget eventually over-optimises and average score drops (Fig. 21 caption); an "IFEval overoptimization" appendix exists (section B.4 heading, not read).
**DT connection** `[inferred]`: binary verifier reward is the *terminal return* DT would condition on; RLVR optimises toward it instead of conditioning, with $\beta$-KL as the anchor.
**Numeric** `[computed]`: $\alpha=10,\ \beta=0.05$, sequence KL $=2.0$: correct -> $10-0.1=9.9$; incorrect -> $0-0.1=-0.1$.
**Official figure** `[paper]` Fig. 18 (line [2207]): "An overview of how RLVR works. We sample completions from a policy model given a set of prompts, and verify their correctness using a deterministic function. If the answer is verifiably correct, we provide reward of $\alpha$, otherwise 0. We then train against this reward using PPO." Teaches: RLVR = RLHF with the RM swapped for a verifier. (Image filename for Fig. 18 not identified; Fig. 1 of the paper is https://arxiv.org/html/2411.15124v5/tulu3_figure1_v2.png, HTTP 200.)

---

## 10. LLMs as sequential decision agents (brief)

### 10.1 ReAct
**Ref**: Yao, Zhao, Yu, Du, et al. (7 authors per arXiv API), *ReAct: Synergizing Reasoning and Acting in Language Models*, ICLR 2023, arXiv 2210.03629 **v3** `[paper]`. Code `ysymyth/ReAct` MIT `[meta]`.
**Formalism** (html lines [123],[126]) `[paper]`: policy $\pi(a_t|c_t)$, context $c_t=(o_1,a_1,\dots,o_{t-1},a_{t-1},o_t)$; ReAct augments the action space $\hat{\mathcal A}=\mathcal A\cup\mathcal L$ ($\mathcal L$ = language "thoughts"; a thought "does not affect the external environment, thus leading to no observation feedback" but updates the context).
**Algorithm**: frozen LLM (PaLM-540B; GPT-3 in appendix) prompted with few-shot human trajectories of Thought/Act/Obs (line [129]-[131]); no gradient updates. HotpotQA/FEVER via a Wikipedia API; best overall = ReAct+CoT combination. CoT-SC baseline: 21 samples at T=0.7 (line [161]).
**Failure modes**: CoT hallucinates / propagates errors without grounding (line [93]); acts without reasoning get stuck repeating (lines [124]-[125]) `[paper]`.
**DT connection** `[inferred]`: the trajectory-as-context view is the same as DT's, but conditioning is on natural-language thoughts, not returns.
**Figure**: Fig. 1 (line [107]): "Comparison of 4 prompting methods, (a) Standard, (b) Chain-of-thought (CoT, Reason Only), (c) Act-only, and (d) ReAct (Reason+Act), solving a HotpotQA question." Teaches: interleaving reasoning with environment feedback.

### 10.2 Reflexion
**Ref**: Shinn, Cassano, Berman, Gopinath, et al. (6 authors per arXiv API), *Reflexion: Language Agents with Verbal Reinforcement Learning*, NeurIPS 2023, arXiv 2303.11366 **v4** `[paper]`. Code `noahshinn/reflexion` MIT `[meta]`.
**Algorithm** (Algorithm 1 "Reinforcement via self-reflection", html line [257]) `[paper]`: Actor (LLM) acts -> trajectory $\tau_t$ -> Evaluator gives reward $r_t$ -> Self-Reflection model summarises $\{\tau_t,r_t\}$ into verbal feedback $sr_t$ stored in episodic memory `mem`, bounded to $\Omega$ experiences ("usually set to 1-3", lines [346]-[353]); loop until Evaluator accepts. **No weight update** - "lightweight and doesn't require finetuning the LLM" (line [121]).
**Failure modes**: bounded by context length ($\Omega$) `[paper]`; relies on a reliable evaluator `[inferred]`.
**DT connection** `[inferred]`: episodic text memory = in-context "return/feedback conditioning" across trials.
**Figure**: Fig. 2 (line [274]) "(a) Diagram of Reflexion. (b) Reflexion reinforcement algorithm". Fig. 1 (line [143]): Reflexion applies to decision-making, programming, reasoning.

### 10.3 Voyager
**Ref**: Wang, Xie, Jiang, Mandlekar, et al. (8 authors per arXiv API), *Voyager: An Open-Ended Embodied Agent with Large Language Models*, arXiv 2305.16291 **v2** `[paper]`. Code `MineDojo/Voyager` MIT `[meta]`.
**Algorithm** (html lines [83]-[102]) `[paper]`: three components - (1) automatic curriculum from GPT-4 ("in-context novelty search"), (2) skill library of executable code, (3) iterative prompting (environment feedback + execution errors + self-verification) with **code as the action space**; black-box GPT-4, no fine-tuning.
**Figures**: Fig. 2 (line [95]): "Voyager consists of three key components: an automatic curriculum for open-ended exploration, a skill library for increasingly complex behaviors, and an iterative prompting mechanism that uses code as action space." Image candidate https://arxiv.org/html/2305.16291v2/pull_fig_fig.png (HTTP 200; figure-number mapping `[inferred]`). Fig. 1 (line [87]) discovery curves vs baselines.
**DT connection** `[inferred]`: skill library = retrieval-based policy memory; "return" is replaced by curriculum goals.

---

## 11. World-model decision methods (brief)

### 11.1 DreamerV3
**Ref**: Hafner, Pasukonis, Ba, Lillicrap, *Mastering Diverse Domains through World Models*, arXiv 2301.04104 **v2** (2024-04-17) `[paper]`. Code `danijar/dreamerv3` MIT `[meta]` (pushed 2026-10-04).
**World model loss** (Eq. 2, html lines [113]-[117]) `[paper]`: $\mathcal L(\phi)=\mathbb E_{q_\phi}\big[\sum_{t=1}^T(\beta_{\text{pred}}\mathcal L_{\text{pred}}+\beta_{\text{dyn}}\mathcal L_{\text{dyn}}+\beta_{\text{rep}}\mathcal L_{\text{rep}})\big]$ with $\beta_{\text{pred}}=1,\ \beta_{\text{dyn}}=1,\ \beta_{\text{rep}}=0.1$; prediction loss = symlog squared loss (decoder, reward) + logistic regression (continue flag); dynamics and representation losses are KL terms differing by stop-gradient and scale; **free bits** = clip dyn/rep losses below 1 nat (line [124]).
**Actor loss** (Eq. 6, lines [175]-[179]) `[paper]`: $\mathcal L(\theta)=-\sum_{t=1}^T\text{sg}\big((R^\lambda_t-v_\psi(s_t))/\max(1,S)\big)\log\pi_\theta(a_t|s_t)+\eta\,\mathrm H[\pi_\theta(a_t|s_t)]$, $\eta=3\times10^{-4}$, $S=\text{EMA}(\text{Per}(R^\lambda_t,95)-\text{Per}(R^\lambda_t,5),0.99)$ - REINFORCE on *imagined* latent rollouts.
**Algorithm**: (1) store real experience, (2) train RSSM world model, (3) imagine trajectories from replayed latents, (4) train critic on $\lambda$-returns and actor with Eq. 6, (5) act in real env.
**Repo config** `[code]` (`dreamerv3/configs.yaml`): `batch_size: 16, batch_length: 64, train_ratio: 32.0`, `loss_scales: {rec:1, rew:1, con:1, dyn:1, rep:0.1, policy:1, value:1, repval:0.3}`, `opt: {lr: 4e-5, agc: 0.3, ... warmup: 1000}`, `imag_length: 15`, `horizon: 333`, `imag_loss: {lam: 0.95, actent: 3e-4, slowreg: 1.0}`, RSSM `{deter: 8192, hidden: 1024, stoch: 32, classes: 64}` for the 'size' preset shown.
**Failure/limits**: sparse-reward exploration solved by return normalisation (line [190]); free bits needed to avoid degenerate trivially-predictable latents (line [124]) `[paper]`.
**DT connection** `[inferred]`: Dreamer *plans in imagination and optimises*; DT *conditions on desired return*. A world model supplies the counterfactual rollouts DT lacks.
**Symlog numbers** `[computed]` with the standard $\text{symlog}(x)=\text{sign}(x)\ln(|x|+1)$ `[inferred - definition line not captured]`: $x=0,1,10,1000,-100\to0,\ 0.6931,\ 2.3979,\ 6.9088,\ -4.6151$.
**Figures** `[paper]`: Fig. 3 (line [78]): "Training process of Dreamer. The world model encodes sensory inputs into discrete representations $z_t$ ... predicted by a sequence model with recurrent state $h_t$ given actions $a_t$. The inputs are reconstructed to shape the representations. The actor and critic predict actions $a_t$ and values $v_t$ and learn from trajectories of abstract representations predicted by the world model." Fig. 1 (line [49]): benchmark summary with fixed hyper-parameters; image https://arxiv.org/html/2301.04104v2/x1.png (HTTP 200; mapped to Fig. 1 `[inferred]`).

### 11.2 MuZero
**Ref**: Schrittwieser, Antonoglou, Hubert, Simonyan, et al. (12 authors per arXiv API), *Mastering Atari, Go, Chess and Shogi by Planning with a Learned Model*, Nature 2020, arXiv 1911.08265 **v2** `[paper]`. Official code: none located in this session `[not read]` (paper supplement pseudocode `[not read]`). Related: `google-deepmind/mctx` Apache-2.0 `[meta]` (JAX MCTS library; description not read).
**Loss** (html line [56]) `[paper]`: $l_t(\theta)=\sum_{k=0}^K l^r(u_{t+k},r^k_t)+l^v(z_{t+k},v^k_t)+l^p(\pi_{t+k},\mathbf p^k_t)+c\|\theta\|^2$ - reward, value and policy heads unrolled $K$ steps through a learned hidden-state dynamics function $g$ with representation $h$; **no reconstruction loss** ("predict those aspects of the future that are directly relevant for planning", line [35]).
**Hyper-parameters** (line [72]): $K=5$ unroll steps; 1M minibatches (size 2048 board games / 1024 Atari); 800 MCTS simulations/move in board games, 50 in Atari.
**Algorithm**: MCTS over the learned model produces improved policy $\pi_t$ and search value; targets $z$ (n-step return/outcome), train unrolled model on replayed trajectories.
**DT connection** `[inferred]`: *value-equivalent* model trained for decision usefulness; contrast DT: no model, no search.
**Figure** `[paper]` Fig. 1 (line [43]-[47]): (A) planning with the model via MCTS, (B) acting in the environment, (C) "How MuZero trains its model" - unrolled for $K$ steps with real actions.

### 11.3 MOPO
**Ref**: Yu, Thomas, Yu, Ermon, et al. (8 authors per arXiv API), *MOPO: Model-based Offline Policy Optimization*, NeurIPS 2020, arXiv 2005.13239 **v6** `[paper]`. Code `tianheyu927/mopo` MIT `[meta]`, last push 2022-05-17.
**Core equation** (lines [116],[166]) `[paper]`: uncertainty-penalised reward $\tilde r(s,a)=\hat r(s,a)-\lambda\,u(s,a)$, with $u(s,a)=\max_{i=1..N}\|\Sigma^i_\phi(s,a)\|_F$ (max Frobenius norm of the ensemble's predicted covariance); $\lambda:=\gamma c$ in the theory; return in the penalised MDP **lower-bounds** the true return (lines [116]-[119]).
**Algorithm 1** (line [123]): train ensemble dynamics on batch; roll out short model trajectories; compute $\tilde r_j=r_j-\lambda\max_i\|\Sigma^i(s_j,a_j)\|_F$; run SAC-style actor-critic on penalised model data. Hyper-parameters ($\lambda$, rollout length) `[not read]`.
**Failure/limits**: if $u$ underestimates true error the bound breaks `[inferred]`; the paper's Fig. 1 motivates model-based RL for batch RL (MBPO >> SAC offline) (line [24]) `[paper]`.
**DT connection** `[inferred]`: the *pessimism* penalty is the model-based analogue of what DT gets "for free" by staying near the data distribution.
**Numeric** `[computed]`: $\hat r=1.0,\ \lambda=0.5,\ u=0.8\Rightarrow\tilde r=0.6$.

---

## 12. Robot / foundation policies (brief)

### 12.1 Diffusion Policy
**Ref**: Chi, Xu, Feng, Cousineau, et al. (8 authors per arXiv API), *Diffusion Policy: Visuomotor Policy Learning via Action Diffusion*, RSS 2023 / IJRR, arXiv 2303.04137 **v5** (2024-03-14) `[paper]`. Code `real-stanford/diffusion_policy` MIT `[meta]`.
**Equations** `[paper]` (html lines [141]-[148],[174]): reverse step $\mathbf x^{k-1}=\alpha(\mathbf x^k-\gamma\,\epsilon_\theta(\mathbf x^k,k)+\mathcal N(0,\sigma^2I))$ (interpretable as a noisy gradient step $\mathbf x'=\mathbf x-\gamma\nabla E(\mathbf x)$); training loss on an observation-conditioned action chunk
$$\mathcal L=\text{MSE}\big(\epsilon^k,\ \epsilon_\theta(\mathbf O_t,\ \mathbf A^0_t+\epsilon^k,\ k)\big).$$
Horizons (lines [165]-[166]): observe $T_o$ steps, predict $T_p$ action steps, execute $T_a$ (receding horizon).
**Data**: demonstrations (behaviour cloning, no reward). **Hyper-parameters**: paper - sim uses iDDPM with 100 train and 100 inference iterations (line [1071]); real-world DDIM 100 train iterations -> **16** inference iterations in the appendix (line [1071]) vs "**10** inference iterations ... 0.1 s latency on a Nvidia 3080" in the main text (line [206]) - **internal inconsistency; flag** `[paper]`; Square-cosine schedule (line [204]). Repo `train_diffusion_unet_hybrid_workspace.yaml` `[code]`: `horizon: 16, n_obs_steps: 2, n_action_steps: 8`, DDPMScheduler `num_train_timesteps: 100, beta_schedule: squaredcos_cap_v2, prediction_type: epsilon`, `num_inference_steps: 100`, `batch_size: 64, lr: 1.0e-4, weight_decay: 1.0e-6, num_epochs: 3050, use_ema: True`.
**Failure modes / strengths**: handles **multimodal** action distributions; inference latency (needs DDIM); needs demonstrations `[paper]`.
**DT connection** `[inferred]`: both are conditional sequence generators trained by supervised loss on trajectories; Diffusion Policy conditions on observations (no return), DT on return-to-go.
**Figures** `[paper]`: Fig. 1 (line [100]) policy representations: "a) Explicit policy ... b) Implicit policy learns an energy function ... c) Diffusion policy refines noise into actions via a learned gradient field. This formulation provides stable training, allows the learned policy to accurately model multimodal action distributions, and accommodates high-dimensional action sequences." Image (HTTP 200): https://arxiv.org/html/2303.04137v5/DP_teaser.png (mapping `[inferred]`). Fig. 2 (line [133]): overview with $T_o,T_a$, FiLM conditioning in the CNN version.

### 12.2 RT-2
**Ref**: Brohan, Brown, Carbajal, Chebotar, et al. (54 authors), *RT-2: Vision-Language-Action Models Transfer Web Knowledge to Robotic Control*, arXiv 2307.15818 **v1** `[paper]`. Official code: none located `[not read]`.
**Method** (ar5iv lines [96]-[103]) `[paper]`: represent robot actions as text tokens "terminate $\Delta$pos$_x$ $\Delta$pos$_y$ $\Delta$pos$_z$ $\Delta$rot$_x$ $\Delta$rot$_y$ $\Delta$rot$_z$ gripper_extension"; VQA-style prompt "Q: what action should the robot take to [task instruction]? A:"; **co-fine-tune** VLM on web VQA + robot trajectories, rebalancing robot-vs-web sampling weights per batch. Loss = ordinary next-token cross-entropy (implicit; not stated as an equation) `[inferred]`.
**Fig. 1 caption** (line [66]-[68]): "RT-2 overview: we represent robot actions as another language, which can be cast into text tokens and trained together with Internet-scale vision-language datasets. During inference, the text tokens are de-tokenized into robot actions, enabling closed loop control." Teaches: action tokenisation = treat control as language modelling.
**Failure modes**: discretised actions, no action chunking, autoregressive latency `[inferred]` (pi0 text contrasts discretisation vs flow matching, line [84]).
**DT connection** `[inferred]`: RT-2 is DT-style (sequence model emitting actions) but conditioned on a language *instruction* instead of a return.

### 12.3 pi0 ($\pi_0$)
**Ref**: Black, Brown, Driess, Esmail, et al. (24 authors, Physical Intelligence), *$\pi_0$: A Vision-Language-Action Flow Model for General Robot Control*, arXiv 2410.24164 **v4** (updated 2026-01-08) `[paper]`. Code `Physical-Intelligence/openpi` Apache-2.0 `[meta]` (pushed 2026-08-24; `src/openpi/training/config.py` exists but not read; weights licence `[not read]`).
**Objective** (html lines [96]-[103]) `[paper]`: model $p(\mathbf A_t|\mathbf o_t)$ for an action chunk $\mathbf A_t=[\mathbf a_t,\dots,\mathbf a_{t+H-1}]$, $H=50$; observation = images + language + proprioception. Conditional flow-matching loss
$$L^\tau(\theta)=\mathbb E_{p(\mathbf A_t|\mathbf o_t),\,q(\mathbf A^\tau_t|\mathbf A_t)}\|\mathbf v_\theta(\mathbf A^\tau_t,\mathbf o_t)-\mathbf u(\mathbf A^\tau_t|\mathbf A_t)\|^2,$$
$q(\mathbf A^\tau_t|\mathbf A_t)=\mathcal N(\tau\mathbf A_t,(1-\tau)\mathbf I)$, noisy action $\mathbf A^\tau_t=\tau\mathbf A_t+(1-\tau)\epsilon$, target $\mathbf u=\mathbf A_t-\epsilon$; $\tau$ sampled from a beta distribution emphasising low (noisier) $\tau$. Inference: forward Euler $\mathbf A^{\tau+\delta}_t=\mathbf A^\tau_t+\delta\,\mathbf v_\theta(\mathbf A^\tau_t,\mathbf o_t)$ from $\tau=0$ (noise) to 1 with **10 steps ($\delta=0.1$)**.
**Architecture**: PaliGemma 3B VLM + 300M-parameter action expert = 3.3B; separate weights for action/state tokens; bidirectional mask among action tokens (lines [95],[100],[104]). Cross-embodiment pre-training mixture (lines [79]-[80]).
**Failure/limits**: compared against OpenVLA/Octo which "does not support action chunking or high-frequency control" (line [140]) `[paper]`; compute-heavy `[inferred]`.
**DT connection** `[inferred]`: same supervised trajectory modelling, but generates a *chunk* with a continuous generative head; conditioning on language, not return.
**Figure** `[paper]`: Fig. 1 is the overview of pre-training + post-training with a VLM backbone (lines [78]); image https://arxiv.org/html/2410.24164v4/overview.png (HTTP 200; mapping to Fig. 1 `[inferred]`; caption text not captured).

### 12.4 OpenVLA
**Ref**: Kim, Pertsch, Karamcheti, Xiao, et al. (18 authors), *OpenVLA: An Open-Source Vision-Language-Action Model*, CoRL 2024, arXiv 2406.09246 **v3** (2024-09-05) `[paper]`. Code `openvla/openvla` MIT `[meta]` (pushed 2025-03-23); `vla-scripts/finetune.py`, `train.py` `[code]`.
**Method** (html lines [104]-[111]) `[paper]`: Prismatic-7B (SigLIP + DinoV2 vision encoders, Llama 2 7B) fine-tuned on **970k** Open-X-Embodiment episodes; each continuous action dimension discretised into **256 bins**, tokens written over the **256 least-used Llama tokens**; trained with standard next-token cross-entropy on the action tokens only: $\mathcal L=-\sum_{d}\log p_\theta(\text{bin}_d\mid \text{image},\text{instruction},\text{bin}_{<d})$ `[inferred form of the paper's description]`. (The bin-range rule text is truncated in my capture.)
**Hyper-parameters** `[paper]`: 27 epochs (train until action-token accuracy > 95%), fixed LR **2e-5**, no warmup, batch **2048**, 64 A100 x 14 days = 21,500 A100-hours; ~6 Hz on an RTX 4090, 15 GB bf16 (lines [125]-[128]). Repo fine-tune defaults `[code]` (`vla-scripts/finetune.py`): `batch_size=16, learning_rate=5e-4, lora_rank=32, lora_dropout=0.0, max_steps=200_000, image_aug=True, use_quantization=False` - these are **LoRA fine-tune defaults, not the pre-training recipe**.
**Failure/limits**: discrete tokens, single-step actions (no chunking) - the contrast pi0 draws (line [140]) `[paper]`.
**DT connection** `[inferred]`: closest to RT-2 and to DT's "actions as tokens"; conditioning = language instruction.
**Figures** `[paper]`: Fig. 1 (line [73]-[74]): "OpenVLA, a 7B-parameter open-source vision-language-action model (VLA), trained on 970k robot episodes from the Open X-Embodiment dataset ... can be quickly adapted to new robot domains via parameter-efficient fine-tuning." Image https://arxiv.org/html/2406.09246v3/openvla_teaser.png ; Fig. 2 (model architecture) https://arxiv.org/html/2406.09246v3/openvla_model.png (HTTP 200 checked for `openvla_model.png`; mapping to figure numbers `[inferred]`).

---

## 13. Consolidated comparison (for the lesson)

| Method | Signal | Needs RM? | Needs ref model? | Online sampling? | Loss type | "Return" lives in |
|---|---|---|---|---|---|---|
| BT RM (Christiano/InstructGPT) | pairwise prefs | is the RM | no | no (labels) | $-\log\sigma(r_w-r_l)$ | scalar head |
| PPO-RLHF | scalar $r_\phi$ | yes | yes (KL) | yes | clipped PG + value | RM + critic |
| DPO | pairs | no (implicit) | yes | no | $-\log\sigma(\beta\Delta)$ | policy log-ratio |
| IPO | pairs | no | yes | no | $(\Delta-\frac1{2\tau})^2$ | log-ratio target |
| KTO | unpaired good/bad | no | yes (+KL est.) | no | $\lambda_y-v$ | log-ratio vs $z_0$ |
| RLOO | scalar | yes (or rule) | yes (KL) | yes ($k\ge2$) | REINFORCE + LOO baseline | sibling samples |
| GRPO | scalar / rule | optional | optional ($\beta$) | yes ($G\ge2$) | clipped PG, group z-score | group statistics |
| ORPO | pairs | no | **no** | no | NLL + $\lambda$ odds-ratio | odds of $y$ |
| SimPO | pairs | no | **no** | no | $-\log\sigma(\text{avg-logp diff}-\gamma)$ | avg log-prob |
| RLVR | verifier | **no (rule)** | yes | yes | PPO/GRPO on $v\in\{0,\alpha\}$ | verifier |
| DT | observed returns | no | no | no | action prediction CE/MSE | **conditioning token** |

---

## 14. Reproducible numeric snippet (all `[computed]` values above)
```python
import math, statistics as st
sig=lambda x:1/(1+math.exp(-x)); ls=lambda x:math.log(sig(x))
b=0.1
for pw,pl,rw,rl in [(-12,-15,-13,-14),(-20,-18,-19,-19)]:
    d=(pw-pl)-(rw-rl); print(d, -ls(b*d), (d-1/(2*b))**2, sig(-b*d))   # DPO, IPO, grad weight
R=[1,0,0,0]; m=st.mean(R)
print([(r-m)/st.pstdev(R) for r in R], [(r-m)/(st.stdev(R)+1e-4) for r in R], [r-m for r in R])
print([R[i]-sum(R[j] for j in range(4) if j!=i)/3 for i in range(4)])  # RLOO
```

---

## 15. Not verified / open questions
1. **PPO paper (1707.06347)** not read; clip objective and $\epsilon=0.2$ come from RLOO/Tulu 3 restatements. DPO/IPO/KTO/ORPO formulas read from latest arXiv versions only - earlier versions not diffed (KTO v5 in particular post-dates the original 2024 notation).
2. **R1 "GRPO clip ratio $\varepsilon$ = 10"** (line [212]) looks odd; check the PDF/typo before teaching. Whether GRPO std is population vs sample is unspecified in both DeepSeek papers.
3. **No official R1/GRPO training code** exists in `deepseek-ai/DeepSeek-R1` or `DeepSeek-Math` (listing only). All "GRPO code" is third-party reimplementation; TRL defaults (`beta=0`, `loss_type="dapo"`) deviate from the papers.
4. DPO repo defaults (`lr 5e-7`, batch 4) **differ** from paper text (`1e-6`, batch 64). TRL's IPO length-normalises, unlike the IPO equation.
5. Not read: Christiano official code (if any), Ziegler 2019/Stiennon 2020 details, KTO Table 1 values, InstructGPT final $\gamma$ (pretrain-mix coefficient), IPO's recommended $\tau$, PRM800K appendix F scoring alternatives, Tulu 3 `open-instruct` trainer source, R1 Appendix A.3 (GRPO vs PPO), MuZero supplement pseudocode, MOPO $\lambda$/rollout-length hyper-parameters, openpi `config.py` and weights licence, RT-2 code availability, OpenVLA bin-range rule, pi0 Fig. 1 caption text, ReAct/Voyager hyper-parameters.
6. **Figure images were never visually inspected**; only captions (text) and HTTP-200 checks of URLs. Figure-number-to-filename mappings marked `[inferred]` should be confirmed by opening the HTML page before embedding. Direct image URLs verified HTTP 200: DPO `teaser.png`, R1 `ppo_vs_grpo.png`, pi0 `overview.png`, KTO `utility.png`, PRM `large_orm_prm.png`/`data_interface_simple.png`, Tulu3 `tulu3_figure1_v2.png`, ORPO `orpo_main.png`, DP `DP_teaser.png`, OpenVLA `openvla_model.png`, Voyager `pull_fig_fig.png`, DreamerV3 `x1.png`. **Licence/reuse terms of figures not checked** (arXiv "perpetual non-exclusive licence" per PRM page line [54]; others unchecked).
7. Dates/versions come from the arXiv API at 2026-11-20 and may move; repo "last push" values from GitHub API.
8. Open pedagogical question: is DT "conditioning" vs "optimisation" a clean dichotomy? E.g. RAFT/best-of-$k$ SFT (RLOO paper) and R1's rejection-sampling SFT stage sit in between - treat as `[inferred]` framing, not a sourced taxonomy.
9. Claim-level caveats: all `[inferred]` DT-connection paragraphs are my synthesis; no source in this note discusses Decision Transformer *and* preference optimisation together.

10. **Venue names** in reference lines (NeurIPS/ICLR/ACL/RSS/CoRL/Nature) are from my background knowledge, not checked against the sources - verify before citing. Author lists are truncated to the arXiv-API-verified first names + count.
