Long-Document Translation at Million-Token Context: A Practical Pipeline

    This article explains why long-document translation has been hard to engineer, and how million-token context windows change the approach. It presents a reusable four-stage pipeline built around structured intermediate artifacts: global pre-reading and style profiling, chunked translation with constraint injection, global consistency validation, and chapter-level polishing. It also covers a three-layer quality evaluation model, common pitfalls such as output truncation and diluted constraints, and a practical engineering checklist for making long-document translation stable and readable.

    1. Why Long-Document Translation Is Hard to Engineer

    For books, technical manuals, legal contracts, and product documentation, the difficulty of machine translation has never been whether individual sentences are correct. It is whether the whole document reads as if it were written by the same person. Early LLM-based translation solutions tend to expose three problems in production:

    1. Style drift: register, sentence length, and rhetorical density keep shifting between chapters of the same work, and readers clearly sense a “different translator.”
    2. Inconsistent terminology and proper nouns: names of people, places, and organizations, along with product concepts, recur throughout a long text. Without a global constraint, the same entity gets translated several different ways in different positions.
    3. Broken context: after splitting by fixed length, coreference, ellipsis, foreshadowing, and callbacks are lost, so the translation jumps logically and can even erase a subtle touch planted earlier.

    The shared root cause is that the evidence needed for a translation decision is distributed across the entire document, while the range a model can “see” in a single inference pass is limited.

    2. What Long Context Changes

    Once the context window scales to the million-token range, the first engineering change is that you can hand an entire book to the model in one pass, build a global understanding first, and then translate section by section. This yields two concrete benefits.

    The first is establishing a style prior. During the read-through, the model can extract features such as narrative person, tense habits, sentence-length distribution, punctuation preferences, and cultural register, and turn them into a reusable “style guide” that constrains every subsequent segment.

    The second is bootstrapping a global entity table. The read-through can have the model output a character list, place-name list, glossary, and list of key motifs, which then act as hard constraints for later translation and suppress proper-noun drift at the source.

    It is worth stressing that long context is not a case of “the more you stuff in, the better.” Window capacity is only a necessary condition; what really determines quality is how the context is organized and how constraints are propagated.

    3. Reference Architecture: A Four-Stage Pipeline

    A reusable long-document translation pipeline usually has four stages, decoupled from each other through structured intermediate artifacts.

    Stage 1: Global Pre-Reading and Profiling

    Input the full text (or the full text grouped by volume) and output structured metadata:

    1. {
    2. "style_guide": {
    3. "register": "literary narration, leaning formal",
    4. "avg_sentence_len": 24,
    5. "punctuation": "full-width Chinese punctuation, few em dashes",
    6. "tone": "restrained, slightly ironic"
    7. },
    8. "glossary": [
    9. {"src": "the ten days", "tgt": "十日", "type": "motif"},
    10. {"src": "brigata", "tgt": "小队", "type": "proper noun"}
    11. ],
    12. "entities": [
    13. {"name": "Filomena", "tgt": "菲洛梅娜", "first_seen": "ch3"}
    14. ],
    15. "key_motifs": ["plague setting", "story within a story"]
    16. }

    Stage 2: Chunked Translation with Constraint Injection

    Even when the window is large enough, it is still advisable to chunk by semantic boundaries (chapters, scenes) for translation, because chunking can be parallelized, retried, and localized for debugging, and it substantially reduces the risk of a single output running out of control. The key is that every chunk request injects the same global constraints.

    1. [Style constraint] Follow style_guide strictly; do not change the register.
    2. [Terminology constraint] Entries in glossary must use the specified translation consistently.
    3. [Entity constraint] Use the translation in entities on first occurrence, and keep it consistent afterwards.
    4. [Context] Last 300 characters of the previous chunk's translation + first 200 characters of the next chunk's source (for continuity).
    5. [Task] Translate the following segment, preserving the narrative rhythm and rhetoric of the source; do not add or omit anything.

    Stage 3: Global Consistency Validation

    Parallel chunking inevitably introduces inconsistency, so an independent validation step is required:

    • Proper-noun consistency scan: extract all person and place names from the translation, compare them against the entity table, and send any variant back for retranslation.
    • Terminology hit-rate statistics: measure the compliant usage ratio of glossary entries, and trigger retranslation when it falls below the threshold.
    • Style metric regression: compute the variance of sentence-length and punctuation distributions, compare it with the baseline from the profiling stage, and raise an alert on large deviation.
    • Anaphora and ellipsis check: for pronoun-dense passages, verify that each referent is unique and correct.

    Stage 4: Polishing and Final Review

    The last pass polishes for coherence at the chapter level, allowing small adjustments to word order, merging of short sentences, and completion of connectives that Chinese readers expect, as long as the meaning is unchanged. This is the step that takes a translation from “correct” to “readable,” and it is where the gap to a professional human translation is smallest.

    4. Quality Evaluation: Don’t Rely on Sentence Similarity Alone

    Long-document translation cannot be measured simply with sentence-level metrics such as BLEU. A three-layer evaluation is recommended:

    1. Sentence level: sampled human ratings for adequacy and fluency, focusing on mistranslation and omission.
    2. Paragraph level: coherence, clarity of reference, and whether logical connections read naturally.
    3. Document level: terminology consistency rate, proper-noun consistency rate, style variance, and a subjective readability score from readers.

    In practice, the three layers can be built into a dashboard together with a sampled regression set, so that every prompt change or model switch can be compared quantitatively, avoiding unreproducible judgments like “it feels better.”

    5. Common Pitfalls and How to Avoid Them

    • Truncation from one overly long output: stick to chunking even when the window is large enough; output length is itself a cost factor.
    • Global constraints getting “diluted”: placing constraints at the end of the request and repeating key items is more reliable than putting them only at the beginning.
    • Over-paraphrasing: explicitly require that nothing be added or omitted, and reserve the authority to add or cut for the final review stage.
    • Arbitrary handling of culture-specific items: flag culture-loaded words during pre-reading and adopt one strategy for the whole document, either “literal translation plus necessary notes” or “domestication”; never mix them.
    • Cost and latency getting out of control: cache and reuse pre-reading results, run chunks concurrently, and retry failed chunks individually instead of redoing the whole document.

    6. A Practical Engineering Checklist

    • Use object storage for the source text, intermediate artifacts, and the final draft, so everything is traceable and rerunnable.
    • Use a message queue to drive chunk tasks, enabling concurrency and failure isolation.
    • Use a logging service with monitoring and alerting to track consistency metrics and failure rates, closing the loop.
    • Version the style profile, glossary, and entity table, so that when a draft is revised you can trace back to the exact constraint version in use.

    7. Conclusion

    The real value of million-token context is not that it “fits a whole book,” but that it moves translation from local optima to a global optimum: build global understanding first, land it section by section under strong constraints, and close with independent validation and document-level polishing. Once this pipeline is in place, both the stability and readability of long-document translation improve measurably, and the team can shift effort from repeated rework to genuine quality refinement.