← All posts
how we build

A translation has to survive the trip back

· 6 min read · by aft3r_d0t

Duotone ink illustration of a lone small boat on dark, broken water under heavy storm clouds.

This blog comes in English and Polish. I read both, but I don’t have the patience to compare every paragraph of every post by hand. So the blog does it for me, in a slightly odd way: every Polish post is translated back into English, and the result is compared with the original.

If the trip back loses something, the post doesn’t go out.

Why back

Checking a translation directly is hard for a machine. Polish and English share almost no words, so there’s nothing simple to compare. Checking English against English is easy. Translate the Polish back, and you have two texts in the same language that should say the same thing.

They won’t match word for word. A good translation changes the words, and the trip back changes them again. That’s fine. We’re not looking for the same words. We’re looking for the same content.

The trip back is written fresh, from the Polish alone, never by tidying up the English original. A back-translation that is just a copy of the source fails on its own, so that shortcut is closed. And when a post gets longer, the trip back is written again from the new Polish. An old one doesn’t count.

How close is close enough

The score is chrF, a measure from machine-translation research (Maja Popović, 2015). It counts how many short runs of characters the two texts share: single letters, pairs, and so on up to runs of six. Case is ignored and runs of spaces count as one. It doesn’t care much about word order, and it forgives a changed ending on a word, which matters for a language like Polish. Missing text costs more than extra text: the score weights what the back-translation leaves out twice as heavily as what it adds.

To get a feel for it, here’s one sentence scored against four others, with the same function the blog uses:

0.858  The board restarts when the firmware panics.
0.894  When the firmware panics, the board reboots.
0.416  The board reboots.
0.185  The cat sat on the mat.

The original was “The board reboots when the firmware panics.” Swap one word for a synonym and you keep most of the score. Turn the sentence around and you keep even more, because every word is still there. Drop half of it and the score falls below half. A sentence about something else entirely lands near the floor.

There are two bars. The whole back-translation has to score at least 0.60 against the original. And every single paragraph of the original has to find a partner in the back-translation that scores at least 0.45.

The second bar is the one that does the work. A whole-post score can stay high while one paragraph quietly goes missing. The paragraph bar can’t. Headings are left out of the paragraph match, since a short heading scores wildly either way; the number of headings is checked on its own instead.

Where the numbers came from

The first plan was 0.45 for the whole post and 0.25 per paragraph. Before anything shipped, one of us measured what those numbers would actually do.

Two unrelated texts by the same author scored between 0.421 and 0.503 against each other. So a 0.45 bar for the whole post would have let about half of the unrelated pairs through. And 86% of dropped paragraphs still found some other paragraph scoring at least 0.25, so that bar would have caught almost nothing.

Honest round trips scored 0.805 to 0.857 for the whole post, and no paragraph went below 0.552. So the bars moved up to 0.60 and 0.45. There’s room above them for a free translation, and almost none below them for a missing paragraph.

Proving it bites

A bar that has never failed proves nothing. So the check was tested by taking a 12-paragraph text and dropping one paragraph at a time from the back-translation: the first, the sixth, the last.

All three failed. The best partner the missing paragraphs could find scored 0.381, 0.450 and 0.403. The middle one is the closest call. It printed as 0.450 but sat just under the line, and it still failed.

I saw the same thing on a real post later. One paragraph left out of the trip back scored 0.397 and failed.

The other gates

The trip back is one of seven gates every post goes through. The others check the structure of the file, that the thesis is one sentence, that every link answers, that the post is the right length for its shelf, that it doesn’t repeat an earlier post’s point, and that no private word gets out.

Two small rules turned out to matter more than I expected. The translation has to keep the same number of headings, and the same numbers. Not the same words, the same digits. Write “1” on one side and “one” on the other, and the gate fails. It caught exactly that in one of the first posts.

The digit rule had to learn some manners first. English writes 1,627 and Polish writes 1 627; one side writes 08 and the other 8. Counted naively, three of the first five real posts failed on formatting alone. Now a thousands group counts as one number and leading zeros are dropped. Change a 4 into a 7, though, and it still fails: the gate names the number that went missing and the one that appeared.

Length is checked too, as a ratio: the Polish has to be between 0.60 and 1.40 times the English in words. Polish runs a little shorter, usually around 0.8 to 0.9 on this blog, so the band is wide enough for a language and narrow enough for a missing section.

The private-word check fails closed. If its list is missing or empty, it doesn’t pass everything; it refuses to run at all.

What it found first

The first real run of all this didn’t catch a bad translation. It caught a leak.

Unfinished posts are kept out of the built site, but their cover pictures were not. A build copied five draft covers into the site that would be deployed, while their pages were left out. The art and the file names of posts that didn’t exist yet would have gone live with the next release. Now there’s a filter that lets through only the covers of posts that are live, and tests that go red when it’s switched off.

What it can’t do

The check is lexical. It compares characters, not meaning. A text whose paragraphs all sound alike can hide a dropped one, and a test on synthetic text showed exactly that. Real prose hasn’t fooled it so far, but “so far” is all I can say.

There’s a quieter trap on the other side. The score is about characters, so a faithful trip back can still lose points by picking a different word for the same thing. Call someone “the receiver” on the way back when the original said “the acceptor”, and a correct paragraph drifts toward the line. The fix isn’t to game the score. When the original’s term is a fair reading of the Polish, the trip back uses it.

And the check can only measure the back-translation it’s given. It can’t prove that the trip back was done honestly. For the first posts I read every version myself. Now the crew checks each one against the rules and the notes I’ve left on earlier posts, someone spot-checks that, and I can still pull any post I don’t like.

A translation I can’t check is a translation I’m just hoping about. The trip back turns the hope into a number.

— Max