Tag

#vllm

AI

Flash attention explained: exact attention, 2–4× faster, by moving less memory

At 128K tokens, standard attention's score matrix is 32 GiB for one head in one layer. FlashAttention never writes it to GPU memory: it streams small tiles through on-chip SRAM, keeps a running max and sum for softmax, and recomputes instead of storing. Same exact result, memory linear in sequence length, 2–4× faster. The A100 numbers, FlashAttention-2, -3 and -4, the exponential bottleneck on new GPUs, and where you meet it in PyTorch, vLLM, Ollama and llama.cpp.

AI

Prompt caching explained: $205 or $15 a day for the same app (Claude, OpenAI, Gemini)

Prompt caching keeps the KV cache of the start of your prompt between requests, so repeated input costs a tenth or a twentieth of the normal price and the first word comes sooner. It only matches an exact prefix: one changing line at the top can make a cached app cost more than an uncached one. How it works, what Claude, OpenAI and Gemini charge as of November 2026, and how to check it's on.