A model on STACKIT AI Model Serving writes German that is often good. It does not know which parts of a page must stay exactly as they are. This asset shows the two layers that take care of that: numbered pieces before the model and a guard after it.
Why Not the Whole File
Section titled “Why Not the Whole File”The simple way is to send a page and ask for the translation. It fails in quiet ways. The model translates YAML inside a code example. It translates a badge value that must stay English. It drops a closing tag.
Sent as whole files, 2 to 4 of 11 pages broke. In small pieces our chosen model kept all 11 intact. A broken page is expensive because a build error or a wrong link shows up late.
How a Piece Travels
Section titled “How a Piece Travels”- Split: a parser reads the page and cuts it into pieces of plain text.
- Protect: links, inline code, components and image targets become placeholders such as
⟦3⟧. Code blocks and imports never leave the file. - Translate: the model sees only numbered pieces with placeholders.
- Correct: a second model improves the pieces that need it.
- Restore: code puts every placeholder back at its original place.
The model does not see a link, so it has no chance to change it. The rules for German links, such as the de/ prefix and German anchors, are applied by code as well.
The Proof
Section titled “The Proof”We rebuilt 222 existing pages from their pieces without any model in between. All 222 came back byte for byte identical apart from the text. That test runs before every change to the splitter.
The Risk
Section titled “The Risk”Placeholders protect the markup. They cannot stop the model from writing something new into the text itself. The page it reads is written by contributors. A sentence on that page can try to talk the model into adding a link or a new paragraph. This is prompt injection. It was possible in the first version.
What the Guard Checks
Section titled “What the Guard Checks”After every model call, code compares the answer with its source. It does not read what the text means. It only compares shapes. It cannot judge whether the meaning is right, so a person checks that.
- No new address: the answer must not contain a web address the source did not have.
- No new markup: no angle brackets, braces, backticks or link syntax beyond the source.
- Plausible length: a translation is neither far longer nor far shorter than its source.
- Right language: the answer must show words of the target language.
When the Guard Refuses
Section titled “When the Guard Refuses”A refused piece is asked for once more on its own. Refused again, it keeps its source text and the report says where. We tested the guard on 8,056 pieces from 174 existing human English and German pairs. It raised 11 false alarms, which means it refused 11 good human pieces. An earlier, stricter language rule refused 109 pieces of our own human German, so we loosened it.
A known limit: an address that is already in the source may appear in the answer.
Pinned Terms
Section titled “Pinned Terms”A glossary from existing pages tells the model which English terms to keep. A short pinned list on top of it wins in a conflict. It holds terms such as “Use Case” and “Best Practice”. The file has a strict format: short entries, letters and digits only.
What Went Wrong on the Way
Section titled “What Went Wrong on the Way”- A wrong heading: “Typical use case” became “Typischer Case” because the term was missing from the glossary. Fix: pinned terms.
- Thinking on: a run took five times as long and 165 pieces were missing. Fix: thinking off.
- Broken structure: whole files. Fix: pieces.
- A too strict rule: the first language check refused 109 pieces of our own human German. Fix: refuse only when nothing of the target language is left.
Learn More
Section titled “Learn More”Asset historyAdded Oct 30, 2026TMUpdatedNo updates · 1 bar = 1 week i
- TMTobias M.Head of STACKIT Cloud Framework · STACKITOwner
Tobias M.Head of STACKIT Cloud Framework · STACKITOwnerActive 11 of the last 12 weeks · 196 updateswww.linkedin.com/in/tobias-müller-011304172