Abstract
Large Language Models (LLMs) are increasingly applied in various science domains, yet their broader adoption remains constrained by a critical challenge: the lack of trustworthy, verifiable outputs. Current LLMs often generate answers without reliable source attribution, or worse, with incorrect attributions, posing a barrier to their use in scientific and high-stakes settings, where traceability and accountability are paramount. To be reliable, attribution systems require high accuracy for short-length attribution on retrieved data, i.e., attribution to a sentence within a document rather than the entire document. We propose SAFE, a Sentence-level Attribution FramEwork for Retrieve-Augmented Generation (RAG) systems that attributes generated sentences during generation. This allows users to verify sentences as they read them and correct the model when the attribution indicates the generated text is not grounded in the documents, increasing the safety of LLM systems. This framework consists of two steps: predicting the required number of references for a sentence, and attributing the sentence. Our approach achieved 95% accuracy in the first step, which translated to 2.1~6.0% improvements in the accuracy (normalized for maximum possible accuracy) of all attribution algorithms in our clean dataset, when compared to their top-1 accuracy. We also applied SAFE in real-world scenarios with documents containing hundreds to thousands of sentences. In these settings, SAFE reliably attributed sentences to their source documents, demonstrating that the method generalizes beyond controlled benchmarks. The SAFE framework and the training dataset are publicly available on GitHub.
Introduction
While Large Language Models (LLMs) have demonstrated remarkable capabilities, they frequently suffer from a "black box" problem, stating facts without sources or providing "hallucinated" citations. Standard Retrieval-Augmented Generation (RAG) systems often cite entire documents for whole paragraphs, forcing users to manually verify claims across extensive text. This lack of fine-grained, sentence-level traceability is a significant barrier in high-stakes domains like medicine, law, and scientific research. The SAFE framework addresses this by providing accurate, real-time attribution that identifies the specific sentence in a source document supporting a generated claim.
The SAFE Framework
The SAFE (Sentence-level Attribution FramEwork) pipeline operates "in-generation," breaking attribution into two distinct steps:
- Pre-attribution Classification: Before searching for a source, a classifier analyzes the generated sentence to predict the number of references required: 0 (common knowledge), 1 (single fact), or 2+ (complex claims). This classification utilizes either 24 numerical textual features (e.g., sentence length, named entity density) or sentence embeddings.
- Attribution: Based on the predicted count, the system selects an appropriate attribution algorithm (e.g., BM25, SPLADE, or semantic similarity) to locate the best-matching quotes from retrieved documents.
By performing these steps during generation, the LLM can pause after each sentence, allowing the user to verify or correct the model before it continues.
Datasets and Methodology
The researchers evaluated SAFE using three primary datasets:
- HAGRID: A standard human-LLM collaborative dataset for information-seeking.
- WebGLM-QA: A large-scale dataset for web-enhanced question answering.
- HAGRID-Clean: A manually curated and relabeled version of HAGRID (2,638 queries) created to address noise, such as over-referenced or under-referenced sentences, providing a high-quality benchmark for sentence-level attribution.
Key Results and Insights
The study revealed several critical findings regarding the effectiveness of pre-attribution classification:
- Classifier Performance: The pre-attribution classifier achieved up to 95% accuracy on the HAGRID-Clean dataset. Interestingly, simple numerical features often outperformed high-dimensional embeddings in classification tasks.
- Systemic Improvement: Integrating the SAFE framework led to a 2.1% to 6.0% improvement in the accuracy of various attribution algorithms compared to standard "top-1" approaches.
- Efficiency: XGBoost was identified as the optimal classifier, balancing high accuracy with the speed required for real-time applications.
A key insight is the "Top-1 Fallacy": most systems assume every sentence needs exactly one reference. SAFE demonstrates that predicting the number of references is a prerequisite for grounding accuracy.
Limitations and Future Work
Despite its success, sentence-level attribution faces challenges such as contextual isolation, where a retrieved quote might support a claim while the surrounding source text contradicts it. Additionally, training datasets remain skewed toward single-reference sentences. Future work will explore semi-supervised learning to expand clean training data and investigate methods to mitigate manual labeling bias.
Summary updated