The structure of Practical LLM in Rust
Connect the practical text model's data, learning, generation and saved state, then follow every published and planned chapter from 0 to 32.
Content revision: 15The practical course
Extend a separate copy of the completed Rust language model. Chapter 0 explains the structure; Chapter 1 onward introduces practical mechanisms with runnable examples. The index lists available lessons; later chapters remain part of the roadmap.
Connect the practical text model's data, learning, generation and saved state, then follow every published and planned chapter from 0 to 32.
Content revision: 15Identify the tiny scalar decoder's fixed inputs and interpret its replay, window-slot scores, checkpoint reload and generated tokens without mistaking them for laptop-scale capability.
Content revision: 1Use NVIDIA NeMo Curator to apply a word-count rule, remove repeated text and preserve known source-group splits, then load prepared JSONL in Rust.
Content revision: 1Extend the existing Rust BPE trainer and tokenizer with bounded local updates, preserve their learned decisions and inspect a chapter-local GPT-2 segmentation example.
Content revision: 2Extend the Rust batch and decoder APIs with right padding, valid attention prefixes and a loss averaged over real targets.
Content revision: 2Use next-fit placement, occurrence segments and reset positions to preserve document-local attention, targets and token-weighted loss.
Content revision: 1Scale each block's two output projection weight matrices once at initialization, then inspect residual activation RMS and completed mean-loss adjoints on fixed CPU decoders.
Content revision: 4Validate model and run records, plan resources before constructing the existing CPU decoder, then preserve full and cached text through one shared decoder path.
Content revision: 4Apply optional residual dropout with saved-mask gradients, exact evaluation identity and checked random counters. Keep local replay distinct from durable job resume.
Content revision: 3Read configuration refusals, optimizer failures and checkpoint publication failures at their actual state boundaries. Distinguish local evidence from future backend integration.
Content revision: 5Compose text lookup, the existing causal backbone and a tied text head. Follow vector shapes, live parameter checks and the two gradient paths into one shared table.
Content revision: 3Select CUDA for existing matrix products and sum/mean reductions. Follow host/device copies and compare the same text model's logits, loss and gradients with a CPU reference.
Content revision: 3Inspect FP16 and BF16 rounding in the existing decoder, retain higher-precision weights and reductions, and skip overflowing loss-scaled updates safely.
Content revision: 2Preserve token-weighted loss across smaller batches, replay decoder blocks with the same dropout choices, and measure retained tensor payload at a declared point.
Content revision: 1Build a warmup and cosine schedule around existing AdamW, inspect a shared clipping factor, and keep successful updates separate from refused or skipped attempts.
Content revision: 1Preserve a tied text model for fresh-process CPU inference, then restore the extra state for bounded exact training continuation.
Content revision: 3Score valid next-token targets, compare a training-only bigram and three initialization seeds, and evaluate the saved text model on CPU.
Content revision: 1Fit row-group scales, pack signed weight codes, and compare reconstructed products, saved bytes and the same text model's likelihood on CPU.
Content revision: 1Trace shared key/value groups and local causal windows, count cache payload and compare each initialized model's full-prefix and cached CPU logits.
Content revision: 3Follow a stable running attention summary, reconstruct tiled gradients and compare numerical results and logical storage with the dense reference.
Content revision: 1Trace logical positions through a KV page table, separate live and unused buffer payload, and compare the same restored model under contiguous and paged placement.
Content revision: 1