Ship one LLM serving stack in 10 weeks
A 10-week, 30-minutes-a-day roadmap for engineers who want to actually run LLM inference in production, not just read about it. Every session feeds a single OpenAI-compatible service that you deploy on a rented GPU, instrument, load test, tune and publish as a benchmark.
Week 1 of 10 · you are here
The mental model
- Focus
- Install the one model everything else hangs on. Roofline, arithmetic intensity, and why decode waits on memory while prefill waits on compute.
- Medium
- Video-first. Roofline reasoning benefits from live derivation and diagrams.
- Deliverable
- A hand-derived arithmetic intensity figure for the model you will serve, and the ability to say which phase is bandwidth-bound and why.
- Making Deep Learning Go Brrrr From First Principles (Horace He), first half through the compute vs memory-bandwidth vs overhead regimes.
- Finish the post. Operator fusion, overhead, and why adding FLOPS does nothing for a memory-bandwidth-bound kernel.
- Stanford CS336 Lecture 5: GPUs (Percy Liang, Tatsunori Hashimoto), first 30 min: execution model and memory hierarchy. Slides.
- CS336 Lecture 5, second 30 min: arithmetic intensity, roofline, why data movement dominates. Text version: Transformer Inference Arithmetic (kipply).
- Hand-derive arithmetic intensity for your target model. The value is producing your own figure, not re-reading the explanation.
- CS336 Lecture 10: Inference, then the prefill vs decode opening of the Databricks post.
Read first: short explainers for this week
- Autoregressive Models, the family of models that generate one piece at a time by predicting the next step from the past.
What it covers (11)
- What is an Autoregressive Model?
- The Chain Rule of Probability
- The Generation Loop
- Step-by-Step Numeric Example
- Why GPT-style Models are Autoregressive
- Why Autoregressive Models Need Causal Masking
- The Connection with KV Cache
- Autoregressive vs Non-Autoregressive Generation
- Popular Autoregressive Models we should know
- Pros and Cons of Autoregressive Models
- Quick Summary
- Prefill vs Decode, the two phases of LLM inference, and how understanding them helps us optimize the speed of an LLM.
What it covers (12)
- What is LLM inference
- The two phases: Prefill and Decode
- Prefill explained in simple words
- Decode explained in simple words
- A diagram of the two phases and the KV cache flow
- The KV cache as the bridge between the two phases
- A step-by-step walkthrough of a few decode steps
- Prefill vs Decode comparison table
- Why this split matters: compute-bound vs memory-bound
- The key metrics: TTFT, TPOT, throughput, and end-to-end latency
- Optimization techniques mapped to each phase
- Conclusion
- How a GPU works for Deep Learning.
What it covers (13)
- What is a GPU?
- Why is the GPU perfect for deep learning?
- CPU vs GPU
- The math professor and the thousands of students
- Why deep learning is mostly matrix multiplication
- Serial work vs parallel work
- GPU memory (VRAM) and memory bandwidth
- Why the model must fit in VRAM
- Tensor Cores and lower precision (FP16, BF16, INT8)
- CUDA and the software stack (cuDNN)
- Training vs inference on GPUs
- Multiple GPUs working together
- Why NVIDIA GPUs power modern AI
- How CUDA Kernels work.
What it covers (11)
- Why do we need a GPU?
- What is CUDA?
- What is a CUDA Kernel?
- Threads, Blocks, and Grids
- Host and Device
- Writing our first CUDA Kernel
- How a thread finds its own work
- What happens inside the GPU when a kernel runs
- Memory in CUDA
- Why CUDA Kernels matter for AI
- Where CUDA Kernels work well and where they fail
Interview questions this week prepares you for
Before you publish a benchmark
The mistakes that get public inference benchmarks taken apart. Read them in week 5, apply them in week 10.
- Sweep the request rate. A single concurrency level is an anecdote.
- Report exact input and output token lengths. KV cache size and therefore throughput depend entirely on them.
- Report p50, p95, and p99. Means hide the tail that users feel.
- Keep TTFT and inter-token latency separate. Collapsing prefill and decode into one number destroys the finding.
- Do not measure at the saturation point where the server is preempting. Report the knee, not the collapse.
- Avoid synthetic uniform-length traffic. Uniform lengths hide the heavy tail that makes continuous batching matter.
- Account for tokenizer differences between engines before comparing tokens per second.
- Pin engine versions and publish exact commands, so a critic can reproduce rather than speculate.
Who it is for, why the order matters, and setup
Who this is for
You should be comfortable with Python, transformers at the architecture level, and the command line. You do not need prior serving, Kubernetes, or CUDA experience.
If you already know a topic, the sessions marked skim are the ones to compress. Do not compress the build sessions, they are the point.
What you will have at the end
- A serving stack you configured, instrumented, and tuned yourself
- Grafana dashboards showing TTFT, inter-token latency, throughput, queue depth, and cost per request
- A load test harness that reproducibly drives 1000+ concurrent requests
- Benchmarked variants across FP16, FP8, INT4, speculative decoding, and KV eviction
- A cost/latency/quality router with per-request token budgeting
- A published benchmark writeup with pinned versions and reproducible commands
Time commitment
| Session length | 30 minutes |
| Sessions per week | 5, plus 2 buffer days |
| Total | 10 weeks, 50 sessions, 25 hours |
| GPU cost | Roughly one 24GB card rented by the half hour, plus two H100 sessions |
Buffer days exist so that missing a Tuesday does not collapse the plan. They are for catching up, not for new material.
How the roadmap is ordered
The order here is deliberate and differs from how most people write this list down. Five decisions drive it.
The roofline model comes first. Every optimization later is a move on the same plot. Quantization attacks memory-bandwidth-bound decode. Continuous batching raises arithmetic intensity toward the compute roof. Speculative decoding spends FLOPs, which are cheap in the memory-bound regime, to cut sequential memory loads. Disaggregation exists because prefill is compute-bound and decode is bandwidth-bound and they fight over one GPU. Without this model, the rest is a bag of tricks.
Measurement comes before optimization. Instrumentation lands in week 3 and load testing in week 5, well before the tuning knobs. Nothing after them is verifiable without them, and a public benchmark is mostly a credible measurement harness with a model attached.
Paged attention and continuous batching are not build exercises. vLLM implements both, and chunked prefill is the default scheduling strategy in vLLM and SGLang. Reimplementing them teaches less than reading the block manager and the scheduler until you can explain from the code why memory waste drops under 4 percent and why the GPU stops idling between requests.
The router sits next to unit economics. A router that picks a backend by cost, latency, and quality is the one component that forces a dollar figure and a latency budget into code. Studying economics the same week turns the reading into a routing policy instead of a blog post you agreed with.
Edge deployment is optional and last. ONNX Runtime, TensorRT-LLM, and WebLLM are client-side and embedded runtimes. They share almost no operational surface with the datacenter stack the other nine weeks build.
Setup
GPU access
A 7-8B model needs roughly one 24GB GPU. Rent by the half hour and shut the instance down between sessions.
| Provider | Good for |
|---|---|
| RunPod | Per-second billing, quick pods |
| Modal | Serverless, best for benchmark sweep scripts |
| Lambda / vast.ai | Cheap on-demand and marketplace GPUs |
| Colab | Pure-Python sessions, no serving |
All of week 1, most of week 3, the week 6 lecture days, and all of week 9 reading need no GPU at all. Batch your rentals around the build days. One H100 is needed for exactly two sessions: the 1000-concurrent test in week 5, and disaggregation in week 8 if you run it for real.
Tools you will install
pip install vllm
pip install guidellm
pip install sglang
Plus Docker for the Prometheus and Grafana stack, and kind or a small managed cluster for week 8.
Decision points, papers, courses and tools
Decision points
Moments where following the schedule blindly is the wrong move.
| If | Then |
|---|---|
Week 5. TTFT spikes and num_requests_waiting climbs before target concurrency. |
The server is preempting. Stop and tune --max-num-seqs, --gpu-memory-utilization, and chunked prefill first. A run measured at the preemption point is not publishable. |
| Week 6. INT4 costs more than 1-2% on your quality proxy for the throughput it returns. | Keep FP16 or FP8 as the default. Treat INT4 as a memory-pressure lever, not a throughput default. |
| Week 7. Speculative decoding slows you down at your real request rate. | Expected. Gains appear at low query rate and vanish when the GPU is compute-saturated. Publish the crossover point, it is more useful than the speedup. |
| Week 8. Kubernetes starts eating whole sessions on cluster plumbing. | Use a managed cluster, or fall back to single-node Docker plus the KEDA reading. The autoscaling signal matters more than a bespoke cluster. |
Reference
Papers
| Paper | Venue | Topic |
|---|---|---|
| PagedAttention / vLLM | SOSP 2023 | KV cache paging |
| Orca | OSDI 2022 | Continuous batching |
| SGLang | NeurIPS 2024 | RadixAttention, prefix reuse |
| SARATHI / Sarathi-Serve | OSDI 2024 | Chunked prefill |
| DistServe | OSDI 2024 | Prefill/decode disaggregation |
| Splitwise | ISCA 2024 | Phase splitting across GPU types |
| Mooncake | FAST 2025 | KV-cache-centric serving |
| StreamingLLM | ICLR 2024 | Attention sinks, long context |
| EAGLE | arXiv | Speculative sampling |
For GPTQ, AWQ, SmoothQuant, LLM.int8(), Medusa, H2O, SnapKV, and the FlashAttention family, use Lilian Weng's survey and the NVIDIA optimization survey, which cite them directly. Search exact titles rather than guessing arXiv IDs.
Courses and series
- Stanford CS336: Language Modeling from Scratch, taught by Percy Liang and Tatsunori Hashimoto. Lectures 5 (GPUs), 6 (Kernels), 7-8 (Parallelism), 10 (Inference).
- MIT 6.5940 EfficientML.ai, taught by Song Han. Fall 2023 and Fall 2024 recordings both work.
- vLLM Office Hours, bi-weekly, from the engine team.
- GPU MODE, kernel and systems-level lectures.
- USENIX, OSDI, NSDI, and ATC talks by paper authors.
Tools
| Tool | Use |
|---|---|
| vLLM | Primary serving engine |
| SGLang | Prefix-reuse comparison |
| GuideLLM | SLO-aware rate sweeps |
| genai-perf | TTFT and ITL measurement |
| LLMPerf | Hosted endpoint benchmarking |
| production-stack | Kubernetes deployment |
Reading habit
One 30-minute session a week: scan titles on arXiv cs.DC and the systems conferences, read exactly one paper's abstract, method figure, and evaluation, and track the applied writeups on the vLLM and LMSYS blogs and the Modal Almanac. Read the systems paper, skip the model-release press.
Notes on the sources
Every video here has a named speaker from a university, an engine team, or a conference, and is paired with a text covering the same material, so you can read instead of watch. Where no video met that bar, the week is text-only rather than padded.
A few things to keep in mind:
- Timestamps are targets. Talks get re-uploaded and re-cut, so use the on-video chapter markers to place split points.
- MIT 6.5940 was not offered in Fall 2025. Fall 2023 and Fall 2024 recordings both exist and either works.
- vLLM serves its blog at two URL shapes and its docs change with versions. If a link 404s, search the exact title rather than editing the path.
- Performance figures quoted here are the sources' own claims from their papers and blogs, not independently reproduced. Treat them as the number that source is willing to defend, not as ground truth for your hardware.
- Cost per million tokens and GPU hourly rates move fast. The economics reading is valuable for its method. Re-derive every number against your own hardware.
Roadmap from time-to-first-token by patchy631, adapted for this site. See Credits for its license.