Machine Translation

Jurafsky & Martin, Speech and Language Processing, 3rd ed. draft, ch. 13

72 cards

Introduction

  1. What is probably the most common use of machine translation today?
    Information access: translating web instructions, recipes, news articles, Wikipedia or government pages written in another language.
  2. What is the digital divide in information access, and how can MT help?
    Much more information is available in English and other languages of wealthy countries (more search results, bigger Wikipedias). Good MT can bring that information to speakers of lower-resourced languages.
  3. What are computer-aided translation (CAT), post-editing and localization?
    CAT: MT produces a draft that a human translator fixes in a post-editing phase. Localization: adapting content or a product to a particular language community, commonly using CAT.
  4. Name newer, in-the-moment uses of MT.
    Incremental translation of speech on the fly before the sentence is complete (as in simultaneous interpretation), and image-centric translation, e.g. OCR of menus or street signs from a phone camera.
  5. Why is MT naturally modeled with an encoder-decoder (sequence-to-sequence) architecture?
    The output is a complex function of the entire input: target words don’t correspond to source words in number or order (Japanese puts the verb last and drops the pronoun “he”).
    Hewrotea lettertoa friendtomodachinitegami-okaitafriendtoletterwrote(no “he”)
    Verb in the middle vs at the end; preposition vs postposition.

13.1 Language divergences and typology

  1. What are linguistic universals and statistical universals?
    Universals hold for every language (e.g. words for people, eating and drinking; nouns and verbs; ways to ask questions or give commands); statistical universals hold for most languages.
  2. What are translation divergences, and which two kinds are distinguished?
    Differences between languages that make translation hard: idiosyncratic lexical differences handled one by one (the word for “dog”), and systematic differences that can be modeled generally (verb before or after the object).
  3. What is linguistic typology, and what resource catalogs typological facts?
    The study of systematic cross-linguistic similarities and differences; WALS, the World Atlas of Language Structures.
  4. What are SVO, SOV and VSO languages? Give examples.
    The basic order of subject, verb and object: SVO (English, German, French, Mandarin), SOV (Hindi, Japanese), VSO (Irish, Arabic).
  5. What correlation holds between verb–object order and adpositions?
    VO languages generally have prepositions; OV languages generally have postpositions.
  6. Give an example of adjective–noun order differing between languages.
    English puts adjectives before nouns (green witch); Spanish and Modern Hebrew put them after (bruja verde).
  7. Give examples of one-to-many lexical divergences in translation.
    English bass → Spanish lubina (fish) or bajo (instrument); wall → German Wand (inside) or Mauer (outside); brother → Mandarin gege (older) or didi (younger). This links MT to word sense disambiguation.
  8. How can grammatical constraints on word choice differ between languages?
    One language may require information another leaves unmarked: English marks plural on nouns but Mandarin doesn’t; French and Spanish mark gender on adjectives, so translating into them requires choosing a gender.
  9. Give an example of a many-to-many lexical mapping between languages.
    English leg, foot, paw vs French: an animal’s leg is patte, a journey’s leg étape, a chair’s leg pied, a human leg jambe; foot is pied for humans but patte for animals.
    EnglishcontextFrench
    leghumanjambe
    leganimalpatte
    legjourneyétape
    legchairpied
    foothumanpied
    foot, pawanimalpatte
  10. What is a lexical gap? Give an example.
    When no word or phrase short of an explanatory footnote expresses a word’s exact meaning in another language: English has no neat equivalent of Mandarin xiào / Japanese oyakōkō (“filial piety”).
  11. What is the difference between verb-framed and satellite-framed languages?
    Verb-framed languages mark the direction of motion on the verb and manner on satellites (Spanish La botella salió flotando “exited floating”). Satellite-framed languages mark direction on particles or phrases and manner on the verb (English The bottle floated out).
  12. Which languages are verb-framed and which satellite-framed?
    Verb-framed: Japanese, Tamil, Romance, Semitic and Mayan languages. Satellite-framed: Chinese and non-Romance Indo-European languages like English, Swedish, Russian, Hindi, Farsi.
  13. What are pro-drop languages?
    Languages that can omit pronouns when the referent is given in the discourse, e.g. Spanish “[El jefe] dio con un libro. Ø Mostró su hallazgo…”.
  14. What is referential density, and what are “hot” and “cold” languages?
    How much a language uses explicit pronouns rather than zeros. Referentially sparse languages like Chinese or Japanese, which make the hearer infer more, are cold; more explicit languages are hot (after McLuhan’s hot vs cold media).
  15. Why is translating from Chinese or Japanese into English hard with respect to pronouns?
    The model must identify each omitted argument (zero) and recover its referent in order to insert the right English pronoun.

13.2 MT using encoder-decoder

  1. What is the basic MT task and its usual simplification?
    Generate a target-language sentence corresponding to a source sentence, typically translating each sentence independently.
  2. What is MT trained on, and what probability does it maximize?
    A large set of parallel sentences; it is trained to maximize \(P(y_1, \ldots, y_m \mid x_1, \ldots, x_n)\) of the target subword tokens given the source tokens.
  3. How does an encoder-decoder translate?
    The encoder maps the source tokens to a context \(h = \text{encoder}(x)\); the decoder generates the output token by token, \(y_{t+1} = \text{decoder}(h, y_1, \ldots, y_t)\).
  4. Why do MT systems use a shared subword vocabulary for source and target?
    It makes it easy to copy tokens like names from source to target, and handles languages with and without spaces (English vs Chinese, Thai) uniformly. It is learned on combined source and target data.
  5. How does the wordpiece algorithm differ from BPE?
    Instead of merging the most frequent pair, it adds the merge of two existing wordpieces that most increases the language-model probability of the training corpus, until a desired vocabulary size is reached (BPE instead fixes the number of merges).
  6. How does unigram (SentencePiece) tokenization build its vocabulary?
    Top-down: start from a huge vocabulary (all characters plus frequent character sequences), estimate token probabilities (with EM), and iteratively remove tokens that don’t appear in high-probability tokenizations until the desired size is reached.
  7. Why does unigram tokenization often produce better tokens than BPE?
    BPE creates many small meaningless pieces and merges very common tokens like ed onto neighbors (cor rupted), while unigram tends to find meaningful units (corrupt ed).
  8. What is a parallel corpus (bitext)? Give examples.
    Text appearing in two or more languages: Europarl (European Parliament proceedings), the UN Parallel Corpus, OpenSubtitles (movie and TV subtitles), ParaCrawl (web text).
  9. What two components are needed to create sentence alignments from two translated documents?
    A cost function scoring how likely a span of source sentences and a span of target sentences are translations of each other, and an alignment algorithm (usually dynamic programming, like minimum edit distance) that finds a good overall alignment.
  10. How are sentences scored for alignment across languages?
    With a multilingual embedding space where sentences from different languages share one space: cosine similarity, normalized against random sentences and biased toward aligning single sentences (Thompson & Koehn).
  11. What kinds of alignments can sentence alignment produce?
    1–1 mappings, 2–1 (or 1–2) alignments where one sentence is split or merged, and null alignments where a sentence has no counterpart.
  12. How are parallel corpora cleaned?
    Remove noisy pairs with rules (too long, too short, different URLs, suspiciously identical) or by discarding pairs with low multilingual-embedding cosine.

13.3 The encoder-decoder model

  1. How do the encoder and decoder transformers differ in an MT model?
    The encoder uses standard (unmasked) transformer blocks over the whole source. The decoder is a conditional language model whose blocks add a cross-attention layer, with causal self-attention over the target generated so far.
  2. What is cross-attention?
    Attention in the decoder (also called encoder-decoder or source attention) where the queries come from the previous decoder layer and the keys and values from the encoder’s final output \(H^{enc}\): \(Q = H^{dec}W^Q\), \(K = H^{enc}W^K\), \(V = H^{enc}W^V\), \(\text{softmax}(QK^\top/\sqrt{d_k})V\).
    encoder (source)decoder self-attncross-attentionK, VQ→ feedforward → next tokenThe green witch arrived<s> llegó la …
  3. How is an encoder-decoder MT model trained?
    Give the encoder the source; train the decoder autoregressively from the separator/start token to predict each next target token with cross-entropy loss, using teacher forcing (feeding the gold target token, not the model’s prediction, at each step).

13.4 Decoding: beam search

  1. What is the problem with greedy decoding for MT, illustrated by a search tree?
    A locally most probable token may lead to a worse sequence: if “yes” (0.5) beats “ok” (0.4) at step 1, greedy picks yes, even if “ok ok” has the highest total probability.
    startokyesokyes.4.5.7.4.28.20
    Green: best path (.4 × .7). Orange: the greedy path (.5 × .4).
  2. Why can’t dynamic programming (Viterbi) or exhaustive search be used for MT decoding?
    Generation has long-distance dependencies between output decisions, so dynamic programming doesn’t apply, and exhaustive search over all \(V^T\) sentences is far too slow.
  3. What is beam search?
    A heuristic search keeping the \(k\) best hypotheses (partial translations with their probabilities) at each step: extend each with every vocabulary token, score the \(k \times V\) candidates, and prune back to the best \(k\). \(k\) is the beam width.
  4. When does beam search stop, and what does it return?
    When a hypothesis generates EOS it is complete and removed from the frontier, and the beam shrinks by one; search continues until the beam is empty, returning \(k\) complete hypotheses.
  5. How are beam search hypotheses scored?
    By the log probability of the sequence, built incrementally with the chain rule: \(\text{score}(y) = \sum_{i=1}^{t}\log P(y_i \mid y_1, \ldots, y_{i-1}, x)\).
  6. Why is length normalization needed in beam search, and how is it done?
    Language models give longer strings lower probabilities, so completed hypotheses of different lengths would favor short outputs. Divide the log probability by the number of words: \(\frac{1}{t}\log P(y \mid x)\).
  7. What beam widths are typical in MT?
    Between 5 and 10.
  8. What is minimum Bayes risk (MBR) decoding?
    Instead of the most probable translation, choose the one likely to have the least error: from a set of candidate translations \(Y\) (e.g. 32–64 samples), pick the candidate most similar to all the others, \(\hat{y} = \arg\max_{y \in Y}\sum_{c \in Y}\text{util}(y, c)\), with a utility like chrF, BLEU or BERTScore.
  9. Where else has MBR decoding been used?
    Widely in speech recognition before MT, and in other generation tasks such as summarization, dialogue and image captioning.

13.5 Low-resource translation

  1. What is data augmentation?
    Adding synthetic training data generated from the current natural data to address insufficient training data.
  2. Describe backtranslation.
    To improve source→target MT with a small bitext and plenty of target-language monolingual text: train a target→source system on the bitext, translate the monolingual target text into the source language, and add these synthetic pairs (MT source, natural target) to the training data.
  3. What parameters does backtranslation have, and how well does it work?
    How the synthetic source is generated (greedy, beam search, sampling) and the ratio of backtranslated to natural data (natural bitext can be upsampled). It works surprisingly well: roughly two-thirds of the gain of the same amount of natural bitext.
  4. How does a multilingual translation model know which languages to translate between?
    Special tokens: a source-language token \(l_s\) for the encoder and a target-language token \(l_t\) for the decoder: \(h = \text{encoder}(x, l_s)\), \(y_{i+1} = \text{decoder}(h, l_t, y_{1:i})\).
  5. How can multilingual MT help low-resource languages?
    It can draw on a similar higher-resource language in the training data, e.g. understanding a Galician word through Spanish.
  6. What sociotechnical problems affect MT for low-resource languages?
    Native speakers are often not involved as curators, technologists or evaluators; audits found many multilingual corpora mostly of unacceptable quality (boilerplate, wrong translations); and resources focus on pairs involving English.
  7. Why did a participatory African MT project recommend evaluating by post-editing?
    Having labelers minimally edit MT output and measuring the distance is simpler to train evaluators for, and captures true errors rather than legitimate linguistic variation.

13.6 MT evaluation

  1. On what two dimensions are translations evaluated?
    Adequacy (faithfulness, fidelity): how well the translation captures the meaning of the source; and fluency: how grammatical, clear, readable and natural it is in the target language.
  2. How do human raters evaluate MT?
    Rate fluency and adequacy on scales (e.g. 1–5 or 1–100); bilingual raters compare with the source, monolingual raters with a reference translation; or rank pairs of candidates; or post-edit outputs and measure the edits.
  3. Why do human MT evaluations need rater training and normalization?
    Untrained raters struggle to separate fluency from adequacy, and raters disagree (ambiguous sources, different knowledge, different use of scales); outliers are removed and scores normalized per rater.
  4. What is the intuition behind overlap-based MT metrics?
    A good machine translation tends to contain the characters and words that occur in a human translation of the same sentence (going back to Miller & Beebe-Center, 1956).
  5. Define chrF.
    Character F-score: average the character n-gram precisions (chrP, \(n = 1..k\), fraction of hypothesis n-grams in the reference) and recalls (chrR, fraction of reference n-grams in the hypothesis), then combine: \(\text{chrF}_\beta = (1 + \beta^2)\frac{\text{chrP}\cdot\text{chrR}}{\beta^2\,\text{chrP} + \text{chrR}}\), usually with \(\beta = 2\) (recall weighted twice as much). Spaces are ignored.
  6. Compute chrF (\(k = \beta = 2\)) for HYP “witness of the past,” against REF “witness for the past,”.
    Without spaces: REF has 18 unigrams and 17 bigrams; HYP 17 and 16. Matches: 17 unigrams, 13 bigrams. chrP = (17/17 + 13/16)/2 ≈ .906; chrR = (17/18 + 13/17)/2 ≈ .855; chrF = 5·.906·.855/(4·.906 + .855) ≈ .86.
  7. How does BLEU differ from chrF?
    BLEU is word-based and precision-only: the geometric mean of clipped word n-gram precisions (n = 1..4) over the corpus, times a brevity penalty for too-short outputs. Being word-based, it is sensitive to tokenization (use SacreBLEU) and weaker for morphologically complex languages.
  8. How is statistical significance assessed for chrF comparisons?
    With the paired bootstrap (or randomization) test: resample pseudo-test sets; the middle 95% of their scores gives a confidence interval, and the share of pseudo-test sets where A beats B compares two systems.
  9. What are the limitations of overlap metrics like chrF and BLEU?
    They are very local (a moved phrase barely changes the score), can’t judge cross-sentence properties like discourse coherence, and compare very different systems poorly; they are best for evaluating changes to a single system.
  10. How do learned metrics like COMET and BLEURT evaluate translations?
    They train a predictor (a BERT-like model plus a linear layer) on datasets of human quality ratings of (reference, candidate) pairs; their outputs correlate highly with human judgments.
  11. How does BERTScore compare a candidate to a reference?
    It embeds both with BERT, scores token pairs by cosine, and greedily matches each reference token to its most similar candidate token (recall) and each candidate token to its most similar reference token (precision), combining them into F1. Tokens can be weighted by idf.

13.7 Bias and ethical issues

  1. How do MT systems exhibit gender bias?
    When translating from gender-neutral languages (Hungarian ő, often-dropped Spanish pronouns) into English, they default to male or follow stereotypes: “she is a nurse”, “he is a CEO”, amplifying biases beyond actual labor statistics.
  2. What does the WinoMT challenge set show?
    MT systems translate worse when sentences describe people in non-stereotypical gender roles (“The doctor asked the nurse to help her”).
  3. Why do MT systems need confidence estimates?
    They are used in urgent situations without human translators (medicine, law); to “do no harm” they should be able to abstain from giving incorrect translations.

Historical notes

  1. What was the ALPAC report, and what was its effect?
    A critical 1966 US report (Automatic Language Processing Advisory Committee) that led to dramatic funding cuts for MT and a call for basic research in computational linguistics; it also included an influential early evaluation study.
  2. What are the three classic MT architectures shown in the Vauquois triangle?
    Direct translation (word by word with a large bilingual dictionary), transfer (parse the source, transform the parse with rules, generate), and interlingua (analyze into an abstract meaning representation, generate from it). Deeper analysis needs less transfer knowledge.
    direct translationtransferinterlinguasource texttarget textanalysisgeneration
  3. How can the neural encoder-decoder be seen in terms of the Vauquois triangle?
    As an interlingual approach, with attention integrating direct and transfer approaches by letting the decoder access source words and their representations directly.
  4. What drove statistical MT around 1990, and what were the IBM Models?
    Large bilingual corpora like the Canadian Hansards and then the web. The IBM group, drawing on the noisy channel model of speech recognition, proposed generative IBM Models 1–5 (the Candide system), published in full detail.
  5. What were phrase-based translation and MERT?
    Phrase-based translation: a generative statistical approach that induces translations of phrase pairs. MERT (Minimum Error Rate Training): directly optimizing a discriminative log-linear model for metrics like BLEU. Toolkits: GIZA, Moses.
  6. What are transduction (synchronous) grammars?
    Grammars assigning parallel syntactic trees to a sentence pair, translating via reordering operations on the trees (e.g. inversion transduction grammar, synchronous CFGs).
  7. Who pioneered neural encoder-decoder MT?
    Kalchbrenner & Blunsom (2013, CNN encoder + RNN decoder); first applied to MT by Bahdanau et al. (2015); the transformer encoder-decoder by Vaswani et al. (2017).

Source