Let's consider language translation and let $I_1,\ldots,I_{N_i}$ be the $N_i$ input tokens. My understanding is that the encoder produces $N_i$ embeddings, which I will refer to as $E_1,\ldots,E_{N_i}$. In what follows, let's consider what happens at inference time and not during training. My understanding is that the decoder has multiple inputs and they possibly change when he produces the different output tokens. If considering a single decoder module, I guess it makes sense to distinguish between the external inputs that are fed into the multi-head attention module and the ones that go into the masked multi-head attention module as shown below.
Here are now my questions:
- Is it correct that what comes from the left into the multi-head attention modules are always the encoder embeddings $E_1,\ldots,E_{N_i}$?
- I believe to understand that the bottom input to the masked multi-head attention module is not always the same and depends on the iteration we find ourselves in, i.e. which output token we predict and which decoder module is considered if there are multiple. More precisely, is it true that for the first prediction, i.e. when predicting the first output token, the sole input to the first decoder module is the embedding of the 'START' token plus positional encoding?
- What are the bottom inputs of the different decoder modules when predicting the individual output tokens?