Skip to main content
QUICK REVIEW

[Paper Review] Multi-Head RAG: Solving Multi-Aspect Problems with LLMs

Maciej Besta, Ales Kubicek|ArXiv.org|Jun 7, 2024
Natural Language Processing TechniquesComputer Science3 citations
TL;DR

This paper introduces Multi-Head RAG (MRAG), a novel retrieval-augmented generation framework that leverages activations from multiple attention heads in a Transformer decoder instead of the final feed-forward layer to generate embeddings. By capturing distinct data aspects across heads, MRAG improves retrieval accuracy for multi-aspect queries—achieving up to 20% higher relevance than standard RAG baselines—without additional inference passes, storage, or model instances.

ABSTRACT

Retrieval-Augmented Generation (RAG) improves Large Language Models (LLMs) by retrieving supporting documents into the prompt, but existing methods do not explicitly target queries that require fetching multiple documents with substantially different content. Such multi-aspect queries are challenging because relevant documents can be far apart in embedding space, making joint retrieval difficult. We introduce Multi-Head RAG (MRAG), which addresses this gap with a simple yet powerful idea: using Transformer multi-head attention activations rather than the standard decoder-layer embedding, as retrieval keys. It leverages the observation that different heads capture different semantic aspects. This yields multi-aspect embeddings for both documents and queries, improving retrieval accuracy on complex queries. We show MRAG's design advantages over 18 RAG baselines, up to 20% higher retrieval success ratios for real-world use cases, and improved downstream LLM generation. MRAG integrates seamlessly with existing RAG frameworks and benchmarks.

Motivation & Objective

  • Address the challenge of retrieving multiple, semantically distant documents for complex, multi-aspect queries in RAG pipelines.
  • Overcome the limitation of standard RAG, where embeddings from a single decoder layer fail to capture diverse aspects of queries and documents.
  • Improve retrieval accuracy for real-world industrial queries requiring integration of heterogeneous information sources (e.g., maintenance logs, weather, personnel data).
  • Design a method that is compatible with existing RAG frameworks and benchmarking tools like RAGAS, without increasing computational or storage overhead.
  • Demonstrate the effectiveness of attention head activations as a source of multi-faceted embeddings for improved retrieval in complex, real-world scenarios.

Proposed method

  • Replace standard RAG embedding generation—based on the final feed-forward layer—with activations from the multi-head attention mechanism within the decoder block.
  • Utilize the distinct attention heads (e.g., 96 in GPT-3) as separate embedding sources, each capturing different semantic aspects of the input.
  • Generate multiple query and document embeddings per input, one per attention head, enabling retrieval of documents with diverse content facets.
  • Apply retrieval using these head-specific embeddings, allowing the system to retrieve documents that are semantically distant in standard embedding space but relevant from different perspectives.
  • Integrate seamlessly with existing RAG pipelines, including vector databases, retrieval systems, and downstream evaluation tools like RAGAS.
  • Support integration with additional retrieval enhancements such as cross-encoder reranking or knowledge graph-based structuring without architectural changes.

Experimental results

Research questions

  • RQ1Can leveraging multiple attention head activations improve retrieval accuracy for queries requiring information from semantically distant documents?
  • RQ2How does MRAG perform compared to standard RAG baselines on multi-aspect queries involving diverse data facets (e.g., historical, technical, environmental)?
  • RQ3To what extent does MRAG reduce retrieval failure for complex, real-world industrial queries that span multiple domains?
  • RQ4Can MRAG be deployed without increasing inference cost, storage, or model complexity compared to standard RAG?
  • RQ5How does MRAG’s performance scale across synthetic and real-world datasets with varying degrees of multi-aspectuality?

Key findings

  • MRAG improves retrieval relevance by up to 20% compared to standard RAG baselines on multi-aspect queries, as measured by dedicated evaluation metrics.
  • The method effectively retrieves documents with significantly different semantic content—such as historical figures and technological timelines—by exploiting distinct attention head representations.
  • MRAG achieves higher accuracy without requiring additional LLM inference passes, multiple model instances, or increased storage, making it computationally efficient.
  • The approach is compatible with existing RAG frameworks and benchmarking tools like RAGAS, enabling plug-and-play integration into current pipelines.
  • Evaluation on synthetic and real-world datasets confirms that attention head activations capture complementary aspects of queries and documents, enhancing retrieval coverage and precision.
  • MRAG outperforms standard RAG in scenarios involving multi-faceted industrial queries, such as root cause analysis in chemical plants requiring integration of personnel, equipment, and environmental data.

Read this paper

Open the full text in the Nubint reader and ask about any passage as you read.

Read this paper on Nubint

This review was generated by AI from the original paper. Please check the paper before citing it.