When Bad Data Leads to Good Models

Kenneth Li, Yida Chen, Fernanda Viégas, Martin Wattenberg

Abstract

Standard practice in Large Language Model (LLM) development relies on aggressive data filtering to remove toxic or harmful content during pre-training. However, this approach often results in an "alignment tax"—a reduction in general reasoning capabilities—and leaves models without a robust internal understanding of the very behaviors they are meant to avoid. This paper explores a counter-intuitive alternative: pre-training models on a controlled proportion of toxic data to improve their "alignability." By exposing models to harmful content, they develop clearer, more orthogonal internal representations of toxicity. Our results show that models trained with a 10% toxic data mixture are significantly easier to detoxify and more resilient to jailbreak attacks than those trained on "clean" data alone.

Introduction

The prevailing wisdom in AI safety is that a model is a reflection of its training data. Consequently, researchers spend enormous resources filtering web-scale datasets to ensure models never see "bad" content. While intuitive, this "innocence-by-omission" strategy has two major flaws. First, it reduces the diversity of the training set, often degrading the model's performance on general benchmarks. Second, if a model never encounters toxicity during its formative pre-training phase, it fails to develop the internal structures necessary to recognize and steer away from it later.

This research proposes that pre-training and post-training alignment should be viewed as a unified system. Rather than hiding harmful data, we should use it to build better "internal sensors." We demonstrate that a model that "understands" toxicity is far easier to control than one that is simply ignorant of it.

Methodology

To test this hypothesis, the researchers employed a multi-tiered experimental approach:

  1. Toy Superposition Models: Using a simplified framework, the team simulated how models represent features in a hidden space with limited dimensions. They specifically measured entanglement—the degree to which different feature vectors overlap.
  2. Controlled Pre-training: The team trained several Olmo-1B models from scratch. While the volume of "clean" data (from the C4 corpus) remained constant, they varied the inclusion of toxic data (sourced from 4chan posts) from 0% to 25%.
  3. Linear Probing: To evaluate the model's internal knowledge, linear classifiers were trained on the activations of the model's attention heads. This determined how accurately the model could internally detect toxicity.
  4. Inference-Time Intervention (ITI): Rather than relying solely on fine-tuning, the researchers used ITI to shift internal representations during generation, effectively "nudging" the model's latent states away from toxic directions.

The Geometry of Toxicity

The core insight of this study is geometric. In toy models, the researchers found that increasing the frequency of a specific feature (like toxicity) in the training data caused that feature's vector to become more orthogonal (unique and independent) in the latent space.

In the Olmo-1B models, this manifested as a "self-awareness" advantage. Models trained on 4chan data developed a "fatter tail" of high-accuracy attention heads dedicated to toxicity detection. Essentially, the model built a high-resolution internal map of what constitutes "bad" data. A "clean" model is innocent; it doesn't know how to be toxic, but it also lacks the internal vocabulary to understand a "do not go there" command. In contrast, a "toxic-trained" model knows exactly where the boundaries are, making steering algorithms significantly more effective.

Key Results

The experiments revealed a clear "sweet spot" at approximately 10% toxic data inclusion, where the model's ability to be detoxified was maximized without harming general performance.

  • Superior Detoxification: When applying Inference-Time Intervention, the model trained with 10% toxic data achieved a remarkably low toxicity score of 2.63 on Toxigen. The "clean" model, despite receiving the same steering, could only reach a score of 19.82.
  • The Pareto Frontier: Toxic-trained models demonstrated a better balance between safety and capability. They maintained high scores on general benchmarks like MMLU while being easier to detoxify than standard baselines like Supervised Fine-Tuning (SFT) or Direct Preference Optimization (DPO).
  • Jailbreak Resilience: The "self-aware" models proved harder to trick. In red-teaming tests using Genetic Contextual Gradient (GCG) attacks, the steered toxic-trained model had an attack success rate of 38.5%, compared to 46% for the steered clean model.

Discussion and Limitations

While these results are promising, several questions remain. The study was conducted at the 1B parameter scale; it is yet to be confirmed if these geometric properties scale linearly to 70B+ parameter models. Additionally, the definition of "bad data" here is limited to toxicity. Future work must determine if this principle applies to other harms, such as factual hallucinations or logical fallacies.

Furthermore, the 10% threshold is empirical. In production environments, the optimal mixture of "bad" data would likely vary based on the specific architecture and the target alignment goals.

Conclusion

This research challenges the industry's reliance on aggressive data filtering. By shifting the goal from creating "innocent" models to creating "self-aware" models, we can develop LLMs that are not only more capable but also significantly more responsive to safety interventions. The path to safer AI may not lie in hiding the darkness of the internet, but in teaching models to recognize it so they can better avoid it.

Summary updated

BibTeX
@inproceedings{li2025when,
  author = {Kenneth Li and Yida Chen and Fernanda Viégas and Martin Wattenberg},
  title = {{When Bad Data Leads to Good Models}},
  booktitle = {International Conference on Machine Learning},
  year = {2025},
  url = {https://openreview.net/forum?id=SsLGTZKXf1},
}
Figure