Skip to content
PodSubs
ShowsPeopleGuestsJobsNewsEvents
More
BlogPodCred
Menu
ShowsPeopleGuestsJobsNewsEventsBlogPodCredNetworksSign in
Join nowSign in
  • Shows
  • People
  • Jobs
  • News
  • More
    • Guests
    • Events
    • Blog
    • PodCred
    • Networks
    Join nowSign in

Mechanical Dreams

Mechanical Dreams artwork

Engram Paper

Jan 12, 202618 minAudio
ShareXLinkedInFacebookWhatsAppEmail

In this episode: • The Memory Bottleneck: Professor Norris and Linda introduce the paper 'Conditional Memory via Scalable Lookup' and debate the inefficiency of using expensive neural computation to simulate simple knowledge retrieval. • Engram: N-grams Strike Back: Linda breaks down the 'Engram' module, explaining how it uses hashed N-grams and context-aware gating to inject static embeddings directly into the Transformer backbone. • The U-Shaped Curve of Sparsity: The hosts discuss the 'Sparsity Allocation' problem, analyzing the trade-off between MoE experts and memory capacity, and the discovery that a hybrid approach yields superior results. • Deepening the Network Without Layers: A discussion on mechanistic analysis, focusing on how Engram handles static patterns like named entities in early layers, freeing up the model's attention for complex reasoning. • Prefetching the Future: Linda and Norris explore the system-level advantages of deterministic lookups, including offloading massive embedding tables to CPU memory, and conclude the episode.

Audio and video play straight from the show's own hosting. PodSubs stores and serves no media.

Transcript

From the show.

## The Memory Bottleneck

Norris: Hello everyone, and welcome back to Mechanical Dreams. I’m Professor Norris, and as always, I am joined by the person who actually reads the footnotes, my brilliant student, Linda. Linda: Thanks, Professor! And you know, sometimes the footnotes are where the real drama happens. But today, we’re looking at a paper that puts the drama right in the title. Norris: Oh? Let me guess. "Attention is All You Need... Again?" Linda: Not quite. It’s called "Conditional Memory via Scalable Lookup: A New Axis of Sparsity for Large Language Models." It’s from researchers at DeepSeek-AI and Peking University. Norris: DeepSeek. They’ve been making waves lately. But "Conditional Memory"? That sounds a bit... vintage. We just got used to "Conditional Computation" with Mixture-of-Experts. Are we just adding more conditions to everything now? Linda: That’s exactly the point! Think about how a Mixture-of-Experts model works. It scales capacity by having lots of parameters but only using a few for each token. It’s great for reasoning. But the authors argue there’s a massive inefficiency in how we handle simple facts. Norris: Inefficiency? MoEs are the definition of efficiency. They’re sparse! You don't fire the whole brain for every thought. Linda: True, but think about what the model is actually doing. Let's say the input is "Alexander the..." and the model needs to predict "Great." Norris: Okay. "Alexander the Great." Simple. Linda: Right, it's static. It’s a fixed phrase. But to predict that, a standard Transformer—even an MoE—has to run that sequence through multiple layers of attention and feed-forward networks. It effectively reconstructs the concept of "Alexander the Great" from scratch, doing expensive matrix multiplications just to finish a cliché. Norris: I see. So it’s burning GPU cycles to derive a fact that should just be a table lookup. It’s like hiring a team of mathematicians to calculate my phone number every time I want to make a call. Linda: Exactly! The paper calls this "simulating retrieval through computation." They show an example where the model takes six layers just to figure out that "Diana, Princess of..." should end with "Wales." Norris: Six layers! That is wasteful. So, if the model is spending all its brainpower remembering that Diana is from Wales, it has less capacity left over to actually reason about her life or historical impact. Linda: Precisely. The authors propose that language modeling has two distinct sub-tasks: compositional reasoning, which needs deep computation, and knowledge retrieval, which is just... looking things up. And right now, we’re using the same hammer for both nails. Norris: So, we need a screwdriver. Or in this case, a memory module. But surely we aren’t going back to the dark ages of just memorizing training data? Linda: We sort of are, but in a very high-tech way. They’re introducing a module called "Engram," which essentially modernizes N-grams. Yes, N-grams, Professor. Norris: N-grams? What is this, 1995? Next, you’ll tell me we’re bringing back punch cards. Linda: Hear me out! It’s not your grandfather’s N-gram model. It’s N-grams meets modern vector embeddings. And it might just solve the memory bottleneck.

## Engram: N-grams Strike Back

Norris: Okay, Linda, you dropped the N-word. N-grams. I haven't thought about those since I was teaching Intro to NLP in the early 2000s. Are we really going back to counting how often 'cat' follows 'the'? Linda: Not counting, Professor—embedding. The Engram module isn't a probability table; it's a massive, learnable memory bank. Here’s the hook: instead of computing the relationship between tokens using attention, we just take the last few tokens—say, the suffix 'Alexander the'—and use that as a key. Norris: A key to unlock what? Linda: A vector embedding. A dense representation of what comes next, or what that phrase means. It’s an O(1) lookup. Constant time. No quadratic attention mechanism required. Norris: Hold on. The number of possible 3-grams or 4-grams in English is astronomical. If you try to build a table for every possible combination, you’ll run out of RAM before you finish the letter A. Linda: That’s the first bottleneck they solved. They don’t store everything. They use 'Multi-Head Hashing.' They hash the N-gram context into indices for a fixed-size embedding table. Norris: Hashing? But that guarantees collisions. 'Alexander the Great' might hash to the same bucket as 'The cat sat.' You’d get noise. Linda: Right, which is why they use multiple heads with different hash functions. It’s like a Bloom filter but for embeddings. If one head collides, the others likely won't, and the model learns to average them out to get the clean signal. Norris: Clever. It sounds a bit like those old 'Hash Embeddings' papers, but applied to sequence chunks. But I see another problem. Tokenizers are messy. 'Apple' at the start of a sentence is a different token ID than ' apple' with a leading space. Wouldn't that mess up the lookups? Linda: You’re sharp today, Professor! The authors noticed that standard subword tokenizers prioritize reconstruction over meaning. So, Engram uses 'Tokenizer Compression.' They pre-compute a mapping that collapses raw token IDs into canonical ones—normalizing case, removing spaces—before doing the N-gram lookup. Norris: So they force the lookup to be semantically dense. I like that. But where does this module sit? If it's just looking up static phrases, is this just a fancy input embedding layer? Linda: That’s the twist. It’s not at the input. Engram modules are injected deep into the network—like at layer 2 or layer 15. They treat the retrieved embedding as a 'value' that gets fused into the current hidden state. Norris: Fused? But what if the memory is wrong? Or irrelevant? If I write 'The ban on... bans,' a static lookup might just see 'The ban on' and shout 'Smoking!' or 'Trade!', which might completely derail the sentence. Linda: That is where the 'Conditional' in 'Conditional Memory' comes in. They use a mechanism called Context-Aware Gating. The model uses its current hidden state—which contains the global context—as a 'Query.' The retrieved N-gram embedding is the 'Key' and 'Value.' Norris: Ah, attention mechanics again. So the model looks at the retrieved static memory and asks, 'Does this fit with what I’m currently thinking?' Linda: Exactly. They calculate a scalar gate, alpha. If the retrieved memory aligns with the current context, the gate opens and the information flows in. If it’s noise or a hash collision, the gate closes, effectively multiplying it by zero. Norris: So it’s a safety valve. The model can choose to rely on rote memorization when it's safe—like 'New York City'—but ignore it when doing complex reasoning that defies the stereotype. Linda: Spot on. It offloads the easy, static stuff to this look-up table, so the actual attention heads can save their energy for the hard stuff. And because they use this hashing trick, they scaled this memory up to 27 billion parameters. Norris: 27 billion parameters of pure, unadulterated rote memory. My high school history teacher would be so proud. But surely, there's a trade-off. You can't just add parameters for free. Linda: Well, that brings us to the 'Sparsity Allocation' problem. If you have a fixed budget, do you want more brain cells—the MoE experts—or more textbooks—the Engram memory? The answer, it turns out, is a very specific shape.

## The U-Shaped Curve of Sparsity

Norris: So, we have a shiny new toy called Engram that acts as a massive lookup table. But Linda, we live in a world of finite resources. If I'm building a model, I have a parameter budget. Every gigabyte I give to this Engram memory is a gigabyte I can't give to my MoE experts. Linda: Exactly. That is the core trade-off the paper investigates. They call it the 'Sparsity Allocation' problem. Imagine you have a fixed budget of 'inactive' parameters—the parts of the model that aren't firing for every single token. How do you split that pie? Norris: Intuitively, I’d want to maximize the experts. Experts are the 'brain cells' of the operation. They do the conditional computation. Engram is just... a bookshelf. Surely a bigger brain beats a bigger bookshelf? Linda: You would think so, and that has been the default assumption in AI for years. But when they actually ran the experiments—training models with identical FLOP budgets and identical parameter counts—they found a U-shaped curve. Norris: A U-shaped curve? Meaning the extremes are bad? Linda: Precisely. If you go 100% MoE—all experts, no memory module—the performance is suboptimal. The model is forced to use its precious computational depth to reconstruct static patterns, like we discussed with 'Alexander the Great.' It’s working too hard for simple things. Norris: And I assume if you go 100% Engram, you end up with a very large parrot that can't do math. Linda: Correct. If you starve the MoE experts to build a massive memory, the model loses its reasoning capabilities. It can recall facts, but it can't handle dynamic context or logic. But right in the middle—or actually, slightly leaned toward experts—there's a sweet spot. Norris: Where is this sweet spot? Linda: The data suggests reallocating about 20% to 25% of the sparse parameter budget to Engram yields the best loss. It beats the pure MoE baseline significantly. Norris: So, giving up a quarter of your 'brain cells' to buy a 'handbook' actually makes you smarter. That is... humbling. Linda: And here is the most surprising part, Professor. You’d expect a memory module to mostly help with knowledge tasks—like trivia or fact retrieval benchmarks like MMLU. Norris: Naturally. If I have an encyclopedia, I’m better at Trivial Pursuit. Linda: It did help there, specifically MMLU went up by 3.4 points. But they saw even bigger gains in general reasoning and code. The 'Big Bench Hard' benchmark went up by 5 points. Math and coding scores improved significantly too. Norris: Wait, wait. Why would a static lookup table help with coding or math? Those are the definitions of dynamic reasoning. You can't memorize the solution to a math problem you haven't seen. Linda: Think about writing code, Professor. How much of it is creative logic, and how much is just remembering the syntax for `matplotlib.pyplot`? Or the specific arguments for a function? Norris: Fair point. I spend half my time looking up API documentation. Linda: Exactly! By offloading those static, syntax-heavy patterns to the Engram memory, the MoE experts are relieved of the burden. They don't have to waste weights memorizing that `import` is followed by `numpy`. They can focus entirely on the algorithm itself. Norris: So Engram isn't just about knowing facts. It’s about clearing the clutter. It handles the rote memorization so the experts can do the deep thinking. It’s structural specialization. Linda: Structural optimization, they call it. And it seems to suggest that we've been asking our neural networks to do too much 'grunt work' all these years.

## Deepening the Network Without Layers

Norris: Okay, Linda, I buy the intuition. You offload the grunt work to the memory module, and the experts get to focus on the hard stuff. But 'intuition' is a dangerous word in our field. Did they actually open up the black box to prove this is happening? Linda: They did, and the results are fascinating. They used two main techniques: LogitLens and CKA—Centered Kernel Alignment—to peek at the internal representations layer by layer. Norris: LogitLens... that’s where you project the hidden states of intermediate layers directly to the vocabulary to see what the model is 'thinking' at that specific point, right? Linda: Exactly. In a standard model, if you look at the early layers for a phrase like 'Diana, Princess of Wales,' the model is confused. Layers 1 through 4 are just slowly piecing together the tokens. It doesn't confidently predict 'Wales' until Layer 6. Norris: Right, because it’s spending those first five layers performing the 'computation' of retrieval. It’s calculating the fact that Diana is a Princess. Linda: But with Engram, the LogitLens shows that the model locks onto the correct entity almost immediately—by Layer 2 or 3. Because the memory lookup happens early, the uncertainty collapses instantly. Norris: So it skips the buildup. It just knows. Linda: And the CKA analysis backs this up. They compared the similarity of layers between the Engram model and the baseline. They found a distinct upward shift. The representations at Layer 5 of the Engram model looked mathematically similar to Layer 12 of the baseline. Norris: Wait, Layer 5 equals Layer 12? That implies the Engram model is effectively 'deeper.' It’s getting seven layers' worth of work done for free, just by looking up the answer. Linda: That’s exactly how the authors phrase it. By relieving the early layers of static reconstruction, Engram effectively deepens the network for complex reasoning. The later layers aren't playing catch-up anymore; they start with high-quality, fully realized concepts. Norris: This explains the reasoning gains. If your network starts 'thinking' at Layer 3 instead of Layer 10, you have more computational depth left to solve the actual problem. Linda: And there’s a massive side benefit: Attention capacity. Since the model doesn't need to attend to local tokens just to resolve multi-word phrases, the attention heads are free to look at the global context. Norris: Ah, so instead of focusing on the word 'San' to predict 'Francisco', it can focus on a paragraph ten pages ago to answer a question. Linda: Exactly. They tested this on long-context benchmarks like 'Needle in a Haystack.' On a task called Multi-Query NIAH, the baseline scored 84.2%. The Engram model? 97%. Norris: That is a staggering jump. Usually, we fight for a 1% improvement in long-context retrieval. Linda: It makes sense, though. If you stop the model from nearsightedly squinting at every local phrase, it suddenly has the bandwidth to see the whole picture. It’s not just memory; it’s attention management.

## Prefetching the Future

Norris: Linda, this all sounds marvelous—smarter models, better reasoning, happier attention heads. But there is a giant elephant in the server room. You mentioned scaling this memory to 27 billion parameters. Or even 100 billion. Linda: Yes, they tested up to very large scales. Norris: Well, my poor GPU runs out of memory if I open too many Chrome tabs. High-Bandwidth Memory, or HBM, is the most expensive real estate in the world right now. How do you fit a 100-billion parameter lookup table on a GPU alongside the actual model? Linda: You don't. And that is the final piece of the puzzle: 'Infrastructure-Aware Efficiency.' This is where Engram completely diverges from MoE. Norris: How so? MoE is sparse, this is sparse. What's the difference? Linda: MoE routing is dynamic. The model has to compute the hidden state at Layer 10 to decide which expert to call. You don't know what you need until you get there. But Engram? The lookup keys are just the input text. Norris: Oh! The input text is known before you even start the forward pass. You know exactly which 'Alexander the Great' tokens are in the sequence. Linda: Exactly. The memory IDs are deterministic. This allows for 'Prefetching.' The system can see what embeddings are needed and pull them from cheap Host RAM—CPU memory—over to the GPU via PCIe, all while the GPU is busy processing the previous layers. Norris: So it overlaps the communication with computation. While the GPU is crunching numbers on Layer 1, the CPU is fetching the 'textbook' needed for Layer 2. Linda: Precisely. They showed that offloading a 100-billion parameter table to CPU memory incurs less than 3% overhead. It basically makes the memory capacity infinite, limited only by cheap RAM, not expensive GPU VRAM. Norris: That... changes the economics of scaling entirely. You can have a trillion-parameter memory without buying a trillion dollars worth of GPUs. Linda: That’s their vision. They see 'Conditional Memory' as an indispensable primitive for the next generation. We stop simulating retrieval, we stop wasting VRAM, and we let the experts be experts. Norris: Well, I must say, I was skeptical about N-grams making a comeback, but you’ve convinced me. It’s not just a lookup table; it’s a whole new way to structure the artificial brain. Thanks for bringing this one in, Linda. Linda: My pleasure, Professor. I’ll see you next week—hopefully with something that doesn’t require us to resurrect any more tech from the 90s. Norris: No promises. Until then, keep dreaming... mechanically.

Open the transcript file

Hosts and Guests

Nobody is credited on this episode yet.

Credit the people on this episode

Be the first to rate this episode

More episodes

All episodes
  1. You don’t need long context

    Nov 12, 202620 minAudio

    In this episode: • The Context Window Arms Race: Professor Norris and Linda introduce the episode and discuss a new NVIDIA paper challenging the necessity of massive context windows, highlighting the hidden...

    Credit the people on this episode

  2. Scaling Hierarchical Networks

    Nov 11, 202621 minAudio

    In this episode: • Intro and The Bitter Lesson: Introducing the podcast and the Cartesia paper on Hierarchical Networks. • Scaling Ladders and The BPE Comparison: Discussing the compute efficiency gains of 1-stage...

    Credit the people on this episode

  3. Perturbing Inputs Improves Pretraining Distillation

    Nov 10, 202621 minAudio

    In this episode: • Introduction and Standard Distillation: Professor Norris and Linda introduce the podcast and set the baseline for standard knowledge distillation in language models. • The Core Idea of Perturbed...

    Credit the people on this episode

  4. Why is AI-generated language so hard to understand

    Nov 9, 202620 minAudio

    In this episode: • Introduction: The Reader-Patience Budget: Professor Norris and Linda introduce the episode's topic, discussing the growing sentiment that AI-generated text is becoming overly convoluted. • The...

    Credit the people on this episode

  5. Muse Glimmer 30B

    Nov 8, 202622 minAudio

    In this episode: • Introduction & Paper Overview: Professor Norris and Linda introduce the episode and the Muse Glimmer 30B paper, outlining its goal of bringing agentic capabilities to consumer hardware. • Architecture...

    Credit the people on this episode