Large Language Models (LLMs) are the cornerstone for many Natural Language Processing (NLP) tasks like sentiment analysis, document classification, named entity recognition, question answering, summarization, etc. LLMs are often trained on data which originates from the web. This data is prone to having content with Hate, Abuse and Profanity (HAP). For a detailed definition of HAP, please refer to the Appendix. Due to the LLMs being exposed to HAP content during training, the models learn it and may then generate hateful or profane content. For example, when the open-source RoBERTa model (specifically, the RoBERTA base model) from the HuggingFace (HF) Transformers library is prompted to replace the mask token in `I do not know that Persian people are that MASK` it returns the word `stupid` with the highest score. This is unacceptable in civil discourse.The detection of Hate, Abuse and Profanity in text is a vital component of creating civil and unbiased LLMs, which is needed not only for English, but for all languages. In this article, we briefly describe the creation of HAP detectors and various ways of using them to make models civil and acceptable in the output they generate.
翻译:大型语言模型(LLMs)是情感分析、文档分类、命名实体识别、问答、摘要等众多自然语言处理(NLP)任务的基石。LLMs的训练数据常源自互联网,这类数据易包含仇恨、滥用及粗俗(HAP)内容(HAP的详细定义请参见附录)。由于训练过程中接触HAP内容,模型会习得此类特征,进而可能生成仇恨或粗俗的输出。例如,当HuggingFace(HF) Transformers库中的开源RoBERTa模型(具体为RoBERTa base模型)被提示填补"I do not know that Persian people are that MASK"中的遮蔽标记时,其返回得分最高的词为"stupid",这在文明对话中是不可接受的。文本中仇恨、滥用及粗俗内容的检测,是构建文明且无偏见的LLMs的关键环节——这不仅针对英语,而是所有语言均需如此。本文简要阐述了HAP检测器的构建方法,以及利用检测器使模型输出更文明且可接受的多种途径。