# What is the difference between RAG-Sequence Model and RAG-Token Model?

When I start to learn about RAG, I can't understand the difference between the RAG-Sequence Model and RAG-Token Model.

First of all, I see that for RAG-Sequence Model we use just one document to generate the hole output and for RAG-Token Model for each token we use all the k document chosen.

But, when I see the equation in the paper, I can't understand why they make a summation in the case of RAG-Sequence Model while we generate the output from one document.

In the first equation, you can see that in the sequence likelihood (the big product) $$z$$ is constant, which means that you first find which are the interesting documents, than you give your LLM these document, and you ask it to answer (for the whole generation, these documents are always the same)
In the second case, you can see that for every step ($$i$$), you have a corresponding $$z_i$$ (a set of documents) that is used in the summation. However, you can see that that summation is just an expectation for the $$y_i$$ token. This means that, if earlier you first find K documents and then generate an answer, now you have to find interesting documents every time you have to sample a token.