All technical posts
All personal posts

« Back to Home

Vanilla attention basics and llama KV cache design

09 Nov 2026

I recently presented Vanilla attention basics and llama KV cache design to a group of colleagues at a paper reading group. Here are the slides from that session.

Download the slides (PDF)

The slides start with queries, keys, and values, work through attention with small numerical examples, then look at how llama.cpp stores and accesses its KV cache. They cover split versus unified caches, attention masking, and the kv_rows indexing approach for avoiding work on other sequences’ cache entries.

This excerpt ends just before prefix caching. The PDF preserves the step-by-step diagram builds, so there are 95 pages rather than one page per topic.

« Back to Home


Comments