TLDR: A new research paper introduces Layer Fused Decoding (LFD), a decoding strategy for Retrieval-Augmented Generation (RAG) systems. LFD improves how large language models (LLMs) utilize external knowledge by identifying and fusing representations from specific intermediate layers that are most effective at integrating factual information. This approach helps to overcome the LLM’s tendency to over-rely on internal, potentially outdated knowledge, leading to more accurate generations with minimal computational overhead.
Large Language Models (LLMs) have become incredibly powerful, but they often struggle with providing accurate and up-to-date information, sometimes even making things up, a phenomenon known as hallucination. To combat this, a technique called Retrieval-Augmented Generation (RAG) was developed. RAG helps LLMs by giving them access to external knowledge, like documents or databases, during the generation process. This allows the models to adapt to new information and perform better on tasks that require specific knowledge.
Surprisingly, recent studies have shown that adding a bit of ‘noise’ – irrelevant documents or tokens – to the retrieved information can actually help LLMs use external knowledge more effectively and improve the quality of their generated text. While this seems counterintuitive and isn’t always practical, it offers a unique way to study how LLMs integrate external information.
A new research paper, titled “LFD: Layer Fused Decoding to Exploit External Knowledge in Retrieval-Augmented Generation”, delves into this phenomenon. The authors, Yang Sun, Lixin Zou, Dan Luo, Zhiyong Xie, Long Zhang, Liming Dong, Yunwei Zhao, Xixun Lin, Yanxiong Lu, and Chenliang Li, propose a novel approach to enhance RAG systems. You can read the full paper here.
Understanding How LLMs Learn: A Layer-by-Layer Breakdown
The core insight of this paper is that different layers within an LLM handle information in distinct ways. The researchers found a clear functional division:
-
Shallow Layers: These layers are primarily concerned with understanding the immediate, local context of the input text.
-
Intermediate Layers: These layers are crucial for integrating long-range external factual knowledge from the retrieved documents.
-
Deeper Layers: As the model goes deeper, it tends to rely more on its own pre-trained, internal knowledge, which can sometimes lead to outdated information or hallucinations if it contradicts the provided external context.
This means that while external knowledge is integrated in the middle layers, the deeper layers might sometimes override this with their internal, potentially incorrect, information. Imagine an LLM being asked “Who has more La Liga titles, Real Madrid or Barcelona?” If the retrieved document correctly states Real Madrid has 33 and Barcelona 25, shallow layers will process the words, intermediate layers will identify the factual answer, but deeper layers might still lean towards a common misconception (e.g., Barcelona) based on their internal knowledge.
Introducing Layer Fused Decoding (LFD)
Building on this understanding, the researchers propose a simple yet effective decoding strategy called Layer Fused Decoding (LFD). The main idea behind LFD is to directly combine the representations from an optimal intermediate layer (where external knowledge is best integrated) with the final output of the LLM. This fusion helps to fully exploit the external factual knowledge and prevent the deeper layers from overriding it with potentially incorrect internal knowledge.
To identify the “optimal” intermediate layer for fusion, LFD introduces an Internal Knowledge Score (IKS). This score helps pinpoint the layer in the latter half of the model that shows the least reliance on its internal parametric knowledge, indicating it’s still strongly influenced by the external context. By selecting this layer, LFD ensures that the most accurate external signals are preserved and used in the final generation.
Also Read:
- Enhancing LLM Responses: A New Method for Factual Accuracy and Natural Language
- New Research Uncovers How Quantization Affects Different Types of Knowledge in Large Language Models
Benefits and Performance
The experimental results across various benchmarks and different LLMs (like Llama2-7B, Mistral-7B, DeepSeek-7B, and Qwen3-8B) demonstrate that LFD significantly improves the ability of RAG systems to use retrieved context knowledge effectively. It consistently outperforms traditional decoding methods and even matches or exceeds the performance of noise-injection strategies, but with a crucial advantage: minimal computational cost.
Unlike noise injection, which can increase processing time and memory usage, LFD operates efficiently at inference time, requiring no additional fine-tuning or architectural changes to the LLM. This makes it easy to integrate into existing RAG pipelines. The paper shows that LFD incurs only a slight increase in latency and memory usage compared to a noise-free baseline, while offering substantial gains in factual accuracy.
In essence, LFD provides a principled and efficient way to ensure that LLMs truly leverage the external knowledge provided to them, leading to more accurate and trustworthy responses in RAG applications.


