Learning LLM inference from scratch: a small C++/CUDA engine with 6 hours of video
An open-source GitHub project builds Llama 3.2 1B inference from scratch in C++ and CUDA, with 6+ hours of build videos and about 85 pages of handwritten notes. The engine covers prefill, a paged KV cache, paged decode attention, and static and continuous…
Why it matters
A hands-on way to understand what vLLM-style serving engines do under the hood.
What happened
1 min readAn open-source GitHub project builds Llama 3.2 1B inference from scratch in C++ and CUDA, with 6+ hours of build videos and about 85 pages of handwritten notes. The engine covers prefill, a paged KV cache, paged decode attention, and static and continuous batching.
Our analysis
This is a teaching engine, not a vLLM or TensorRT-LLM competitor: model dimensions and context are fixed and prefill is still one prompt at a time. Its value is the step-by-step treatment of RoPE, GQA, paged attention and batching. The page-budget admission policy is a nice worked example of avoiding preemption. Worth a look for engineers who want to reason about serving cost and latency.