llm-inference-notes / articles /inference-engineer-roadmap.md
inference-engineering-academy's picture
Upload folder using huggingface_hub
cc5fceb verified
|
Raw History Blame Contribute Delete
4.02 kB
# Inference engineer roadmap: skills, tools, and a 12-week plan
"Inference engineer" is the person who makes a trained model cheap, fast, and reliable to serve. Training teams care about loss curves; inference teams care about time-to-first-token (TTFT), inter-token latency, throughput per GPU, and cost per million tokens. This roadmap lists what to learn, in what order, and a concrete 12-week plan.
## The core skills
**1. The math of a forward pass.** You should be able to estimate, without running anything, how many bytes and FLOPs a token costs. For a dense model, a forward pass costs roughly 2 x parameters FLOPs per token, and decode must read every weight once per step. That one fact explains most of serving performance.
**2. Memory: weights plus KV cache.** Weights are params x bytes (Llama 3.1 8B in FP16: 8.03B x 2 = ~16 GB). The KV cache is 2 x layers x kv_heads x head_dim x bytes per token (Llama 3.1 8B: 2 x 32 x 8 x 128 x 2 = 128 KiB per token). Sizing a deployment is mostly these two numbers.
**3. Prefill vs decode.** Prefill processes the whole prompt in parallel and is compute-bound. Decode generates one token per step per sequence and is memory-bandwidth-bound at small batch sizes. Batching, chunked prefill, and disaggregated serving all exist because of this split.
**4. Batching and scheduling.** Continuous (iteration-level) batching, introduced by Orca (OSDI 2022), lets new requests join a running batch every step. PagedAttention (vLLM, SOSP 2023) stores the KV cache in fixed-size blocks so memory is not wasted on padding.
**5. Quantization.** FP8, INT8, and 4-bit weight formats (AWQ, GPTQ) trade a little accuracy for less memory and bandwidth. Know which part is quantized (weights, activations, KV cache) and how to measure quality loss.
**6. Engines.** vLLM, SGLang, and TensorRT-LLM are the main open serving engines; NVIDIA Dynamo and similar systems orchestrate across many GPUs. Be able to deploy one, read its metrics, and tune it.
**7. GPU basics.** HBM bandwidth (H100 SXM: about 3.35 TB/s), tensor-core FLOPs, NVLink vs PCIe, and what tensor and pipeline parallelism cost in communication.
**8. Measurement.** Benchmarks that report TTFT, inter-token latency, and throughput at a fixed latency target, with realistic prompt/output length distributions.
## A 12-week plan (about 8 to 10 hours a week)
| Week | Focus | Deliverable |
|---|---|---|
| 1 | Transformer forward pass, FLOPs and bytes per token | A one-page estimate sheet for an 8B model |
| 2 | KV cache math, GQA vs MHA | A script that computes KV per token for any config.json |
| 3 | Prefill vs decode, roofline model | Plot measured decode tok/s vs batch size |
| 4 | Run vLLM locally or on a rented GPU | OpenAI-compatible endpoint serving an 8B model |
| 5 | Continuous batching and PagedAttention | Load test with 1, 8, 32, 64 concurrent users |
| 6 | Metrics: TTFT, ITL, throughput, goodput | A benchmark report with p50/p99 |
| 7 | Quantization: FP8, AWQ/GPTQ INT4 | Compare memory, speed, and an eval score |
| 8 | Prefix caching and SGLang | Measure TTFT with a shared system prompt |
| 9 | Speculative decoding | Measure acceptance rate and speedup on your workload |
| 10 | Multi-GPU: tensor parallelism | Serve a 70B model across 2 to 4 GPUs |
| 11 | TensorRT-LLM or Dynamo, disaggregated prefill/decode | Compare against your vLLM baseline |
| 12 | Capstone | A write-up: cost per million tokens for a defined SLA |
## Tips
- Always write the estimate before running the benchmark. If they disagree by more than 2x, find out why; that is where learning happens.
- Rent GPUs by the hour instead of buying; one week of experiments on a single 80 GB card is enough for weeks 4 to 9.
- Publish your benchmark reports. They double as a portfolio for inference roles.
---
*If you want to go deeper, the free Foundations course at [Inference Engineering Academy](https://www.inference-engineering.xyz/) covers these topics with browser labs. Disclosure: written by the academy team.*