LLMs from the Bytes Up

Most explanations of large language models start with diagrams. This course starts with a file. It opens a real model, reads the numbers in it, runs it, and measures it on real hardware — and every number it quotes as observed came from doing exactly that.

It is written for engineers who are fluent in operating systems, memory, and C, and new to machine learning. Code is shown in C where it can be, and every term is defined the first time a lesson uses it — including the ones a machine-learning course would assume, like tensor, dot product, and softmax. No linear algebra is required beyond what each lesson explains.

Read it in order. Each lesson builds on the one before:

  • Module 1 opens the model file and turns text into numbers.
  • Module 2 shows that nearly all of the model is matrix-times-vector, then runs it end to end.
  • Module 3 turns predictions into text and explains attention.
  • Module 4 looks at the hardware, and closes with the question the whole course exists to answer: why does generating text run at a few dozen tokens a second on a machine that can do tens of trillions of operations a second?

The model throughout is deepseek-coder-6.7b-instruct, a small, plain, 6.7-billion-parameter model. The machine is an NVIDIA DGX Spark. Every measurement can be reproduced with the scripts in the course’s companion code repository, llm-bytes-up-code (MIT-licensed). Each lesson names the script that produced its numbers.

💾

Module 1 — The Model Is Data

A model is a file of numbers, and text becomes numbers before anything else happens. Open the file, read its bytes, and turn words into vectors.

🧮

Module 2 — The Computation

Almost all of an LLM is one operation, matrix times vector, repeated. Walk one token through a layer by hand, then run the whole model end to end.

🔁

Module 3 — Generating Text

A model predicts one token's probabilities at a time. The loop that turns that into text, the settings that shape it, and the attention mechanism and cache that make it work.

⚡

Module 4 — The Machine

What a GPU is, where its memory sits, and why that — not arithmetic — sets how fast a model talks. Ends with the capstone: the sentence the course set out to understand.