[Paper Review] DExperts: Decoding-Time Controlled Text Generation with Experts and Anti-Experts
DExperts proposes a decoding-time method for controlled text generation that reweights a pretrained language model's outputs using a product of experts and anti-experts—small language models fine-tuned on desirable and undesirable text attributes. It outperforms existing methods in detoxification and sentiment control, preserving fluency and generalization even with minimal data or when applied to large models like GPT-3 via API.
Despite recent advances in natural language generation, it remains challenging to control attributes of generated text. We propose DExperts: Decoding-time Experts, a decoding-time method for controlled text generation that combines a pretrained language model with "expert" LMs and/or "anti-expert" LMs in a product of experts. Intuitively, under the ensemble, tokens only get high probability if they are considered likely by the experts, and unlikely by the anti-experts. We apply DExperts to language detoxification and sentiment-controlled generation, where we outperform existing controllable generation methods on both automatic and human evaluations. Moreover, because DExperts operates only on the output of the pretrained LM, it is effective with (anti-)experts of smaller size, including when operating on GPT-3. Our work highlights the promise of tuning small LMs on text with (un)desirable attributes for efficient decoding-time steering.
Motivation & Objective
- To address the challenge of controlling undesirable attributes in generated text, such as toxicity or negative sentiment, without requiring fine-tuning the base language model.
- To develop a lightweight, efficient method for steering large pretrained language models (e.g., GPT-3) at inference time, avoiding the high cost of retraining or fine-tuning.
- To enable effective control using only small, specialized language models (experts and anti-experts) that are fine-tuned on specific attribute distributions.
- To demonstrate that steering via direct probability ensembling of expert and anti-expert models is more effective than using them to estimate class probabilities.
- To show that the method remains effective even when only an anti-expert is used, eliminating the need for annotated non-toxic examples.
Proposed method
- DExperts combines a base pretrained language model with an expert LM (modeling desirable attributes) and an anti-expert LM (modeling undesirable attributes) via a product-of-experts formulation.
- At each decoding step, the logits from the base model are reweighted using the difference between the expert and anti-expert logits: $\tilde{\mathbf{z}}_t = \mathbf{z}_t + \alpha(\mathbf{z}^{+}_t - \mathbf{z}^{-}_t)$, where $\alpha$ controls the steering strength.
- The final token distribution is obtained via softmax over the reweighted logits, enabling controlled generation while preserving fluency and diversity.
- The method operates solely on the output of the base model, making it compatible with black-box models like GPT-3 accessed via API.
- Experts and anti-experts are fine-tuned on small, human-annotated datasets (e.g., 650 toxic comments) to model specific attributes.
- The approach generalizes across attributes: it is applied to both toxicity and sentiment control, demonstrating robustness and effectiveness.
Experimental results
Research questions
- RQ1Can a decoding-time method based on expert and anti-expert language models effectively reduce toxicity in generated text without requiring access to the base model’s weights?
- RQ2How well does DExperts perform compared to existing controllable generation methods in both automatic and human evaluations for detoxification?
- RQ3Can DExperts achieve effective control using only an anti-expert and reusing the base model as the expert, eliminating the need for non-toxic training data?
- RQ4How effective is DExperts in controlling sentiment, particularly in adversarial settings where prompts are designed to elicit opposite sentiment?
- RQ5To what extent can small, fine-tuned expert and anti-expert models effectively steer large, frozen base models in a lightweight, inference-time manner?
Key findings
- DExperts outperforms existing methods on both automatic and human evaluations in language detoxification, successfully reducing toxicity while maintaining high fluency and diversity.
- The method achieves strong performance even with only 650 toxic comments used to train the anti-expert, demonstrating data efficiency.
- DExperts remains effective when using only an anti-expert and the base model as the expert, enabling toxicity mitigation without requiring non-toxic training examples.
- In sentiment control, DExperts outperforms baselines on both automatic and human evaluations, especially in adversarial settings where prompts are designed to elicit negative or positive continuations.
- The method generalizes to different attributes and maintains strong performance when applied to GPT-3 via API, showing compatibility with large-scale black-box models.
- Direct probability ensembling of expert and anti-expert outputs proves more effective than using them to estimate class probabilities, as in GeDi or FUDGE.
Read this paper
Open the full text in the Nubint reader and ask about any passage as you read.
Read this paper on NubintThis review was generated by AI from the original paper. Please check the paper before citing it.