# What are the keys and values of the attention model for the encoder and decoder in the "Attention Is All You Need" paper?

I have recently encountered the paper on NLP. It is very new to me and I am still unable to see how that works. I have used all the resources over there from the original paper to Youtube videos and the very famous "Illustrated Transformer".

Suppose I have a training example of "I am a student" and I have the respective French as "Je suis etudient".

I want to know how these 3 words are converted to 4 words. What are the query, keys, values?

This is my understanding of the topic so far.

The encoder part is:

• Query: a single word embedded in a vector form. such as "I" expressed as a vector of length 5 as $$[.2, 0.1, 0.4, 0.9, 0.44]$$.

• Keys: the matrix of all the vectors or in simple words, a matrix that has all the words from a sentence in the form of embeddings.

• Values = Keys

For decoder:

• Query: the input word in the form of a vector (which is output given by the decoder from the previous pass).

• Keys = values = outputs from the encoder's layers.

BUT there are 2 different attention layers and one of which do not use the encoder's output at all. So, what are the keys and values now? (I think they are just like encoder, but just the generated until that pass)?