ccd-repro-code / README.md
ashishk1331's picture
Upload folder using huggingface_hub
2a88bc9 verified
|
Raw
History Blame Contribute Delete
3.75 kB
# Reproduction: "Beyond Confidence: Adaptive and Coherent Decoding for Diffusion Language Models"
Independent reproduction of ICML 2026 paper #6883 (OpenReview `b0O96emqNj`, arXiv
[2512.02044](https://arxiv.org/abs/2512.02044)). **No official code was released**, so
everything here is written from the equations in Section 3.
## Layout
| path | what |
|---|---|
| `scripts/ccd_decode.py` | CCD + CCD-DS decoder for Dream (Eq. 1, 6, 16, 17, 18, 20) |
| `scripts/run_eval.py` | Trip Plan / HumanEval driver, Dream's official hyperparameters |
| `scripts/check_propositions.py` | Claim 2: exact numerical audit of Prop. 1 and Prop. 2 |
| `scripts/check_budget_bound.py` | the `k <= V/(d+1)` speedup ceiling + simulation |
| `scripts/smoke_test.py` | decoder mechanics on a tiny random Dream (CPU) |
| `scripts/test_scorers.py` | metric validation against gold answers (CPU) |
| `scripts/make_figures.py` | logbook figures + raw CSVs |
| `scripts/job_*.sh` | the exact HF Jobs run scripts |
| `data/trip_planning.json` | Trip Plan benchmark (from DreamLM/Dream `eval/data/`) |
| `outputs/` | all results, per-example scores/steps/responses, figures |
## Reproducing
```bash
pip install torch "transformers==4.46.2" "huggingface_hub<1.0" "datasets<4" accelerate
# free, no GPU: mechanism + metric gates + both analytical claims
python scripts/smoke_test.py
python scripts/test_scorers.py
python scripts/check_propositions.py
python scripts/check_budget_bound.py
# GPU (~24GB): one benchmark config
python scripts/run_eval.py --task trip --method ccd_ds --limit 64 --out outputs/x.json
```
## Determinism / seeds
| component | status |
|---|---|
| `check_propositions.py`, `check_budget_bound.py` | Seeded (`np.random.default_rng(0)`). Bit-identical across runs — verified 3x. |
| Example selection (`load_trip`) | Seeded, fixed at `seed=0`, independent of `--seed`, so every arm scores the same stratified sample. |
| Decoding at **T=0** (Trip Plan, HumanEval, all ablations) | Deterministic: `_pick_token` takes the argmax, no RNG involved. |
| Decoding at **T>0** (the Claim 6 sweep, T=0.1/0.4/0.7/1.0) | Samples via `Categorical.sample()`. `run_eval.py --seed N` (default 0) now seeds `random`/`numpy`/`torch`, and the seed is recorded in each result JSON. |
**Honest caveat:** `--seed` was added *after* the runs in `outputs/` were produced. The T=0
results (the large majority, including every number on the poster's ceiling, Trip Plan,
HumanEval and ablation cards) are argmax and reproduce exactly regardless. The eight
temperature-sweep runs at T>0 (`c6_*_t0.1/0.4/0.7/1.0`) predate the seeding and therefore will
**not** reproduce bit-exactly; re-running them under `--seed 0` is the first thing to do with a
fresh GPU budget. At n=16 those points are our weakest evidence anyway, and the poster says so.
## Hyperparameters
Taken from the Dream authors' own eval scripts, which is what the paper says it does
("we follow the base models' default settings without tuning"):
* Trip Plan: `steps=256, max_new_tokens=256, temperature=0, top_p=1, alg=entropy`, 2-shot
(`DreamLM/Dream eval/eval_dream_gen_planning.sh`)
* HumanEval: `steps=768, max_new_tokens=768, temperature=0.1, top_p=0.9, alg=entropy`, 0-shot
chat template (`DreamLM/Dream eval_instruct/eval.sh`)
CCD: `V=4`, `d=3` for Dream (paper Sec. 4.2).
## Gotchas found
* The Trip Plan file is **ordered by difficulty** (first 200 examples are all
`num_cities=3`). Prefix sampling inflates the score ~55% vs ~15%. Use the
stratified sampler in `load_trip`.
* HumanEval responses are the function **body only** (the prompt's `gen_prefix`
already contains the signature), so the `\ndef` stop sequence must be applied to
the continuation, not to prompt+continuation.