Massively Parallel Suffix Array Queries and On-Demand Phrase Extraction for Statistical Machine Translation Using GPUs

Hua He, Jimmy J. Lin, Adam LopezNAACL 2013

Abstract

Translation models in statistical machine translation can be scaled to large corpora and arbitrarily-long phrases by looking up translations of source phrases “on the fly” in an indexed parallel corpus using suffix arrays. However, this can be slow because on-demand extraction of phrase tables is computationally expensive. We address this problem by developing novel algorithms for general purpose graphics processing units (GPUs), which enable suffix array queries for phrase lookup and phrase extraction to be massively parallelized. Compared to a highly-optimized, state-of-the-art serial CPU-based implementation, our techniques achieve at least an order of magnitude improvement in terms of throughput. This work demonstrates the promise of massively parallel architectures and the potential of GPUs for tackling computationally-demanding problems in statistical machine translation and language processing.

Introduction

In Statistical Machine Translation (SMT), translation models can become prohibitively large. Instead of pre-computing and storing a massive explicit phrase table (which can require terabytes of RAM), a highly memory-efficient alternative is to use the parallel training corpus itself as an implicit model. When a new sentence needs to be translated, the system uses suffix arrays to look up source phrases and extract their translations "on the fly."

While this saves memory, it introduces a massive computational bottleneck. Searching a massive parallel corpus for every possible substring of an input sentence, extracting the aligned target phrases, and scoring them on demand is incredibly slow on a standard CPU. This paper attempts to solve this bottleneck by redesigning the underlying lookup and extraction algorithms to run on massively parallel GPU architectures.

Methods

The authors introduce novel GPU-friendly algorithms for three stages of the extraction pipeline:

  1. Suffix Array Queries (Finding the Phrases): Naively parallelizing all possible substring queries wastes GPU threads on phrases that don't exist in the corpus. Instead, the authors use a two-pass strategy. Pass 1 concurrently finds the longest matching substring length for each word in the input. Pass 2 only spawns threads to search for valid substrings. Furthermore, they parallelize the binary search itself—using separate threads to find the first and last match bounds in the suffix array simultaneously.
Thread allocation for the two-pass suffix array query strategy.
  1. Phrase Extraction (Finding the Alignments): To extract valid target phrases, the system must check word alignment consistency (ensuring no words inside the phrase pair align to words outside it). To do this efficiently on the GPU, the authors pre-compute alignment projection arrays (leftmost and rightmost bounds) and pack them into 32-bit integers to minimize memory footprint. GPU thread blocks are then assigned to process multiple occurrences of a matched substring in parallel.
  2. Feature Computation (Scoring): The extracted phrase pairs are sorted directly on the GPU. This groups identical phrase pairs together, allowing aggregate statistics (like translation probabilities and lexical weights) to be computed in a single, highly efficient pass.

Experimental Setup

  • Training/Corpus Data: Chinese text from the Xinhua News Agency (27 million words) and the United Nations (81 million words), paired with English translations.
  • Evaluation/Query Data: Tokenized sentences from the NIST 2002–2006 translation campaigns (Chinese-to-English).

Key Results and Insights

The GPU implementation demonstrates dramatic performance gains over optimized CPU baselines, particularly when exhaustive phrase extraction is required.

Throughput and speedup comparison between GPU and CPU implementations.
  • Massive Throughput Gains: On the Xinhua dataset, the GPU achieved up to a 7,217x speedup over the single-threaded CPU baseline when extracting phrases without sampling, and a 62x speedup when sampling was used. The GPU processed up to 12,405 words per second (with sampling), compared to just 200 words per second on the CPU.
  • Approximations are no longer necessary: Historically, CPU-based on-the-fly extraction was so slow that researchers had to use strict length limits and sample a maximum number of phrase occurrences (e.g., capping at 300 matches). The GPU implementation is so fast that these constraints can be entirely lifted, allowing for the generation of complete, exact phrase tables on the fly with a negligible performance hit.
  • End-to-End Pipeline: When integrating the GPU phrase extraction with a standard CPU decoder (using 4 threads), the total time to translate the NIST05 test set dropped from 196 seconds to 41 seconds—a 4.8x overall system speedup.

Conclusion and Future Work

This work demonstrates that intra-sentential parallelism—using thousands of threads to concurrently process the substrings and alignments of a single sentence—can effectively eliminate the computational overhead of on-demand phrase extraction. While the system currently requires large batch sizes to fully saturate the GPU, it offers a powerful path forward for scaling SMT to massive datasets without heuristic sampling. Future work includes extending this acceleration to hierarchical phrase-based models and moving the decoding step itself to the GPU to minimize data transfer bottlenecks.

Summary updated

BibTeX
@inproceedings{he2013massively,
  author = {Hua He and Jimmy J. Lin and Adam Lopez},
  title = {{Massively Parallel Suffix Array Queries and On-Demand Phrase Extraction for Statistical Machine Translation Using GPUs}},
  booktitle = {Conference of the North American Chapter of the Association for Computational Linguistics},
  year = {2013},
  url = {https://openreview.net/forum?id=ry-oyXZuWS},
}
Figure