CMD: a framework for Context-aware Model self-Detoxification

Fuente: arXiv
Gespeichert in:
Bibliographische Detailangaben
Hauptverfasser: Tang, Zecheng, Zhou, Keyan, Li, Juntao, Ding, Yuyang, Wang, Pinzheng, Yan, Bowen, Hua, Rejie, Zhang, Min
Format: Preprint
Veröffentlicht: 2023
Schlagworte:
Online-Zugang:
Tags: Tag hinzufügen
Keine Tags, Fügen Sie den ersten Tag hinzu!
_version_ 1866909344989184000
author Tang, Zecheng
Zhou, Keyan
Li, Juntao
Ding, Yuyang
Wang, Pinzheng
Yan, Bowen
Hua, Rejie
Zhang, Min
author_facet Tang, Zecheng
Zhou, Keyan
Li, Juntao
Ding, Yuyang
Wang, Pinzheng
Yan, Bowen
Hua, Rejie
Zhang, Min
contents Text detoxification aims to minimize the risk of language models producing toxic content. Existing detoxification methods of directly constraining the model output or further training the model on the non-toxic corpus fail to achieve a decent balance between detoxification effectiveness and generation quality. This issue stems from the neglect of constrain imposed by the context since language models are designed to generate output that closely matches the context while detoxification methods endeavor to ensure the safety of the output even if it semantically deviates from the context. In view of this, we introduce a Context-aware Model self-Detoxification~(CMD) framework that pays attention to both the context and the detoxification process, i.e., first detoxifying the context and then making the language model generate along the safe context. Specifically, CMD framework involves two phases: utilizing language models to synthesize data and applying these data for training. We also introduce a toxic contrastive loss that encourages the model generation away from the negative toxic samples. Experiments on various LLMs have verified the effectiveness of our MSD framework, which can yield the best performance compared to baselines.
format Preprint
id arxiv_https___arxiv_org_abs_2308_08295
institution arXiv
publishDate 2023
record_format arxiv
spellingShingle CMD: a framework for Context-aware Model self-Detoxification
Tang, Zecheng
Zhou, Keyan
Li, Juntao
Ding, Yuyang
Wang, Pinzheng
Yan, Bowen
Hua, Rejie
Zhang, Min
Computation and Language
Text detoxification aims to minimize the risk of language models producing toxic content. Existing detoxification methods of directly constraining the model output or further training the model on the non-toxic corpus fail to achieve a decent balance between detoxification effectiveness and generation quality. This issue stems from the neglect of constrain imposed by the context since language models are designed to generate output that closely matches the context while detoxification methods endeavor to ensure the safety of the output even if it semantically deviates from the context. In view of this, we introduce a Context-aware Model self-Detoxification~(CMD) framework that pays attention to both the context and the detoxification process, i.e., first detoxifying the context and then making the language model generate along the safe context. Specifically, CMD framework involves two phases: utilizing language models to synthesize data and applying these data for training. We also introduce a toxic contrastive loss that encourages the model generation away from the negative toxic samples. Experiments on various LLMs have verified the effectiveness of our MSD framework, which can yield the best performance compared to baselines.
title CMD: a framework for Context-aware Model self-Detoxification
topic Computation and Language
url https://arxiv.org/abs/2308.08295