Transformer-based Language Models (LMs) have achieved impressive results on natural language understanding tasks, but they can also generate toxic text such as insults, threats, and profanity, limiting their real-world applications. To overcome this issue, a few text generation approaches aim to detoxify toxic texts using additional LMs or perturbations. However, previous methods require excessive memory, computations, and time which are serious bottlenecks in their real-world application. To address such limitations, we propose an effective yet efficient method for language detoxification using an attribute-discriminative latent space. Specifically, we project the latent space of an original Transformer LM onto a discriminative latent space that well-separates texts by their attributes using a projection block and an attribute discriminator. This allows the LM to control the text generation to be non-toxic with minimal memory and computation overhead. We validate our model, Attribute-Discriminative Language Model (ADLM) on detoxified language and dialogue generation tasks, on which our method significantly outperforms baselines both in performance and efficiency.
翻译:基于Transformer的语言模型在自然语言理解任务上取得了显著成果,但也能生成包含侮辱、威胁、亵渎等毒性文本,限制了其实际应用。为解决此问题,现有文本生成方法尝试通过额外语言模型或扰动实现去毒化,但这类方法需要大量内存、计算资源和时间,成为实际应用中的严重瓶颈。针对这些局限,我们提出一种利用属性判别隐空间的高效语言去毒化方法。具体而言,我们通过投影模块和属性判别器,将原始Transformer语言模型的隐空间映射至可清晰区分文本属性的判别隐空间中,使语言模型在仅增加极小内存与计算开销的前提下,实现非毒性文本生成的精准控制。我们在去毒化语言生成与对话生成任务上验证了所提模型——属性判别语言模型(ADLM),结果表明本方法在性能与效率上均显著优于基线模型。