Proceedings

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

Download BibTeX Cite

Proceedings of the Thirty-Fourth International Joint Conference on Artificial Intelligence. Main Track. Pages 466-474.

https://doi.org/10.24963/ijcai.2025/53

Abstract

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. Our work offers insights into ensuring safer LLM pretraining and serves as a resource for Responsible AI (RAI) compliance.

Disclaimer: This paper includes potentially offensive content due to the nature of the research.

  1. [Abdin et al., 2024] Marah Abdin, Sam Ade Jacobs, Am- mar Ahmad Awan, Jyoti Aneja, Ahmed Awadallah, Hany Awadalla, Nguyen Bach, Amit Bahree, Arash Bakhtiari, Harkirat Behl, et al. Phi-3 technical report: A highly capa- ble language model locally on your phone. arXiv preprint arXiv:2404.14219, 2024.
  2. [Abdulsalam and Alhothali, 2022] Asma Abdulsalam and Areej Alhothali. Suicidal ideation detection on social me- dia: A review of machine learning methods, 2022.
  3. [Achiam et al., 2023] Josh Achiam, Steven Adler, Sandhini Agarwal, Lama Ahmad, Ilge Akkaya, Florencia Leoni Aleman, Diogo Almeida, Janko Altenschmidt, Sam Alt- man, Shyamal Anadkat, et al. Gpt-4 technical report. arXiv preprint arXiv:2303.08774, 2023.
  4. [Beltagy et al., 2020] Iz Beltagy, Matthew E. Peters, and Ar- man Cohan. Longformer: The long-document trans- former, 2020.
  5. [Brown et al., 2020] Tom Brown, Benjamin Mann, Nick Ry- der, Melanie Subbiah, Jared D Kaplan, Prafulla Dhari- wal, Arvind Neelakantan, Pranav Shyam, Girish Sastry, Amanda Askell, Sandhini Agarwal, Ariel Herbert-Voss, Gretchen Krueger, Tom Henighan, Rewon Child, Aditya Ramesh, Daniel Ziegler, Jeffrey Wu, Clemens Winter, Chris Hesse, Mark Chen, Eric Sigler, Mateusz Litwin, Scott Gray, Benjamin Chess, Jack Clark, Christopher Berner, Sam McCandlish, Alec Radford, Ilya Sutskever, and Dario Amodei. Language models are few-shot learn- ers. In H. Larochelle, M. Ranzato, R. Hadsell, M.F. Bal- can, and H. Lin, editors, Advances in Neural Information Processing Systems, volume 33, pages 1877-1901.
  6. Curran Associates, Inc., 2020.
  7. [Bubeck et al., 2023] Sébastien Bubeck, Varun Chan- drasekaran, Ronen Eldan, Johannes Gehrke, Eric Horvitz, Ece Kamar, Peter Lee, Yin Tat Lee, Yuanzhi Li, Scott Lundberg, et al. Sparks of artificial general intelli- gence: Early experiments with gpt-4. arXiv preprint arXiv:2303.12712, 2023.
  8. [Cascavilla et al., 2022] Giuseppe Cascavilla, Gemma Catolino, and Mirella Sangiovanni. Illicit darkweb clas- sification via natural-language processing: Classifying illicit content of webpages based on textual information. In Proceedings of the 19th International Conference on Security and Cryptography, page 620-626.
  9. [Caselli et al., 2021] Tommaso Caselli, Valerio Basile, Je- lena Mitrović, and Michael Granitzer. HateBERT: Retrain- ing BERT for abusive language detection in English. In Aida Mostafazadeh Davani, Douwe Kiela, Mathias Lam- bert, Bertie Vidgen, Vinodkumar Prabhakaran, and Zeerak Waseem, editors, Proceedings of the 5th Workshop on On- line Abuse and Harms (WOAH 2021), pages 17-25, On- line, August 2021. Association for Computational Lin- guistics. [Conneau et al., 2020]
  10. Alexis Conneau, Kartikay Khandel- wal, Naman Goyal, Vishrav Chaudhary, Guillaume Wen- zek, Francisco Guzmán, Edouard Grave, Myle Ott, Luke Zettlemoyer, and Veselin Stoyanov. Unsupervised cross- lingual representation learning at scale, 2020.
  11. [DeepSeek-AI et al., 2025] DeepSeek-AI, Daya Guo, Dejian Yang, and Haowei Zhang et. al. Deepseek-r1: Incentiviz- ing reasoning capability in llms via reinforcement learn- ing, 2025.
  12. [Dodge et al., 2021] Jesse Dodge, Maarten Sap, Ana Marasović, William Agnew, Gabriel Ilharco, Dirk Groen- eveld, Margaret Mitchell, and Matt Gardner. Documenting large webtext corpora: A case study on the colossal clean crawled corpus. In Marie-Francine Moens, Xuanjing Huang, Lucia Specia, and Scott Wen-tau Yih, editors, Proceedings of the 2021 Conference on Empirical Meth- ods in Natural Language Processing, pages 1286-1305, Online and Punta Cana, Dominican Republic, November 2021. Association for Computational Linguistics.
  13. [Dubey et al., 2024] Abhimanyu Dubey, Abhinav Jauhri, Abhinav Pandey, Abhishek Kadian, Ahmad Al-Dahle, Aiesha Letman, Akhil Mathur, Alan Schelten, Amy Yang, Angela Fan, et al. The llama 3 herd of models. arXiv preprint arXiv:2407.21783, 2024.
  14. [Gehman et al., 2020] Samuel Gehman, Suchin Gururangan, Maarten Sap, Yejin Choi, and Noah A. Smith. Real- ToxicityPrompts: Evaluating neural toxic degeneration in language models. In Trevor Cohn, Yulan He, and Yang Liu, editors, Findings of the Association for Computa- tional Linguistics: EMNLP 2020, pages 3356-3369, On- line, November 2020. Association for Computational Lin- guistics.
  15. [Gemma, 2024] Riviere et al. Gemma. Gemma 2: Improving open language models at a practical size, 2024.
  16. [Guo et al., 2022] Zhijiang Guo, Michael Schlichtkrull, and Andreas Vlachos. A survey on automated fact-checking. Transactions of the Association for Computational Lin- guistics, 10:178-206, 2022.
  17. [Inan et al., 2023] Hakan Inan, Kartikeya Upasani, Jianfeng Chi, Rashi Rungta, Krithika Iyer, Yuning Mao, Michael Tontchev, Qing Hu, Brian Fuller, Davide Testuggine, and Madian Khabsa. Llama guard: Llm-based input-output safeguard for human-ai conversations, 2023.
  18. [Jansen et al., 2022] Tim Jansen, Yangling Tong, Victoria Zevallos, and Pedro Ortiz Suarez. Perplexed by quality: A perplexity-based method for adult and harmful content detection in multilingual heterogeneous web data, 2022.
  19. [Longpre et al., 2024] Shayne Longpre, Gregory Yauney, Emily Reif, Katherine Lee, Adam Roberts, Barret Zoph, Denny Zhou, Jason Wei, Kevin Robinson, David Mimno, and Daphne Ippolito. A pretrainer's guide to training data: Measuring the effects of data age, domain coverage, quality, & toxicity. In Kevin Duh, Helena Gomez, and Steven Bethard, editors, Proceedings of the 2024 Confer- ence of the North American Chapter of the Association for Computational Linguistics: Human Language Technolo- gies (Volume 1: Long Papers), pages 3245-3276, Mexico
  20. City, Mexico, June 2024. Association for Computational Linguistics.
  21. [Loshchilov and Hutter, 2019] Ilya Loshchilov and Frank Hutter. Decoupled weight decay regularization, 2019.
  22. [Luccioni and Viviano, 2021] Alexandra Luccioni and Joseph Viviano. What's in the box? an analysis of undesirable content in the Common Crawl corpus. In Chengqing Zong, Fei Xia, Wenjie Li, and Roberto Nav- igli, editors, Proceedings of the 59th Annual Meeting of the Association for Computational Linguistics and the 11th International Joint Conference on Natural Language Processing (Volume 2: Short Papers), pages 182-189, Online, August 2021. Association for Computational Linguistics.
  23. [Markov et al., 2023] Todor Markov, Chong Zhang, Sand- hini Agarwal, Florentine Eloundou Nekoul, Theodore Lee, Steven Adler, Angela Jiang, and Lilian Weng. A holis- tic approach to undesired content detection in the real world. In Proceedings of the Thirty-Seventh AAAI Confer- ence on Artificial Intelligence and Thirty-Fifth Conference on Innovative Applications of Artificial Intelligence and Thirteenth Symposium on Educational Advances in Ar- tificial Intelligence, AAAI'23/IAAI'23/EAAI'23. AAAI Press, 2023. [Meta, 2024] Meta. Llama 3.2: Revolutionizing edge ai and vision with open, customizable models. https://ai.meta.com/blog/llama-3-2-connect-2024-vision/ edgemobile-devices/, 2024. Link
  24. [Mistral, 2024] Mistral. Mistral-7b-v0.3. https: //huggingface.co/mistralai/Mistral-7B-v0.3, 2024. Link
  25. [Ollama, 2024] Ollama. Ollama -get up and running with large language models. https://ollama.com/, 2024. Link
  26. [Parmar et al., 2024] Jupinder Parmar, Shrimai Prabhumoye, Joseph Jennings, Bo Liu, Aastha Jhunjhunwala, Zhilin Wang, Mostofa Patwary, Mohammad Shoeybi, and Bryan Catanzaro. Data, data everywhere: A guide for pretraining dataset construction. In Yaser Al-Onaizan, Mohit Bansal, and Yun-Nung Chen, editors, Proceedings of the 2024 Conference on Empirical Methods in Natural Language Processing, pages 10671-10695, Miami, Florida, USA, November 2024. Association for Computational Linguis- tics.
  27. [Penedo et al., 2024] Guilherme Penedo, Hynek Kydlíček, Loubna Ben allal, Anton Lozhkov, Margaret Mitchell, Colin Raffel, Leandro Von Werra, and Thomas Wolf. The fineweb datasets: Decanting the web for the finest text data at scale. In The Thirty-eight Conference on Neural In- formation Processing Systems Datasets and Benchmarks Track, 2024.
  28. [Raffel et al., 2020] Colin Raffel, Noam Shazeer, Adam Roberts, Katherine Lee, Sharan Narang, Michael Matena, Yanqi Zhou, Wei Li, and Peter J. Liu. Exploring the limits of transfer learning with a unified text-to-text transformer. Journal of Machine Learning Research, 21(140):1-67, 2020.
  29. [Rana, 2010] Ahad Rana. Common crawl -building an open web-scale crawl using hadoop, 2010.
  30. [Sood and Dandapat, 2023] Ojasvin Sood and Sandipan Dandapat. Problematic webpage identification: A trilogy of hatespeech, search engines and GPT. In Yi-ling Chung, Paul R\"ottger, Debora Nozza, Zeerak Talat, and Aida Mostafazadeh Davani, editors, The 7th Workshop on On- line Abuse and Harms (WOAH), pages 126-137, Toronto, Canada, July 2023. Association for Computational Lin- guistics. [Truicȃ and Apostol, 2023]
  31. Ciprian-Octavian Truicȃ and Elena-Simona Apostol. It's all in the embedding! fake news detection using document embeddings. Mathemat- ics, 11(3):508, January 2023.
  32. [Vaswani et al., 2017] Ashish Vaswani, Noam Shazeer, Niki Parmar, Jakob Uszkoreit, Llion Jones, Aidan N. Gomez, Łukasz Kaiser, and Illia Polosukhin. Attention is all you need. In Proceedings of the 31st International Conference on Neural Information Processing Systems, pages 5998- 6008, Long Beach, California, 2017.
  33. [Curran Associates, Inc. Wei et al., 2022] Jason Wei, Xuezhi Wang, Dale Schuur- mans, Maarten Bosma, Brian Ichter, Fei Xia, Ed H. Chi, Quoc V. Le, and Denny Zhou. Chain-of-thought prompt- ing elicits reasoning in large language models. In Proceed- ings of the 36th International Conference on Neural In- formation Processing Systems, NIPS '22, Red Hook, NY, USA, 2022.

References were extracted automatically from the PDF and may contain errors.

Welcome Future Conferences AI Journal Division IJCAI Proceedings About IJCAI IJCAI Awards