Our new X account is live! Follow @wizwand_team for updates
WorkDL logo mark

Contrastive Perplexity for Controlled Generation: An Application in Detoxifying Large Language Models

About

The generation of toxic content by large language models (LLMs) remains a critical challenge for the safe deployment of language technology. We propose a novel framework for implicit knowledge editing and controlled text generation by fine-tuning LLMs with a prototype-based contrastive perplexity objective. Central to our method is the construction of hard negatives - toxic outputs that are generated through adversarial paraphrasing to be semantically similar and model probability to their non-toxic counterparts. By training on these challenging and realistic pairs, our approach ensures robust and stable contrastive optimization. Experimental results in the domain of detoxification demonstrate that our method significantly reduces toxic generation while maintaining strong performance on downstream tasks such as commonsense reasoning and reading comprehension. Our findings highlight the effectiveness of exploiting hard negatives for attribute-aware fine-tuning.

Tassilo Klein, Moin Nabi• 2024

Related benchmarks

TaskDatasetResultRank
DetoxificationSafeNLP (test)
Similarity46
13
Text DetoxificationBlack-box mode
Similarity Score0.67
8
Toxicity and diversity evaluationSafeNLP
Toxicity0.028
6
Showing 3 of 3 rows

Other info

Follow for update