WEBVTT

00:00:01.710 --> 00:00:02.482
Hi, I'm Oskar.

00:00:02.482 --> 00:00:05.829
A long chat fills a cache of past tokens, and it gets huge.

00:00:05.829 --> 00:00:08.918
Let me show you how to shrink it and still reuse it.

00:00:10.183 --> 00:00:13.640
The trick is to score the cache without looking at your question.

00:00:13.640 --> 00:00:16.809
Then one compressed cache can answer any question you ask later.

00:00:19.633 --> 00:00:23.356
First, read the whole context once and store it as a key value cache.

00:00:23.776 --> 00:00:27.309
Then ask the model to read that context again, straight from the cache.

00:00:27.729 --> 00:00:31.401
Give each stored pair a score: the most attention it gets during that reread.

00:00:31.821 --> 00:00:34.801
Keep the pairs that earned attention, and throw the rest away.

00:00:35.221 --> 00:00:38.928
The scoring never saw your question, so this one cache serves any query.

00:00:40.233 --> 00:00:43.594
The old way scores the cache against the current question, so it

00:00:43.594 --> 00:00:45.554
fits that one question and nothing else.

00:00:45.974 --> 00:00:49.675
Score by rereading instead, and the same small cache holds up

00:00:49.675 --> 00:00:51.021
across every later question.

00:00:52.458 --> 00:00:55.010
Here is the full cache, one cell per stored pair.

00:00:55.430 --> 00:00:58.728
Keep about the top thirty percent, and the answers barely change.

00:01:00.342 --> 00:01:03.773
That is three to four times less memory, and about twice the

00:01:03.773 --> 00:01:05.488
decode speed, with almost no loss.

00:01:06.725 --> 00:01:10.109
Score the cache without your question, and you compress it once and

00:01:10.109 --> 00:01:11.518
reuse it for every answer.

00:01:14.275 --> 00:01:17.728
So: reread to score the cache, compress once and reuse, and get

00:01:17.728 --> 00:01:20.894
it three to four times smaller and about twice as fast.

00:01:21.314 --> 00:01:23.458
Every source is in the full article.

00:01:23.458 --> 00:01:24.071
I'm Oskar.

00:01:24.071 --> 00:01:24.377
Bye!
