Speeding Up Neural Machine Translation Decoding by Cube Pruning

Wen Zhang, Liang Huang, Yang Feng, Lei Shen, Qun Liu

Introduction

Neural Machine Translation (NMT) has set new benchmarks for translation quality but remains computationally expensive during inference. The sequential nature of generation, coupled with massive vocabulary sizes and attention mechanisms, creates a significant bottleneck. This paper introduces an adaptation of "cube pruning"—a technique originally from statistical machine translation—to NMT. By clustering similar hidden states into equivalence classes, the authors achieve a speedup of 3.3x on GPUs and 3.5x on CPUs with negligible impact on translation quality.

The Decoding Bottleneck

Standard NMT decoding faces three primary challenges:

  1. Sequential Recurrence: Target words are generated one by one, limiting parallelization.
  2. Attention Overhead: The model must attend to every source word for every generated target word.
  3. Softmax Bottleneck: Normalizing probabilities over vocabularies of 30,000+ words is extremely costly, particularly on CPUs.

While researchers often trade quality for speed by reducing model size, this work focuses on optimizing the search process itself.

Methods: Cube Pruning and Self-Normalization

The core innovation is grouping translation hypotheses into equivalence classes based on shared previous target words. This allows the decoder to cluster similar paths and skip redundant computations.

  • Naive Cube Pruning (NCP): Uses a heap-based approach within clusters to explore only the most promising combinations of states and words.
  • Accelerated Cube Pruning (ACP): A more aggressive variant that uses a single "top-1" representative state vector to approximate the distribution for an entire cluster. The exact hidden state is only calculated for selected candidates.
  • Self-Normalization (SN): To bypass the softmax bottleneck, a penalty term is added during training to force the normalization constant ($Z$) toward 1. At inference, the model can use raw scores directly.
Figure 1: Illustration of the selection and merging process in cube pruning, showing how candidates are prioritized in a grid-like search space.

Experimental Results

The method was evaluated on a Chinese-to-English (Zh-En) task using standard LDC corpora and NIST test sets. The combination of ACP and SN provided the most dramatic improvements.

Speed and Quality

On the MT03 test set, the proposed system was 3.3x faster on GPUs and 3.5x faster on CPUs than standard beam search. Crucially, BLEU scores remained stable, and in some instances, slightly improved. This is likely because the efficiency gains allowed the model to explore a larger effective search space within the same time budget.

Scaling with Beam Size

A key metric introduced is the Average Merging Rate (AMR), which measures how many hypotheses are collapsed into clusters. As shown in the figure below, the AMR increases with beam size, indicating that cube pruning becomes increasingly beneficial as the search space expands.

Figure 6: Average Merging Rate (AMR) vs. Beam Size. The graph shows that as beam size increases, the efficiency gains from merging hypotheses (NCP and ACP) become more pronounced compared to naive beam search.

Conclusion and Future Work

This work demonstrates that algorithmic optimizations can provide hardware-independent speedups for NMT. By treating redundancy as an opportunity for clustering, cube pruning effectively mitigates the computational cost of large-scale beam search. While the study focused on RNN-based architectures, the underlying logic of hypothesis clustering is a promising avenue for optimizing modern Transformer-based models and multi-head attention mechanisms.

Summary updated

BibTeX
@inproceedings{zhang2018speeding,
  author = {Wen Zhang and Liang Huang and Yang Feng and Lei Shen and Qun Liu},
  title = {{Speeding Up Neural Machine Translation Decoding by Cube Pruning}},
  booktitle = {Conference on Empirical Methods in Natural Language Processing},
  year = {2018},
}
Figure