Accelerated Reinforcement Learning for Sentence Generation by Vocabulary Prediction

Kazuma Hashimoto, Yoshimasa Tsuruoka

Abstract

Reinforcement learning (RL) for sentence generation is often hampered by the massive search space of large vocabularies. This paper proposes a method to accelerate RL training by dynamically predicting a small, input-specific vocabulary (typically $K=1,000$) to serve as a reduced action space. Our approach achieves up to a 2.7x speedup in training and a 2.3x reduction in GPU memory usage without sacrificing translation or captioning quality.

Introduction

In RL-based sentence generation, such as the REINFORCE algorithm, every word selection is treated as an action. With vocabularies often exceeding 50,000 words, models face two primary challenges: high computational overhead from large softmax operations and sparse rewards due to the difficulty of exploring a vast action space. While softmax approximations exist for supervised learning, they are often incompatible with RL, which requires the model to simulate its own behavior during training.

Methodology: Dynamic Vocabulary Prediction

The core innovation is the dynamic pruning of the vocabulary based on the input $X$.

  1. Vocabulary Predictor: A lightweight model predicts a subset of words likely to appear in the output. For text, it uses a bag-of-embeddings approach; for images, it utilizes pre-computed CNN features.
  2. Small Softmax: The generator operates only within a predicted subset of $K$ words. This transforms the softmax layer into a much smaller matrix multiplication, drastically reducing computational load.
  3. Integrated Training: This reduced space is used consistently across supervised pre-training, the REINFORCE phase, and inference.
Recall vs. vocabulary size K across various datasets. High recall at K=1000 justifies the reduced action space.

As illustrated in Figure 1, a small vocabulary size ($K$) is sufficient to capture target words with high recall across diverse datasets, validating the feasibility of the "Small Softmax" approach.

Experimental Results

The method was evaluated on eight datasets covering Machine Translation (En-De, En-Ja, En-Vi, Ch-Ja) and Image Captioning (MS COCO, Flickr8K).

Efficiency and Convergence

The "Small Softmax" approach significantly accelerates convergence. By narrowing the action space, the model receives more meaningful feedback during exploration, leading to faster learning.

BLEU score vs. pre-training epochs for Small vs. Full softmax. The Small softmax approach converges faster and reaches higher performance.

Figure 2 demonstrates that the Small softmax model achieves higher BLEU scores with fewer pre-training epochs compared to the full-vocabulary baseline.

Performance Gains

  • Hardware Efficiency: Training on the En-Ja (2M) dataset was ~2.7x faster. GPU memory usage on En-Vi dropped from 10.8 GB to 2.9 GB, allowing large models to be trained on a single consumer-grade GPU.
  • Rare Word Advantage: By removing thousands of irrelevant frequent words, the model can more easily select correct rare words, improving overall generation quality.
  • Accuracy: BLEU scores remained competitive or improved. For instance, on the En-Ja test set, the REINFORCE model with a small vocabulary achieved a BLEU score of 40.16.

Discussion and Limitations

The system's success depends on the vocabulary predictor's recall. While $K=1000$ generally provides near 100% recall, any word omitted by the predictor cannot be generated. Currently, the predictor and generator are trained separately; joint training remains a challenge due to RL instabilities. Future work may explore integrating this technique with Generative Adversarial Networks (GANs) to accelerate discriminator training.

Conclusion

By dynamically reducing the action space, this method makes reinforcement learning for natural language generation significantly more efficient and accessible without compromising performance.

Summary updated

BibTeX
@inproceedings{hashimoto2019accelerated,
  author = {Kazuma Hashimoto and Yoshimasa Tsuruoka},
  title = {{Accelerated Reinforcement Learning for Sentence Generation by Vocabulary Prediction}},
  booktitle = {Conference of the North American Chapter of the Association for Computational Linguistics},
  year = {2019},
  doi = {10.18653/v1/n19-1315},
}
Figure