TLDR: TreePrompt is a novel few-shot example selection method for machine translation that leverages LLM preferences to identify high-quality, contextually relevant examples within a tree-structured framework. It combines LLM-based quality scoring with K-Nearest Neighbors (K-NN) semantic expansion. Evaluations on English-Persian and English-German translation tasks with models like GPT-4o and DeepSeek show that TreePrompt, especially when integrated with AFSP or Random selection and a reranker, significantly improves translation performance by focusing on quality over mere similarity, particularly beneficial for low-resource languages.
In the rapidly evolving field of artificial intelligence, large language models (LLMs) have shown remarkable capabilities in various tasks, including machine translation. However, the quality of these translations often hinges on the effectiveness of the prompts used to guide the LLMs. A new research paper introduces an innovative method called TreePrompt, designed to significantly enhance translation quality by intelligently selecting high-quality examples for few-shot prompting.
The Challenge of Few-Shot Prompting
Few-shot prompting is a technique where an LLM is given a few example translation pairs to learn from before translating a new input. While effective, most existing methods for selecting these examples primarily focus on how similar an example is to the query, often overlooking the actual quality or usefulness of the example for the LLM. This can lead to suboptimal performance, especially for languages with fewer available resources.
Introducing TreePrompt: A Hierarchical Approach
TreePrompt addresses this limitation by proposing a novel example selection approach that learns the LLM’s own preferences for what constitutes a “good” translation example. It operates within a tree-structured framework, iteratively refining the set of examples used for prompting. The process begins with a set of randomly chosen examples, which are then labeled by the LLM itself as positive (improves translation), neutral, or negative (degrades translation).
Following this initial labeling, TreePrompt expands the set of high-quality examples. It does this by taking the source sentence of the best-labeled example and using a K-Nearest Neighbors (K-NN) algorithm, based on RoBERTa embeddings, to find semantically similar candidates from a larger pool of potential examples. These newly retrieved examples are then also labeled by the LLM, and the process continues, building a tree-like structure of increasingly relevant and high-quality examples. This dynamic approach ensures that the selection is not just based on similarity but also on the LLM’s learned preference for effective translation examples.
Balancing Similarity and Quality
To further optimize the selection, TreePrompt can be combined with other similarity-driven methods like K-NN and Adaptive Few-Shot Prompting (AFSP). This integration helps strike a balance between selecting examples that are semantically similar to the input query and those that the LLM has identified as high-quality. The researchers evaluated TreePrompt on two language pairs: English-Persian using the MIZAN corpus and English-German using the WMT19 dataset. They tested it with various LLMs, including GPT-4o, GPT-3.5-Turbo, and DeepSeek.
Also Read:
- MITS: Guiding Large Language Models Through Complex Reasoning with Information Theory
- Advancing Kurdish Language Understanding with a New Semantic Textual Similarity Dataset
Key Findings and Performance
The evaluations showed that integrating TreePrompt, particularly with AFSP or Random selection combined with a reranker, consistently led to improved translation performance. This was especially evident in COMET scores, a neural-based metric highly correlated with human judgment. For instance, with GPT-4o, the TreePrompt-324 + AFSP method achieved the best COMET score for English-Persian translation. The study also highlighted that GPT-4o exhibited a more selective labeling behavior, indicating stricter criteria for what it considers a high-quality example, compared to DeepSeek and GPT-3.5 Turbo.
While TreePrompt is computationally more intensive due to the iterative labeling and K-NN expansion, the research suggests that proper tuning of its parameters can significantly reduce these costs. The core takeaway is that by incorporating LLM preferences into the example selection process, TreePrompt can achieve comparable translation quality using fewer, but higher-quality, examples. This is particularly beneficial for low-resource languages like Persian, where high-quality parallel corpora are scarce.
For more in-depth details, you can read the full research paper available here.


