Your First Training Run

Quickstart gave you the commands. This page slows down the single-GPU debug run and explains what the log line means, what ends up in the checkpoint directory, and how to resume.

Run it

uv run python scripts/train.py configs/train/debug.toml \
  --checkpoint.dir=/tmp/kf_first_run

This loads configs/train/debug.toml: a 256-dim, 4-layer model (~20M params), synthetic data, batch size 4, sequence length 512, 100 steps, cosine schedule with 10 warmup steps, AdamW at lr=3e-4. It runs in under a minute on a single H100.

What the log line means

You will see one metrics line every 5 steps (controlled by metrics.log_interval):

2026-11-04 14:03:12.345 [rank 0] INFO     [step 10] loss=9.1800 | lr=2.70e-04 | grad_norm=1.340 | tok/s=13,653 | mfu=0.1% | mem=2.1/80GB | step_time=0.15s

Like every line the framework logs, it starts with the local time (to the millisecond), the rank that wrote it and the log level. The metrics follow:

Field

What it is

step

Optimizer step count. Matches checkpoint filenames.

loss

Training cross-entropy for this step, averaged over the data-parallel ranks.

lr

Learning rate this step’s update used: 0 at step 1, then ramping up for 10 steps before the cosine decay. For schedule_free_adamw, the optimizer applies its own warmup (schedule_free_warmup_steps) inside step(), so lr shows the rate before that warmup.

grad_norm

L2 norm of gradients before clipping (returned by clip_grad_norm_). Clipping to train.grad_clip_norm (default 1.0) is applied in-place before the optimizer step.

tok/s

Tokens the model ran this step, on all GPUs, over step_time.

mfu

Model FLOPs Utilization — achieved FLOPs / theoretical peak for the GPU.

mem

Peak GPU memory / total GPU memory, on rank 0’s GPU. The peak is the most allocated at any point since the process started, not in this step: a high-water mark that never goes down (see Memory monitor).

step_time

Wall-clock time of this step, in seconds, from loading its first batch to the end of its optimizer step and LR update. Eval and checkpoint saves run after it and are not in it (nor in tok/s and mfu); each save’s time is logged as checkpoint/save_sec.

Synthetic data means loss starts near log(vocab_size) ≈ 10.4 and falls slowly because the “dataset” is random tokens — there is no real signal to fit. The point of this run is to exercise the pipeline, not to learn anything.

What’s in the checkpoint directory

With checkpoint.interval=50 and checkpoint.keep_last_n=2 from debug.toml, after the run you’ll have:

/tmp/kf_first_run/
├── step_50/               # Full DCP checkpoint at step 50
├── step_100/              # Full DCP checkpoint at step 100
└── latest → step_100/     # Symlink to the most recent checkpoint

Each step_N/ is a directory (not a single file) because DCP shards parameters across ranks. On a single-GPU run there is one shard; on multi-GPU FSDP there is one shard per rank.

latest is a symlink updated atomically after each save. Auto-resume reads this symlink; if it’s missing and checkpoint.load_path isn’t set, the run starts from scratch.

Resume

Kill the run partway (Ctrl-C) and re-launch the same command:

uv run python scripts/train.py configs/train/debug.toml \
  --checkpoint.dir=/tmp/kf_first_run

train.py detects the latest symlink, loads model + optimizer + scheduler

  • RNG + dataloader position, and continues from the next step. No flags needed — auto-resume is the default when checkpoint.dir contains a valid checkpoint.

To start a new run from a different checkpoint, give it its own checkpoint directory:

uv run python scripts/train.py configs/train/debug.toml \
  --checkpoint.dir=/tmp/kf_from_step_50 \
  --checkpoint.load_path=/tmp/kf_first_run/step_50

load_path is used only while checkpoint.dir holds no checkpoint. With --checkpoint.dir=/tmp/kf_first_run the run would resume from latest instead, and warn that load_path is not used.

Change something and re-run

Pick one and re-run with a fresh --checkpoint.dir (shape changes break auto-resume). Start with:

  • More steps, same model: --train.max_steps=500. Watch MFU stabilize past the warmup region.

  • Bigger model: --model.dim=512 --model.n_layers=8. You’ll see loss curves change and memory go up.

  • Longer context: --train.seq_len=2048 --model.max_seq_len=2048. tok/s drops (attention is quadratic) but MFU typically rises.

  • Real data: point --data.dataset_path at pre-tokenized .npy shards. See Quickstart step 4.

  • Different optimizer: --optimizer.name=muon. Note the LR is not transferable between optimizers — Muon expects different LRs than AdamW.

What’s next