Natural Language Processing · free preview

Machine Translation with Encoder-Decoders

How languages diverge in word order, lexicon, and omissions, the cross-attention encoder-decoder that maps between them, beam search decoding, and chrF evaluation.

1. Machine Translation with Encoder-Decoders

Machine Translation with Encoder-Decoders

2. The encoder-decoder with cross-attention

The encoder-decoder with cross-attention

3. Beam search and evaluation

Beam search and evaluation

4. Beam search and chrF in NumPy

Beam search and chrF in NumPy

5. Reading a typological map

Which set of typological statements about translation divergences is correct?

6. Where cross-attention looks

In the decoder's cross-attention layer, where do the queries, keys, and values come from?

7. Greedy versus a beam of two

A decoder's first-token probabilities are fog 0.60.6 and mist 0.40.4. After fog, the next token is bank with 0.50.5 then end with 1.01.0; after mist, the next token is shoal with 0.950.95 then end with 1.01.0. Compute the probability of greedy's complete output and of the beam's best output, then give the beam path's probability.

8. Dividing the score by length

Why do beam search implementations divide each hypothesis's log probability by its length before comparing finished candidates?

9. chrF with one wrong character

The reference is 'red fishing boat' and a candidate is 'red fishing boot'. With k=2k = 2, chrF ignores spaces, averages unigram and bigram precision into chrP and recall into chrR, then computes chrF2=5⋅P⋅R4P+R\text{chrF}_2 = \frac{5 \cdot P \cdot R}{4P + R}. Compute chrP, rounding to three decimals.

Practice this interactively

Free account · instant grading · spaced review that schedules itself.

Start this course for free