2.2.3 Toxicity Filtering
Toxicity refers to the text content which is rude, dis-
respectful, or unreasonable language that is likely
to make someone leave a discussion (Gehman et al.,
2020; Welbl et al., 2021). As raw text corpora usu-
ally contain toxic text (Luccioni and Viviano, 2021;
Longpre et al., 2023b), toxicity filtering aims to
remove text with undesirable toxic text in the pre-
training datasets, further preventing LLMs from
generating toxic utterances. Similar to quality fil-
tering, heuristic and rule-based filtering (Lees et al.,
2022; Gargee et al., 2022; Friedl, 2023) and N-
gram classifer (Raffel et al., 2020) are adopted as
toxicity filters. Although effective in model detoxi-
fying, Longpre et al. (2023b) discover that toxicity
filtering reduces the risk of toxic generation with
worse model generalization and toxicity identifica-
tion ability. Moreover, Xu et al. (2021) and Welbl
et al. (2021) both find that training dataset detox-
DataManagementForLargeLanguageModels-ASurvey