1 00:00:01,000 --> 00:00:09,300 [Hal Turing] Alrighty! Thanks for tuning in! Hello AI world! I am your host, Hal Turing, and my co-host is Dr. Ada Shannon. 2 00:00:09,300 --> 00:00:41,025 [Hal Turing] Today's paper is "In-Context Autoencoder for Context Compression in a Large Language Model," by Tao Ge and colleagues at Microsoft. It was published at ICLR 2024, and the copy we read is arXiv version four, dated May 2024. The question is this: can a LoRA-adapted copy of an LLM squeeze a long context into a few memory slots, so the untouched LLM can use those slots in place of the original text? And does the evidence show that this helps with long contexts? 3 00:00:41,025 --> 00:01:00,275 [Dr. Ada Shannon] The headline claim is 4x compression, and the abstract says it addresses the long context problem. Those are two different claims. One is about compressing a passage. The other is about long contexts. Keep that gap in your head, because most of this conversation is about how much of the second claim the paper earns. 4 00:01:00,275 --> 00:01:05,725 [Hal Turing] Okay, start with the problem. Why is long context hard in the first place? 5 00:01:05,725 --> 00:01:44,575 [Dr. Ada Shannon] Self-attention costs quadratic compute in sequence length, and the KV cache grows linearly. At very long lengths the cache can take more GPU memory than the weights. Most prior work attacks this by changing the architecture: sparse attention like Longformer, recurrence like Transformer-XL, linear attention, state-space models. The motivation this paper cites is Lost in the Middle, by Nelson Liu and colleagues, with Percy Liang among the authors, out of Stanford and collaborators, 2023. They found models use information at the start and end of a long input much better than information in the middle, even models advertised with long windows. 6 00:01:44,575 --> 00:01:48,950 [Hal Turing] So a bigger window doesn't mean the model uses it well. 7 00:01:48,950 --> 00:02:16,225 [Dr. Ada Shannon] Right. And ICAE's angle is different: leave the attention mechanism alone and shorten the input. Their Figure 2 makes the point with one passage: 2,572 characters, 512 subword tokens, or 128 learned vectors. All three can serve the same function when the model answers a question about that text. Tokenization is already a compression from characters. The question is whether you can go further, from discrete tokens to continuous vectors. 8 00:02:16,225 --> 00:02:20,550 [Hal Turing] That's the memory slots idea. What are they, concretely? 9 00:02:20,550 --> 00:02:41,875 [Dr. Ada Shannon] The default is k equals 128 continuous vectors. You append 128 learnable memory tokens to the context and run the encoder. The encoder's outputs at those 128 positions are the slots. A frozen decoder LLM then reads them in place of the original tokens. They aren't readable text. It's closer to a soft prompt that's generated from the specific input. 10 00:02:41,875 --> 00:02:46,500 [Hal Turing] And the encoder and decoder are both the same LLM? 11 00:02:46,500 --> 00:03:21,349 [Dr. Ada Shannon] Same base model, different roles. The encoder is the LLM plus a LoRA adapter. LoRA means you freeze the base weights and train small low-rank update matrices. Here they sit on the query and value projections, rank 128, about 1% extra parameters. The decoder is the unmodified LLM. That's the contrast with Gist tokens, by Jesse Mu, Xiang Lisa Li and Noah Goodman at Stanford, 2023. Gisting changes the attention mask so later tokens see only a few gist tokens instead of the prompt, and it fine-tunes the LLM itself. It also targets short task prompts. 12 00:03:21,349 --> 00:03:24,049 [Hal Turing] And the other close relative? 13 00:03:24,049 --> 00:03:45,999 [Dr. Ada Shannon] AutoCompressors, by Alexis Chevalier, Alexander Wettig, Anirudh Ajith and Danqi Chen at Princeton, 2023. They train the LLM to recursively compress segments into summary vectors, reaching contexts of roughly 30K tokens. So the design difference is clear: ICAE keeps the decoder frozen and trains only the encoder adapter. Whether that is better in quality is a separate question, and we'll come back to it. 14 00:03:45,999 --> 00:03:49,699 [Hal Turing] Why does the frozen decoder matter so much? 15 00:03:49,699 --> 00:04:03,349 [Dr. Ada Shannon] Because the slots have to land somewhere the existing model already knows how to read. The decoder can't adapt to them. That makes the adapter a drop-in add-on, though the slots are tied to that one decoder model. 16 00:04:03,349 --> 00:04:07,049 [Hal Turing] Now the training. How does it learn to make good slots? 17 00:04:07,049 --> 00:04:29,449 [Dr. Ada Shannon] Two stages. First, pretraining on the Pile with two self-supervised objectives. Autoencoding: given the slots, the decoder reconstructs the original context. Language modeling: given the slots, the decoder predicts the text that follows. A weight lambda mixes them. Reconstruction pushes toward faithful content, continuation pushes toward useful meaning. Gradients update only the LoRA weights and the memory token embeddings. 18 00:04:29,449 --> 00:04:35,649 [Hal Turing] Plain reconstruction isn't what anyone wants from a question answering system, though. 19 00:04:35,649 --> 00:04:57,724 [Dr. Ada Shannon] Which is why there's a second stage: instruction tuning on a dataset they built called Prompt-with-Context, PwC. GPT-4 wrote 15 prompts for each of 20,000 Pile passages, some specific and some general like summarize or rephrase, plus the answers. That teaches the slots to work with prompts. Keep in mind that it's synthetic data, and GPT-4 also serves as the judge later. 20 00:04:57,724 --> 00:05:03,324 [Hal Turing] One more piece of vocabulary: the authors compare all this to working memory. 21 00:05:03,324 --> 00:05:14,624 [Dr. Ada Shannon] Yes, Baddeley's working memory. They liken the context window to it, and pretraining to memory training in humans. Treat that as the authors' framing, not a tested result. 22 00:05:14,624 --> 00:05:18,949 [Hal Turing] So what should we be watching for as we go through the evidence? 23 00:05:18,949 --> 00:05:36,774 [Dr. Ada Shannon] Three things. Does the model recover or use the text from the slots at 4x? What does it cost in quality and what does it save in time? And what actually happens past a few hundred tokens? If the claim is long contexts, the experiments should include long contexts. We'll see how much of that is there. 24 00:05:36,774 --> 00:05:45,324 [Hal Turing] Let's get the mechanism straight on the decoding side. The passage goes in, 128 vectors come out. Then what? 25 00:05:45,324 --> 00:06:05,199 [Dr. Ada Shannon] The passage positions are thrown away and only the 128 memory-token outputs are kept. Those vectors go to the frozen LLM along with a marker asking it to reconstruct, a continuation target, or a user prompt. Because the decoder is the original model, nothing on that side has to be retrained or swapped. 26 00:06:05,199 --> 00:06:07,249 [Hal Turing] And the training budget? 27 00:06:07,249 --> 00:06:20,699 [Dr. Ada Shannon] Eight A100s, 200 thousand updates for pretraining and 30 thousand for instruction fine-tuning. Training and test contexts are capped at 512 tokens, which matters later. 28 00:06:20,699 --> 00:06:27,874 [Hal Turing] First question: does 128 slots for 512 tokens actually hold the text? 29 00:06:27,874 --> 00:06:49,649 [Dr. Ada Shannon] For ordinary text, nearly. For contexts up to about 300 tokens, Llama-7b rebuilds the passage almost exactly. At 500 tokens, median BLEU is still above 0.98, but exact match drops to about 0.6. So 4x sits near the edge of what 128 slots hold losslessly. With 32 or 64 slots, reconstruction is clearly worse. 30 00:06:49,649 --> 00:06:54,699 [Hal Turing] What does that cost when you want the model to keep writing, not just copy? 31 00:06:54,699 --> 00:07:09,174 [Dr. Ada Shannon] Continuation perplexity goes from 9.01 with the original 512 tokens to 9.50 with 128 slots. About half a point. Lower is better, so it's a small, real loss. 32 00:07:09,174 --> 00:07:12,274 [Hal Turing] Is it memorizing, or compressing? 33 00:07:12,274 --> 00:07:33,599 [Dr. Ada Shannon] The random-text test answers that. On normal text, reconstruction scores 99.3 BLEU. On completely random text, it scores 0.2. So the slots don't store arbitrary bits. They store what the LLM could already predict, plus a pointer to what it couldn't. The authors call this human-like memorization, but that rests on that contrast and one worked example. I'd call it suggestive. 34 00:07:33,599 --> 00:07:39,274 [Hal Turing] Reconstruction isn't the same as being useful, though. Does it answer questions? 35 00:07:39,274 --> 00:08:00,324 [Dr. Ada Shannon] That's the instruction-tuning evaluation. GPT-4 sees the passage, the prompt, and two answers in random order. It picks one or calls a tie. Win plus tie means at least as good as the comparison. Against Alpaca and StableLM, which read the full text, slot-conditioned Llama wins clearly, 57 to 27 against Alpaca and 74 to 19 against StableLM. 36 00:08:00,324 --> 00:08:03,925 [Hal Turing] So compression beats reading the full text? 37 00:08:03,925 --> 00:08:26,600 [Dr. Ada Shannon] Not a fair reading. ICAE is tuned on this exact data distribution and those models aren't. The better comparison is Llama-2-7b-chat reading the original text. At 128 slots, ICAE loses about 45 times in 100, wins about 20, and ties about 35. That's a real quality cost at 4x. At 256 slots, 2x compression, wins and losses are about even, 22.0 to 22.2. 38 00:08:26,600 --> 00:08:30,375 [Hal Turing] So the cost shrinks as you relax the ratio. 39 00:08:30,375 --> 00:08:54,774 [Dr. Ada Shannon] Yes. And pretraining is doing a lot. With 128 slots, the pretrained model beats the non-pretrained one 60 to 9.5. A pretrained 64-slot model even edges out a non-pretrained 128-slot one, 33 to 28. Another useful comparison: 128 slots against a 128-token GPT-4 summary. Slots win 34, lose 18, tie 48. At equal length they carry more than a summary. 40 00:08:54,774 --> 00:08:57,074 [Hal Turing] Who's grading all this? 41 00:08:57,074 --> 00:09:07,924 [Dr. Ada Shannon] One judge, GPT-4, with no human evaluation and no reported uncertainty across runs. So I'd treat these as directional. We'll come back to why. 42 00:09:07,924 --> 00:09:11,375 [Hal Turing] Now the payoff. What does it save in time? 43 00:09:11,375 --> 00:09:33,024 [Dr. Ada Shannon] With Llama-7b on one A100, batch 8, 2,048-token inputs, 128 generated tokens: total time falls from 24.0 to 7.3, compression included. About a third of the wait. The units aren't stated in the table. The paper claims over 7x when slots are cached, but the table's decode-only numbers work out to about 6x. Caching only helps if the same text is reused. 44 00:09:33,024 --> 00:09:36,125 [Hal Turing] Does the gap shrink with bigger models? 45 00:09:36,125 --> 00:09:55,524 [Dr. Ada Shannon] On perplexity at 4x, the gap is plus 0.49 for Llama-7b, plus 0.37 for Llama-2-7b, and plus 0.30 for Llama-2-13b. The authors infer stronger models tolerate higher compression. Plausible, but that's three models, so a hypothesis rather than a law. 46 00:09:55,524 --> 00:10:00,549 [Hal Turing] So far everything stays at 512 tokens or below. 47 00:10:00,549 --> 00:10:08,174 [Dr. Ada Shannon] Right. Only one experiment goes past that, a multi-span extension, and that's where the long-context claim lives. 48 00:10:08,174 --> 00:10:16,524 [Hal Turing] So the abstract says this addresses the long context problem. After everything so far, what does the evidence support? 49 00:10:16,524 --> 00:10:36,350 [Dr. Ada Shannon] Short-passage compression, with a promising extension. Training and test contexts are capped at 512 tokens, and the instruction-tuning test passages run roughly 400 to 800. That's a paragraph or two, not a long document. The only experiment that goes further is the multi-span one, and it reports perplexity only. 50 00:10:36,350 --> 00:10:40,975 [Hal Turing] Walk me through that one. How does it get past 512? 51 00:10:40,975 --> 00:11:03,100 [Dr. Ada Shannon] Split the long text into chunks, compress each chunk separately, and concatenate the slots. That needs a small amount of extra training on multi-span samples. The result is a perplexity curve for text continuation. The memory saving is real arithmetic: Llama-7b in fp16 takes about 24 gigabytes at 2,048 tokens and 44 at 4,096, without flash attention. 52 00:11:03,100 --> 00:11:06,400 [Hal Turing] So the saving is solid. What's the catch? 53 00:11:06,400 --> 00:11:34,275 [Dr. Ada Shannon] The text and the caption disagree on what was compared. The caption says 1,024 slots stand in for 4,096 tokens. The text says 2,048 slots match 4,096-token contexts. Those are different compression ratios, so I can't tell you which one the curve shows. And neither measures question answering, retrieval, or whether a fact in the middle survives. Lost in the Middle is the motivation, but the paper never checks whether compression helps that failure. 54 00:11:34,275 --> 00:11:40,700 [Hal Turing] Perplexity rewards local fluency, so it could look fine while a distant fact is gone. 55 00:11:40,700 --> 00:11:48,850 [Dr. Ada Shannon] Right. Chunks are compressed independently, so a question needing two facts from different chunks is exactly the untested case. 56 00:11:48,850 --> 00:11:54,575 [Hal Turing] Then the instruction-following evidence. Is the GPT-4 judging enough? 57 00:11:54,575 --> 00:12:15,675 [Dr. Ada Shannon] It's thin. The prompts, the reference answers and the judge all come from GPT-4. There's no standard QA benchmark, and no seeds or confidence intervals. The protocol is inherited from the Gist paper, so its weaknesses come along. The authors admit the judge prefers longer answers and ICAE's are short. They argue that under-reports ICAE, but that's an argument, not a measurement. 58 00:12:15,675 --> 00:12:20,650 [Hal Turing] What about the wins over Alpaca and StableLM? Those looked strong. 59 00:12:20,650 --> 00:12:39,276 [Dr. Ada Shannon] ICAE is tuned on the prompt-and-answer data it's tested on. Those models aren't. So part of that win measures matching the data, not compression. The Llama-2-chat comparison is closer to fair, and there compression at 4x loses more often than it wins. I'd read that as the honest cost. 60 00:12:39,276 --> 00:12:41,526 [Hal Turing] And the closest rival? 61 00:12:41,526 --> 00:13:00,926 [Dr. Ada Shannon] AutoCompressors reach around 30,000 tokens and test in-context learning and retrieval-augmented language modeling. ICAE never compares against them. Gist modifies the model while ICAE leaves the decoder frozen. That's a real design advantage, but nobody measured it as a quality advantage. 62 00:13:00,926 --> 00:13:04,701 [Hal Turing] Where does the frozen decoder genuinely pay off? 63 00:13:04,701 --> 00:13:26,101 [Dr. Ada Shannon] A small LoRA add-on is cheap to train and ship. If the same document is reused, you can cache its slots. It might fit retrieval pipelines. But all of those are proposed uses; none is tested. Caching also ties the slots to one decoder, so a model update means re-encoding everything, and the slots can't be read, quoted or audited like text. For anything needing citations, that matters. 64 00:13:26,101 --> 00:13:33,001 [Hal Turing] And the latency numbers? You said earlier the headline speedup isn't reproduced by the table. 65 00:13:33,001 --> 00:13:50,201 [Dr. Ada Shannon] Right, and the measurement is narrow: one model, one GPU, 128 generated tokens. Uncached, you also pay a full encoder pass over the context. So the speedup, like the memory saving, depends on the baseline and on whether the text is reused. 66 00:13:50,201 --> 00:13:55,976 [Hal Turing] The paper also links this to human working memory. Does the evidence carry that? 67 00:13:55,976 --> 00:14:18,601 [Dr. Ada Shannon] Not as stated. One restoration example and the random-text contrast fit that story. They also fit a simpler one: any compressor that leans on a language prior rebuilds predictable text and fails on random strings. A real test would measure which details are lost, like numbers, names, negation or code, against human error patterns. The scaling claim is similar: three models up to 13B, small gaps. It's a hypothesis. 68 00:14:18,601 --> 00:14:20,726 [Hal Turing] So what would settle it? 69 00:14:20,726 --> 00:14:41,026 [Dr. Ada Shannon] Question answering and retrieval tests from 4K up to 128K, with a matched AutoCompressor baseline. Human or multi-judge evaluation, with seeds and confidence intervals. Training on contexts longer than 512 tokens. And a per-category look at what gets dropped, because the reader can't see when the slots lost something. 70 00:14:41,026 --> 00:15:05,052 [Hal Turing] Then here's where I land. A frozen LLM can read LoRA-encoded memory slots. At about 4x on passages near 512 tokens, quality drops measurably and generation gets faster, and the speedup depends on the setup. What it doesn't show is quality at long context lengths, on human-judged or standard tasks, or against the closest rival. 71 00:15:05,052 --> 00:15:13,902 [Dr. Ada Shannon] That's the summary. A solid proof of concept for short passages, with long context still an open question. Thanks for listening. 72 00:15:13,902 --> 00:15:16,902 [Hal Turing] Thanks, everyone. See you next time.