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:47,000 [Hal Turing] Today we're on "BABILong: Testing the Limits of LLMs with Long Context Reasoning-in-a-Haystack." The first author is Yuri Kuratov, with Aydar Bulatov, Mikhail Burtsev and colleagues, from AIRI in Moscow, the Neural Networks and Deep Learning Lab at MIPT, and the London Institute for Mathematical Sciences. The arXiv version is from June 2024, revised that November, and it appeared in the NeurIPS 2024 Datasets and Benchmarks track. The question is simple. Models advertise 128K tokens or more. How much of that can they actually use to reason? 3 00:00:47,000 --> 00:01:06,875 [Dr. Ada Shannon] Advertised context length and usable context length are different quantities, and the standard test hides the gap. The benchmarks that do measure it mostly stop around 40K tokens, like LongBench and L-Eval. The popular test, needle-in-a-haystack, is passed almost perfectly by strong models. So it no longer separates them. 4 00:01:06,875 --> 00:01:10,099 [Hal Turing] Remind me how that needle test works. 5 00:01:10,099 --> 00:01:29,774 [Dr. Ada Shannon] Greg Kamradt popularized it in 2023. You take long essays by Paul Graham as filler and hide one sentence in them, say a magic number. Then you ask the model to repeat it. You sweep the needle's depth and the total length, and plot a heatmap of scores. An LLM judge does the scoring. Frontier models filled that heatmap with green. 6 00:01:29,774 --> 00:01:34,974 [Hal Turing] So green everywhere means the models are good, or the test is easy. 7 00:01:34,974 --> 00:01:49,299 [Dr. Ada Shannon] The test is checking lookup. One needle, one question that shares words with it. That's close to what attention does anyway. It doesn't ask whether you can combine several scattered facts. That's the gap BABILong targets. 8 00:01:49,299 --> 00:01:52,649 [Hal Turing] Start with the ingredients. What's bAbI? 9 00:01:52,649 --> 00:02:27,000 [Dr. Ada Shannon] Twenty synthetic reasoning tasks from Jason Weston and colleagues at Facebook. Each story is a handful of short templated sentences. They cover chaining facts, counting, lists and sets, negation, deduction, induction. Models solved them on short stories years ago, so they looked finished. BABILong makes them hard again by stretching the story. The other ingredient is PG19, a corpus of full-length public-domain books, mostly written before 1919, from the Compressive Transformer work at DeepMind. That's the natural-language filler. 10 00:02:27,000 --> 00:02:29,750 [Hal Turing] Walk me through one sample. 11 00:02:29,750 --> 00:02:48,849 [Dr. Ada Shannon] Two sentences: "Mary got the milk there." and "Mary travelled to the hallway." These are inserted, in order, at different places in a long stretch of book prose. The question is: "Where is the milk?" The model has to find both sentences, see that Mary had the milk, and see that she then went to the hallway. The answer is the hallway, and it appears in neither sentence. 12 00:02:48,849 --> 00:02:51,224 [Hal Turing] And the QA numbers? 13 00:02:51,224 --> 00:03:09,250 [Dr. Ada Shannon] They count the supporting facts. QA1 needs one fact: where is Mary. QA2 needs two, like the milk example. QA3 needs three, in the right temporal order, because the milk could be picked up, carried, dropped, and the order decides the answer. Higher number, more facts to find and combine. 14 00:03:09,250 --> 00:03:14,225 [Hal Turing] Why generate all this instead of collecting real long documents? 15 00:03:14,225 --> 00:03:34,225 [Dr. Ada Shannon] Two reasons the paper gives. You can build a sample at any length, so the benchmark grows with the models. They released splits up to ten million tokens and evaluated beyond that. And since the tasks are generated, nobody could have trained on the test set. Human-labeled long sets can't offer either. The cost is that the text is synthetic and templated, and we'll come back to that. 16 00:03:34,225 --> 00:03:38,900 [Hal Turing] Now the term in the headline. What counts as using the context? 17 00:03:38,900 --> 00:03:58,950 [Dr. Ada Shannon] They define effective context size as the longest input at which a model still scores above 85% accuracy, which they call satisfactory. Under 30% counts as complete failure. A footnote says those cutoffs aren't universal. So any statement about how much of the window a model uses is relative to that choice. 18 00:03:58,950 --> 00:04:04,100 [Hal Turing] Which makes me want to know what happens if you pick 70, or 95. 19 00:04:04,100 --> 00:04:09,725 [Dr. Ada Shannon] Hold that thought. It matters for how much weight to give the headline, and we'll come back to it. 20 00:04:09,725 --> 00:04:17,675 [Hal Turing] Fine. The paper also tests alternatives to just stuffing everything into the window. First one is retrieval. 21 00:04:17,675 --> 00:04:32,701 [Dr. Ada Shannon] Retrieval-augmented generation. You split the long text into pieces, embed them, find the top-k pieces most similar to the question, and give only those to the model. They try 512-token chunks and single sentences. 22 00:04:32,701 --> 00:04:36,901 [Hal Turing] And the other one is the recurrent memory transformer. 23 00:04:36,901 --> 00:05:12,101 [Dr. Ada Shannon] The idea is that a transformer reads the text in fixed-size segments, 512 tokens here. A few extra memory tokens ride along with each segment. After the segment is processed, the outputs at those memory positions are handed to the next segment as input. Attention is normal inside a segment. The only channel between segments is that small fixed memory, so memory use stays constant however long the input gets. Capacity is finite, and processing is sequential. The associative variant, ARMT, adds a richer memory. Here both sit on a GPT-2 backbone of 137 million parameters, which is tiny. 24 00:05:12,101 --> 00:05:14,351 [Hal Turing] Any other contenders? 25 00:05:14,351 --> 00:05:25,351 [Dr. Ada Shannon] Mamba, a state-space model. It keeps a fixed-size recurrent state instead of attending over the whole history. They fine-tune a 130-million-parameter one. 26 00:05:25,351 --> 00:05:35,676 [Hal Turing] So the roadmap: how the big models use their window, how retrieval and these recurrent models compare, and then how BABILong stacks up against RULER. 27 00:05:35,676 --> 00:05:44,526 [Dr. Ada Shannon] Right. And keep one thing in mind throughout. The models that win in some of those comparisons are trained on the task, and the others aren't. 28 00:05:44,526 --> 00:05:51,551 [Hal Turing] Let's get into how the samples are built. Is it just dropping the bAbI sentences somewhere in the book? 29 00:05:51,551 --> 00:06:13,226 [Dr. Ada Shannon] Sort of. The generator keeps adding PG19 sentences in their natural order until the sample hits the target length. The task sentences are scattered among them, in order. QA1 through QA10 differ in how many supporting facts the answer needs, one, two, three, and in how many distractor facts sit nearby. They scored models with no filler at all first, which they call 0K. That tells you whether the model can do the reasoning when nothing is buried. 30 00:06:13,226 --> 00:06:15,926 [Hal Turing] And that check matters because? 31 00:06:15,926 --> 00:06:33,776 [Dr. Ada Shannon] Because many models fail before any haystack arrives. Of the 34 models tested, only 23 reached 85% on at least one of QA1 to QA3 at 0K. So a model's score at length mixes two things: can it do the task, and can it find the facts. 32 00:06:33,776 --> 00:06:36,401 [Hal Turing] What did the 34 look like? 33 00:06:36,401 --> 00:06:50,251 [Dr. Ada Shannon] Open models grouped by claimed window, from 32K up to 200K. GPT-4 and Gemini 1.5 Pro as references. And context-extension methods, Yarn and Activation Beacon. 34 00:06:50,251 --> 00:06:54,676 [Hal Turing] Then the headline. How far does the usable window stretch? 35 00:06:54,676 --> 00:07:16,551 [Dr. Ada Shannon] On the easiest task, one fact, most models stay above the 85% bar only to about 4K tokens. GPT-4 and Llama-3.1-70B reach 16K. Qwen-2.5-70B and Gemini 1.5 Pro reach 64K. The paper puts that at 5% to at most 50% of the advertised window. So even the best model on the easy task keeps the bar for no more than half its window. 36 00:07:16,551 --> 00:07:19,126 [Hal Turing] And with two or three facts? 37 00:07:19,126 --> 00:07:36,226 [Dr. Ada Shannon] It gets worse quickly. With filler, no tested model stays above 85% on the two-fact task. On the three-fact task the best scores are below 80%. Finding a fact is one skill. Finding two or three and combining them is another, and it breaks earlier. 38 00:07:36,226 --> 00:07:41,951 [Hal Turing] What about the context-extension methods? Those are supposed to fix exactly this. 39 00:07:41,951 --> 00:07:55,201 [Dr. Ada Shannon] Not here. Yarn fails to hold up at 32K on this benchmark, and so do the 32K fine-tunes. Being stretched to a longer window doesn't mean the model can use a fact from the far end of it. 40 00:07:55,201 --> 00:08:02,201 [Hal Turing] Now retrieval. The obvious move is to skip the long window and fetch the relevant sentences. 41 00:08:02,201 --> 00:08:19,751 [Dr. Ada Shannon] That's the RAG experiment, and it mostly doesn't work. On the single-fact task it tops out around 60%, roughly flat as the text grows. Retrieving by sentence beats 512-token chunks. But raising sentence retrieval from top-5 to top-20 doesn't help. 42 00:08:19,751 --> 00:08:23,076 [Hal Turing] Why wouldn't more retrieved sentences help? 43 00:08:23,076 --> 00:08:44,201 [Dr. Ada Shannon] Because the miss isn't about quantity. Take the milk example. The question is 'Where is the milk?'. The sentence 'Mary got the milk there' resembles it, so it gets retrieved. 'Mary travelled to the hallway' shares almost nothing with the question, so the retriever never returns it. The model gets half the chain. On the two- and three-fact tasks, accuracy falls below random guessing. And the order of the facts matters, which similarity search ignores. 44 00:08:44,201 --> 00:08:48,251 [Hal Turing] The paper says they didn't tune the retriever, right? 45 00:08:48,251 --> 00:08:56,326 [Dr. Ada Shannon] Right. The retrieval component and the prompts weren't optimized. So this is a default pipeline, not the best RAG can do. 46 00:08:56,326 --> 00:08:58,526 [Hal Turing] So what actually worked? 47 00:08:58,526 --> 00:09:22,176 [Dr. Ada Shannon] Small recurrent models, fine-tuned. RMT and ARMT use a GPT-2 backbone, 137 million parameters, trained one task at a time. Training uses a curriculum. It starts with samples that fit in one segment, then moves to longer ones once training converges. Each stage samples lengths from one up to n segments. They topped out at 32 segments, about 16K tokens, with 10,000 training and 1,000 evaluation samples per task. 48 00:09:22,176 --> 00:09:24,126 [Hal Turing] And at that length? 49 00:09:24,126 --> 00:09:42,776 [Dr. Ada Shannon] They beat GPT-4. The surprise is what happens beyond training. RMT stays high to 128K with marginal degradation, and still works at 11.1 million tokens, over 600 times its training length. ARMT, from Rodkin and colleagues, goes to 50 million. 50 00:09:42,776 --> 00:09:49,326 [Hal Turing] How does a fixed handful of memory tokens carry facts across eleven million tokens? 51 00:09:49,326 --> 00:10:07,426 [Dr. Ada Shannon] The paper doesn't test this, so it's my inference. The task is narrow. The model can learn to write only fact-like sentences into memory and let the book prose pass through. If it learns that, the memory holds a few relevant facts, not the whole text, and length barely matters. That would also explain the flat curve. 52 00:10:07,426 --> 00:10:09,051 [Hal Turing] And Mamba? 53 00:10:09,051 --> 00:10:28,226 [Dr. Ada Shannon] The 130M version, fine-tuned, matches RMT on the single-fact task and has an edge on the three-fact one. But inference past 128K is extremely slow because of implementation limits, so it can't be pushed to the millions. The paper gives no latency numbers, only that qualitative note. 54 00:10:28,226 --> 00:10:34,252 [Hal Turing] What about fine-tuning the big models? GPT-3.5 and Mistral-7B? 55 00:10:34,252 --> 00:10:47,652 [Dr. Ada Shannon] They fine-tuned them on 1,000 single-fact samples for three epochs. Accuracy flattens across lengths, so the decay mostly goes away. But they still land behind the fine-tuned recurrent models. 56 00:10:47,652 --> 00:10:52,977 [Hal Turing] Hold on. That's fine-tuned small models against off-the-shelf big ones. 57 00:10:52,977 --> 00:11:03,877 [Dr. Ada Shannon] Yes, and that's the comparison to keep in view. The recurrent models were trained on this exact task, one task at a time. The off-the-shelf LLMs weren't. 58 00:11:03,877 --> 00:11:15,827 [Hal Turing] So the recurrent result is real, but it's a specialist beating generalists. Before we get to fairness, I want to go back to the headline. The 10 to 20 percent figure. How firm is it? 59 00:11:15,827 --> 00:11:36,377 [Dr. Ada Shannon] Less firm than it sounds. It depends on the authors' own bars: above 85 percent counts as satisfactory, below 30 as failure, and their footnote says those cutoffs aren't universal. The paper never reruns the analysis at 70 or 95 percent. My reasoning, not a finding: accuracy falls steeply with length, so a different bar probably shifts the crossing point, but we don't know by how much. 60 00:11:36,377 --> 00:11:39,852 [Hal Turing] And the paper itself gives different ranges. 61 00:11:39,852 --> 00:11:57,377 [Dr. Ada Shannon] Right. Five to fifty percent on the single-fact task, 10 to 20 in the abstract, 5 to 25 in the conclusion. The source never reconciles them. The number also comes only from QA1 to QA3, so it says little about tasks that need many scattered facts. 62 00:11:57,377 --> 00:12:03,802 [Hal Turing] Is it a property of the model, then, or of bAbI sentences dropped into old novels? 63 00:12:03,802 --> 00:12:26,202 [Dr. Ada Shannon] That's the open question. The facts are short, templated, small-vocabulary sentences, and the filler is nineteenth-century prose. A model could find them by spotting the style shift. The authors concede it twice: the brevity and similarity of the task sentences lets models tell them apart, and the fixed vocabulary makes the tasks easier for fine-tuned models. Distractors from the same vocabularies only partly mitigate it. 64 00:12:26,202 --> 00:12:34,252 [Hal Turing] But that can't explain everything. If the facts stand out, why do the big models still fail on two and three facts? 65 00:12:34,252 --> 00:12:54,402 [Dr. Ada Shannon] Agreed. Style leakage fits why small fine-tuned models do so well. It doesn't explain off-the-shelf models that find the facts but can't combine them. Attention dilution, position bias and failure to combine retrieved facts are all plausible, and this paper has no ablation separating them. Nobody should say dilution has been shown. 66 00:12:54,402 --> 00:12:57,477 [Hal Turing] What does outside work say about those? 67 00:12:57,477 --> 00:13:20,327 [Dr. Ada Shannon] This is outside material. RULER, by Hsieh and colleagues at NVIDIA in 2024, is the paper's own comparison. It adds multi-hop tracing, aggregation and varied needle types. BABILong reports that its correlation with MMLU, a short-text knowledge test, drops as length grows, while RULER's stays high. At length, BABILong tracks MMLU about half as well as RULER does. The authors read that as BABILong being more discriminative. 68 00:13:20,327 --> 00:13:22,153 [Hal Turing] Do you buy that? 69 00:13:22,153 --> 00:13:42,903 [Dr. Ada Shannon] Only partly. A low correlation shows it measures something other than general ability. It doesn't show that the something is useful. It could be sensitivity to templates. The sample is roughly seven to ten models per panel, the exact number isn't reported, there are no confidence intervals, and the figure labels the values R-squared in one place and Pearson R on the axis. So treat it as suggestive. 70 00:13:42,903 --> 00:13:48,478 [Hal Turing] What about the shared-words problem? The question says Mary, and the fact says Mary. 71 00:13:48,478 --> 00:14:18,978 [Dr. Ada Shannon] NoLiMa, by Modarressi and colleagues at Adobe Research in 2025, targets exactly that. It builds needles with minimal lexical overlap with the question. And Lost in the Middle, by Liu and colleagues in 2023, documented position bias in retrieval from long contexts. That's a candidate mechanism for the BABILong conclusion that performance leans on the first 5 to 25 percent of the input. BABILong places facts at various positions, but the text I read has no position-by-position analysis. That's unknown. 72 00:14:18,978 --> 00:14:22,853 [Hal Turing] Now the fairness question beyond the fine-tuning. 73 00:14:22,853 --> 00:14:43,803 [Dr. Ada Shannon] The retrieval pipeline wasn't tuned, by the authors' admission, so RAG falling below chance on QA2 and QA3 is a result for naive top-k similarity, not for retrieval in general. And there is only one background corpus family, PG19 and Wiki. The recurrent result is real for this task. It isn't evidence of general long-context competence. 74 00:14:43,803 --> 00:14:46,103 [Hal Turing] And the memory itself? 75 00:14:46,103 --> 00:15:06,678 [Dr. Ada Shannon] The paper states the costs: finite capacity and sequential processing. How the memory copes as the number of facts to keep grows isn't something I saw in the excerpt. My reading is that the benchmark rewards selective forgetting, because the question is fixed at training time and the facts look like bAbI. Real documents often pose the question after the text, with nothing marking what matters. 76 00:15:06,678 --> 00:15:10,128 [Hal Turing] Also no latency or cost numbers. 77 00:15:10,128 --> 00:15:21,778 [Dr. Ada Shannon] None, beyond the note that Mamba is very slow past 128K. So we can't say what the recurrent approach costs in practice against a long-window transformer. 78 00:15:21,778 --> 00:15:24,853 [Hal Turing] So what should a practitioner do with this? 79 00:15:24,853 --> 00:15:47,153 [Dr. Ada Shannon] Don't trust an advertised window for multi-fact reasoning. Test on your own task, at your own lengths. Expect retrieval to fail when the evidence doesn't resemble the question. A recurrent state is a credible way to hold a narrow, well-defined memory. And a good benchmark should vary length, position and needle phrasing. The authors suggest richer sources like ProofWriter and FOLIO mixed into same-domain text, which would address some of this. 80 00:15:47,153 --> 00:16:02,028 [Hal Turing] Let me try the takeaway. On a controllable test that can't leak from the training set, long-context reasoning degrades well before the advertised limit, and a small recurrent model trained for the task works far beyond that. 81 00:16:02,028 --> 00:16:15,878 [Dr. Ada Shannon] And the boundary matters. That's templated facts hidden in book text, with thresholds the authors chose. So the exact fraction of context used belongs to this test setup. It isn't a universal constant. 82 00:16:15,878 --> 00:16:19,328 [Hal Turing] Thanks for listening, everyone. Take care.