# Decision models: research index and build rules

Scope (user-confirmed 2026-11-20): Decision Transformer family plus RL and offline-RL foundations. The planner review and critic added bandits/OPE, policy gradient, critiques, and LLM-era preference optimisation. [Open Decision Lab](../index.html) · [Parent project index](../../INDEX.md) · [Project status](../../pending-work.md#decision-models).

## Notes

| File | What it holds | State |
|---|---|---|
| [00-plan-review.md](./00-plan-review.md) | Original scope review, 12-chapter draft outline, and provisional tier suggestion | historical proposal; not build approval |
| [01-dt-family.md](./01-dt-family.md) | DT, TT, Online DT, EDT, MGDT, Gato, Diffuser, Decision Diffuser, Decision Mamba, Q-Transformer, RT-1/2, ... | corrected (B1, M1, M8) |
| [02-rl-foundations.md](./02-rl-foundations.md) | MDP, Bellman, DQN, PPO/SAC, BC, offline-RL algorithms | targeted critic review and fixes for DAgger, BEAR, CQL, IQL, AWAC and TD3+BC; remaining `[recall]` is not lesson evidence |
| [03-data-config-training.md](./03-data-config-training.md) | D4RL, configs, protocol, score tables | corrected (B2, M1); §9 counts and rounded return mean/std retested from 15 cached HDF5 files |
| [04-clone-and-run.md](./04-clone-and-run.md) | 10 repos cloned, CPU-verified shapes and counts | verified by scripts in [verification/](./verification) |
| [05-bandits-ope-ads.md](./05-bandits-ope-ads.md) | Bandits, IPS/SNIPS/DM/DR, slates | corrected (M3, M4); DR-to-DM collapse is specific to the tabular toy |
| [06-llm-era-decisions.md](./06-llm-era-decisions.md) | Reward models, RLHF, DPO family, GRPO | corrected (M5) |
| [07-pg-and-critiques.md](./07-pg-and-critiques.md) | REINFORCE to PPO, critiques of return-conditioned models | numbers re-run by critic |
| [08-gap-research-report.md](./08-gap-research-report.md) | Seven gap areas: sequential OPE, imitation, ranking, reward-model feedback, cross-embodiment robotics, five DT variants and six newer offline-RL methods | research-phase snapshot; website verification recorded separately |
| [critic-1.md](./critic-1.md) | Critic review of 00, 01, 03-07 | applied where marked |

Source clones are maintained locally outside cloud-synced folders during verification.

## Rules the lesson must obey

1. **Scores:** store each as (model, task, value, source paper + table, dataset version, seeds, protocol). Rank only inside one source table. Never put numbers from two papers in one ranking. Examples: Diffuser 77.5 (own paper) vs 75.3 (as listed in Decision Diffuser, different cells); DT average 74.7 vs 52.5 vs 57.0 (different task sets and sources).
2. **Averages:** the DT paper's printed BC averages look swapped. Recompute from rows: 47.7 without Reacher, 46.4 with it.
3. **DT sizes (three different models, always label which):** official Hopper 727,695; HF Hopper 858,767; HF default config 1,256,854. HF adds `wpe[0]` as a constant bias, so it is not the same architecture as the official code.
4. **Trajectory Transformer:** effective width is 32 × 4 heads = 128, same as the paper. Real paper/code gaps: lr 2.5e-4 vs 6e-4, epochs 80 vs 50 (reference).
5. **DT batch sampling:** official code samples trajectories in proportion to length with a uniform start index; return only enters through `pct_traj` (%BC). It does not weight batches by return.
6. **DT warmup:** paper prints 1e5 steps (equal to the whole run); code default is 1e4.
7. **Figures and licences:** embed only CC BY figures, with attribution. Everything else is an original redraw plus a link to the source figure. No third-party GIFs or videos. Code and data licences: D4RL code Apache-2.0, D4RL data CC BY 4.0, Online DT CC BY-NC 4.0 (link only), Decision Diffuser, BEAR and CQL repos have no licence file (link only).
8. **Tags:** `[paper]` read in the paper text, `[code]` read in a repo file at a recorded commit, `[docs]`, `[computed]` produced by a saved script, `[inferred]`, `[recall]` and `[not read]` never appear as fact. Toy-lab outputs carry a "toy" badge.
9. **Separate dataset inspection from policy performance:** [D4RL recount](./verification/10_d4rl_counts_output.json) measures cached v2 files; no simulator training or evaluation was run. Paper scores are not local scores. The recount does not establish a v0 → v2 conversion recipe or independently verify every auxiliary statistic in 03 §9.
10. **Examples are not benchmarks:** [09 gap fixtures](./verification/09_gap_examples_output.json) demonstrate where shortcuts fail. For example, an undiscounted target of 8 followed by 6 achieved leaves a residual of **+2**, not a negative residual; a target of 4 leaves **−2**. Neither residual implies the model can reach arbitrary targets. The DR-equals-DM identity in M3 is specific to the context-free saturated tabular fit.

## Before extending the lesson

- Keep the working eight-chapter reading path separate from the atlas. Use [the gap report](./08-gap-research-report.md) for extensions, verify exact image reuse terms, and preserve paper-only and unreproduced labels.
- **Older claims to clear or omit before use:** minor items from critic-1 (m1, m2), including MGDT's single-seed caveat, the Brandfonbrener horizon wording, RT-1 defaults versus published config, and suspect OBP confidence interval. Unverified and `[recall]` details are not eligible for the lesson.

## Website build and verification

Open [index.html](../index.html) directly in a browser; no server or installation is required. The [verification receipt](../verification/receipt.json) records the visual plan, accepted artifact fingerprint, commands and independent PASS. The [media registry](../sources.json) distinguishes attributed embedded figures from source-only links. The implementation uses native HTML/CSS/JavaScript/SVG (Tier 0), rather than the historical Tier 2 proposal.

Run `python .\build.py` from the [Decision Models folder](../) to assemble the page from [the editable sources](../src/), or add `--check` to verify the generated bytes without writing. Run `node --test .\verification\lesson.test.cjs` for numerical checks and `node .\verification\browser.cjs` for the offline Edge probe; the latter needs Playwright available on `node`'s module path or `PLAYWRIGHT_MODULE` set. These are development tools only; they are not required to open the generated HTML.
