Skip to content

Understanding Large Language Models from the Ground Up

Start with an everyday question, then follow how text enters a model, how a response is produced, and how the model is trained.

This bilingual open textbook explains how language models work, from observable responses to the calculations behind them. Part I assumes no programming background. Later practical chapters introduce the Python, mathematics, and engineering needed to build models and applications.

All 57 chapters and both primers are available

Section titled “All 57 chapters and both primers are available”

All 57 chapters and the Python and HTTP primers are available in English and Chinese. Chapters 40–57 and the HTTP primer were released on September 15, 2026. Chapters 5–39 and the Python primer retain September 13, and Chapters 1–4 retain their September 10 first-edition date. Examples, diagrams, calculations and exercise solutions are directly readable on the page.

  • Chapter 1: judge a response against the task and its evidence, and distinguish a model from the complete assistant.
  • Chapter 2: follow how a response is generated and how training changes the model.
  • Chapter 3: turn text into pieces, IDs, and vectors, then examine what those representations preserve.
  • Chapter 4: build a small language model by counting, calculate its predictions, and test its limitations.

Continue through the published parts:

The full roadmap links the complete core sequence. The optional multimodal extension remains planned and unpublished. Companion services are local demonstrations; publishing the book does not deploy them.

Where did the explanation lose you? Which example helped, and where was a step missing? Share the page and passage through reader feedback. You do not need to know the correction to describe a difficulty.

For a specific error, use the errata and feedback page. Source text and accompanying materials are available on GitHub.