Efficient (Soft) Q-Learning for Text Generation with Limited Good Data

Han Guo, Bowen Tan, Zhengzhong Liu, Eric P. Xing, Zhiting Hu

Abstract

Traditional text generation models rely heavily on Maximum Likelihood Estimation (MLE), which requires vast amounts of high-quality human-annotated data. However, MLE struggles when "good" data is scarce or when optimizing for non-differentiable metrics. This paper introduces a reinforcement learning (RL) framework based on Soft Q-Learning (SQL). By re-interpreting model logits as Q-values and enabling vocabulary-wide updates, SQL provides a stable and data-efficient alternative for training text generators from scratch or with noisy data.

Introduction: The Limits of Mimicry

Most modern language models are trained to mimic human text through MLE. While effective for general-purpose generation, this approach has significant drawbacks in two major scenarios:

  1. Data Scarcity: In specialized tasks like generating adversarial attacks or specific control prompts, high-quality "gold" datasets are often non-existent.
  2. Metric Mismatch: MLE optimizes for word-level prediction, but many real-world goals—such as logical entailment, safety, or specific style—are non-differentiable and sequence-level.

Reinforcement Learning (RL) offers a solution by optimizing for rewards directly. However, standard RL methods like Policy Gradient are often unstable in the massive action spaces of natural language (tens of thousands of tokens) and suffer from sparse rewards.

Methods: Efficient Soft Q-Learning

The authors propose Efficient Soft Q-Learning (SQL) to bridge the gap between RL and language modeling. The core innovation lies in treating the language model's output logits as RL "Q-values," representing the expected future reward for selecting a specific token.

Efficient Soft Q-Learning (SQL) framework illustrating simultaneous vocabulary-wide updates and joint on/off-policy training.

Key technical contributions include:

  • Logits as Q-Values: By re-interpreting raw scores as Q-values, the language model acts as its own "critic," predicting future rewards for every possible word choice.
  • Vocabulary-Wide Updates: Unlike traditional Q-learning that updates a single action, SQL updates the scores for the entire vocabulary simultaneously using the log-partition function. This drastically improves sample efficiency.
  • Path Consistency Learning (PCL): This ensures that values across a sequence are consistent with the final reward, effectively backpropagating the learning signal from the end of a sentence to its beginning.
  • Joint Training: The framework seamlessly integrates on-policy samples (generated by the model) and off-policy data (from external, potentially noisy datasets).

Applications and Results

The SQL framework was evaluated across three distinct domains: learning from noisy text, adversarial text generation, and controlled prompt generation.

Overview of application tasks: learning from noisy text, adversarial generation, and prompt control.

Learning from Noisy Data

Using the SNLI dataset, the researchers tested if SQL could learn to generate logical entailments even when 50% of the training data was "negative" (contradictory). While MLE models blindly copied the noise, SQL successfully filtered the signal, maintaining high entailment rates and better output diversity.

Adversarial Text Generation

In the task of finding "universal adversarial attacks"—phrases that trick a classifier regardless of input—SQL outperformed standard Policy Gradient methods. It discovered phrases like "saint-pierre-et-saint-paul" that achieved a 97.4% success rate in tricking an entailment classifier.

Prompt Generation for Control

SQL was used to train a "prompt generator" to steer frozen models (like GPT-2) toward specific topics. SQL achieved higher accuracy than specialized steering algorithms (PPLM, GeDi) and was 15-80x faster at inference because it avoids expensive gradient computations during the generation process.

Discussion and Future Work

SQL demonstrates that RL can be a stable, primary training objective for text generation, even from a random initialization. This challenges the common practice of "pre-warming" RL models with MLE.

However, challenges remain. SQL's performance is highly dependent on the quality of the reward function; a flawed reward can lead to "reward hacking" where the model generates nonsense to maximize scores. Additionally, scaling the Path Consistency Learning objective to massive Large Language Models (LLMs) requires further optimization of computational overhead. Future research will focus on refining reward engineering and scaling SQL to larger architectures.

Summary updated

BibTeX
@inproceedings{guo2022efficient,
  author = {Han Guo and Bowen Tan and Zhengzhong Liu and Eric P. Xing and Zhiting Hu},
  title = {{Efficient (Soft) Q-Learning for Text Generation with Limited Good Data}},
  booktitle = {Conference on Empirical Methods in Natural Language Processing},
  year = {2022},
  doi = {10.18653/v1/2022.findings-emnlp.518},
}
Figure