Skip to content

Understand ML deeply. Explain it clearly.

Type any machine learning topic and learn it in six short pages, from the big picture to code you can run.

TryLoRAKV cacheAttentionBackpropagationGRPO

Library

The figures from sessions, on pages you can land on and play with.

Browse the Library
queries and keyscatsatonmatqscore q·k/√d → softmaxcat1.520.62sat0.200.17on-1.040.05mat0.190.16values and the outputcatsatonmato
Most attention: cat (62%)
Attention is a dot product, a softmax and a weighted average. The query q is compared with every key k; keys that point the same way score highest. Softmax turns the scores into weights, and the output is the weighted mix of the values v. Two dimensions instead of 64 or 128, the same arithmetic.

Studio

Export any figure as SVG or PNG for your slides and papers.

Open Studio
64 MiB256 MiB1 GiB4 GiB16 GiB64 GiB1K2K4K8K16K32K64K128Ktokens in the contextmodel weights, bf1632 KV heads, bf16 (no head sharing)8 KV heads, bf16 (Llama 3 8B)8 KV heads, FP8 (quantised cache)equal at 123K tokens4 GiB1 GiB512 MiB
One long conversation can need as much memory as the model. Cache size for a single Llama 3 8B sequence on log scales. Sharing key and value heads (8 instead of 32) cuts it by four; an FP8 cache halves it again. The dashed line is the 16 GB of bf16 weights.