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 7 of 10
Speculative decoding and KV eviction
- Focus
- Two knobs where the concept is widely known but the implementation detail is not.
- Medium
- Video-first for speculative decoding, taught by the person who wrote vLLM's implementation. Text-first for KV eviction.
- Deliverable
- A speculative decoding variant and a long-context eviction configuration, both benchmarked, including negative results.
- Speculative decoding docs for the method-selection table, then the vLLM benchmark post: up to 2.8x at QPS 1, but 1.4-1.8x slowdown at high QPS. The crossover is the finding, not the speedup.
- GPU MODE Lecture 22: Hacker's Guide to Speculative Decoding in vLLM (Cade Daniel, Anyscale), first half: proposers, scorers, verifiers, draft model worker.
- Enable speculative decoding and benchmark inter-token latency at both low and high QPS. Finding your own crossover point is the session.
- StreamingLLM (Guangxuan Xiao et al, ICLR 2024): up to 22.2x speedup over sliding-window recomputation, stable past 4M tokens. Optional video: StreamingLLM and DuoAttention (MIT CSAIL).
- Configure a long-context workload and an eviction strategy, then measure memory and TTFT. Long context is where eviction stops being theoretical.
- Finish GPU MODE Lecture 22, then skim speculators and its office hours.
Read first: short explainers for this week
- KV Cache Compression, the set of techniques that shrink the memory an AI model uses to remember the conversation while it is writing its reply.
What it covers (11)
- What is an LLM and how it writes text
- What is Attention
- What is the KV Cache
- Why the KV Cache becomes huge
- What is KV Cache Compression
- Approach 1: Quantization
- Approach 2: Token Eviction
- Approach 3: Sharing Keys and Values across Heads
- Approach 4: Low-Rank Compression
- Comparison of the approaches
- When to use which one
- Speculative Decoding - what it is, why LLM generation is slow without it, how a small draft model and a big target model work together to produce tokens faster, the rejection sampling math that guarantees no quality loss, real numbers showing the 2x to 3x speedup, where it is used in production, and the trade-offs to watch out for.
What it covers (10)
- What problem does Speculative Decoding solve?
- The Big Picture
- Why is LLM generation slow?
- The core idea behind Speculative Decoding
- Step-by-step walkthrough
- The verification step
- Real numbers and speedup
- Where it is used
- Trade-offs
- Quick Summary
- Medusa, a simple way to make a language model generate text 2 to 3 times faster by giving it several extra heads that guess multiple future tokens at once.
What it covers (10)
- What is Medusa
- Why text generation is slow
- A quick recap of speculative decoding
- The problem with needing a draft model
- The big idea: many heads on one model
- How tree attention checks many guesses at once
- The math behind the speedup with small numbers
- The results
- How Medusa lives on today
- Quick Summary
- EAGLE, a state-of-the-art way to speed up language model generation by drafting tokens at the feature level instead of the token level.
What it covers (9)
- What is EAGLE
- A quick recap of speculative decoding
- The problem with token-level drafting
- The big idea: draft at the feature level
- Resolving the uncertainty by feeding back the token
- The math behind the speedup with small numbers
- EAGLE-2 and dynamic draft trees
- How EAGLE lives on today
- Quick Summary
- N-gram Speculation in LLMs, a simple trick that makes a language model write its answer faster by guessing the next few words from the text it has already seen.
What it covers (10)
- How an LLM generates text
- Why generating text is slow
- What is Speculative Decoding
- The cost of a draft model
- What is an N-gram
- What is N-gram Speculation
- N-gram Speculation step by step
- Why the output stays exactly the same
- Where it works well and where it fails
- N-gram Speculation vs Draft Model Speculative Decoding
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.