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

Rare Tokens Degenerate All Tokens

Apr 2, 202620 minAudio
ShareXLinkedInFacebookWhatsAppEmail

In this episode: • Welcome and Introduction: Professor Norris and Linda introduce the podcast and the topic of the week, discussing the general concept of representation degeneration in neural language models. • The Culprit: Rare Tokens: Linda explains the paper's core empirical finding: rare token embeddings degenerate first and drag the rest of the tokens into a narrow cone. • Adaptive Gradient Gating (AGG): The hosts dive into the mathematical mechanics of the proposed solution, explaining how gating specific parts of the gradient prevents rare tokens from drifting away from non-rare targets. • Results and Experiments: Norris and Linda evaluate the empirical results, looking at perplexity, token diversity, word similarity, and BLEU scores in machine translation tasks. • Conclusion and Sign-off: Professor Norris shares his final, convinced thoughts on the paper, and the hosts sign off.

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

Transcript

From the show.

## Welcome and Introduction

Norris: Welcome back to Mechanical Dreams, the podcast where we parse the latent spaces of machine learning and natural language processing to find the true signal. I am Professor Norris, and as always, I am joined by my brilliant student, Linda, who makes it her weekly mission to drag me out of my comfort zone. Linda: Hi everyone! And come on, Professor, keeping you on your toes with the latest research is practically my thesis project at this point. Today, I have brought a really elegant paper that tackles a fundamental issue in how language models learn. It is called 'Rare Tokens Degenerate All Tokens: Improving Neural Text Generation via Adaptive Gradient Gating for Rare Token Embeddings', by researchers from Seoul National University and Hyundai. Norris: Well, that title is certainly a mouthful. But the first half, 'Rare Tokens Degenerate All Tokens', is quite the hook. It sounds a bit like a linguistic zombie apocalypse where the obscure vocabulary infects the entire dictionary. So, set the stage for us, Linda. What exactly is this degeneration, and why should our listeners care? Linda: It is a fascinating issue. So, a lot of recent studies have noticed that in large-scale neural language models, the learned token embeddings tend to become anisotropic. In simpler terms, instead of the embeddings spreading out evenly in a beautiful, spherical space, they all end up clustering into a very narrow cone shape. Norris: Ah, yes, the representation degeneration problem. I remember some papers on this phenomenon a few years back. If all the embeddings are pointing in roughly the same direction, the cosine similarity between any two random words becomes artificially high. The model loses its expressiveness because it can no longer easily distinguish between different semantic relationships. Linda: Exactly! If the vector for 'apple' and the vector for 'spaceship' are crammed into the same narrow cone, the model struggles to generate high-quality, diverse text. Usually, it just starts playing it safe and repeating frequent words, which we have all seen when a generative model gets stuck in a loop. Norris: Right, the classic geometric headaches of the softmax layer. I know the standard band-aids for this usually involve some kind of post-processing step, or slapping a massive regularization term on all the token embeddings to force them apart. Linda: Spot on. But the problem with those existing methods is twofold. First, applying regularization to all tokens can over-regularize embeddings that were actually learning their semantic relationships perfectly well. Second, and more importantly, no one really understood how or why the token embeddings were degenerating during the training procedure itself. They were just treating the symptoms based on the final observed phenomena. Norris: Until this paper, I presume. Based on the title, they are pointing the finger squarely at the rare words. But how on earth does a word that barely shows up in the training corpus manage to collapse the embedding space of the entire vocabulary? Linda: That is exactly the mystery they set out to solve! To figure it out, they didn't just look at a fully trained model. They actually conducted empirical studies on the training dynamics from step zero. And what they found completely shifts how we should think about gradient updates in these embedding matrices. I cannot wait to get into the details with you.

## The Culprit: Rare Tokens

Norris: Alright Linda, you left us on quite the cliffhanger. You claimed that rare tokens, which by definition barely show up in the training data, are somehow the architects of this entire embedding space collapse. As a healthy skeptic, I need some hard evidence. How did the researchers figure this out? Linda: They started with a classic empirical study. They took a standard 6-layer Transformer decoder model and trained it from scratch on the WikiText-103 dataset. But before training, they divided the entire vocabulary into three distinct groups based on how frequently the words appeared in the training corpus. Norris: Okay, so we have our usual suspects. Frequent words like 'the' and 'is', and rare words like... well, specific proper nouns or highly technical jargon. How did they define the cutoffs for these groups? Linda: They assigned the top 30 percent of tokens to the frequent group, the next 50 percent to the medium group, and the bottom 20 percent to the rare group. Then, they visualized the training dynamics of these token embeddings in their initial stages using a 2D Singular Value Decomposition, or SVD, projection. Norris: A 2D projection of a massive high-dimensional embedding space can sometimes be misleading, but it is great for getting an intuition. What did the SVD show them as the training steps progressed? Linda: It was incredibly clear. In the paper, they have these scatter plots for training steps 100, 500, 1500, and 3500. At step 100, everything is a nice, isotropic cloud. But by step 500, the red points, representing the rare tokens, start shooting out from the center to form a narrow cone. And here is the kicker: the green and blue points, the medium and frequent tokens, follow right behind them. Norris: I see. So the rare tokens degenerate first, and the rest of the vocabulary gets dragged into that same narrow subspace. But correlation does not equal causation, Linda! Maybe the rare tokens just move faster because they get updated less frequently and have higher variance in their gradients. How do we know they are actually causing the frequent tokens to collapse? Linda: I knew you would bring up causation! And so did the authors. To prove it, they ran an ablation study that completely blew my mind. They trained the exact same model, but they froze the rare token embeddings in their initial random states. They basically told the model, 'you are not allowed to update the weights for the bottom 20 percent of the vocabulary.' Norris: Wait, they just turned off the gradient updates for the rare tokens entirely? That is a bold experiment. What happened to the rest of the network? Linda: The degeneration problem basically vanished! To measure the isotropy, they use a metric called I of W, which ranges from 0 to 1, where higher is better. The baseline model had an overall isotropy of 0.293. But when they froze the rare tokens, the isotropy shot up to 0.739. The space became vastly more spread out and expressive. Norris: That is absolutely wild. You are telling me that by actively refusing to train 20 percent of the vocabulary, the model actually did a better job learning the other 80 percent? Did the perplexity of the frequent tokens improve as well? Linda: It did! The perplexity of the frequent group improved from 16.58 to 16.48. By simply doing nothing to the rare tokens, the network became fundamentally healthier. It conclusively proved their hypothesis: the degeneration of rare token embeddings induces the degeneration of non-rare token embeddings. It is a cascading failure triggered by the rarest words. Norris: I concede the point, that is brilliant empirical work. But obviously, we cannot just leave 20 percent of our vocabulary frozen as random initialization noise forever. If I ask the model to generate text about a rare word, it needs to have a meaningful embedding. We have to train them eventually. Linda: Exactly. Freezing them was just a diagnostic test. To actually fix the problem, the authors had to open up the black box of the negative log-likelihood loss gradient and figure out exactly what was pushing those rare tokens out of bounds when they were allowed to train. Norris: Ah, the math. We are dissecting the gradient itself. Let me guess, it has something to do with the softmax denominator constantly penalizing words that do not show up often? Linda: You are right on the money. The authors broke down the gradient for a rare token embedding into three distinct parts. Part A pulls the rare token closer to its actual target feature vector. Part B pushes it away from the feature vectors of non-rare targets. And Part C pushes it away from the feature vectors of other rare targets. Norris: Okay, so Part A is the good stuff. That is the model actually learning the semantic meaning of the rare word when it finally appears. But Parts B and C are the pushback. Since rare words are almost always the wrong answer, they spend 99 percent of the training time just getting shoved away from whatever the correct, frequent word is. I am guessing Part B is the primary culprit here? Linda: Spot on. Part B is the bedrock cause of the degeneration problem. In our next chapter, we can talk about exactly how the authors propose to gate that specific part of the gradient to save the embedding space.

## Adaptive Gradient Gating (AGG)

Norris: Alright, so we established our villain at the end of the last chapter. Part B of the negative log-likelihood loss gradient. The mathematical mechanism that forces rare token embeddings to be pushed away from the contextual feature vectors of frequent targets. Linda: Exactly. Because frequent targets appear, well, frequently, rare tokens spend almost all of their training time acting as the negative class in the softmax denominator. They are endlessly shoved into a corner of the embedding space, and their collapse eventually drags the frequent tokens down with them. Norris: So, we need a way to stop Part B from wreaking havoc, without resorting to the sledgehammer approach of freezing the rare embeddings entirely, like we did in that ablation study. How do the authors propose we fix this? Do they just mask out Part B? Linda: It is much more elegant than a simple mask. They introduce a method called Adaptive Gradient Gating, or AGG. But before they can even gate the gradient, they had to solve a logistical problem: how do you dynamically define what a 'rare' token is during mini-batch training? Norris: Ah, that is an excellent point. A word might be globally rare in the whole WikiText-103 corpus, but what if a specific mini-batch happens to be an entire Wikipedia article about that specific rare word? For that one forward pass, it is technically a frequent token. Linda: Right! If you just use static frequency groupings, it is suboptimal for mini-batch training. So, the authors implemented a token counter memory. It is essentially a moving window that tracks the number of appearances of each token over the previous K training steps. They use this to calculate an appearance ratio, and if that ratio falls below a certain hyperparameter alpha, the token is dynamically classed as rare for that step. Norris: I like that. A moving average of rarity gives the model contextual awareness of the current training dynamics. So, once we have our dynamically updated list of rare tokens for the current batch, how do we apply this Adaptive Gradient Gating to Part B? Linda: They use a very clever trick with the computation graph. In PyTorch, you can use the detach function to stop gradients from flowing through a specific tensor. They take the embedding parameter, let's call it x, and create a detached copy called x-tilde. x-tilde has the exact same values as x, but as far as the autograd engine is concerned, it is just a constant. Norris: I have used detach before when training GANs to keep the generator from updating the discriminator's weights. So they compute a gated parameter that is a linear combination of the trainable x and the constant x-tilde, weighted by some gate tensor g? Linda: You nailed the math, Professor! The gated parameter is g times x, plus one minus g times x-tilde. When you pass that gated parameter into the loss function, the gradient with respect to x simply becomes scaled by that gate tensor g. If g is 1, you get the full gradient. If g is 0, no gradient flows back. Norris: That is a beautiful piece of engineering. You get to selectively scale the gradient update on a per-token basis. So what determines the value of this gate tensor g for Part B? Linda: They introduce a specific gate vector called g1 to handle Part B. For any token dynamically flagged as rare, its corresponding value in g1 is calculated based on its exact rarity in that moving window. The rarer the token is, the closer the gate value is to zero. If the token is not rare, the gate is just 1. Norris: So if a word shows up once in a blue moon, its gate is practically zero, and we completely suppress its urge to push away from frequent words. But if it shows up a bit more often, we let a little bit of that gradient through. It is an adaptive leash! Linda: An adaptive leash is the perfect analogy. And they actually take it one step further. Remember Part C of the gradient? The part that pushes rare tokens away from the feature vectors of other rare targets? Norris: I remember. We said Part B was the main culprit, though. Does Part C cause trouble too? Linda: It usually does not, but the authors noticed a micro-version of the degeneration problem happening within the rare group itself. If you have a 'very rare' token getting pushed away from a 'less rare' token, it creates the exact same collapsing dynamic, just on a smaller scale. Norris: It is like a fractal of embedding collapse! The same problem repeating at different scales of rarity. Linda: Exactly! So to fix the fractal collapse, they approximate multiple levels of rarity. They calculate the average appearance rate within the rare group itself. If a token appears less than that average, it gets classified as 'very rare'. And then they introduce a second gate vector, g2, specifically to scale down Part C for those very rare tokens. Norris: I am thoroughly impressed by the rigor here. They didn't just solve the macro problem of rare versus frequent; they anticipated the edge cases within the rare vocabulary itself. By applying g1 to Part B, and g2 to Part C, they essentially disarm the softmax bottleneck's ability to warp the geometry. Linda: And because they only apply these gates to the rare tokens, the frequent tokens are trained completely normally using standard MLE. There is absolutely no over-regularization for the words the model already understands well. It is surgical. Norris: It really is a scalpel instead of a sledgehammer. But theory and elegant PyTorch implementations are one thing. Do we have the experimental results to back up this beautiful math? Let's dive into the metrics in the next chapter.

## Results and Experiments

Norris: Alright, Linda, you have sold me on the mathematical elegance of Adaptive Gradient Gating. But the proof of the pudding is in the perplexity. Did this scalpel approach actually work on real datasets? Linda: It worked beautifully. They tested it on language modeling using WikiText-103, word similarity datasets, and even machine translation. Let us start with language modeling. They compared their AGG method against a standard Maximum Likelihood Estimation baseline, or MLE. Norris: And I assume they measured that isotropy metric we talked about earlier, the I of W? Linda: Yes! The overall isotropy of the token embedding space more than doubled, jumping from 0.377 in the baseline to 0.813. The space completely opened up. And when they looked at the rare tokens specifically, the perplexity plummeted from about 438 down to just 75. Norris: A perplexity drop of that magnitude is staggering. But what about the frequent tokens? Did gating the rare tokens hurt the performance of the common words? Linda: Not at all. The perplexity for the frequent token group stayed virtually identical to the baseline, hovering around 13.3. So they successfully fixed the rare words without inflicting any collateral damage on the rest of the vocabulary. Norris: That is the holy grail of regularization right there. Now, earlier you mentioned that when embeddings collapse into a narrow cone, the model tends to generate repetitive text. Did AGG actually improve the diversity of the generated text? Linda: It did. They used a metric called Uniq, which measures the number of unique next-token predictions. The AGG model generated significantly more unique tokens. There is a great qualitative example in the paper where the baseline model gets stuck repeating 'air defence, air defence, and air defence', while the AGG model generates a historically accurate, varied continuation about an Australian military squadron. Norris: Ah, the classic generative loop. It is always a relief to see a model break out of that. But you also mentioned machine translation and word similarity. How did it fare there? Linda: On word similarity datasets like MEN and WS353, AGG consistently outperformed the baseline, proving the semantic relationships between words were well learned and preserved. And for machine translation, they tested it on the standard WMT14 English to German dataset. Norris: Translation is a fantastic testbed for this. If the embeddings are warped, the cross-lingual alignments will be a complete mess. What happened to the BLEU scores? Linda: They saw an improvement of 1.4 BLEU scores compared to the baseline Transformer model. And here is the best part: it even beat out other specific representation degeneration methods like CosReg and Adv MLE. AGG achieved the highest BLEU score among them all. Norris: That is a definitive win. An improvement of 1.4 BLEU might sound small to an outsider, but in the machine translation world, that is a highly significant leap. And they achieved it just by fixing the gradient updates for rare tokens! Linda: Exactly! They even ran ablation studies showing that if you remove that g1 gate we talked about, the isotropy and diversity drop right back down. It proves that gating Part B of the gradient is the absolute key to the whole operation.

## Conclusion and Sign-off

Norris: I have to say, Linda, you have successfully dragged me out of my comfort zone again. When we started this episode, I was highly skeptical that a handful of obscure words could act like a black hole, dragging the entire embedding space into a narrow cone. But the empirical evidence is undeniable. Linda: It really is a paradigm shift, isn't it? Instead of just looking at a broken embedding space at the end of training and slapping a post-processing band-aid on it, these researchers actually looked under the hood at the training dynamics. By pinpointing the exact mathematical moment the collapse happens, they fixed the root cause. Norris: And they did it with surgical precision. The Adaptive Gradient Gating method, clipping the leash on those rare tokens with the g1 and g2 gates to stop that fractal collapse, is just beautiful engineering. It solves a massive representation degeneration problem without adding computational bloat or over-regularizing the words the model already understands. Linda: Exactly! It just goes to show that sometimes the biggest leaps in model performance do not come from throwing more parameters at the wall, but from fundamentally understanding the geometry of our loss gradients. I will make sure to link the paper in the show notes so everyone can check out the math and those amazing 2D SVD visualizations for themselves. Norris: Highly recommended reading for anyone wrestling with generative loops or embedding collapse. Well, that brings us to the end of another episode of Mechanical Dreams. Thank you all for tuning in, and thank you, Linda, for another fantastic paper. Linda: My pleasure, Professor! Keep dreaming in high dimensions, everyone. We will see you next week!

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