Manuscript Offprint

arXiv:2608.27036

Reasoning about In-Context Samples for Machine-Translation

Maxime Bouthors, Josep Crego, François Yvon

Open access. PaperVantage converted this article to text, so layout and figures may differ from the original.

Abstract

Large Language Models (LLMs) can be trained to perform chain-of-thoughts reasoning in order to improve the reliability of their responses. In this work, we investigate how explicit reasoning can be leveraged for LLM-Based Machine Translation (MT) with in-context samples. We introduce a novel fragment-based reasoning framework in which the model first extracts parallel source-target fragments from retrieved similar exemplars, and uses these fragments as intermediate reasoning traces to produce the final translation. To train our model, we distill silver fragments and drafts from a large teacher model. Our experiments with the Qwen3 model family, over 6 languages, including up to 5 domains per language, demonstrate that fragment-based MT significantly outperforms alternative methods like standard k-shot or basic drafting. 1^{1}

1 Introduction

Large Language Models (LLMs) have proven to be successful in a wide variety of tasks (Touvron et al., 2023), including Machine Translation (MT) (Vilar et al., 2022; Zhang et al., 2022). In-context learning (ICL) (Brown et al., 2020) successfully improves MT-tailored LLMs (Zhang et al., 2023a), as it provides a simple mechanism to input additional task-specific, lexical, terminological or stylistic context to guide the generation algorithm towards more accurate translations (Moslem et al., 2023).

LLMs have recently evolved into Large Reasoning Models (LRMs), which first generate “thinking” tokens before computing their final output (Wei et al., 2022). LRMs can be further instructed, e.g., through supervised fine-tuning (SFT) or reinforcement learning (RL), to reproduce human reasoning steps in formal domains such as mathematics or coding (DeepSeek-AI, 2025). In the context of MT, these extra tokens serve, for instance, to simulate linguistic analyses, partial translations or drafts before generating the final translation (Raunak et al., 2023; He et al., 2024; Briakou et al., 2024; Zebaze et al., 2025a).

Most works on Chain-of-Thoughts (CoT) for MT thus take inspiration from the activities of human translators, modeled as a series of logically organized steps, from dictionary search to terminological analysis, translation and then revision(s), and make their models simulate the corresponding “thinking” tokens. Our inspiration is different, as we would like to model the reasoning process associated with the edition of one or several close exemplar(s) in translation-memory (TM) augmented translation (Bowker and Fisher, 2010). Despite the advances of NMT systems, TMs remain important tools in professional translators’ workbench, as they enable the transparent reuse of high-quality translations, which have already been validated for their correct terminology and phraseology – two key aspects in specialized translation. The integration of TMs with NMT, then with in-context learning and LLMs, is thus an important issue, studied e.g., in (Gu et al., 2018; Bulte and Tezcan, 2019).

As discussed in early works on Example-Based Machine Translation (EBMT) (Somers, 1999), reasoning with TMs can also logically be decomposed in several steps: (a) retrieving relevant exemplars 2^{2} for the current source sentence, typically based on fuzzy surface similarity scores; (b) matching segments in the retrieved exemplars that also occur in the source sentence and retrieving their target side equivalent; (c) selecting, recombining, adapting and completing these segments into a translation; (d - optional) revising this draft translation.

In this work, our main focus is on steps (b), and to a lesser extent (c). We rely on external

1^{1}Our code and data are available at https://github.com/Maxwell1447/Fragment-Based-Reasoning

2^{2}Exemplars are instances of past translations, stored in a TM and associating a source text and a target side translation.

Figure

Figure 1: Overview of the training pipeline of the model: (1) exemplars are retrieved from the TM; (2) A teacher model performs FE from the exemplars; (3) A student model is trained to reproduce FE as a reasoning trace.

retrieval modules for (a), and on the built-in generation abilities of LLMs for (d). We accordingly ask the following research questions: (RQ1) can LLMs/LRMs reliably perform the matching step and identify, rather than generate, actual translation fragments in retrieved exemplar(s)? (RQ2) Are the corresponding fragments improving the MT quality? (RQ3) Does fragment extraction (henceforth FE) benefit more when multiple exemplars are retrieved? In other words, can they sort valuable information from noise? (RQ4) Does FE benefit more for some specific domains or languages than for others?

To study these questions, we develop a complete pipeline, illustrated in Figure 1, relying on the Qwen3-32B model (Yang et al., 2025) as a teacher to generate training samples for the matching task, and on a finetuned version of Qwen3-8B to perform the reasoning and translation generation tasks. Our main findings are the following: (a) LLMs can learn to match, select or generate useful parallel fragments in parallel sentences; (b) Extracting such fragments during the reasoning process – even when noisy – significantly improves the translation quality for all metrics considered in this work; (c) The gains are independent of the number of retrieved exemplars, suggesting that FE produces a robust signal that can be exploited to generate the final translation; (d) This method generalizes to domains that are unseen during fine-tuning; (e) Combining segment retrieval with drafting techniques seems to undermine translation quality for domains seen in training, but yields improvement for unseen domains.

References (25)