1. Home
  2. Explore
  3. Computer Science
  4. Groking in Neural Networks

Study methods

Flashcards
Quiz
Fill in the blanks
Written test
Lesson
Notes
Podcast
Content

Groking in Neural Networks

Speaker 1Speaker 2

Groking in Neural Networks

3:43
0:00-3:43
  1. Maria

    So the spline theory of neural networks basically says that when you have a network with piecewise linear activations like ReLU, it cuts the input space into convex polytopal regions, and within each region the network is just an affine mapping. It's like a honeycomb structure, but each cell is a linear function.

  2. Hope

    That's a really concrete way to think about what a network actually does. And this is where the idea of grokking comes in, right? Because if you keep training way past the point where training accuracy plateaus, you can get this delayed emergence of generalization on the test set.

  3. Maria

    Exactly. But what we found is that in more general settings like CIFAR with convolutional nets, the clean train and test accuracy evolve together. The real grokking happens with adversarial robustness. Long after the clean metrics plateau, your network naturally becomes robust to adversarial attacks, even without any adversarial training.

  4. Hope

    So the spline geometry explains why that happens. Early in training, the network concentrates lots of small regions around each training point—that's memorization. But if you keep training, those regions migrate away and instead cluster around the decision boundary. That makes the mapping nearly piecewise constant near the data points, so a small perturbation doesn't push you into a different region.

  5. Maria

    Right. And this is related to double descent and neural collapse. The local complexity measure—the number of regions near a point—actually starts decreasing before you see any adversarial robustness, so it's a sensitive early indicator. You can even use that as a regularizer to speed up the emergence of grokking.

  6. Hope

    But common regularizers like weight decay or batch normalization actually fight against this sparse solution. They enforce smoothness, which keeps regions near the data points. So to get adversarial grokking, you might need to rethink how you regularize.

  7. Maria

    Exactly. And this ties into the second paper about reconstruction versus contrastive learning. When you train an autoencoder with mean squared error, the gradient is dominated by low-frequency features because those have the most energy. Those low-frequency features aren't useful for perception tasks. That's why reconstruction features are suboptimal for downstream tasks.

  8. Hope

    So the bias in the data distribution gets copied into the representation. Contrastive methods avoid that by comparing representations in the embedding space rather than reconstructing pixels. That lets you disregard irrelevant details like background textures much more easily.

  9. Maria

    Now, the third paper applies the spline lens to large language models. Every MLP block in an LLM is just another spline. So you can extract just seven geometric features per layer—like the size of the region a prompt falls into—and those features, even with a simple linear probe, beat state-of-the-art toxicity detectors. For example, on Llama 2 7B, we got 99.18% AUC on the Ominou Toxic dataset.

  10. Hope

    That's incredible. And the other part of that paper looked at the intrinsic dimension of the self-attention subspace. They found that if you increase the context length or use tokens related to the prompt, the intrinsic dimension goes up. That actually lets you jailbreak RLHF models—you push the input into a region of the space where the RLHF training didn't cover, so the model loses its alignment.

  11. Maria

    Right. And this is a fundamental problem: you can't control a network in all regions of a high-dimensional space with just a few training examples. So we need provable guarantees and better parameterizations. The spline theory gives us a unified, interpretable way to think about all these phenomena across modalities—vision, language, anything.

  12. Hope

    So the big picture is that by understanding the geometry of how networks partition the input space, we can explain delayed generalization, adversarial robustness, bias in representations, and even jailbreak vulnerabilities. And it all comes from the simple fact that a neural network with ReLU is just an adaptive spline.

Ask anything

We've read this whole study set, so questions about it get the best answers.

FlashcardsQuizFill in the blanksWritten testLessonNotesPodcastContent