SYNTOLOGY HomeExplorerAtlasCodeMethodologyAboutDevelopersFeedPricing
Paper · 2409.16146 · 2024

Controlling Risk of Retrieval-augmented Generation: A Counterfactual Prompting Framework

arXiv · PDF · Open in the Atlas

Code that ran

We lifted 8 functions out of this paper's own repositories and ran 5 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
ict-bigdatalab/rc-rag canonical 5 of 8
FunctionStatusWhere it lives
count_fold Ran ict-bigdatalab/rc-rag/code/our_method.py
pointer only (licence: NONE) · get_code("a8a8836d932ec18f")
extract_ans_evi Ran ict-bigdatalab/rc-rag/code/utils.py
pointer only (licence: NONE) · get_code("d6996f6829d28ba0")
get_init_message Ran ict-bigdatalab/rc-rag/code/llm_ours.py
pointer only (licence: NONE) · get_code("7aecd499e2dfa745")
get_new_message Ran ict-bigdatalab/rc-rag/code/llm_ours.py
pointer only (licence: NONE) · get_code("72c89a81b7984d11")
get_single_prompt Ran ict-bigdatalab/rc-rag/code/prompt.py
pointer only (licence: NONE) · get_code("3edffed8712da81b")
deal_prediction_with_evidence Not yet run ict-bigdatalab/rc-rag/code/utils.py
pointer only (licence: NONE) · get_code("e98c8fc431c41f5d")
get_llm_result Not yet run ict-bigdatalab/rc-rag/code/llm_ours.py
pointer only (licence: NONE) · get_code("6d1b76b609c84a4a")
has_answer Not yet run ict-bigdatalab/rc-rag/code/utils.py
pointer only (licence: NONE) · get_code("485983d5215ab6e1")

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 emerged as a popular solution to mitigate the hallucination issues of large language models. However, existing studies on RAG seldom address the issue of predictive uncertainty, i.e., how likely it is that a RAG model's prediction is incorrect, resulting in uncontrollable risks in real-world applications. In this work, we emphasize the importance of risk control, ensuring that RAG models proactively refuse to answer questions with low confidence. Our research identifies two critical latent factors affecting RAG's confidence in its predictions: the quality of the retrieved results and the manner in which these results are utilized. To guide RAG models in assessing their own confidence based on these two latent factors, we develop a counterfactual prompting framework that induces the models to alter these factors and analyzes the effect on their answers. We also introduce a benchmarking procedure to collect answers with the option to abstain, facilitating a series of experiments. For evaluation, we introduce several risk-related metrics and the experimental results demonstrate the effectiveness of our approach. Our code and benchmark dataset are available at https://github.com/ict-bigdatalab/RC-RAG.

For agents

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

get_harvested_code_for_paper("2409.16146")
get_code_for_paper("2409.16146")
have("2409.16146")

Connect an agent — have() is free.