Document-Level and Context-Aware Translation › Document Memory
Language AI HandbookAll chapters A translation system can carry prior choices in a translation memory or glossary, a cache of hidden states, or text copied into the next prompt. A translation memory stores translated segment pairs. A cache supplies model representations, and a prompt supplies previous wording as text.
Translation memory retrieval
Given the current source segment, retrieve similar source segments from the translation memory and present their translated pairs to the model. Compare a lexical ranking such as BM25, an embedding ranking, or a combination on examples from the target domain.
A retrieved target provides wording the model can copy or adapt. If the old source says “enable Cloud Storage” and the current one says “disable Cloud Storage”, copying the old target preserves the product term but reverses the instruction. Check the changed part of the source before reusing retrieved text.
Adaptive and interactive MT
Adaptive MT uses a translator’s corrections to influence later output. Domingo et al. (2019) demonstrate online learning that updates model parameters after a translator confirms a correction. In a system that uses retrieved examples or a prompt, you can instead add the correction to those inputs and reuse it on later segments without changing the model parameters.
An interactive system can treat the translator’s validated prefix as fixed text and propose a continuation. Check whether your interface also supports selecting required terms.
Save reviewed corrections with their source context so later segments can reuse the wording. Check that an earlier correction still applies when the source wording or context changes.
Glossary memory in LLM pipelines
One way to supply document memory to an LLM is to put it in the prompt. Try a prompt with four blocks:
- Instructions: "Translate the following segment from English to Spanish. Use the glossary exactly. Match the style of the prior translations."
- Glossary: a list of source-target term pairs.
- Prior translations: the last translated segments, possibly with a summary of terminology choices.
- Current segment: the source sentence to translate.
The prior translations give the model examples of style and terminology. Prompted glossary entries and conflict-resolution instructions guide generation. If exact forms are mandatory, decoding constraints can ensure their presence in accepted outputs. Then check that each required source occurrence has the intended translation at the corresponding target location. If a check fails, retry or send the segment for review. As a starting layout, put the current segment last and the glossary near the instructions. Test the ordering on the translation model and task you intend to use.
For prompted translation, test context length and glossary size on the documents you expect to handle. Mark the current segment explicitly, then check whether the output repeats an earlier translation or includes material from neighboring segments. Update the prompt’s glossary and style decisions as the document progresses.
Comments
Add to the conversation
A question, a correction, or an example from your own work.
No comments yet. Be the first to share your thoughts!