WEBVTT

00:00:01.290 --> 00:00:02.238
Hi, I'm Larch!

00:00:02.238 --> 00:00:05.714
Every new token rereads a cache of past keys and values.

00:00:05.714 --> 00:00:07.926
Here's how attention learned to shrink it.

00:00:09.517 --> 00:00:14.162
Decoding rereads the whole cache at every step, so its size sets the speed.

00:00:14.162 --> 00:00:16.485
Each variant caches fewer bytes per token.

00:00:18.608 --> 00:00:20.056
One formula sets the bill.

00:00:20.608 --> 00:00:22.603
Every token keeps a key and a value.

00:00:23.461 --> 00:00:26.706
The lever is the number of key-value heads: one per query head,

00:00:26.706 --> 00:00:28.328
a few groups, or just one.

00:00:28.748 --> 00:00:31.477
Times the head width, times two bytes in sixteen-bit.

00:00:33.425 --> 00:00:37.221
Multi-head attention gives every query head its own key and value head.

00:00:37.221 --> 00:00:38.487
That's the full bill.

00:00:38.907 --> 00:00:42.399
Grouped-query attention lets each group of query heads share one.

00:00:42.399 --> 00:00:45.542
On T5, eight groups kept nearly all the quality.

00:00:45.962 --> 00:00:50.931
Multi-query shares one across all heads: the smallest cache, and the biggest quality cost.

00:00:52.967 --> 00:00:56.807
MLA squeezes each token's hidden state into one latent of five

00:00:56.807 --> 00:00:58.203
hundred and twelve numbers.

00:00:58.623 --> 00:01:02.350
Only the latent is cached, and all one hundred and twenty-eight heads share it.

00:01:02.770 --> 00:01:07.704
Rotary position can't survive the compression, so a separate sixty-four wide key carries it.

00:01:08.124 --> 00:01:12.062
At attention time the up-projections fold into the query and output.

00:01:12.062 --> 00:01:13.493
Keys are never rebuilt.

00:01:15.050 --> 00:01:19.127
At a hundred and twenty-eight K tokens, the full multi-head cache is

00:01:19.127 --> 00:01:23.204
fifty-seven times MLA's: four hundred and eighty against eight and a half.

00:01:24.850 --> 00:01:26.152
The queries never change.

00:01:26.152 --> 00:01:29.732
Only the key-value side shrinks: share its heads, or cache a

00:01:29.732 --> 00:01:31.034
latent and rebuild nothing.

00:01:33.275 --> 00:01:34.450
Count the key-value heads.

00:01:34.450 --> 00:01:35.919
Share them, or compress them.

00:01:35.919 --> 00:01:38.269
And check the bytes at your context length.

00:01:38.689 --> 00:01:40.711
Every source is in the full article.

00:01:40.711 --> 00:01:41.289
I'm Larch.

00:01:41.289 --> 00:01:41.578
Bye!
