Multilingual Universal Sentence Encoder for Semantic Retrieval

Yinfei Yang, Daniel Cer, Amin Ahmad, Mandy Guo, Jax Law, Noah Constant, Gustavo Hernández Ábrego, Steve Yuan, Chris Tar, Yun-Hsuan Sung, Brian Strope, Ray Kurzweil

This paper from Google AI introduces two new pre-trained multilingual sentence encoding models designed to map text from 16 different languages into a single, shared semantic space. By providing both a high-accuracy Transformer-based model and a high-efficiency CNN-based model, the authors offer a "Universal Sentence Encoder" (USE) toolkit optimized for semantic retrieval tasks like finding similar questions or matching translation pairs across languages.

TL;DR

The authors present two multilingual dual-encoder models that embed 16 languages into one semantic vector space, enabling cross-lingual retrieval without explicit translation. These models achieve state-of-the-art performance on retrieval tasks and, surprisingly, often match or exceed the performance of specialized monolingual English models on English-only benchmarks.

What Problem Does This Paper Address?

In traditional NLP, retrieval across different languages usually requires translating everything into a pivot language (like English) or training separate models for every language pair. This is computationally expensive and often loses semantic nuance.

The goal here is Multilingual Semantic Retrieval: creating a single model where the vector for "How old are you?" in English is mathematically close to its equivalent in Arabic, Chinese, or Turkish. The challenge lies in training a model that generalizes across diverse language families (see Table 1 below) while maintaining high performance on specific downstream tasks like question answering and bitext alignment.

Table 1: The 16 supported languages and their families.

Methods

The researchers utilized a multi-task dual-encoder framework. The core idea is to train a shared encoder on three distinct tasks simultaneously:

  1. Question-Answer Prediction: Learning to associate questions with their correct answers.
  2. Translation Ranking: Learning to identify the correct translation of a sentence from a pool of candidates.
  3. Natural Language Inference (NLI): Determining if a sentence entails or contradicts another.

They provide two architectural flavors:

  • Transformer: Uses bi-directional self-attention to create context-aware representations. It is more accurate but scales quadratically ($O(n^2)$) with sentence length.
  • CNN: Uses convolutional layers and average pooling. It is significantly faster and uses less memory, making it ideal for production environments where latency is critical.

To handle 16 languages at once, they use a single SentencePiece vocabulary of 128k tokens, which allows the model to process text without needing language-specific pre-processing.

Datasets

  • Training: The models were trained on a massive corpus of mined question-answer pairs (60M+ per language), mined translation pairs, and the Stanford Natural Language Inference (SNLI) corpus (translated into all 15 other languages to ensure balance).
  • Evaluation:
    • Semantic Retrieval (SR): Quora question-pairs and AskUbuntu datasets.
  • Bitext Retrieval (BR): The United Nations (UN) Parallel Corpus.
  • Retrieval Question Answering (ReQA): A transformed version of the SQuAD v1.0 dataset.

Key Insights and Ideas

  • The "Multilingual Bonus": One of the most striking findings is that training on 16 languages doesn't dilute the model's power. In fact, the multilingual USE models often outperform previous English-only models on English transfer tasks. This suggests that learning cross-lingual relationships helps the model capture deeper semantic structures.
  • Shared Vocabulary Efficiency: Using a single SentencePiece vocabulary for all languages works remarkably well, achieving >99% character coverage. However, for character-heavy languages like Chinese or Japanese, the tokenizer tends to split text into single characters, which increases task difficulty.
  • Context Matters in QA: For the ReQA task, the authors found that encoding the context surrounding an answer (the paragraph it lives in) significantly improves retrieval accuracy compared to encoding the answer sentence in isolation.

Key Results

The Transformer model (USE_Trans) generally outperformed the CNN version (USE_CNN) across the board, though both were highly competitive.

  • Semantic Retrieval: On English benchmarks, the models achieved an average MAP of 65.7, outperforming previous baselines (see Table 2).
  • Bitext Retrieval: The models showed high precision in matching English sentences to their translations, with P@1 scores ranging from ~79% (en-zh) to ~89% (en-ru).
  • Efficiency: As shown in the resource usage benchmarks (Figure 1), the CNN model is a clear winner for long sequences. While the Transformer's memory and time requirements spike as sentence length increases, the CNN remains relatively flat, making it the "attractive choice for efficiently encoding longer texts."
Table 2: MAP@100 results on Semantic Retrieval tasks.
Figure 1: Comparison of CPU inference time, GPU inference time, and memory footprint between Transformer and CNN models.

Limitations and Future Work

  • Character-Rich Languages: The authors note a performance dip in English-Chinese retrieval. They attribute this to the shared vocabulary over-segmenting Chinese text into individual characters, losing some semantic information.
  • Quadratic Scaling: The Transformer model's $O(n^2)$ complexity limits its use for very long documents.
  • Future Directions: The authors suggest that future iterations could explore more sophisticated ways to balance the vocabulary across diverse scripts and potentially diverge the architectures for specific tasks like QA to further boost performance.

The models are publicly available on TensorFlow Hub, allowing developers to integrate multilingual semantic search into their own applications immediately.

Summary updated

BibTeX
@inproceedings{yang2020multilingual,
  author = {Yinfei Yang and Daniel Cer and Amin Ahmad and Mandy Guo and Jax Law and Noah Constant and Gustavo Hernández Ábrego and Steve Yuan and Chris Tar and Yun-Hsuan Sung and Brian Strope and Ray Kurzweil},
  title = {{Multilingual Universal Sentence Encoder for Semantic Retrieval}},
  booktitle = {Annual Meeting of the Association for Computational Linguistics},
  year = {2020},
  doi = {10.18653/v1/2020.acl-demos.12},
}
Figure