LLM Translation Quality and Instruction Following: A Practical Evaluation Guide
This article breaks down what it takes to evaluate a large language model for production translation. Beyond semantic accuracy, it examines four core instruction-following constraints—outputting only the translation, preserving formatting and line breaks, keeping proper nouns intact, and protecting tags and placeholders—with practical Python patterns for each. It then proposes a three-layer evaluation approach covering translation quality, instruction-following pass rates, and stability under load, along with guidance on routing between lightweight and deep-reasoning models. A deployment architecture and release strategy are included for teams building translation pipelines.
1. Why Translation Quality Is More Than “Faithful, Expressive, Elegant”
In scenarios such as global expansion, cross-border e-commerce, document localization, and multilingual customer support, machine translation has moved from “good enough” to “ready for delivery.” Yet real business requirements go far beyond semantic correctness: downstream systems need to parse, render, and store the output. Any extra explanatory text, broken line breaks, or mistranslated variable names can directly break the pipeline. Evaluating a translation model therefore requires looking at two capabilities at once: the translation quality itself, and instruction following—whether the model can strictly work within the output contract defined by the user.
2. Four Core Instruction-Following Constraints
2.1 Output Only the Translation
The most frequently violated constraint is “do not explain.” Models tend to add opening lines such as “Here is the translation:”. In engineering practice, you can define the output contract explicitly in the prompt and add post-processing as a safety net:
def strip_preamble(text: str, markers=("Here is", "Translation:", "以下是")) -> str:for m in markers:if text.startswith(m):text = text.split("\n", 1)[-1]return text.strip()
2.2 Preserve Original Formatting and Line Breaks
The number of paragraphs, list markers, and table structures must correspond one-to-one. The recommended approach is to split the structure first, translate segment by segment, and reassemble in the original order, avoiding sending the entire document at once, which can cause structural drift:
segments = [s for s in re.split(r"(\n+)", raw) if s != ""]translated = [seg if seg.isspace() else translate(seg) for seg in segments]result = "".join(translated)
2.3 Preserve Proper Nouns
Brands, model numbers, personal names, and place names should not be paraphrased. Maintain a glossary, inject it into the prompt as a hard constraint, and run a consistency check after decoding, triggering re-translation for segments that fail.
2.4 Preserve Tags and Placeholders
In rich text and templating scenarios, tags and variable placeholders belong to a “do not translate” zone. The general strategy is to mask placeholders first, then restore them after translation, ensuring tags remain properly closed and names stay unchanged.
3. Layered Evaluation for More Reliable Results
Evaluation should be organized in three layers. The first is translation quality, combining automatic metrics with manual spot checks. The second is instruction following, using rule-based assertions to compute pass rates. The third is stability, examining performance degradation under long documents, extra-long contexts, and concurrent load.
A key insight is that parameter size and inference compute do not linearly determine the experience. A smaller model in fast-thinking mode, if well trained and well aligned to constraints, can approach or even exceed a solution that consumes an order of magnitude more compute. On texts that require deep reasoning, however, a larger model with thinking capability still holds an advantage. Model selection should therefore be layered by scenario: use lightweight models for high-throughput, low-latency channels, and route high-value documents through a deep-reasoning channel.
4. Deployment Architecture Recommendations
On Baidu AI Cloud, translation capability can be packaged as a service, with a glossary and placeholder protection in front, quality scoring and automatic re-translation in the middle, and rule-based validation at the back. Object storage can hold corpora, a message queue can smooth traffic spikes, a container platform can scale elastically, and logging and monitoring services can provide full-chain observability. During the canary stage, it is recommended to use the “instruction-following pass rate” as the core release gate, then gradually increase traffic.
5. Conclusion
The engineering value of a translation model equals semantic quality multiplied by contract reliability. Only by turning the output contract, structure preservation, and terminology consistency into measurable, regression-testable evaluation items can you deliver reliably in real business.
