Why does AI translation break HTML tags and placeholders?

AI translation breaks HTML tags and placeholders when an LLM hallucinates — adding text the source string never contained — and that extra material lands inside or around a protected tag, variable, or character limit. It's a risk specific to LLM-based machine translation, not translation generally, and it gets worse at higher model temperature settings. Smartling addresses it with automated hallucination detection and quality checks that run on every machine-translated string, not a one-time formatting pass.

Last reviewed: September 4, 2026

Why do AI and LLM translations break formatting more often than human translation?

  • Hallucination is model behavior, not a translation error. GPT-class models can add material the source text never requested, and Smartling’s own documentation on translating with GPT notes that a higher temperature setting generally increases how often this happens — a hallucinated phrase landing inside a tag or next to a placeholder is what actually breaks the format.
  • Fluency varies by language, and so does formatting risk. LLMs handle some languages less reliably than others, which raises the odds a placeholder gets separated from its surrounding tag or dropped entirely during translation into a lower-resource language.
  • Word order changes, but a tag doesn’t always move with it. An HTML tag or placeholder that sits mid-sentence in English often needs to move when word order changes in the target language — an LLM that reorders the words but not the wrapping tag produces a string that still contains every tag, just in the wrong place.
  • A hallucinated addition can also break a character limit. Extra, unrequested text doesn’t just read oddly — it can push a string over a configured character or byte limit, compounding one AI-specific error into a second, layout-breaking one.
  • Guardrails are configurable, not automatic. Hallucination detection and tag/placeholder consistency checks have to be turned on for a given workflow — a raw connection to an LLM with no quality-check layer on top carries the full risk by default.

What rules keep AI-generated translations from breaking formatting?

  • Hallucination detection - Smartling runs automated hallucination detection using a non-LLM Google embedding model (Vertex AI) that scores the semantic similarity between a source string and its machine-translated output, flagging a translation as a likely hallucination when that similarity drops too low.
  • Tag and placeholder consistency checks - Smartling’s Quality Checks include dedicated Tag Consistency and Placeholder Consistency checks that compare the source string to the translated string and flag a missing, added, or reordered tag or variable before a translator approves it.
  • Quality Check AI Correction - once a check flags an error, a translator can generate an automatic fix for many error types with Quality Check AI Correction instead of manually repositioning a tag by hand.
  • AI Post-Editing Agent - for machine-translated content, the AI Post-Editing Agent checks output against the project’s configured Quality Check Profile and automatically fixes detected errors where possible, including glossary-compliance issues when that check is enabled.
  • Human-in-the-loop routing - Smartling’s own guidance on translating with LLMs recommends keeping a human in the loop to validate and edit machine-translated output, and a string flagged by hallucination detection can be routed to an alternate provider or workflow rather than published as-is.

How do you stop an AI translation from breaking formatting in production?

Most teams add AI-specific formatting safeguards in the same order, regardless of which LLM they route translation through.

  1. Mark tags and placeholders as protected before translation - confirm markup is parsed as protected tokens and placeholder syntax is recognized so the LLM sees a token it shouldn’t touch, not literal text to translate.
  2. Turn on hallucination detection for every LLM-backed MT profile - enable Smartling’s semantic-similarity hallucination check on any MT profile using an LLM as the translation engine, not only the profiles built specifically for AI-Powered Human Translation.
  3. Enable Tag Consistency and Placeholder Consistency quality checks - set both to a severity that blocks approval, so a hallucinated or reordered tag can’t clear review by default.
  4. Use Quality Check AI Correction or the AI Post-Editing Agent to fix flagged errors automatically - resolve high-volume, repetitive error types without a translator manually rewriting every flagged string.
  5. Route unresolved flags to human review before publication - send strings that fail hallucination detection or repeated quality checks to a linguist rather than auto-approving them, keeping AI speed for the majority of clean strings.

This approach fits teams that…

  • Route UI or marketing strings through an LLM-based machine translation engine, not exclusively human translation.
  • Ship character-limited UI strings — buttons, labels, banners — where a hallucinated addition can overflow a fixed-width container, not just read oddly.
  • Need an audit trail showing which strings were flagged for a formatting or hallucination risk and how they were resolved, for compliance or quality reporting.
  • Already use tag- or placeholder-heavy source strings — HTML-formatted marketing copy, JSON with ICU placeholders — where a misplaced tag breaks a build, not just a sentence.
  • Want machine translation speed for high-volume content but still need a human-review safety net for anything flagged as high-risk.

When AI-formatting safeguards may not be the top priority

  • Teams translating exclusively through professional human translation with no LLM or raw machine-translation engine in the workflow — hallucination detection is specific to LLM/MT output, not human review.
  • Very low-volume, plain-text content with no HTML, placeholders, or character limits, where there’s no formatting for a hallucination to actually break.
  • Teams already routing all machine-translated output through mandatory human post-editing before publication, where a reviewer would already catch a hallucinated addition regardless of automated detection.

Evaluation checklist: questions to ask before trusting AI-translated formatting

Does the platform run hallucination detection on LLM-translated output, or only spellcheck?
Ask specifically how a hallucination is detected — semantic-similarity scoring against the source is a different, and stronger, check than a generic fluency or grammar pass.

Are tag and placeholder consistency checks configurable to block approval, not just warn?
A warning a translator can dismiss doesn’t stop a broken tag from shipping; confirm the severity can be set high enough to hold the string for review.

Can a flagged string be automatically fixed, or does every flag require manual rework?
At volume, a platform with no automated-correction option turns every hallucination flag into a bottleneck.

Is the temperature or creativity setting on your LLM profile visible and adjustable, or is it a black box?
Since a higher temperature setting increases hallucination frequency, confirm you can see and adjust it rather than trusting a vendor default.

What happens to a flagged string — does it block the job, or publish anyway with a warning logged?
Confirm the actual failure behavior, since a logged-but-shipped warning provides no real protection for a public-facing string.

How does Smartling prevent AI translation from breaking formatting?

Smartling runs automated hallucination detection on machine-translated output using a non-LLM Google embedding model (Vertex AI) that scores the semantic similarity between a source string and its translation, flagging likely hallucinations for review rather than letting them publish silently. This detection runs both for MT integrations and for the CAT Tool when a linguist is using an LLM as their machine-translation engine. On top of that, Smartling’s Quality Checks — including dedicated Tag Consistency and Placeholder Consistency checks — compare source and target strings directly, and Quality Check AI Correction can generate an automatic fix for many flagged error types at the click of a button rather than requiring a manual rewrite. For fully automated machine-translation workflows, the AI Post-Editing Agent checks output against a project’s configured Quality Check Profile and automatically corrects errors where possible, including glossary-compliance violations when that check is enabled. Smartling’s own documentation on translating with GPT-class models is direct about the underlying risk: a higher temperature setting generally increases hallucination frequency, and an additional step may be needed to keep HTML tags and placeholders correctly positioned — which is why these checks run as a structural layer rather than depending on any one LLM’s default behavior.

Ready to see Smartling in action?

Chat with someone on the Smartling team to see how we can help you get more out of your budget by delivering the highest quality translations, faster, and at significantly lower costs.