Back to directory

Modern LLM Notebook

A notebook-first course of 26 runnable Jupyter notebooks that builds a modern LLM system from scratch in PyTorch, covering tokenizers, attention, mixture-of-experts, training, RLHF, quantization, speculative decoding, and deployment.

Modern LLM Notebook

Modern LLM Notebook has learners implement the essential machinery of a large language model themselves rather than treating it as a black box: tokenizer, embedding, self-attention, Transformer blocks, training objectives, mixture-of-experts layers, LoRA, RLHF, decoding, KV caching, and long-context techniques, following the complete path from raw text to a working model system across 26 notebooks.

Its recently rebuilt inference section covers FP8 and FP4 quantization formats with a grid experiment and an end-to-end walkthrough producing several standard quantized checkpoint formats and serving each one; a runnable speculative-decoding loop with measured acceptance rate and speedup; batching, paging, and prefix-caching simulators alongside refreshed serving-engine deployment workflows; and an evaluation notebook that scores real models against common benchmarks and registers a custom benchmark into an existing evaluation harness.

Each notebook keeps a consistent learning loop of intuition, hand calculation, implementation, and experiment, and the course is bilingual, with Chinese as the source edition and an English mirror updated alongside it; it can be run locally or started directly in a hosted notebook environment.

More in Tutorials

See all 478
  • BootLife

    github.com

    Conway's Game of Life implemented to run directly from a 512-byte x86 boot sector in assembly, using VGA memory itself as the simulation grid.

  • A technical blog post deriving the Y combinator as a composition of combinator birds in an array language, and examining how eager evaluation changes fixed-point recursion compared with the usual lazy telling.

  • System Design Atlas

    atlas-sysdes.vercel.app

    A free reference of worked system design problems with interactive architecture diagrams, covering ranked designs such as a feed, a chat app, a URL shortener, and a rate limiter, plus pages on the technologies behind them.