Where Can You Practice LLM Inference Techniques by Writing the Code Yourself?
Free coding problems and projects for KV caching, continuous batching, quantization, PagedAttention, speculative decoding and FlashAttention, each tested in the browser on TensorTonic.
Most material on LLM inference is either a paper or a library you call. Reading about a KV cache and calling a serving framework are both useful, but neither makes you write the cache, the scheduler or the quantizer yourself, and that is where the details you get asked about in interviews actually live.
This guide lists the free problems and project steps on TensorTonic for each core inference technique, in the order I would learn them. Every link here is free, runs in the browser and checks your code against tests.
Where can you practice KV caching?
The KV cache is the first thing to learn, because almost every other inference technique builds on it. These problems have you write the decode step that uses the cache, update the cache in place, append to it on a GPU and plan how much memory it needs. The KV cache explainer covers the idea first.
- Decode Attention with a KV Cache: run one decode step that appends the new key and value and attends over everything cached so far.
- KV Cache Update at a Position: write new keys and values into a preallocated cache at the current position.
- KV Cache Append in Triton: do the same append as a GPU kernel.
- Plan KV-Cache Capacity: work out how many tokens and requests fit in a given amount of GPU memory.
Where can you practice continuous batching and scheduling?
Batching is how a server keeps the GPU busy while requests of different lengths come and go. The LLM Serving Scheduler project has you build the scheduler of an LLM server step by step, and these problems cover the batching and routing parts.
- Plan One Continuous Batching Step: decide which requests run in the next step as others finish and new ones arrive.
- Simulate Continuous Decode Batching: simulate a whole run of continuous batching and see how the batch changes over time.
- Measure TTFT, TPOT and Throughput: compute the latency and throughput numbers that serving teams track.
- Route Cache-Aware Prefill Requests: send each request to the server that already holds most of its prefix.
Where can you practice quantization?
Quantization shrinks a model by storing its weights in fewer bits. The Quantize a Language Model to 4 Bits project walks through the main schemes in order, from a single scale and zero point to GPTQ and NF4, and measures each one on a real language model. The quantization explainer covers the formats.
- Quantize with a Zero Point: map floats to integers with a scale and a zero point.
- Int8 Matmul with Per-Channel Scales: run a matrix multiply on int8 weights with one scale per channel.
- Group-Wise 4-Bit Weights with Protected Columns: quantize weights in groups and keep the outlier columns in higher precision.
- SmoothQuant Smoothing Factors: move the difficulty from activations into weights before quantizing.
- GPTQ: Quantize Column by Column with Error Feedback: quantize one column at a time and push the error onto the columns that are left.
- NF4: Map Weights to the Nearest Normal Level: use the 4-bit levels behind QLoRA.
- Size a Quantized KV Cache: see how much memory a lower-precision cache saves.
Where can you practice PagedAttention and prefix caching?
PagedAttention stores the KV cache in small fixed-size blocks, so a server can pack in more requests and share prefixes between them. These problems have you write the block allocator, read from a paged cache and find reusable prefixes. The PagedAttention explainer shows how the blocks are laid out.
- Allocate KV Cache Blocks: write the block allocator that PagedAttention relies on.
- Paged KV Cache Gather: read keys and values back out of scattered blocks using a block table.
- Find Reusable Prefixes in a KV Trie: find the shared prefixes that let requests reuse cached blocks.
Where can you practice speculative decoding?
Speculative decoding uses a small draft model to propose several tokens and the large model to check them in one pass. The tricky part is the acceptance rule, which keeps the output identical to the large model. Both problems focus on that rule. The speculative decoding explainer walks through why it works.
- Perform Exact Speculative Sampling: accept or reject drafted tokens so the output matches the target model exactly.
- Speculative Decoding Acceptance: compute how many drafted tokens are accepted in one verification pass.
Where can you practice FlashAttention?
FlashAttention computes exact attention in tiles, so the full attention matrix never has to be written to GPU memory. The Write FlashAttention Step by Step project builds it from online softmax up to a tiled forward pass, and the Triton problem has you write it as a real kernel that runs on a GPU. The FlashAttention explainer covers the algorithm.
- Online Softmax over Chunks: compute softmax one chunk at a time, which is the trick FlashAttention is built on.
- Merge Two Partial Attention Results: combine attention results computed on separate blocks.
- Tiled Attention Forward Pass: put the pieces together into a tiled forward pass that matches PyTorch.
- Count Memory Reads and Writes: count the memory traffic that makes FlashAttention fast.
- FlashAttention Forward Kernel in Triton: write the forward pass as a real GPU kernel.
Do you need a GPU to practice LLM inference?
No. Most of these problems are written in Python and NumPy, because the hard part of inference is the logic of the cache, the scheduler and the quantizer, and that runs fine on a CPU. The Triton problems run on real GPUs on TensorTonic, so you do not need one of your own for those either.
What order should you learn LLM inference techniques in?
Start with the KV cache, since batching, PagedAttention and speculative decoding all depend on it. Then learn batching and scheduling, because that is where most serving performance comes from. After that, do quantization, then PagedAttention and prefix caching, then speculative decoding, and finish with FlashAttention once you are comfortable with attention itself.
If you want the bigger picture of the field, including which metrics matter and how interviews test it, read the inference engineering guide. When you get stuck on a problem, Toni, the AI tutor built into the editor, can give you a hint without giving away the answer.