The Inference Academy blog
Inference engineering, explained with the numbers worked out
How LLMs are served fast and cheaply: the KV cache, batching, quantisation, parallelism, GPU kernels and capacity planning, plus honest guides to running models on your own hardware. Free to read, no sign-up.
36 articles · 4 hours of reading · free · RSS
What is inference engineering? The job behind every fast AI product
Inference engineering is the work of making trained models answer quickly, reliably and cheaply. What inference engineers actually do day to day, the handful of ideas the whole field rests on, why demand for the skill is growing, and where to start.
Read it · 8 min →
New to inference? Read these next
- Why memory bandwidth, not compute, decides how fast an LLM runs6 min read
- The KV cache explained: what it is, how big it gets, and why it limits your users8 min read
- Continuous batching explained: how LLM servers serve many users at once7 min read
- How to become an inference engineer in 2026: a skills roadmap9 min read
All articles
36 articles shown
Hardware and sizing
AMD MI300X vs NVIDIA H100 for LLM inference: specs, software and when AMD wins
How AMD's MI300X compares with NVIDIA's H100 for serving LLMs: 192 GB of memory and 5.3 TB/s against 80 GB and 3.35 TB/s, what that means for decode speed and concurrency, where ROCm still costs you time, and a checklist for trying AMD without betting the platform on it.
· 6 min read
Serving at scale
Cost per million tokens: how to calculate what your LLM really costs to serve
A step-by-step method for turning GPU prices into cost per million input and output tokens for a self-hosted LLM, with a worked example for a 70B model on H100s, why output tokens cost several times more than input tokens, and the five levers that move the number most.
· 7 min read
Hardware and sizing
H100 vs H200 vs B200 for LLM inference: what actually changes
A spec-by-spec comparison of NVIDIA's H100, H200 and B200 for serving LLMs, translated into what matters: decode speed, how many conversations fit, whether a 70B model fits on one GPU, and the price ratio at which each upgrade pays for itself. Worked numbers for a 70B model in FP8.
· 8 min read
Serving at scale
NVIDIA Dynamo vs llm-d: distributed LLM serving frameworks compared
Dynamo and llm-d both sit above engines like vLLM to run LLM inference across many GPUs: disaggregated prefill and decode, KV-cache-aware routing, KV offload and autoscaling. How they differ in design, engine support and operations, and how to tell whether you need either one.
· 8 min read
Serving at scale
Self-hosting an LLM vs using an API: when does it actually pay off?
A worked break-even analysis of self-hosting an open model on your own GPUs against paying an API per token: the formula, two examples at very different volumes, the utilisation threshold that decides it, the costs people forget, and the non-cost reasons (privacy, latency, control) that sometimes matter more.
· 7 min read
Core concepts
Serving LoRA adapters at scale: one base model, hundreds of fine-tunes
How to serve many LoRA fine-tunes from one base model instead of one GPU per fine-tune: why adapters are small, how multi-LoRA batching works, the vLLM settings that control it, adapter memory and speed costs with worked numbers, and the operational patterns for loading, routing and versioning adapters.
· 7 min read
Serving at scale
vLLM vs TensorRT-LLM: which inference engine should you serve with?
A practical comparison of vLLM and NVIDIA's TensorRT-LLM for serving LLMs: hardware support, how each one is built and deployed, quantisation and Blackwell FP4, operations, and a fair way to benchmark the two on your own workload before you commit.
· 8 min read
Serving at scale
Continuous batching explained: how LLM servers serve many users at once
Why batching makes LLM decode dramatically cheaper, why static batching wastes most of the GPU (with a worked example), how continuous (in-flight) batching adds and removes requests every step, how chunked prefill and preemption fit in, the settings that control it in vLLM and SGLang, and how to find the right batch size for your latency target.
· 7 min read
GPU kernels
CUDA vs Triton: which should an inference engineer learn first?
What CUDA and Triton each make you think about, the same kernel written in both, how Triton's autotuning and block-level model work, where each wins on control, portability and productivity, how they show up inside vLLM, SGLang and torch.compile, the newer kernel languages, an eight-week learning plan, and the mistakes that waste the most time.
· 6 min read
Serving at scale
Disaggregated prefill and decode explained: why big deployments split the GPUs
Prefill and decode fight over the same GPUs: long prompts stall everyone's streaming. Disaggregated serving runs them on separate pools and ships the KV cache between them. How it works, a worked example of the interference it removes, the KV transfer cost and how layer-by-layer streaming hides it, how to size the two pools, the failure modes, and when chunked prefill is enough.
· 7 min read
GPU kernels
FlashAttention explained simply: same maths, far less memory traffic
Standard attention writes a huge score matrix to GPU memory and reads it back. FlashAttention computes the same result in tiles that stay on chip, using an online softmax. Why that's faster, a worked example of the memory traffic it saves for an 8B model, the online softmax step by step with real numbers, what changed in FlashAttention 2, 3 and the decode-specific variants, and how to turn it on in PyTorch, vLLM and llama.cpp.
· 8 min read
Serving at scale
FP8 vs INT4 vs FP4: choosing a quantisation for LLM serving
What weight-only and weight-plus-activation quantisation change for prefill and decode, how FP8, INT8, INT4 (AWQ, GPTQ) and FP4 (NVFP4, MXFP4) are built bit by bit, which GPUs run each one natively, the memory and speed maths with a worked 70B example on H100s, why outliers make quantisation hard and how AWQ, GPTQ and SmoothQuant deal with them, how to produce and serve a quantised model, and how to validate quality before shipping.
· 8 min read
Serving at scale
How many GPUs do you need to serve an LLM? A worked capacity plan
A step-by-step capacity plan for a real brief: Llama-class 70B, 1,000 requests a minute, 8K-token prompts, 1K-token answers, P95 time to first token under 1 second and P95 end-to-end under 10 seconds, on H100s. Prefill compute, decode bandwidth, KV memory, batching limits from the latency target, and why the answer is not one 8-GPU node.
· 9 min read
Careers
How to become an inference engineer in 2026: a skills roadmap
A practical route into inference engineering: the skills hiring teams test, what to learn in which order, six projects that prove you can do the job, and the mistakes that slow most people down. No hype, just the path.
· 9 min read
Serving at scale
How to benchmark an LLM server without fooling yourself
A practical method for benchmarking vLLM, SGLang or any LLM server: realistic prompts, open-loop arrival rates instead of fixed users, warm-up, percentiles, goodput against targets, repeated runs, and a report format others can trust. With the commands for vLLM's and SGLang's benchmark tools, a sanity check using Little's law, how many requests you need for a stable P99, an example report, and the eight most common ways LLM benchmarks mislead.
· 7 min read
Serving at scale
LLM serving metrics explained: TTFT, TPOT, ITL, throughput and goodput
The handful of numbers that describe how an LLM service feels to users and what it costs to run: time to first token, time per output token, inter-token latency, end-to-end latency, throughput and goodput. What each measures, how they relate (with worked examples), a goodput sweep showing where capacity really ends, why averages mislead, where to measure, the Prometheus metrics engines export, and how to set targets.
· 8 min read
Core concepts
MHA vs GQA vs MQA vs MLA: how attention design decides your KV cache
The four attention variants used in modern LLMs, what each one stores per token, worked KV cache sizes for the same model under each, how many 32K-token users each design fits on one 8-GPU node, real numbers for popular models, the quality trade-offs, how MLA's absorbed form works, sliding windows and hybrid models, and how to read any model's config to know its serving cost.
· 8 min read
Serving at scale
Mixture of experts inference: cheap to compute, expensive to hold
Why MoE models like DeepSeek, Qwen MoE and Mixtral run with the compute of a small model but need the memory of a large one, how routing works, a worked calculation of how many experts each decode step touches at different batch sizes, why expert parallelism and load balance matter, how to size a deployment, and how to run MoE models locally with experts on the CPU.
· 7 min read
Core concepts
PagedAttention explained: virtual memory for the KV cache
How vLLM's PagedAttention stores the KV cache in small fixed-size blocks instead of one big reservation per request, a worked example of how many more requests that fits, how block tables and the paged attention kernel work, how the same idea enables prefix caching, parallel sampling and copy-on-write, what happens when memory runs out, and the settings and log lines worth knowing.
· 7 min read
Core concepts
Prefill vs decode: why the first token is slow and the rest are fast
Every LLM request runs in two phases with opposite bottlenecks. Prefill is limited by compute, decode by memory bandwidth. Worked numbers for an 8B model on an H100 at prompt lengths from 500 to 32,000 tokens, why attention makes long prompts grow faster than linearly, how context length and batch size change decode, a latency budget for a real request, and which optimisations help which phase.
· 8 min read
Core concepts
Speculative decoding explained: faster LLM output with the same answers
How a small draft model (or extra heads) guesses several tokens and the big model checks them in one step, why the output distribution doesn't change (with a worked example of the acceptance test), how to estimate the speed-up from the acceptance rate and drafter cost, why the gain shrinks as batch size grows, how to turn it on in vLLM, SGLang and llama.cpp, and how to measure it. Covers draft models, EAGLE, Medusa, multi-token prediction and n-gram lookup.
· 7 min read
Serving at scale
Tensor vs pipeline vs data vs expert parallelism for LLM inference
Four ways to spread an LLM across GPUs, what each one communicates, when it helps latency or throughput, and how to choose for a given model and node. With how tensor parallelism splits a layer, the communication maths, a worked example of why going from TP=4 to TP=8 gives less than twice the speed, the pipeline bubble formula, context parallelism for long prompts, the engine settings, and a decision table.
· 7 min read
Core concepts
The KV cache explained: what it is, how big it gets, and why it limits your users
Why LLMs keep a key-value cache, what exactly is stored, the formula for its size, worked numbers for Llama 3.1 8B and 70B at 8K and 128K tokens, how it grows during a request, how many users fit on common GPUs, how it slows decode at long context, how grouped-query attention shrinks it 8 times, and the techniques engines use to fit more of it in memory.
· 8 min read
GPU kernels
What is a GPU kernel? The code where LLM inference actually spends its time
A plain explanation of GPU kernels for engineers who use PyTorch or vLLM but have never written one: what a kernel is, how one call becomes thousands of threads, the GPU's memory hierarchy with real H100 numbers, why memory access patterns matter more than arithmetic, why fusing kernels speeds up inference, a worked example of launch overhead swamping a small model, and how to read the kernel names in a profile.
· 7 min read
Careers
What is inference engineering? The job behind every fast AI product
Inference engineering is the work of making trained models answer quickly, reliably and cheaply. What inference engineers actually do day to day, the handful of ideas the whole field rests on, why demand for the skill is growing, and where to start.
· 8 min read
Hardware and sizing
Can you run a 70B model at home? What hardware works
A 70B model needs about 44 GiB at 4-bit. Which GPUs, Macs, mini PCs and CPUs can hold it, how fast each would be by the bandwidth maths, what partial offload really costs, how to set up two GPUs, and whether you need 70B at all.
· 7 min read
Comparisons
DGX Spark vs Mac vs Ryzen AI Max: which 128 GB box for local LLMs?
Three ways to get 100+ GB of memory a GPU can use, compared on what decides local LLM speed: usable memory, memory bandwidth and prompt-processing compute. With estimated tokens per second for current open models.
· 8 min read
Hardware and sizing
How much VRAM do you need to run an LLM?
A worked method for sizing memory: weights, the KV cache and runtime overhead, with a Llama 3.1 8B example at every quantisation, how GQA and MLA change the KV cache, what concurrent users and serving engines add, worked examples for 8, 12, 24 and 80 GB GPUs, and a rule of thumb you can do in your head.
· 6 min read
Comparisons
llama.cpp vs vLLM: laptop engine or server engine?
llama.cpp runs quantised models on almost any hardware for one or a few users; vLLM serves many concurrent users on GPUs. How they differ in formats, hardware, batching and KV cache memory, with worked memory numbers for an 8B model on a 24 GB GPU, commands to run and benchmark both, and a checklist for moving from one to the other.
· 7 min read
Comparisons
MLX vs llama.cpp on Apple Silicon
Both run LLMs on a Mac's GPU. How they differ in model formats, quantisation, speed, memory and tooling, with the bandwidth maths that sets the speed limit on every Mac, the commands to benchmark both fairly, and which to pick for chat, coding, long prompts and fine-tuning.
· 7 min read
Comparisons
Ollama vs llama.cpp: which should you use?
How the two relate (Ollama is built on llama.cpp's GGML engine), what Ollama adds on top, the settings each exposes, why the same model can run at different speeds in each, how to move a model between them, and a simple rule for choosing, with the commands to start and to check that your GPU is really being used.
· 6 min read
Comparisons
Ollama vs LM Studio vs Jan vs Open WebUI: which local LLM app?
The desktop and web apps people use to run models locally, compared on what they are (engine, app or front end), platforms, model formats, APIs, licences and who each suits. Plus how they fit together, the default ports and a code example that works against all of them, four setups for common situations, and the problems people hit most.
· 6 min read
Comparisons
RAG vs fine-tuning: which does your problem need?
Retrieval adds knowledge at question time; fine-tuning changes behaviour. A decision guide by problem type, cost, freshness, privacy and evaluation, with how each one works under the hood, a worked cost comparison, three real-world scenarios, the cases where you need both, and the order of work that avoids wasted effort.
· 7 min read
Comparisons
vLLM vs SGLang: choosing a serving engine
Two open-source engines for serving LLMs at scale. What they share, how PagedAttention prefix caching and RadixAttention differ under the hood, where scheduling, structured output and large-MoE support differ, a worked example of prefix reuse for an agent workload, the equivalent settings in each, and how to choose by benchmarking your own workload.
· 7 min read
Hardware and sizing
Which quantisation should you pick? Q4_K_M, Q5, Q8 and the rest
What each GGUF quantisation level costs in size, speed and quality, how K-quants and importance matrices work, measured memory for a 70B model at every level, speed estimates for an 8B model on a 24 GB GPU, how to test quality yourself, and a simple decision rule for choosing.
· 6 min read
Hardware and sizing
Why memory bandwidth, not compute, decides how fast an LLM runs
Generating each token streams the whole model through memory. The formula, why the arithmetic is almost free, the predicted speed of Llama 3.1 8B across 14 GPUs, Macs and CPUs, what long contexts, batching and mixture-of-experts do to the picture, and how to check your own machine against its ceiling.
· 6 min read
Get new articles by email
One short email when a new guide is out. Unsubscribe any time.
Prefer step by step? The lessons teach the same ideas with animated diagrams, quizzes and labs, and the interview questions help you check what you know.