Paraphrastic Representations at Scale

John Wieting, Kevin Gimpel, Graham Neubig, Taylor Berg-Kirkpatrick

Abstract

We present a scalable approach for training "paraphrastic" sentence embeddings that outperform supervised Transformer-based models on semantic similarity tasks while being orders of magnitude faster. By scaling simple subword-averaging models (PARAGRAM-SP) to tens of millions of training pairs and utilizing "mega-batch" negative mining, we achieve state-of-the-art results on CPU hardware. Our models enable web-scale text processing without the need for expensive GPU clusters, processing over 12,000 sentences per second on a single CPU core.

Introduction

The ability to measure semantic similarity between sentences is critical for tasks such as paraphrase detection, information retrieval, and bitext mining. However, the field has increasingly relied on computationally heavy models like BERT and Sentence-BERT (SBERT). While accurate, these models face a "compute wall" due to their quadratic scaling during inference, making them prohibitively slow for processing hundreds of millions of sentences. This work addresses the challenge of creating sentence representations that are accurate, multilingual, and extremely fast on standard CPU hardware, democratizing large-scale NLP.

Methods

Our approach, PARAGRAM-SP (P-SP), utilizes a simple encoder that averages subword embeddings generated via SentencePiece. This "bag of subwords" model avoids the complex matrix multiplications and attention mechanisms of Transformer architectures.

Training is conducted using a margin-based ranking loss, which ensures that the cosine similarity between a sentence and its true paraphrase is higher than its similarity to a "negative" example by at least a margin $\delta$. To make the model robust, we implement a "mega-batching" strategy that aggregates multiple mini-batches to find the most confusing negative examples for every sentence in the set. To handle the unprecedented scale of our training data—reaching over 25 million pairs—the training infrastructure utilizes the HDF5 format to keep data on disk, preventing memory bottlenecks.

Datasets and Evaluation

The models were trained on massive datasets: 25.85 million English paraphrase pairs from ParaNMT and millions of multilingual bitext pairs for Arabic, German, Spanish, French, Russian, Turkish, and Chinese. Evaluation was performed on the Semantic Textual Similarity (STS) benchmarks (2012–2016), cross-lingual tasks, and bitext mining benchmarks.

Results

P-SP demonstrates that a simple architecture can surpass deep neural models when trained on sufficient high-quality data.

Performance of P-SP compared to BERT, SBERT, and other models on unsupervised English STS tasks.

As shown in the STS evaluation, P-SP achieves an average score of 74.6, significantly outperforming Sentence-BERT (70.9) and LASER (64.9). In multilingual settings, the model remains highly competitive with heavyweights like LaBSE on cross-lingual similarity tasks.

The most striking result is the inference throughput.

Comparison of inference throughput (sentences per second) for P-SP and baseline models on GPU and CPU.

P-SP achieves a throughput of 12,776 sentences per second on a single-core CPU, which is nearly 800x faster than SBERT on the same hardware. Using 32 CPU cores, the model reaches over 15,000 sentences per second, proving it can effectively replace GPUs for large-scale inference.

Conclusion and Future Work

The success of P-SP highlights that "simplicity scales." A bag-of-subwords approach, when combined with hard negative mining and massive datasets, provides a high-performance, CPU-friendly alternative for semantic similarity. While the model currently trails specialized models in literal bitext mining, its accuracy on paraphrastic similarity and its extreme efficiency make it a powerful tool for accessible NLP. Future work will focus on expanding language coverage beyond the current eight languages and refining the model's performance on literal translation mapping.

Summary updated

BibTeX
@inproceedings{wieting2022paraphrastic,
  author = {John Wieting and Kevin Gimpel and Graham Neubig and Taylor Berg-Kirkpatrick},
  title = {{Paraphrastic Representations at Scale}},
  booktitle = {Conference on Empirical Methods in Natural Language Processing},
  year = {2022},
  doi = {10.18653/v1/2022.emnlp-demos.38},
}
Figure