Gradient-Based Constrained Sampling from Language Models
Kumar, Sachin, Paria, Biswajit, Tsvetkov, Yulia
–arXiv.org Artificial Intelligence
Large pretrained language models generate fluent text but are notoriously hard to controllably sample from. In this work, we study constrained sampling from such language models: generating text that satisfies user-defined constraints, while maintaining fluency and the model's performance in a downstream task. We propose MuCoLa -- a sampling procedure that combines the log-likelihood of the language model with arbitrary (differentiable) constraints in a single energy function, and then generates samples in a non-autoregressive manner. Specifically, it initializes the entire output sequence with noise and follows a Markov chain defined by Langevin Dynamics using the gradients of the energy function. We evaluate MuCoLa on text generation with soft and hard constraints as well as their combinations obtaining significant improvements over competitive baselines for toxicity avoidance, sentiment control, and keyword-guided generation.
arXiv.org Artificial Intelligence
Nov-8-2022
- Country:
- Oceania > Australia
- North America
- Dominican Republic (0.04)
- United States
- Washington > King County
- Seattle (0.28)
- Pennsylvania > Allegheny County
- Pittsburgh (0.14)
- New York > New York County
- New York City (0.04)
- Minnesota > Hennepin County
- Minneapolis (0.14)
- Louisiana > Orleans Parish
- New Orleans (0.04)
- Illinois > Cook County
- Chicago (0.04)
- California > San Diego County
- San Diego (0.04)
- Washington > King County
- Canada > British Columbia
- Europe
- United Kingdom > England (0.04)
- Russia (0.04)
- Germany (0.04)
- France (0.04)
- Italy > Tuscany
- Florence (0.04)
- Ireland > Leinster
- County Dublin > Dublin (0.04)
- Denmark > Capital Region
- Copenhagen (0.04)
- Asia
- Africa
- Middle East > Morocco (0.05)
- Equatorial Guinea (0.04)
- Côte d'Ivoire (0.04)
- Sudan (0.04)
- Genre:
- Research Report > New Finding (0.46)
- Industry:
- Technology: