SYNTOLOGY HomeExplorerAtlasCodeMethodologyAboutDevelopersFeedPricing
Paper · 2406.13249 · 2024

R^2AG: Incorporating Retrieval Information into Retrieval Augmented Generation

arXiv · PDF · Open in the Atlas

Code that ran

We lifted 4 functions out of this paper's own repositories and ran 2 of them in a sandbox. "Ran" means the function executed on a synthesized input and returned a value. It is not a reproduction of the paper's results.

RepositoryRoleRan
yefd/RRAG canonical 2 of 4
FunctionStatusWhere it lives
load_data_json Ran yefd/RRAG/retrieval/feature_extraction.py
code served (permissive licence) · get_code("f39fb2a25482d66b")
load_data_jsonl Ran yefd/RRAG/retrieval/feature_extraction.py
code served (permissive licence) · get_code("eaecb3b1dff0a3ab")
load_data_json Not yet run yefd/RRAG/retrieval/finetune_retriever.py
code served (permissive licence) · get_code("8185c033c7aea209")
load_data_jsonl Not yet run yefd/RRAG/retrieval/finetune_retriever.py
code served (permissive licence) · get_code("b5e93ee6eb84d025")

Repositories linked to this paper

Some links come from the archived Papers with Code dataset (CC BY-SA 4.0): attribution and licence.

Abstract

Retrieval augmented generation (RAG) has been applied in many scenarios to augment large language models (LLMs) with external documents provided by retrievers. However, a semantic gap exists between LLMs and retrievers due to differences in their training objectives and architectures. This misalignment forces LLMs to passively accept the documents provided by the retrievers, leading to incomprehension in the generation process, where the LLMs are burdened with the task of distinguishing these documents using their inherent knowledge. This paper proposes R$^2$AG, a novel enhanced RAG framework to fill this gap by incorporating Retrieval information into Retrieval Augmented Generation. Specifically, R$^2$AG utilizes the nuanced features from the retrievers and employs a R$^2$-Former to capture retrieval information. Then, a retrieval-aware prompting strategy is designed to integrate retrieval information into LLMs' generation. Notably, R$^2$AG suits low-source scenarios where LLMs and retrievers are frozen. Extensive experiments across five datasets validate the effectiveness, robustness, and efficiency of R$^2$AG. Our analysis reveals that retrieval information serves as an anchor to aid LLMs in the generation process, thereby filling the semantic gap.

For agents

The same record, over MCP at https://syntology.ai/mcp:

get_harvested_code_for_paper("2406.13249")
get_code_for_paper("2406.13249")
have("2406.13249")

Connect an agent — have() is free.