BuildLLM Troubleshooting Guide

Start with the stage that failed. Preserve the full command and error before changing anything. Make one correction at a time so you know which change solved the problem.

Environment and repository

SymptomCheckResponse
python or py is not recognizedPython is not installed or not on the shell pathInstall a supported Python version, open a new terminal, and repeat the environment lesson.
Activation script is blocked in PowerShellPowerShell execution policy blocks local scriptsUse the current-user process policy permitted by your organization or run the environment’s Python executable directly; do not create a second environment.
Package import failsWrong Python interpreter or incomplete installationActivate .venv, run python -m pip --version, and install requirements into that interpreter.
torch cannot importPyTorch was not installed into .venvUse the official PyTorch selector for the machine, install into the active environment, and rerun python main.py.
A command cannot find a repository fileTerminal is in the wrong directoryNavigate to the repository root and confirm main.py, run_lab.py, and configs are visible.
CUDA Available: FalseCPU-only wheel, driver issue, unsupported GPU, or wrong environmentConfirm driver and PyTorch build compatibility; use CPU only for bounded work until CUDA verifies.

Wikipedia download

SymptomCheckResponse
Download is slowNetwork speed and dump sizeKeep the terminal open; a 10,000-article extraction can still require downloading and reading a large compressed dump.
Download is interruptedPartial download file and network availabilityRerun the same command; the downloader resumes when the server supports it.
Checksum verification takes timeThe complete compressed file must be readWait for verification; do not delete a valid download because the terminal is temporarily quiet.
Output already existsPrevious extraction used the same pathInspect and preserve it, or intentionally choose a new path; do not overwrite an artifact you have not identified.
Report counts are unexpectedly lowNamespace, redirect, cleaning, duplicate, or article limit filteringRead the report fields and inspect accepted JSONL records before changing limits.

Corpus construction

SymptomCheckResponse
Local Wikipedia file is missingPrevious lesson did not finish or path differsBuild data/processed/wikipedia_simple.jsonl with the documented command.
Hugging Face source cannot loadNetwork, package version, dataset access, or remote changePreserve the error, verify network and installed dependencies, then retry; do not substitute an unknown corpus silently.
RFC acquisition failsNetwork or RFC cache stateInspect data/raw/rfc, preserve valid cached files, and rerun the same profile.
Corpus is smaller than configured maximumRejections, deduplication, balancing, or source targets ended firstUse actual report totals; the global maximum is a ceiling rather than a guaranteed result.
Too many documents are rejectedQuality threshold or source contentInspect rejection reasons and sample documents before changing the YAML in a new experiment.
Near-duplicate processing uses substantial memorySimHash state is memory residentUse the bounded 50M profile for the course path or plan sufficient memory for the larger build.
Output path already contains another buildArtifact identity is ambiguousPreserve the existing file and choose a new configuration/output path rather than overwriting evidence.

Tokenizer training

SymptomCheckResponse
Corpus file not foundIncorrect profile output pathUse the exact path from the corpus YAML and report.
Tokenizer training stopsEmpty/invalid corpus, dependency issue, or resource limitInspect several JSONL records, confirm --format jsonl, and preserve the error before retrying.
Verification round trip is unexpectedByte-level segmentation or corrupted tokenizer artifactCompare encoded IDs and decoded text; do not proceed if decoding fails to reconstruct the verification text.
Existing tokenizer would be overwrittenA different corpus used the same output pathUse the corpus-specific tokenizer path documented by the course.
Same vocabulary size is assumed compatibleToken IDs were learned independentlyUse only the exact tokenizer that encoded the checkpoint’s corpus.

Encoding and splitting

SymptomCheckResponse
Encoding cannot load tokenizerPath is wrong or tokenizer artifact is invalidReturn to tokenizer verification and use the corpus-specific path.
Training or validation token count is zeroCorpus has too few valid documents or split/input failedInspect encoding_report.json, source corpus records, and validation fraction.
Files are unexpectedly largeCorpus produced more tokens than estimatedUse report counts to plan storage and training; do not interrupt a valid write without reason.
Train and validation content may overlapSplit process or custom data changedConfirm document-level splitting and split seed; rebuild into a new output directory if identity is uncertain.
Token ID exceeds vocabulary during trainingToken files and tokenizer differPair the token directory with the tokenizer recorded in its encoding report.

CPU training

SymptomCheckResponse
Training is slowModel iteration, examples, batch, background load, and CPUUse Iteration 1 and bounded limits for learning; estimate larger work from measured throughput.
System becomes unresponsiveBatch, memory pressure, or competing applicationsStop safely, close competing work, reduce batch size, and resume only with a documented plan.
Loss is nan or infData, learning rate, gradients, or numeric problemStop, retain output and checkpoint, inspect the triggering settings and batches before retrying.
No validation appearsValidation token path/count or lifecycle settingsConfirm startup validation_examples and the held-out token file.
Run duration differs from expectationExample limits or steps were not checkedUse startup training_batches and maximum_training_steps as authoritative.

CUDA training

SymptomCheckResponse
CUDA out of memoryPeak allocated memory and batch sizeReduce --batch-size first, record the changed step count, and verify with a bounded fresh run.
BF16 unsupportedGPU capability and PyTorch buildUse --precision fp16 or --precision fp32 and record the fallback.
FP16 becomes unstableNon-finite loss, gradient scaling, and learning rateStop, preserve evidence, compare a bounded FP32 run, and inspect gradients and data.
GPU utilization is lowBatch size, workers, transfer, validation, saving, or other processMeasure one bottleneck at a time instead of adding workers automatically.
Throughput falls over timeThermals, power, competing process, or storageCorrelate throughput with temperature, clocks, utilization, validation, and checkpoint saves.
Fused AdamW is not activeInstalled PyTorch/device does not support itAccept the standard AdamW fallback and record fused_adamw; functionality remains.

Checkpoints

SymptomCheckResponse
Save appears frozenCheckpoint size and storage speedWait for Checkpoint saved:; do not close the terminal or press Ctrl+C again.
No last_checkpoint.pt existsBuildLLM stores save reason in metadata and writes numbered step filesUse the exact Checkpoint saved: or verified_checkpoint path.
best_checkpoint.pt is missingNo completed validation established a best checkpointUse the verified numbered checkpoint printed by the trainer.
Checkpoint cannot loadPartial/corrupt file, wrong model profile, or missing pathTry a prior verified numbered checkpoint and preserve the failed file for diagnosis.
Disk is nearly fullTemporary and final saves require headroomStop safely before the next save, protect existing files, and create adequate storage capacity.
Older numbered checkpoint disappearedRetention removed it after newer savesUse a backup policy for rollback points that must outlive automatic retention.

Resume

SymptomCheckResponse
No checkpoint availableWrong directory or no numbered saveSelect the correct experiment directory or pass an explicit existing path.
Model configuration mismatchIteration or architecture setting changedRestore the original command; start a new experiment for changed architecture.
Restored step is not expectedLatest selection found a different numbered fileInspect paths and use --resume <exact path>.
Incomplete epoch repeats dataSampler cursor and RNG states are not checkpointedDocument the limitation; this is recoverable but not bit-for-bit continuation.
Resume uses a different tokenizer or corpusExperiment identity changedStop and restore the original tokenizer and token paths.
Scheduler behavior differsEpoch target, batch, or example count changedRestore the original training command and planned epoch target.

Generation

SymptomCheckResponse
Checkpoint path does not existBest checkpoint absent or directory differsUse the exact verified path from training output.
Token IDs are invalid or text is corruptedTokenizer mismatchUse the tokenizer associated with that checkpoint’s training token files.
Output loopsUndertraining, concentrated logits, or decoder settingsPreserve the output, compare fixed settings and checkpoints, then change one control.
Output is incoherentSmall/undertrained model, high temperature, data weakness, or mismatchVerify identity, return to conservative settings, and compare loss evidence.
Output ends earlyEnd token, stop text, maximum new tokens, or context limitRead Finish reason and Generated tokens.
Output includes invented factsExpected next-token model failureMark the claim as unverified and include it in evaluation evidence.
Repeating a seed changes results across devicesKernel and numeric behavior differRecord the device and treat the seed as an aid rather than a cross-device guarantee.

A disciplined response sequence

  1. Stop safely if continued execution risks the run or data.
  2. Copy the full command, error, startup JSON, and last visible progress.
  3. Identify which artifact boundary failed.
  4. Verify inputs without overwriting them.
  5. Change one variable.
  6. Use a new output or checkpoint directory when the experiment identity changed.
  7. Repeat a bounded check.
  8. Record the cause and response in the run worksheet.

Return to the course home, the glossary, or the run-record worksheet.

Discover more from DrDeathLabs

Subscribe now to keep reading and get access to the full archive.

Continue reading