Fusion-in-Decoder (FiD) is a Transformer architecture designed for open-domain question answering that scales efficiently to large retrieval sets. Unlike traditional RAG approaches that concatenate all retrieved passages into a single prompt, FiD encodes each passage independently in the encoder, then fuses the resulting representations in the decoder via cross-attention, allowing the model to reason jointly over hundreds of documents without quadratic complexity blowup in the encoder.
Glossary
Fusion-in-Decoder (FiD)

What is Fusion-in-Decoder (FiD)?
Fusion-in-Decoder is an encoder-decoder architecture for knowledge-intensive tasks that processes each retrieved document passage independently in the encoder and performs joint reasoning over all passages in the decoder through cross-attention.
The architecture exploits the asymmetry between encoding and decoding costs: the encoder processes each passage in isolation, making its cost linear with respect to the number of retrieved documents, while the decoder attends to all encoded passages simultaneously. This design enables FiD to leverage significantly more retrieved context than concatenation-based methods, improving factual grounding on knowledge-intensive benchmarks like Natural Questions and TriviaQA while maintaining computational tractability.
Key Architectural Features
The core architectural innovations that enable Fusion-in-Decoder to perform joint reasoning over hundreds of retrieved passages without quadratic complexity blowup.
Independent Passage Encoding
Each retrieved document passage is processed independently through the encoder, producing a set of hidden representations for every passage. This avoids the quadratic complexity of concatenating all passages into a single input sequence. The encoder uses a standard T5 architecture and processes passages in parallel, scaling linearly with the number of retrieved documents.
- Encoder input:
question:token followed by passage tokens - Each passage produces its own set of encoder hidden states
- Passages do not attend to each other during encoding
- Enables scaling to 100+ retrieved passages efficiently
Joint Cross-Attention Decoder
The decoder performs cross-attention over the concatenated hidden states from all encoded passages simultaneously. This is the 'fusion' step—the decoder can attend to tokens across all retrieved documents when generating each output token, enabling it to synthesize evidence from multiple sources.
- Decoder cross-attention spans the union of all passage representations
- Enables multi-hop reasoning across disparate documents
- No passage-level bottleneck; all evidence is accessible at every generation step
- Contrasts with extract-then-read pipelines that isolate passages
Linear Scaling with Retrieval Depth
FiD's computational cost scales linearly with the number of retrieved passages (O(n)) rather than quadratically (O(n²)). This is because self-attention is confined to individual passages in the encoder, while the decoder's cross-attention cost grows linearly with the total token count across all passages.
- Encoder self-attention: bounded by passage length, not corpus size
- Decoder cross-attention: O(total_tokens) across all passages
- Practical for n=100 passages at standard sequence lengths
- Enables retrieval-augmented generation at scale without prohibitive compute
Sequence-to-Sequence Foundation
FiD is built on the T5 (Text-to-Text Transfer Transformer) encoder-decoder architecture. The text-to-text framing means both the input (question + passages) and output (answer) are treated as text strings, enabling a unified training objective: maximum likelihood estimation over the target answer tokens.
- Initialized from pre-trained T5 weights (e.g., T5-base, T5-large)
- Fine-tuned on knowledge-intensive tasks like open-domain QA
- Output is generated autoregressively, token by token
- Leverages T5's strong transfer learning capabilities
Evidence Aggregation Without Extraction
Unlike extractive QA systems that must first identify a single answer span within a specific passage, FiD performs abstractive generation by fusing information from all passages in the decoder. This allows the model to synthesize answers that are not verbatim present in any single retrieved document.
- Generates answers that may combine facts from multiple passages
- Handles conflicting evidence through learned weighting in cross-attention
- No hard commitment to a single source passage
- Produces more coherent, natural-language answers than extractive methods
Training with Retrieved Evidence
FiD is trained end-to-end using supervised learning on question-answer pairs where the input includes retrieved passages from a dense retriever (typically DPR). The model learns to ignore irrelevant passages and focus cross-attention on evidence-bearing tokens, developing robustness to retrieval noise.
- Training data: (question, retrieved_passages, ground_truth_answer) triples
- Retriever is typically frozen; FiD learns to leverage its outputs
- Loss: standard cross-entropy over generated answer tokens
- Naturally handles distractor passages without explicit noise modeling
FiD vs. Alternative Retrieval-Augmented Architectures
A technical comparison of Fusion-in-Decoder against other dominant paradigms for integrating retrieved documents into language model generation, evaluated across key architectural and performance dimensions.
| Feature | Fusion-in-Decoder (FiD) | Retrieval-Augmented Generation (RAG) | REALM / DPR + Reader |
|---|---|---|---|
Fusion Point | Decoder cross-attention over all passages jointly | Prompt concatenation before encoder input | Separate reader model processes single passage |
Encoder Processing | Each passage encoded independently in parallel | All passages concatenated and encoded together | Single passage encoded per forward pass |
Cross-Passage Reasoning | |||
Computational Complexity | O(N) encoding, O(N^2) decoding attention | O(N^2) self-attention over full concatenated input | O(N) linear scaling with passage count |
Scalability to Many Passages | Scales to 100 passages efficiently | Limited by context window and quadratic attention | Requires iterative re-ranking or top-1 selection |
Evidence Aggregation | Joint reasoning over all retrieved evidence | Implicit aggregation via self-attention | No aggregation; single passage per prediction |
Typical Use Case | Open-domain QA with multiple supporting documents | General-purpose grounded generation | Factoid QA with single-answer extraction |
Hallucination Mitigation | Strong; decoder attends to all evidence simultaneously | Moderate; prone to lost-in-the-middle effects | Weak; no cross-document verification |
Real-World Applications of FiD
Fusion-in-Decoder (FiD) moves beyond academic benchmarks to power production systems that require synthesizing answers from massive, heterogeneous document collections. These applications leverage FiD's core strength: processing hundreds of passages independently before fusing them into a single, coherent response.
Open-Domain Question Answering
FiD is the foundational architecture for answering complex, fact-seeking queries against a corpus of millions of documents, such as Wikipedia.
- Mechanism: A retriever fetches 100+ relevant passages; the encoder processes each independently; the decoder performs cross-attention over all passages simultaneously to generate a single answer.
- Example: Answering "What is the primary function of the ribosome in a eukaryotic cell?" requires synthesizing evidence from multiple biology articles.
- Key Advantage: Unlike RAG, which prepends text to the prompt, FiD allows the decoder to jointly reason over all evidence, mitigating the Lost-in-the-Middle problem.
Multi-Document Summarization
FiD excels at generating a concise, fluent summary from a large collection of documents on a single topic, such as news articles or financial reports.
- Workflow: The encoder processes each document chunk independently, and the decoder generates a summary that aggregates key points, resolves contradictions, and eliminates redundancy.
- Enterprise Use Case: Automatically generating an executive briefing from a day's worth of market reports, press releases, and analyst notes.
- Technical Benefit: The encoder-decoder structure provides more generative control than extractive methods, producing abstractive summaries that are more coherent.
Conversational AI with Grounding
FiD powers chatbots that must answer user questions by grounding every claim in a specific, retrievable document from a knowledge base.
- Architecture: User query and dialogue history are used to retrieve relevant support articles. FiD fuses these articles to generate a response with citation integrity.
- Example: A customer support bot for a software company that answers technical questions by synthesizing steps from multiple documentation pages.
- Why FiD: It reduces hallucination by forcing the decoder to attend to all provided evidence, making it ideal for regulated industries like finance and healthcare.
Fact Verification & Claim Checking
FiD is used to verify the truthfulness of a claim by aggregating evidence from a corpus of trusted sources and generating a verdict.
- Process: A claim is input, a retriever finds supporting and refuting evidence, and FiD's decoder generates a label (e.g., SUPPORTS, REFUTES, NOT ENOUGH INFO) along with a rationale.
- Application: Automated fact-checking pipelines for newsrooms or social media platforms to combat misinformation at scale.
- Architectural Fit: The model's ability to weigh conflicting evidence from multiple passages in the decoder is critical for nuanced verdicts.
Clinical Evidence Synthesis
In biomedicine, FiD synthesizes answers to clinical questions from a corpus of research abstracts and trial reports, such as PubMed.
- Task: Given a PICO (Population, Intervention, Comparison, Outcome) query, retrieve relevant studies and generate a summary of clinical efficacy.
- Impact: Dramatically reduces the time clinicians spend on systematic literature reviews by providing an initial, evidence-grounded synthesis.
- Domain Adaptation: FiD models are often fine-tuned on biomedical corpora to handle specialized terminology and complex entity relationships.
Legal Document Analysis
FiD processes large volumes of case law and contracts to answer complex legal questions that require reasoning over multiple precedents.
- Mechanism: A query about a legal principle retrieves hundreds of relevant case snippets. FiD's decoder performs joint reasoning to identify the controlling precedent and generate a synthesized answer.
- Use Case: A legal research tool that answers "Under what circumstances is a liquidated damages clause considered an unenforceable penalty?" by analyzing dozens of cases.
- Key Requirement: The architecture's ability to handle long-range dependencies across documents is essential for tracing legal reasoning chains.
Frequently Asked Questions
Explore the architectural mechanics and practical implications of Fusion-in-Decoder, a powerful encoder-decoder paradigm designed to scale knowledge-intensive language tasks by processing hundreds of retrieved passages independently before fusing them in the decoder.
Fusion-in-Decoder (FiD) is an encoder-decoder architecture for knowledge-intensive NLP tasks that processes each retrieved document passage independently in the encoder and performs joint reasoning over all passages in the decoder through cross-attention. Unlike traditional Retrieval-Augmented Generation (RAG) models that concatenate all retrieved documents into a single long prompt, FiD encodes every passage separately. This isolates the self-attention computation to within each passage, reducing the quadratic complexity penalty of processing long concatenated sequences. The decoder then attends to the concatenated representations of all encoded passages simultaneously, allowing the model to aggregate evidence scattered across multiple sources to generate a single, coherent answer. This design enables FiD to scale to processing hundreds of knowledge source passages, such as 100 Wikipedia paragraphs, without exceeding typical GPU memory limits during encoding.
Enabling Efficiency, Speed & Accuracy
Intelligent Analysis, Decision & Execution
We build AI systems for teams that need search across company data, workflow automation across tools, or AI features inside products and internal software.
Talk to Us
Search across company data
Give teams answers from docs, tickets, runbooks, and product data with sources and permissions.
Useful when people spend too long searching or get different answers from different systems.

Automate internal workflows
Use AI to route work, draft outputs, trigger actions, and keep approvals and logs in place.
Useful when repetitive work moves across multiple tools and teams.

Add AI to products and internal tools
Build assistants, guided actions, or decision support into the software your team or customers already use.
Useful when AI needs to be part of the product, not a separate tool.
Related Terms
Explore the core components and related retrieval-augmented generation techniques that interact with the Fusion-in-Decoder paradigm for knowledge-intensive NLP tasks.
Cross-Attention Mechanism
The core architectural component that enables FiD's decoder to perform joint reasoning. In the Transformer decoder, cross-attention allows every generated token to attend to the hidden representations of all tokens from all retrieved passages simultaneously. This is the mechanism that fuses information from multiple independent sources, distinguishing it from encoder-only fusion methods.
Encoder-Decoder Architecture
FiD is fundamentally built on a sequence-to-sequence encoder-decoder framework, typically T5. The encoder processes each retrieved passage independently, generating a set of hidden representations. The decoder then uses cross-attention to aggregate these representations. This separation is critical for FiD's scalability, as encoder computation is linear with the number of passages.
Re-ranking for FiD Pipelines
A critical optimization step where a more precise, computationally intensive model re-scores the initial set of retrieved documents before they enter the FiD encoder. Effective re-ranking ensures that the most semantically relevant passages occupy the limited input slots, maximizing the quality of the decoder's joint reasoning and preventing the dilution of the attention mechanism with noisy text.
Knowledge-Intensive NLP Tasks
The class of problems FiD was designed to solve. These tasks require access to a large corpus of external world knowledge that cannot be stored in a model's parameters. Examples include:
- Open-domain Question Answering: Answering factoid questions without a specified context.
- Fact Verification: Checking the veracity of a claim against a knowledge source.
- Dialogue Generation: Producing knowledgeable responses grounded in external documents.

About the author
Prasad Kumkar
CEO & MD, Inference Systems
Prasad Kumkar is the CEO & MD of Inference Systems and writes about AI systems architecture, LLM infrastructure, model serving, evaluation, and production deployment. Over 5+ years, he has worked across computer vision models, L5 autonomous vehicle systems, and LLM research, with a focus on taking complex AI ideas into real-world engineering systems.
His work and writing cover AI systems, large language models, AI agents, multimodal systems, autonomous systems, inference optimization, RAG, evaluation, and production AI engineering.
Partnered with leading AI, data, and software stack.
How We Work
Custom AI workflows for your Business
One-fit-all AI don't work for modern businesses. At Inferensys, we aim to understand your business & custom requirements; which we use to define most efficient agentic workflows, the data, and the tools for your business.
01
Review the use case
We understand the task, the users, and where AI can actually help.
Read more02
Pick the right approach
We define what needs search, automation, or product integration.
Read more03
Build the first useful version
We implement the part that proves the value first.
Read more04
Improve from there
We add the checks and visibility needed to keep it useful.
Read moreThe first call is a practical review of your use case and the right next step.
Talk to Us