Prince Osei Aboagye
Guide

Troubleshooting

One table of every defect recorded in this project's code, data, configuration, measurements and infrastructure, with its cause, its fix, and the stage that caught it.

// § 01

How to use this page

  • Search the page for the error message or the symptom you see.
  • Caught says where the bug showed up:
    • laptop: the RTX 3060 and the CPU-only work before any H100;
    • data: building the datasets;
    • rehearsal: one H100 with shrunk models;
    • main run: 8×H100, the full model;
    • control run: one H100, Qwen2.5-Math-1.5B.
  • The table lists every defect in code, data, configuration, measurement or infrastructure that my lab notebook records, with its fix. Corrections of wording and of plan documents are left out.
  • Within each stage, rows follow the order in which I met them.

Three patterns run through the table. The most damaging bugs were silent: they exited 0 or gave plausible numbers. A one-GPU rehearsal cannot reach anything that needs several GPUs. And network storage changes what is slow.

// § 02

The table

Symptom Cause Fix Caught
pip refuses to install; the newest torch is far newer than MiniMind’s pinned libraries the OS manages the system Python, and MiniMind pins older packages a Python 3.12 venv with torch 2.11.0 for CUDA 13.0, later a full lock file laptop
a run’s log appears only when the run ends Python buffers output written to a file run with python -u laptop
held-out tests exist only at the hardest tier the first curriculum held out GSM8K and MATH only train on train splits only; hold out six test sets, ASDiv 20% by question hash laptop
later mini-batches look stable when they are not step values averaged in the first mini-batch, whose ratio is exactly 1 report every mini-batch separately laptop
KL 0.94 between a policy and a reference with identical weights; 44–56% of tokens clipped old and reference log-probs were scored on the full batch and new ones on mini-batches, so the same rows went through different kernels, MiniMind’s padded and unpadded attention paths among them (the share of each was not isolated); about half the KL was bf16 rounding, the next row score old, new and reference log-probs in identical mini-batches: KL 0.94 → 0.51 laptop
one update moves the policy as much at 1e-7 as at 1e-6 13% of the fp16 checkpoint’s weights sat on bf16 rounding ties, so any update flipped them compute every log-prob in fp32 laptop
the KL mean jumps around the k3 estimator is a tail statistic: on the trained tokens the top 1% held 77–100% of the mean (35–66% on the untrained ones) report the KL’s median and p99 beside the mean laptop
a “sampler gap” of 0.06–0.19 nats per token it compared two full forward passes in different precisions and batch layouts, not the sampler our own engine records the sampler’s log-probs; the old metric was renamed laptop
an RL update could vanish when saved the trainer saved fp16 weights, whose step near 0.02 exceeds a typical RL weight change save fp32 laptop
a replay matched for 40 steps, then differed in the 7th digit a GPU kernel sums in a varying order; PyTorch’s deterministic mode was off --deterministic on, at 1.20× the time per step laptop
evaluation logged only a total, and moved training’s random numbers evaluation shared training’s random stream a fixed evaluation seed, training’s state restored, per-problem results laptop
logs point to “commit plus uncommitted changes” runs started from a dirty tree commit before every run; a run guard refuses uncommitted code laptop
a check passes that could never fail an assert compared a restored value with itself never assert a value against itself; make every check able to fail laptop
the deterministic-mode warning list is empty the parser matched one wording and missed “defaults to a non-deterministic algorithm” parse warnings broadly, and read them laptop
every update was off-policy rollouts used MiniMind’s hidden defaults: temperature 0.8, top-k 50, top-p 0.85 our own rollout engine: temperature 1, no truncation, fp32, the sampler’s log-probs recorded laptop
“accuracy rose” overstated what improved the grader reads only the final number the claim renamed to final-answer accuracy laptop
dense and MoE runs weighted tokens differently different micro-batching, and MiniMind averages the loss within each micro-batch the same micro-batching for both laptop
held-out SFT conversations share first prompts with training 1,230 of 2,000 open with a training conversation’s first prompt resample by first prompt; report a novel subset laptop
a model loads with mismatched keys and no error MiniMind’s loader skips them silently strict loading laptop
cut-off conversations score a loss of 0 a truncated assistant turn has no scored tokens leave them out and count them (fix specified) laptop
a run looks 1.63× slower than its twin a 23-minute laptop suspend inside one step block sleep during runs; record any suspend laptop
a claim rule used a chance of 1/20 the arms were paired by seed, so 3 of 3 by chance is 1/8 the result reported as descriptive laptop
distillation runs out of memory in its first step micro-batch 32 × 4 with the teacher’s softened probabilities 16 × 8, the same effective batch laptop
the memory check passes runs that ran out of memory it compared only the reserved peak with a limit a run must also exit 0 and log its last step laptop
distilled students look no closer to their teacher measured at temperature 1 for a quantity trained at 1.5 measure at the training temperature too (--kl_temperature) laptop
the setup cannot be reproduced from a fresh clone unpinned clones, data and packages day1_setup.sh: pinned commits and revisions, a lock file, 22 input checksums laptop
a commit went in with failing tests; tests ran only from one folder the commit command ignored a test failure; relative paths commits stop on any failure; tests run from any directory laptop
a neutrality check compared the GPU with the CPU one of two trainers still saw the GPU redone with both on the CPU laptop
the k3 KL estimate is far too low k3 needs the policy to have no mass outside the sampler’s support, which truncation breaks the k1 estimator added laptop
the new engine evaluated at the training temperature, or silently used the old off-policy settings its defaults evaluation keeps its own protocol; missing sampling settings are refused laptop
the drift alert could never fire it read only the old re-scoring gap it reads the sampler–learner gap laptop
planted bugs passed all 17 engine tests early stops, random state and the clip window were untested 28 tests, with a toy model of known logits and a chi-square test laptop
torch.quantile fails on a large tensor it refuses inputs above 2^24 values percentiles by sorting laptop
the Wilson interval returns 0.9999999999999999 at k = n floating-point rounding exact bounds at k = 0 and k = n laptop
a learning rate chosen after seeing the results no rule written before the sweep an on-policy sweep with a rule fixed first; it chose 1e-7 laptop
an analysis crash looks like “condition not met”; one failed run ends a whole batch both used exit code 1; no per-run stop rule exit code 3 for “not met”; a failed run stops only its own arm laptop
the memory probe crashed with no rollout measured max of an empty list fixed, with a test laptop
a failing test would not have stopped a commit the test gate was piped into tail, so it saw tail’s exit status check the test command’s own status laptop
a configuration “does not fit” although it never used the memory the fit rule used reserved memory, the allocator’s cache history cap the allocator, and count a fit as no out-of-memory under the cap laptop
memory-probe review findings: unchecked headers, a leaking allocator variable, checkpointing not shown to run, results lost on a driver out-of-memory gaps in the probe and its tests each fixed, with a test laptop
the MoE’s update runs out of memory with 1.2 GB idle in the allocator fragmentation PYTORCH_CUDA_ALLOC_CONF=expandable_segments:True laptop
MoE GSPO runs out of memory on the 6 GB card the rollout’s fp32 KV cache and attention scores, not the update not fixed: the MoE’s RL moved to the H100 laptop
FineWeb-Edu’s token count does not match ours it counts GPT-2 tokens measured 0.9804 Llama 3.2 tokens per GPT-2 token data
the answer checker accepts 35 wrong answers on 28 LaTeX problems math-verify tolerates loosely written gold answers 9 dropped from training, 19 left out of the MATH score data
always answering “1” scores 8.33% on SVAMP small test sets with common answers report every gain beside the free-score floor data
the data script’s workers cannot pickle their function, and could deadlock the test loaded the script without its module name; fork from a threaded process import by name; spawn data
decontamination drops some real documents stock phrases in MATH questions match 10-word runs accepted: 0.044% of documents data
SFT labels that round, or that few teacher samples agree on the upstream label is a majority vote with no minimum keep a question only with at least 16 of 32 votes data
test questions with changed numbers survive decontamination a 10-word overlap misses a copy with new numbers 10-word overlaps with numbers masked, and embedding near-duplicates data
the download script fails at once; a counter would crash; the rounding detector misses a known phrase a quoting error; a wrong argument type; a missing wording fixed before any run, by reading the script back data
the LaTeX filter rejects 16.0% of solutions while its unit tests pass every $ was read as a math delimiter, so currency amounts broke whole solutions a currency-aware $; read real rejects data
the “equation false” filter flags correct solutions machine floats such as 0.6666666666666666, and labels read as numbers a separate float-artifact rule data
a rounded label (11/3 as 3.67) passes with 32 of 32 votes the solution never wrote the rounding a rounded-label rule data
“9 * 15 = 3x” read as “= 3” a number glued to a letter was not treated as a term a number followed by a letter ends the run data
two of the dataset authors’ own cleaning steps are missing found only by reading their recipe a 200-character minimum and a trim after the final box data
a blind check finds 4 of 50 labels wrong units split the rounded expressions read the arithmetic as a person would data
an SFT answer ends Thus, Rachel is \boxed{6} years ol the upstream generation was cut off, and copied faithfully reject solutions that end in a letter or a comma data
a mixed number became a product 9\frac{1}{3} was converted to “9(1/3)” reject LaTeX mixed numbers data
questions with one or two passing solutions are mostly bad ill-posed questions whose steps round drop a question when at least half its solutions round data
“cannot discard a fraction of a nickel” passes the rounding filter the phrase list missed other verbs match “can’t … a fraction” with any short verb data
unit stripping invents false equations an algebra variable was eaten as a unit word the unit-stripped view may only flag rounding data
1,159 questions have more than 32 solutions repeated question texts whose solutions merged open data
Megatron’s --help crashes a stray % in one help string build the parser in code to check flags laptop
Megatron has no sequence-level ratio, and long answers weigh more its RL loss is token-level and divides by the token count our patch: one ratio and one clip per answer, each answer weighted once laptop
a flag block would have trained a different model Megatron’s defaults are LayerNorm, dropout 0.1, no SwiGLU, learned positions; one flag did not exist; --split re-split the training file the tested arrays in common.sh; separate training and validation paths laptop
each 40-step study arm would write ~110 GB and start from the previous arm Megatron saves at the exit interval, and the arms shared --save and --load weights-only saves, each arm in its own folder laptop
no training curves in W&B Megatron logs scalars to W&B only inside its TensorBoard branch; --wandb-save-dir defaults from --save --tensorboard-dir and --wandb-save-dir on every run laptop
a fix would have lost MaxVio Megatron writes the expert counts only under --save a separate save array for the study arms laptop
Megatron’s router metrics cannot be switched on nothing in the training loop calls them, and no flag exists the MoE handbook’s router_watch.py and expert_watch.py laptop
the solve rate can be negative it was defined as the mean reward the share of correct answers laptop
every launch stops in validate_args --log-max-attention-logit needs Transformer Engine 2.9 or newer a setup check for the version laptop
the patch’s equivalence test is too strict, then never tests the clip a float32 cast; random batches never clipped tolerance 1e-7 with the reason; every batch forces a clip each way laptop
Megatron’s SFT formats write unknown markers, and never append the end token formats built for other tokenizers the identity format, with the end token in the assistant turn laptop
SFT would crash at the first padding, or silently drop a token from the loss Megatron’s pad is <unk>, which Llama 3.2 lacks our patch: the tokenizer’s own pad, refused if equal to the end token laptop
SFT rows would be ~96% padding one example per JSONL line pack about 24 examples per line laptop
the SFT dataset asserts that reset flags are off pretraining’s data array sets them sft.sh leaves them out laptop
Megatron will not load our agent it loads only allowlisted agents our patch registers it laptop
validate_args refuses --save-interval 50 RL intervals count updates, 4 per GSPO step 200 laptop
--seq-length given twice the model array and the RL value one value; the duplicate check caught it laptop
pass@k near 0 although answers are right Megatron counts a pass only at reward exactly 1.0; a right answer of ours scores 1.1 evaluation agents that judge correctness laptop
the first in-run evaluation would crash; an evaluation-only config is refused our reward needs the token count; a config with no training weight score with the token count; keep one training agent laptop
evaluation-only runs log nothing that mode writes no TensorBoard scalars log the means, and one JSON line per problem laptop
calibration runs would write full checkpoints Megatron saves at the exit when --save is set calibration mode sets no --save laptop
the profiler would capture nothing --profile alone marks a range for an external nsys --profile --use-pytorch-profiler laptop
about 20 lines of our command file became a single space uncertain; consistent with typing over a selection restored from git laptop
Megatron’s distillation config fails with ModelOpt 0.48; distillation refuses --manual-gc two keys were removed; ModelOpt’s own rule our distill_alpha05.yaml; a logging array without manual GC laptop
the PTQ stage and the teacher config fail Megatron’s checks a missing --save-interval; lists where single values belong both fixed, found by validate_args and a new test laptop
the image ships an older ModelOpt, which every entry point imports its mere presence switches code paths install ModelOpt 0.48.0 at setup, for every run laptop
the inference engine requires flash-attn 2.7.3 or newer, which Megatron does not install a hard assertion with no fallback the setup script stops without it laptop
GSPO fails to launch with the rehearsal’s settings the shrunk batch gave 32 updates per step, which the intervals did not divide separate RL shrink settings, PROMPTS_PER_STEP=8, and a rehearsal mode in the flag check laptop
the curriculum’s step size could drift from gspo.sh 512 rollouts were hard-coded in the config gspo.sh exports the rollouts per step, with a test laptop
personal paths in 44 committed files; a cleanup altered evidence logs tools print absolute paths; reading .out files as text turned carriage returns into new lines byte-for-byte replacement; changes to evidence checked one for one laptop
finish_reason reads “stop” even at the sequence cap Megatron says “length” only when a token limit was requested the reward reads “stopped short of the cap” instead laptop
full recomputation came back for the Qwen model; a test could not override a placeholder the model-family block sat above the recompute array; a dict() with a shared key the block moved to the end of common.sh; test values last laptop
pip refuses to install on the image it marks its system Python as externally managed PIP_BREAK_SYSTEM_PACKAGES=1 in the setup script rehearsal
rsync exits with code 23 the network volume refuses chown --no-owner --no-group rehearsal
df shows 547 TB free on a 100 GB volume on network storage it reports the whole cluster size the volume when you create the machine rehearsal
no tokenizer library on the image it lacks transformers transformers 5.14.1, Megatron’s CI version rehearsal
torch.compile fails: Triton cannot find cuda.h an SSH shell had 12 environment variables against the container’s 114 copy the container’s environment from /proc/1/environ rehearsal
the 40-step arms write no expert counts counts are written only on multiples of the interval, 100 every 10 steps for the arms rehearsal
no TFLOP/s or step time in W&B Megatron sends them only with --log-timers-to-tensorboard the flag in the shared logging array rehearsal
the overlap arm stops after 29 s, though the flag check passed its check lives in the TransformerConfig, which the flag check did not build the flag check builds the config rehearsal
ModuleNotFoundError: openai; “please install the messagepack library”; “Web backend framework (Quart) not available” the image lacks the RL loop’s optional packages install them at Megatron’s lock versions; setup checks every optional-import flag rehearsal
float(None) in the learning-rate scheduler of an evaluation Megatron builds the scheduler even with --skip-train --lr 0 rehearsal
an AttributeError at the first RL update --check-for-spiky-loss calls a method Megatron lacks off for RL runs rehearsal
max_tokens (16384) must be >= max_requests (81916) at engine start the engine admits as many requests as KV blocks unless told otherwise the dynamic-batching limits: 128 requests, 8,192 tokens rehearsal
add_scalar('max_attention_logit', None) in an evaluation inference-only mode has no training forward the flag left out of eval.sh rehearsal
KeyError: 'optimizer' in the weights-only copy Megatron restores the optimizer unless told not to --no-load-optim --no-load-rng rehearsal
the sampler–learner “gap” equals the answers’ −log p with importance correction off, Megatron puts zeros in the batch keep the engine’s log-probs; treat an all-zero tensor as missing rehearsal
an evaluation reports loss 11.85 and exits 0 the checkpoint was missing, so Megatron started from random weights --exit-on-missing-checkpoint on every load rehearsal
the RL restart starts over, and the tracker drops from 61 to 13 --finetune on the restart no --finetune; the flag check refuses it rehearsal
the policy moves with every advantage 0: KL 4.6e-4 after one update the V4 expert-bias rule kept updating the bias frozen in GSPO and the 4-bit stages rehearsal
PTQ stops building its calibration loader its default dataset is gated a local file of 64 curriculum questions rehearsal
QAD stops in the scheduler the warm-up was longer than the decay a shorter warm-up rehearsal
RuntimeError: expected 3D tensor in Transformer Engine’s fused RoPE micro-batch 2: Megatron’s RL forward holds one packed row micro-batch 1; the flag check refuses more rehearsal
a crashed run holds 25.9 GB at 0% GPU for 24 minutes the inference coordinator was not a daemon process a daemon in our patch, and the stall guard rehearsal
every run finished up to 30 s late the stall guard slept a full poll interval it waits on the process with a timeout rehearsal
“Missing key … decoder.final_layernorm._extra_state” loading a 4-bit checkpoint train_rl.py built the plain model config our patch detects ModelOpt first rehearsal
a 4-bit evaluation hangs after “flash_decode_and_prefill is not compatible” ModelOpt’s attention cannot run in the engine, and the error was raised inside an asynchronous task not fixable here: eval.sh refuses 4-bit models; the stall guard ends the hang rehearsal
the GPU health check fails healthy H100s 701.27 W at the 700 W cap; ECC turned off by the host a 5 W tolerance; ECC off warns rehearsal
the router-bias reader crashes, then pools the layers the loader returns state with the tensors; the biases are stacked by layer fixed: one row per layer rehearsal
the rollout log shows advantages 0 while Megatron’s are not the agent recomputed them with the filter always on it reads Megatron’s own setting rehearsal
JSONL rows read as broken lines U+0085 inside answers, and str.splitlines() splits there ASCII escapes when writing; split on “\n” when reading rehearsal
with nothing to learn and the bias frozen, the policy still drifts to KL 0.079 the router’s balance loss gave each update a gradient norm near 1 no balance loss in GSPO rehearsal
every real evaluation would fail in json.dumps the record’s greedy answer was a message object found by a new test, and fixed rehearsal
a renamed metric loses its producer the tracker still used the old name a test fails on any reference row without one rehearsal
a resumed run profiles the wrong steps the profiler counts steps from each launch set the window per launch rehearsal
a planned 4-bit math evaluation would hang on 8 GPUs the same ModelOpt attention limit removed from the plan rehearsal
the before-SFT evaluation overruns its time limit the subset pass is never cut short, and the base model answers to the length stop accepted rehearsal
setup fails “no NVLink between the GPUs” on a node with NVLink nvidia-smi topo -m piped into grep -q under pipefail: grep exits early, nvidia-smi gets SIGPIPE grep a captured output; a test bans early-exiting readers under pipefail main run
the health check fails on one 706.3 W reading one one-second reading as the burn started the re-run passed; the check’s power rule is open main run
step time 3× too long, GPUs at 0%, processes in state D --no-mmap-bin-files on network storage: about 150 ms per file close the data staged in /dev/shm main run
about 11 s per GSPO step lost writing rollouts an open, append and close per record on network storage one held file handle per file main run
ValueError: Path is not a file: .../latest_checkpointed_iteration.txt after a save Megatron’s W&B hook raced the tracker file across ranks our patch waits for it and never stops training main run
mkdir: cannot create directory '/workspace/runs/aux': Invalid argument the volume refuses a Windows reserved name the folder aux_loss main run
an nsys run sits for minutes with no step BASH_ENV makes every shell under nsys slow to start env -u BASH_ENV in the nsys prefix main run
a new run’s ranks killed by a clean-up command pkill -f by name while a driver could start the next run stop processes by ID main run
the overlap arm runs out of memory at step 1 (78.8 of 79.2 GiB) overlap needs selective recomputation, about 19 GB more here full recomputation without overlap main run
MaxVio 7.0 in all 16 layers by step 10, for the V4 and aux-loss routers the sign-rule bias moves at most 1e-3 per step, while balance needed ±4–6 logits V4’s scores with quantile balancing main run
a progress wait never fires it looked for "step": 100; the files write "iter" test a wait’s pattern on a real file main run
MaxVio alarms on falling values the monitor compared one GPU’s MaxVio with another GPU’s first value the pooled rows, each against its own baseline main run
“–moe-pad-experts-for-cuda-graph-inference must be set when using CUDA graphs with expert parallelism” Megatron’s RL inference switches to CUDA graphs itself the flag on every RL launch; the flag check refuses it missing main run
the SFT → RL gate fails: 6.3%, then 1.6% of groups mixed the model writes the format but rarely the right number the medium tier, with 32 answers per problem main run
the first update’s ratio is not exactly 1: median |log s| 4.9e-3 numerical differences between Megatron’s two passes at expert parallelism 8 the clip set above the noise, 2e-2 and 2.7e-2; batch-invariant kernels left open main run
MaxVio flat at 6.3–6.4 throughout GSPO the RL forward routes padding, about 90% of the tokens read MaxVio against step 1; a padding mask left open main run
all 8 GPUs idle between stages CPU-only analyses ran in sequence with the GPU stages run CPU analyses beside the GPU stages main run
OSError: [Errno 9] Bad file descriptor as an evaluation ends the text server closes a socket twice at shutdown harmless: the exit code is 0 main run
the grader’s parser library is older than the reference’s the image’s other packages require it kept: the grader’s tests pass with it control run
the skeleton stops after 44 s Megatron divides by --eval-interval even with no evaluation --eval-interval 1000 control run
1.44 distinct texts per group of 8 Qwen’s generation_config.json turned sampling into greedy decoding; first blamed on CUDA graphs, which a rerun ruled out the tokenizer copy leaves that file out; check “Sampling defaults” control run
an ssh session ends mid-command pkill -f matched its own shell stop processes by ID control run
the greedy-text conversion check fails: 11 of 20 openings a base model’s greedy openings are near-ties that bf16 flips a log-probability gate control run
the parity check skips 9 answers their re-tokenized text did not line up with the engine’s ids open: compare the engine’s own ids control run
training hangs after update 16, its main thread at 100% CPU the grader’s sympy path spun on one answer, on the thread that drives generation no grading of cut-off answers; a 10 s CPU-time limit per grading control run
one update’s gradient norm is 5.77 against 0.18–1.04 one batch: Megatron’s re-run reproduced the value, so not the GPU the clip at 1.0 scaled it down; nothing else control run
first-reported medians and block values were slightly off a one-off script took the upper middle value, and truncated decimals every number from analyze_control.py control run
an ssh session stays open until a background job ends nohup at the end of an && chain sent the whole chain to the background put nohup on its own line control run
// § 03

Read more