Download README.md from lemoncmd/duo-scaling-tinystories-tiny: direct link, hf CLI and curl.
- Browser
- Download file 6.82 kB
-
https://huggingface.co/lemoncmd/duo-scaling-tinystories-tiny/resolve/main/README.md
- Command line
-
hf download hf://lemoncmd/duo-scaling-tinystories-tiny/README.md
-
curl -L -o README.md https://huggingface.co/lemoncmd/duo-scaling-tinystories-tiny/resolve/main/README.md
license: apache-2.0
library_name: pytorch
datasets:
- roneneldan/TinyStories
tags:
- discrete-diffusion
- uniform-state-diffusion
- duo
- scaling-laws
- checkpoints
Duo data-fraction study on TinyStories: tiny models
4 uniform-state discrete diffusion language models (Duo, duo_base), identical
except for the size of their training set: nested subsets of TinyStories holding
0.01%, 1%, 10% and 100% of the training blocks. Training is in progress (target 1,000,000 steps). This repository is a backup of
the grid checkpoints reached so far and will be updated as training continues.
Each folder holds full checkpoints at 40 fixed steps (dense early, every 50k late), so
the whole training trajectory, including the data-limited regime of the small subsets,
can be analysed.
Models
| fraction | training blocks (1,024 tokens) | step | epochs | val NELBO at that step (nats/token) | training hours |
|---|---|---|---|---|---|
| 0.0001 | 46 | 700,000 | 7,791,304 | 14.6061 | 105 |
| 0.01 | 4,627 | 200,000 | 22,131 | 2.2592 | 29 |
| 0.1 | 46,271 | 700,000 | 7,746 | 1.7455 | 92 |
| 1.0 | 462,709 | 700,000 | 775 | 1.7077 | 104 |
Validation NELBO is computed with the EMA weights on the first 4,608 of the 4,647
TinyStories validation blocks, with fixed noise, every 500 steps (val/nll in the
metrics files).
Training setup (same for every model)
- Model: DiT backbone, config
tiny(33,789,010 parameters in the backbone), context length 1,024, GPT-2 tokenizer (vocabulary 50,258), untied embeddings, dropout 0.1. - Algorithm:
duo_base: uniform-state discrete diffusion trained on the exact NELBO, log-linear noise schedule (no curriculum or distillation). - Optimisation: AdamW, learning rate 3e-4, constant after 2,500 warm-up steps, weight decay 0, gradient clipping 1.0, EMA decay 0.9999, bf16 mixed precision, global batch 512 sequences x 1,024 tokens, 1,000,000 steps (target), seed 1.
- Data: TinyStories (
roneneldan/TinyStories, revisionf54c09fd), GPT-2 tokenized, stories joined with<|endoftext|>and wrapped into 1,024-token blocks: 462,709 training blocks (~474M tokens) and 4,647 validation blocks. Fraction f uses the first floor(f x N + 0.5) blocks of one fixed permutation (seed 20250927, sha256 inrun_info.json), so the subsets are nested (0.0001 within 0.01 within 0.1 within 1.0). The data order depends only on the optimizer step, not on the GPU layout. f = 0.0001 is 46 blocks, fewer than one global batch: whole passes over the subset are laid end to end, so every step contains each of its blocks 10-13 times. - Code: a modified version of s-sahoo/duo
(scaling-study branch), commit per run in
code_sha:8e5752d13235(f = 0.1, 1.0);e4d7e7264dd9(f = 0.0001) adds a data-order path for subsets smaller than one global batch and is otherwise identical;2097b1aeddc3(f = 0.01) has the same training code ase4d7e7264dd9(launcher changes only).
Files
frac_0.0001/ frac_0.01/ frac_0.10/ frac_1.00/
checkpoints/step_*.ckpt PyTorch Lightning checkpoints (40 at 1M)
checkpoints/index.csv step, wall-clock training hours, tokens and epochs per checkpoint (all 74
grid steps, including those not published)
metrics/version_*/metrics.csv training/validation metrics (one file per job segment)
norms/norms_raw.jsonl, norms_ema.jsonl weight norms every 500 steps, raw and EMA weights
run_info.json, config_resolved.yaml, code_sha, segments.jsonl
eval/metrics.csv, eval/per_batch/*.npy post-hoc NELBO (eval_scaling.py) of the EMA weights at the grid
checkpoints on the first 4,608 validation blocks (test) and on a training probe
(the first 4,608 blocks of the permutation, inside every subset; at f = 0.0001
its 46 blocks); per batch [summed NLL, tokens]
eval/norms.jsonl post-hoc norms of the same checkpoints
eval/recovery_t<t>/metrics.csv, tokens/*.npz corrupt-token recovery (eval_recovery.py) at t = 0.25, 0.5,
0.75: 512 test and 512 training-probe blocks (46 at f = 0.0001) corrupted at
time t, restored by the ancestral sampler; per-token entropies H_t, H_0 and
bit-packed perturbed/correct masks
subsets/tinystories_train_perm_s20250927.npy, .json the permutation of the training blocks that
defines the nested subsets (fraction f = its first floor(f x N + 0.5) entries)
Checkpoint steps so far: 0, 100, 200, 300, 500, 700, 1k, 1.5k, 2k, 3k, 4k, 5k, 7k, 10k, 15k,
20k, 30k, 40k, 50k, 60k, 75k, 100k, then every 50k from 150k to 1M. Training saved a checkpoint
at 74 steps (also 400, 2.5k, 6k, 8k, 12.5k, 17.5k, every 5k from 25k to 100k and every 25k from
125k); the evaluation results in eval/ cover all 74, and only these 40 are published to save
space.
Each checkpoint has the raw weights, the EMA weights, the optimizer state and the loop/sampler state, so training can be resumed exactly. Step 0 is about half the size (no optimizer state yet).
import torch
ck = torch.load("frac_0.10/checkpoints/step_0700000.ckpt", map_location="cpu", weights_only=False)
raw = {k: v for k, v in ck["state_dict"].items() if k.startswith("backbone.")}
# EMA tensors follow the backbone's trainable parameters in order (all of the
# state_dict except the rotary-embedding buffer).
names = [k for k in raw if not k.endswith("rotary_emb.inv_freq")]
ema = dict(zip(names, ck["ema"]["shadow_params"]))
print(ck["global_step"], ck["scaling_meta"]["clock"]["train_s"] / 3600, "training hours")
Norms (norms/*.jsonl): per record the step, aggregate norms of the token-path matrices
(embedding, per-block Q/K/V, attention output, MLP, output layer) and, separately, of the
timestep-conditioning path, plus per-matrix statistics (spectral norm, Frobenius, L1,
row and column (2,1)-norms) in float64. log_R is the Bartlett spectral complexity:
sum log||W||_sigma + 1.5 log sum (||W^T||_2,1^(2/3) / ||W||_sigma^(2/3)). It is null at
step 0 because the output layer starts at zero.
Caveats
- Wall-clock time (
train_hours) mixes H100 and H200 segments (the GPU of every segment is insegments.jsonl). For time-based comparisons, use steps or normalise per GPU type. - Training ran in segments with pauses between them (some runs waited at 500k for days before continuing to 1M). Resuming is exact (data order, noise and learning rate depend only on the step), so pauses do not change the trajectory.
trainer/lossin the metrics is one micro-batch on one GPU and depends on the GPU layout; compare runs withval/nll.