Book Deep Read · Generative AI System Design Interview · Ch 3

Google Translate: the hard part isn't language, it's the data distribution — and a ruler that doesn't measure

Generative AI System Design Interview · Ch 3 · Ali Aminian, Hao Sheng & Alex Xu · 2024

中文 →

What is this chapter about?

You point your phone at a street sign in a language you can't read, and a few hundred milliseconds later a fluent sentence appears. This chapter is about building that machine — one that has to serve a hundred-plus languages at once, most of which it has barely seen a decent example of.

An analogy

The old way was like someone working from a phrasebook: chop the sentence into pieces, look each piece up, glue the results back together. You can understand the output, but you can tell instantly that no human wrote it — none of the pieces knows what the whole sentence is about.

The new way is like a real interpreter. They listen to the entire sentence first, form a meaning in their head, then speak the translation one word at a time. And as they say each word, their eyes flick back over the original to check which part they're on right now. That one habit is why long sentences stop getting lost halfway through.

Why the old world was hard

There are around seven thousand languages, but nearly all the bilingual material on the internet piles up in a dozen big ones — English and French have as much as you could ever want, while some languages can't scrape together ten thousand clean matched sentences. And then there's sheer count: two languages need one interpreter, but a hundred languages, every pair, is close to ten thousand directions. You cannot keep an interpreter for each.

How it's done

First, teach one person all the languages. Instead of one machine per language pair, build one machine and stick a little tag on the front of the sentence saying "put this into Chinese." The payoff is that languages help each other: the feel for grammar it picked up from Spanish gets lent to a neighbouring language it has barely studied. You even get something odd — pairs it was never taught at all, which it can still translate, because it learned each end separately.

Second, make up homework for the languages that have none. If a language has articles but no matched translations, run the existing machine backwards to turn them into mediocre English, and use that fake pairing as practice material. The exercises are synthetic; the skill it builds is real.

Third, decide who gets to practise. If you allocate practice time in proportion to what's actually on the internet, the machine spends ninety percent of it on English and French, and the small languages never get a turn. So you deliberately raise the small languages' quota — and the big ones get slightly worse. That is the central trade in this chapter: the plate is only so big, and anyone who gets more means someone gets less.

And one more problem: the ruler is bent

How do you know whether it translated well? The usual method is to compare its output against one "correct answer" and count how many words overlap. But a sentence has many correct translations — phrase it differently, the words stop matching, the score drops, and a human reads it as equally good. So the number is only good for spotting trends. To actually judge quality, you still have to ask a person.

Remember this

The engineering difficulty in translation isn't "how do I turn one language into another." It's how to serve everyone when the resources are wildly unequal, and how to tell whether you're improving at a task that has no single right answer.

Want the mechanisms, the notation and the diagrams? → Switch to the deep read