CTQScorer: Combining Multiple Features for In-context Example Selection for Machine Translation

Aswanth M., Ratish Puduppully, Raj Dabre, Anoop Kunchukuttan

Introduction

Large Language Models (LLMs) have demonstrated remarkable capabilities in machine translation through in-context learning (ICL). By providing a few "demonstration examples" in the prompt, these models can translate text without explicit fine-tuning. However, the performance of ICL is highly sensitive to the specific examples chosen.

Most current selection methods rely on single-factor heuristics, such as BM25 for keyword overlap or cosine similarity of embeddings. These approaches are often sub-optimal because they ignore other critical factors like example quality or structural relevance. For instance, a semantically similar example might be a poor-quality translation itself, or it might lack the necessary structural guidance for the LLM. The challenge lies in effectively weighing diverse features—relevance, quality, and model-specific familiarity—to maximize translation accuracy.

The CTQScorer Framework

To address these limitations, the authors introduce CTQScorer (Contextual Translation Quality), a regression-based framework designed to select the best possible in-context examples by combining multiple features.

The Pipeline

The CTQScorer process follows a multi-stage pipeline:

  1. Candidate Shortlisting: A fast retriever (like BM25) identifies the top 100 potential examples from a large database.
  2. Feature Extraction: For each candidate, a suite of features is calculated, including similarity features (using LaBSE, chrF, and COMET-QE), internal quality features of the example pair, and model-specific perplexity scores.
  3. Scoring & Ranking: A small neural regressor, the CTQ Scorer, assigns a score to each candidate based on these features.
  4. Prompt Construction: The top $k$ examples are selected and formatted into the final prompt for the LLM.
The CTQScorer pipeline for in-context example selection.

Training Methodology

A significant challenge in training such a scorer is the lack of "gold standard" datasets indicating which examples are best for ICL. The authors overcame this by creating a synthetic training set. They used a held-out set of sentences and performed 1-shot translation using various candidates. The resulting translation quality (measured by COMET) served as the target label for the regression model, allowing it to learn which feature combinations lead to better translations.

Key Insights and Results

The evaluation was conducted using BLOOM (7.1B) for Indic languages (Bengali, Gujarati, Hindi) and XGLM (7.5B) for European languages (French, German) and Russian, with performance measured on the FLORES-101 devtest set.

Performance Gains

CTQScorer consistently outperformed standard baselines. It achieved an average gain of 2.5 COMET points when translating into English and 4.5 points when translating out of English compared to random selection. Crucially, it also surpassed the strong BM25 baseline, which is widely used in industry.

Comparison of CTQScorer against baselines and individual feature performance.

Analysis of Features

  • Multi-Feature Synergy: The results demonstrate that combining different views of relevance is significantly more effective than any single metric. The regressor learns to balance similarity with quality.
  • Source-to-Target Similarity: Interestingly, measuring the similarity between the input source and the example's target (using COMET-QE) often provided a stronger signal than traditional source-to-source similarity.
  • Neural vs. Lexical Metrics: Neural metrics like COMET-QE proved far more effective for example selection than traditional lexical metrics like chrF or BM25.
  • Perplexity as a Feature: Features based on model perplexity helped capture how well an example fits the model's internal distribution, complementing similarity-based features.

Limitations and Future Outlook

While CTQScorer offers significant performance improvements, it introduces some inference overhead due to the calculation of multiple neural features for candidate examples. While some features can be pre-computed, real-time selection remains computationally intensive.

Future research could explore the scalability of this approach to larger "frontier" models like GPT-4 and its applicability to other NLP tasks such as summarization or code generation. Additionally, investigating performance on extremely low-resource languages remains an important area for further study.

Summary updated

BibTeX
@inproceedings{m2023ctqscorer,
  author = {Aswanth M. and Ratish Puduppully and Raj Dabre and Anoop Kunchukuttan},
  title = {{CTQScorer: Combining Multiple Features for In-context Example Selection for Machine Translation}},
  booktitle = {Conference on Empirical Methods in Natural Language Processing},
  year = {2023},
  doi = {10.18653/v1/2023.findings-emnlp.519},
}
Figure