Blog
Notes on LLM inference, KV-cache quantization and GPU kernels. RSS
LLM inference
-
Your 4-bit KV cache on Hopper is probably slower than FP8: why, and how to fix it
On H200, vLLM's 4-bit KV caches decode slower than FP8 because Hopper has no FP4 hardware and software unpacking blows the instruction budget (about 7 instructions per byte). A kernel built around that budget, and what it gives inside vLLM.
-
One run is not a result: comparing KV-cache dtypes in vLLM
Same BF16 config, same 500 MATH-500 problems, only the order shuffled: 68.4%, 67.0%, 67.6%. Why single greedy runs can't compare KV-cache dtypes, and what I do instead.
-
FP8 KV cache can silently break small Qwen2-based reasoning models in vLLM. Here's the one-line check.
In vLLM 0.33 the default FP8 KV cache drops R1-Distill-Qwen-7B from 71% to 0.5% on MATH-500, with no error. The cause is layer 0's key bias; keeping layer 0 in BF16 fixes it.
Other topics: optimization and computational physics
-
Adam and Newton both rescale the step. What's the difference? A tilted valley
Adam and Newton's method both want small steps along steep directions and large steps along flat ones. Put the same valley along the axes and then tilt it: diagonal scaling by curvature goes from 1 step to 208, Newton takes 1 step in both, and Adam takes about as long as gradient descent in both. Pictures first, then the math.
-
Why linear mixing stalls, and what Newton's method fixes: Gutzwiller self-consistency as a worked example
One eigenvalue of the fixed-point map near 1 makes linear mixing take hundreds of steps, and one above 1 hides a solution from it entirely. How Newton's method fixes both, where the Jacobian comes from, and when not to use it.