← Latest papers
💬 NLP

Shaping capabilities with token-level data filtering

This paper demonstrates that filtering pretraining data at the token level is a scalable, robust, and cost-effective method for shaping language models to remove undesired capabilities during pretraining, outperforming document-level filtering and post hoc alignment approaches.

Original authors: Neil Rathi, Alec Radford

Published 2026-02-03
📖 5 min read🧠 Deep dive

Original authors: Neil Rathi, Alec Radford

Original paper licensed under CC BY 4.0 (http://creativecommons.org/licenses/by/4.0/). This is an AI-generated explanation of the paper below. It is not written or endorsed by the authors. For technical accuracy, refer to the original paper. Read full disclaimer

Imagine you are teaching a giant, super-smart student (an AI) by giving them a massive library of books to read before they start their job. The goal is for them to learn how to write great stories and do biology research, but not to learn how to make dangerous biological weapons or spread medical misinformation.

Usually, if the student accidentally learns these dangerous skills, teachers try to "unlearn" them later. They might tell the student, "Don't say that," or try to erase the memory. But the paper argues this is like trying to un-teach a student who has already memorized a book; they can easily be tricked into saying the forbidden things again.

Instead, this paper proposes a different strategy: Be careful about which books you put in the library in the first place.

Here is a simple breakdown of what the researchers discovered:

1. The "Scissors" vs. The "Razor" (Token vs. Document Filtering)

Imagine you have a book about biology. Somewhere in the middle, there is a single paragraph about how to make a virus.

  • The Old Way (Document Filtering): If you find that paragraph, the old method says, "This whole book is dangerous!" So, you throw away the entire book. You lose all the good biology info just to get rid of that one bad paragraph.
  • The New Way (Token Filtering): The researchers found a way to use a "razor" instead of "scissors." They can identify the specific words (tokens) about the virus and remove only those words, leaving the rest of the book intact.
  • The Result: This new method is much better. It removes the dangerous knowledge while keeping almost all the useful knowledge. It's like editing a sentence rather than burning the whole page.

2. The Bigger the Brain, the Better the Filter

You might think, "If I remove words, the student will learn less." But the paper found a surprising twist: The bigger the student's brain, the more effective this filtering becomes.

  • Small Brains: If you filter the books for a small student, they might still learn a little bit of the dangerous stuff because they are very eager to learn from whatever is left.
  • Big Brains: For the giant, super-smart students (the largest models tested), removing the dangerous words was incredibly effective. It was as if the student needed 7,000 times more effort to learn the dangerous skill compared to a student who read the unfiltered books. The larger the model, the more "robust" the filter becomes.

3. The "Jailbreak" Test

The researchers tested if a bad actor could trick the filtered student into learning the dangerous skills again (a "jailbreak").

  • Old Methods: If you try to "unlearn" a skill after the student has already learned it, a bad actor can easily re-teach them in just a few minutes.
  • New Method: With the filtered library, it took the bad actor 10 times more effort to re-teach the dangerous skill to the filtered student compared to the unfiltered one. It's much harder to break the filter once it's built into the foundation.

4. Can They Still Say "No"?

A common worry is: "If we remove the dangerous knowledge, will the student know what to refuse?" (e.g., "I can't tell you how to make a bomb" requires knowing what a bomb is).

  • The Surprise: The paper found that students trained with this filtered method were actually better at refusing dangerous questions than the unfiltered ones. They didn't need to memorize the dangerous details to know they shouldn't talk about them. They learned to recognize the "shape" of the question and say, "I don't know that," rather than trying to answer.

5. How They Did It (The "Labeling" Trick)

To remove the right words, you need to know which ones are dangerous. Labeling every single word in a library is expensive and slow.

  • The Hack: The researchers used a special tool (called a "Sparse Autoencoder") that acts like a detective. It looks at the patterns in the AI's brain to guess which words are related to medicine.
  • The Result: Even though this detective wasn't perfect (it made some mistakes), the system was so robust that it still worked incredibly well. They also found that you can train a small, cheap "judge" to do the labeling, and it works just as well as a giant, expensive one.

The Bottom Line

The paper claims that the best way to stop AI from learning dangerous skills is to curate the training data very carefully at the word level before the AI ever starts learning. This is cheaper, more effective, and harder to bypass than trying to fix the AI after it has already learned the bad stuff. It's about building a safe foundation rather than trying to patch a leaking roof later.

Drowning in papers in your field?

Get daily digests of the most novel papers matching your research keywords — with technical summaries, in your language.

Try Digest →