[Paper Review] GeDi: Generative Discriminator Guided Sequence Generation
GeDi proposes a computationally efficient method for controlling large language model (LM) generation by using smaller class-conditional language models (CC-LMs) as generative discriminators. It applies Bayes' rule to compute classification probabilities for next tokens based on desired vs. undesired attributes, enabling faster, more controllable, and safer generation—achieving over 30× speedup over prior methods while reducing toxicity in GPT-2 without sacrificing fluency.
While large-scale language models (LMs) are able to imitate the distribution of natural language well enough to generate realistic text, it is difficult to control which regions of the distribution they generate. This is especially problematic because datasets used for training large LMs usually contain significant toxicity, hate, bias, and negativity. We propose GeDi as an efficient method for using smaller LMs as generative discriminators to guide generation from large LMs to make them safer and more controllable. GeDi guides generation at each step by computing classification probabilities for all possible next tokens via Bayes rule by normalizing over two class-conditional distributions; one conditioned on the desired attribute, or control code, and another conditioned on the undesired attribute, or anti control code. We find that GeDi gives stronger controllability than the state of the art method while also achieving generation speeds more than 30 times faster. Additionally, training GeDi on only four topics allows us to controllably generate new topics zero-shot from just a keyword, unlocking a new capability that previous controllable generation methods do not have. Lastly, we show that GeDi can make GPT-2 (1.5B parameters) significantly less toxic without sacrificing linguistic quality, making it by far the most practical existing method for detoxifying large language models while maintaining a fast generation speed.
Motivation & Objective
- To address the challenge of controlling large language models (LMs) trained on biased or toxic web data, which often generate harmful or uncontrolled content.
- To overcome the computational inefficiency of existing control methods like PPLM and weighted decoding, which scale poorly with vocabulary size.
- To enable zero-shot control over new topics not seen during training, extending controllability beyond the training distribution.
- To reduce toxicity in large LMs like GPT-2 without degrading linguistic quality, offering a practical detoxification solution.
Proposed method
- Uses class-conditional language models (CC-LMs) as generative discriminators (GeDis) to compute token-level classification probabilities via Bayes' rule.
- Applies Bayes' rule to normalize over two class-conditional distributions: one conditioned on a desired control code and one on an anti-control code.
- Employs weighted decoding to guide generation from large LMs using the computed likelihoods, enabling efficient control without re-ranking all candidates.
- Trains GeDis with a hybrid generative-discriminative loss to improve their classification performance, enhancing their effectiveness as discriminators.
- Enables zero-shot topic control by fine-tuning GeDis on only four topics, allowing generalization to unseen topics via keyword prompting.
- Integrates GeDi with large LMs such as GPT-2-XL using inference-time guidance, avoiding costly fine-tuning of the main model.
Experimental results
Research questions
- RQ1Can a smaller generative discriminator (GeDi) effectively guide a large language model to generate text with desired attributes while maintaining high fluency?
- RQ2How does GeDi’s inference speed compare to existing methods like PPLM and weighted decoding, especially at scale?
- RQ3Can GeDi generalize to zero-shot control of new topics not present in its training data?
- RQ4To what extent can GeDi reduce toxicity in large language models like GPT-2 without degrading text quality?
- RQ5Does training GeDi with a hybrid generative-discriminative objective improve its performance as a discriminator for control tasks?
Key findings
- GeDi-guided generation with GPT-2-XL is more than 30× faster than PPLM under default settings, significantly improving inference efficiency.
- GeDi trained on sentiment in movie reviews achieves superior control over tone (positive/negative) compared to state-of-the-art baselines.
- GeDi reduces toxicity in GPT-2 generation while preserving linguistic quality, making it the most practical detoxification method for large LMs.
- GeDi generalizes to zero-shot topic control: fine-tuning on just four topics enables effective generation on entirely new topics using only a keyword.
- Smaller GeDis models (345M parameters), fine-tuned in less than a day on a single GPU, are effective and computationally efficient for guiding larger models.
- The hybrid training objective improves GeDi's discriminative capability, making it more effective than standard generative-only CC-LMs for control tasks.
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.