Fusion-in-decoder

On this page 7

Fusion-in-decoder (FiD) is a retrieval-augmented generation architecture in which an encoder-decoder model encodes each retrieved passage independently together with the question, concatenates all the encoded representations, and lets a single decoder attend to every passage at once while generating the answer. In artificial intelligence, and specifically in the Retrieval & knowledge area, it is one of the most influential reader designs for open-domain question answering.

The architecture was introduced in 2020 by Gautier Izacard and Edouard Grave and published at EACL 2021. Its key contribution is showing that evidence fusion can happen inside the decoder, which lets a model read tens or hundreds of passages at a cost that grows linearly rather than quadratically with the number of passages.

How fusion-in-decoder processes retrieved passages

FiD is a reader, not a retriever: it assumes that a separate retriever has already returned a ranked list of passages. The original work used both BM25 sparse retrieval and Dense passage retrieval (DPR), and paired them with a pretrained T5 encoder-decoder model.

  1. The retriever returns the top N passages, typically 25 to 100 passages of about 100 words each.
  2. Each passage is formatted as a separate input such as question: ... title: ... context: ....
  3. The encoder processes each question-passage pair independently, so self-attention never spans two passages.
  4. The encoder outputs are concatenated into one long sequence of N times L token vectors.
  5. The decoder generates the answer with cross-attention over the full concatenated sequence, combining evidence across passages.

The separation matters because encoder self-attention is quadratic in input length. Encoding 100 passages of 250 tokens as one 25,000-token sequence would be prohibitive, while encoding 100 short sequences is cheap and parallel. The decoder still sees everything, but cross-attention is linear in the encoder length for each generated token.

Why the decoder is the right place for fusion

Earlier extractive readers scored passages one at a time and selected an answer span from the best one, which made them weak at aggregating evidence spread across documents. FiD lets the decoder weigh partial clues from several passages, so the answer can reflect agreement among multiple sources instead of a single top hit.

The authors reported that accuracy kept rising as the number of passages grew from 5 to 100, a finding that distinguished FiD from extractive readers, whose gains flattened early. A large FiD model reached roughly 51 percent exact match on Natural Questions and roughly 68 percent on TriviaQA at publication, a strong result for its size. The table summarizes the scaling behavior qualitatively.

Passages readEvidence coverageCompute costTypical accuracy trend
5 to 10Answer often missingLowClearly below best
25 to 50Most answers presentModerateLarge gains
100Near retriever recall limitHigh, decoder-dominatedBest in original study
More than 100Mostly redundant passagesVery highSmall or no gains
Effect of the number of passages on a FiD reader

The cross-attention weights of a trained FiD model also turned out to be useful relevance signals. A follow-up method distilled these attention scores into the retriever, training a dense retriever without labeled passage annotations, an approach often called FiD-KD.

Fusion-in-decoder compared with other retrieval-augmented designs

FiD occupies a specific point in the design space of retrieval-augmented models. Its neighbors differ in where retrieved text enters the network and whether the retriever is trained jointly.

ArchitectureWhere retrieved text entersCross-passage interactionMain trade-off
Extractive readerEncoder, one passage at a timeNoneCannot combine evidence
Concatenation readerOne long encoder inputFull self-attentionQuadratic cost limits passages
Fusion-in-decoderSeparate encoder passesDecoder cross-attention onlyDecoder memory grows with N
REALMEncoder, with retriever trained end to endMarginalized over passagesCostly index refresh
RETROChunked cross-attention in decoder layersPer chunk of generated textRequires retrieval during pretraining
Decoder-only RAG promptPrompt context of a large language modelFull self-attentionLong context cost and position bias
FiD and related reader architectures

In modern RAG systems built on decoder-only language models, passages are usually concatenated into the prompt, which reintroduces quadratic attention. FiD remains relevant where a compact, fine-tuned reader is preferred, and its ideas reappear in systems such as Atlas, which pairs a FiD reader with a jointly trained retriever.

Efficiency bottlenecks and later variants

Although the encoder is efficient, analysis published in 2022 showed that most inference time is spent in the decoder, because every generated token performs cross-attention over tens of thousands of encoder vectors and must load large key-value tensors from memory. This memory bandwidth bottleneck motivated several variants.

VariantCore changeEffect
FiDOLayer-sparse cross-attention, multi-query attentionMuch faster decoding at similar accuracy
FiD-LightKeeps only first k vectors per passageShorter decoder input, lower latency
FiD-KDDistills reader attention into retrieverBetter retrieval without labels
Passage reranking before FiDFewer, better passagesLower cost with modest accuracy loss
Selected FiD efficiency variants

In practice, engineers tune N, passage length and decoder size together. Halving the number of passages roughly halves decoder cross-attention work, while a stronger reranking stage often recovers most of the lost accuracy.

Limitations and common misconceptions

FiD is powerful but bounded by its inputs and its training setup. The most frequent problems come from retriever recall, answer format and long outputs.

  • Retriever recall caps accuracy: if no passage contains the answer, the decoder can only guess or hallucinate.
  • Short answers were the original target; long-form generation multiplies decoder cost and exposes weaker grounding.
  • No cross-passage reasoning in the encoder: multi-hop questions that need one passage to reinterpret another rely entirely on the decoder.
  • A common misconception is that FiD retrieves by itself; it is a reader and always depends on an external retriever.
  • Fine-tuning is required: a FiD reader must be trained on question-answer pairs, unlike prompt-based RAG with an instruction-tuned model.

The simple explanation

Imagine you ask a question and receive a stack of one hundred short articles. Reading all of them glued together as one huge document would be slow. Fusion-in-decoder takes a smarter route. It reads each article on its own and writes a compact note about it.

Then a single writer looks at all the notes together and composes the answer. The writer can notice that five notes agree and one disagrees. That is the fusion. The approach is fast because the expensive reading is split into small pieces. The final answer still uses every piece of evidence.

How it is used in practice

A pharmaceutical company builds an internal question-answering assistant over two million pages of study reports and regulatory submissions. A dense retriever returns the top 50 passages of about 200 tokens for each employee question, and a fine-tuned T5-based FiD reader generates a short answer such as a dosage range or a study endpoint.

During evaluation, the team finds that answers improve steadily from 10 to 50 passages but not beyond, and that decoder latency dominates response time. They add a cross-encoder reranker, cut the input to 30 passages and keep accuracy within one point of the original. Median latency drops by about a third, and analysts get sourced answers in under two seconds instead of searching documents manually.