gedi (generative discriminator)

**GeDi (Generative Discriminator)** is the **controllable generation technique that uses class-conditional language models as discriminators to guide text generation toward or away from specified attributes** — developed by Salesforce Research as a method to steer any language model's output in real-time by using smaller "guide" models that score candidate tokens for their alignment with desired properties like topic relevance, safety, or sentiment. **What Is GeDi?** - **Definition**: A generation-time control method that uses class-conditional language models (trained on attribute-labeled text) to compute per-token guidance signals that steer a base model's generation. - **Core Innovation**: Treats small fine-tuned language models as Bayesian classifiers that score each candidate next token for its alignment with desired attributes. - **Key Advantage**: Works with any frozen base model — no base model modification needed, attribute control is applied purely at decoding time. - **Publication**: Krause et al. (2021), Salesforce Research. **Why GeDi Matters** - **Plug-and-Play Control**: Add attribute control to any base model without retraining or fine-tuning it. - **Real-Time Steering**: Guidance is computed per-token during generation, enabling dynamic control. - **Multi-Attribute**: Multiple GeDi guides can be combined for simultaneous control over multiple attributes. - **Detoxification**: Particularly effective at steering generation away from toxic content while maintaining fluency. - **Efficiency**: Guide models are small (124M parameters), adding minimal computational overhead. **How GeDi Works** **Training**: Train small class-conditional LMs on text labeled by attribute (e.g., "toxic" vs. "non-toxic"). Each class-conditional model learns language patterns specific to that attribute. **Inference**: At each generation step: 1. Compute next-token probabilities from the base model. 2. Compute next-token probabilities from the desired-class guide model. 3. Compute next-token probabilities from the anti-class guide model. 4. Use Bayes' rule to weight base model probabilities toward desired class. **Guidance Strength**: A control parameter adjusts how strongly the guide influences base model generation — from subtle bias to strong enforcement. **Applications** | Application | Desired Class | Anti-Class | Effect | |-------------|--------------|------------|--------| | **Detoxification** | Non-toxic | Toxic | Safe generation | | **Topic Control** | On-topic | Off-topic | Relevant content | | **Sentiment** | Positive | Negative | Upbeat text | | **Formality** | Formal | Informal | Professional tone | **Comparison with Alternatives** | Method | Base Model Change | Control Granularity | Overhead | |--------|-------------------|-------------------|----------| | **GeDi** | None (frozen) | Per-token | Small guide model | | **PPLM** | Gradient updates during generation | Per-step | Backpropagation per step | | **RLHF** | Full fine-tuning | Global behavior | Training cost | | **Prompting** | None | Instructions only | No overhead | GeDi is **an elegant solution for real-time attribute control in text generation** — proving that small, specialized guide models can effectively steer any base model's output through Bayesian per-token weighting without requiring base model modification.

Go deeper with CFSGPT

Get AI-powered deep-dives, save terms, and run advanced simulations — free account.

Create Free Account