mlsanityData to 14 Oct 2026

Towards Safer Pretraining: Analyzing and Filtering Harmful Content in Webscale datasets for Responsible LLMs

arXiv 2505.02009 ↗First posted 4 May 2025cs.CL cs.LGcited by 9

On the map: LLM safety and security → Safety alignment, refusal and guardrails

Abstract (arXiv)

Large language models (LLMs) have become integral to various real-world applications, leveraging massive, web-sourced datasets like Common Crawl, C4, and FineWeb for pretraining. While these datasets provide linguistic data essential for high-quality natural language generation, they often contain harmful content, such as hate speech, misinformation, and biased narratives. Training LLMs on such unfiltered data risks perpetuating toxic behaviors, spreading misinformation, and amplifying societal biases which can undermine trust in LLM-driven applications and raise ethical concerns about their use. This paper presents a large-scale analysis of inappropriate content across these datasets, offering a comprehensive taxonomy that categorizes harmful webpages into Topical and Toxic based on their intent. We also introduce a prompt evaluation dataset, a high-accuracy Topical and Toxic Prompt (TTP), and a transformer-based model (HarmFormer) for harmful content filtering. Additionally, we create a new multi-harm open-ended toxicity benchmark (HAVOC) and provide crucial insights into how models respond to adversarial toxic inputs. We share TTP, TTP-Eval, HAVOC and a sample of C4 inferenced on HarmFormer. Our work offers insights into ensuring safer LLM pretraining and serves as a resource for Responsible AI (RAI) compliance.

Key facts. Cited by 9 papers in the map (data through 14 Oct 2026). Placed in Safety alignment, refusal and guardrails, one of 12 directions in LLM safety and security. Builds on 24 of its 31 references that are in the map. First posted on arXiv 4 May 2025.

Builds on

24 of 31 references.

Closest ancestors · 1

Same direction, newest first

  1. 2022Perplexed by Quality: A Perplexity-based Method for Adult and Harmful Content Detection in Multilingual Heterogeneous Web Data20 Dec

Other references · 23

  1. 2017Attention Is All You Needcited by 60,361
  2. 2020Language Models are Few-Shot Learnerscited by 32,419
  3. 2023GPT-4 Technical Reportcited by 18,396
  4. 2024The Llama 3 Herd of Modelscited by 14,715
  5. 2019Exploring the Limits of Transfer Learning with a Unified Text-to-Text Transformercited by 14,599
  6. 2022Chain-of-Thought Prompting Elicits Reasoning in Large Language Modelscited by 12,459
  7. 2019Unsupervised Cross-lingual Representation Learning at Scalecited by 3,935
  8. 2020Longformer: The Long-Document Transformercited by 3,413
  9. 2023Sparks of Artificial General Intelligence: Early experiments with GPT-4cited by 2,592
  10. 2024Phi-3 Technical Report: A Highly Capable Language Model Locally on Your Phonecited by 1,917
  11. 2020RealToxicityPrompts: Evaluating Neural Toxic Degeneration in Language Modelscited by 1,255
  12. 2023Llama Guard: LLM-based Input-Output Safeguard for Human-AI Conversationscited by 1,207
11 more
  1. 2024The FineWeb Datasets: Decanting the Web for the Finest Text Data at Scalecited by 1,160
  2. 2021Documenting Large Webtext Corpora: A Case Study on the Colossal Clean Crawled Corpuscited by 492
  3. 2021A Survey on Automated Fact-Checkingcited by 378
  4. 2022A Holistic Approach to Undesired Content Detection in the Real Worldcited by 356
  5. 2020HateBERT: Retraining BERT for Abusive Language Detection in Englishcited by 207
  6. 2023A Pretrainer's Guide to Training Data: Measuring the Effects of Data Age, Domain Coverage, Quality, & Toxicitycited by 182
  7. 2021What's in the Box? A Preliminary Analysis of Undesirable Content in the Common Crawl Corpuscited by 80
  8. 2024Data, Data Everywhere: A Guide for Pretraining Dataset Constructioncited by 11
  9. 2023It's All in the Embedding! Fake News Detection Using Document Embeddingscited by 7
  10. 2022Suicidal Ideation Detection on Social Media: A Review of Machine Learning Methodscited by 4
  11. 2023Illicit Darkweb Classification via Natural-language Processing: Classifying Illicit Content of Webpages based on Textual Informationcited by 3

Built on by

Cited by year (2026 to 14 Oct)

Citing papers per year: 2025: 5; 2026: 4.

9 papers.

Similar, not cited

Close in wording, no citation either way

  1. 2025HarmMetric Eval: Benchmarking Metrics and Judges for LLM Harmfulness Assessment
  2. 2025Something Just Like TRuST : Toxicity Recognition of Span and Target
  3. 2025<think> So let's replace this phrase with insult... </think> Lessons learned from generation of toxic texts with LLMs
  4. 2025Understanding and Mitigating Toxicity in Image-Text Pretraining Datasets: A Case Study on LLaVA
  5. 2026HarmProfile: Characterizing Harmful Distributions in Frontier LLMs
  6. 2024ToxiCraft: A Novel Framework for Synthetic Generation of Harmful Information
  7. 2024Realistic Evaluation of Toxicity in Large Language Models
  8. 2024Toxicity of the Commons: Curating Open-Source Pre-Training Data