Exercise 2: What Attention Weights Actually Represent — Possible Solution ==================================================================== WHAT HAPPENS WHEN THE DECODER GENERATES "noir" ------------------------------ Per this chapter's own example, translating "the black cat" into French, when the decoder is generating the output word "noir" (black), it computes an attention score against every one of the encoder's own hidden states — one score for "the," one for "black," one for "cat." Those scores are passed through softmax to produce weights that sum to 1, and a weighted blend of the encoder's hidden states — the "context" vector — is built using those weights, rather than relying on one fixed summary vector the way plain seq2seq (this chapter's own earlier section) does. WHY "black" WOULD RECEIVE THE HIGHEST WEIGHT HERE ------------------------------ The attention scores are computed from how relevant each source word's hidden state is to what the decoder is currently trying to produce. Since "noir" is specifically the translation of "black," the encoder's own hidden state for "black" is the one most relevant to this exact generation step, so the learned scoring function assigns it the highest weight — "the" and "cat" would receive comparatively small weights, since they're far less relevant to producing "noir" specifically, even though they were still part of the sentence the encoder processed. WHY THIS IS A GENUINE, INTERPRETABLE LINK ------------------------------ Per this chapter, this gives "a direct, interpretable link between output and source" — for any word the decoder generates, the attention weights reveal exactly which source word(s) it drew most heavily from. This is a real, inspectable artifact of the model's own computation, not an interpretation imposed afterward. WHY THE SINGLE FIXED VECTOR COULD NEVER PROVIDE THIS ------------------------------ In plain seq2seq, the decoder only ever has access to one fixed-size summary vector produced once, at the very end of encoding the entire sentence. That vector has already blended every source word together before the decoder even starts generating, with no record kept of which part of it came from which source word. There is no way to ask "which source word most influenced this specific output word," because by the time the decoder sees anything, that information has already been irreversibly compressed away. Attention's own per-step, per-source-word weighting is precisely what restores this — a fresh, word-relevant blend computed at every single decoding step instead of one blend computed once for the whole sentence. WHY THIS WORKS AS AN ANSWER ------------------------------ It traces through this chapter's own worked example to show concretely why "black" would receive the highest attention weight when generating "noir," and explains specifically why the single fixed encoder vector in plain seq2seq structurally cannot provide the same per-output-word, per-source-word relevance information that attention weights make directly visible.