The practical course

Practical LLM in Rust

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.

  1. 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: 15
  2. Extend BPE with bounded local updates

    Extend 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: 2
  3. Make optional dropout explicit and replayable

    Apply optional residual dropout with saved-mask gradients, exact evaluation identity and checked random counters. Keep local replay distinct from durable job resume.

    Content revision: 3
  4. Keep model operations and failures explicit

    Read configuration refusals, optimizer failures and checkpoint publication failures at their actual state boundaries. Distinguish local evidence from future backend integration.

    Content revision: 5
  5. Separate input encoding from the transformer

    Compose 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: 3
  6. Run tensor primitives on a GPU

    Select 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: 3
  7. Train with deliberate precision choices

    Inspect FP16 and BF16 rounding in the existing decoder, retain higher-precision weights and reductions, and skip overflowing loss-scaled updates safely.

    Content revision: 2
  8. Keep token order across cache pages

    Trace 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