Papers
Topics
Authors
Recent
Search
2000 character limit reached

Faithfulness-QA: A Counterfactual Entity Substitution Dataset for Training Context-Faithful RAG Models

Published 28 Apr 2026 in cs.CL and cs.AI | (2604.25313v1)

Abstract: Retrieval-Augmented Generation (RAG) models frequently produce answers grounded in parametric memory rather than the retrieved context, undermining the core promise of retrieval augmentation. A fundamental obstacle to fixing this unfaithfulness is the lack of training data that explicitly requires models to prefer context over internal knowledge. We introduce Faithfulness-QA, a large-scale dataset of 99,094 samples constructed through counterfactual entity substitution. Starting from two established extractive QA benchmarks--SQuAD and TriviaQA--we automatically identify answer-bearing named entities in each context, replace them with type-consistent alternatives drawn from a curated bank of 76,953 entities, and thereby manufacture controlled knowledge conflicts between context and parametric memory. Rigorous quality filtering ensures 100% pass rates across four automated checks on random 200-sample audits. We release the full dataset, the construction pipeline, and a typed entity bank covering eight named entity categories. Faithfulness-QA is designed as a training resource for attention-based faithfulness objectives and as an evaluation benchmark for measuring context-grounding behavior in RAG systems. Data and code are available at https://github.com/qzhangFDU/faithfulness-qa-dataset.

Authors (3)

Summary

  • The paper introduces a counterfactual entity substitution method that creates controlled context-memory conflicts to train more faithful RAG models.
  • It details an automated pipelineโ€”spanning from entity extraction to quality filteringโ€”that generates over 99,000 samples from SQuAD and TriviaQA.
  • The dataset enables direct supervision and fine-grained analysis of context adherence, addressing RAGโ€™s tendency to rely on outdated parametric knowledge.

Faithfulness-QA: Counterfactual Entity Substitution for Context-Faithful RAG Training

Motivation and Problem Statement

Retrieval-Augmented Generation (RAG) systems integrate LLMs with external retrieval to enable dynamic, context-grounded text generation. However, empirical studies have established that RAG models frequently fail to ground on retrieved context, defaulting to parametric memory even in the presence of contradictory evidence. This "unfaithfulness" undermines critical use casesโ€”particularly when RAG is expected to override outdated or incorrect memorized knowledge with external documents.

A primary obstacle is the lack of large-scale training data that systematically induces knowledge conflicts between retrieved contexts and parametric memory, thereby directly supervising context over memorization. Existing benchmarks (e.g., FaithEval) are insufficient in scale or are geared towards evaluation, not training. Prior datasets like CounterFact target knowledge editing, not RAG faithfulness. Attempts to improve RAG faithfulness through architectural or inference-time interventions have not addressed the foundational problem of lacking controlled, large-scale, conflict-generating training signals.

Dataset Construction Pipeline

Faithfulness-QA directly addresses this by introducing a large-scale dataset (99,094 samples) systematically engineered for context-faithfulness supervision via counterfactual entity substitution.

The pipeline proceeds through four automated phases:

  1. Typed Entity Bank Construction: Named entities are extracted using SpaCy's transformer-based NER from SQuAD contexts, yielding a curated bank of 76,953 entities across eight types (PERSON, GPE, ORG, DATE, CARDINAL, NORP, LOC, EVENT).
  2. Answer-Entity Matching: Each QA sample is matched with a corresponding named entity within the context using a cascade of exact, substring, and character overlap matching strategies, ensuring type consistency for the counterfactual process.
  3. Counterfactual Substitution: The answer-bearing entity is replaced in context with a type-matched alternative from the entity bank, sampling up to five candidates to control for length ratios. This generates a new context where the only faithful answer is the new entityโ€”parametric knowledge is now in direct conflict with the context.
  4. Quality Filtering: Rigorous, rule-based checks (e.g., presence of new entity, context modification, absence of entity preexistence, limits on replacements per context) are used to ensure well-formedness. A stratified audit of 200 random samples yields a 100% pass rate across criteria, underscoring the pipeline's robustness. Figure 1

    Figure 1: The Faithfulness-QA construction pipeline. The counterfactual entity substitution stage manufactures controlled context-vs-memory conflicts that train RAG models to follow context.

Dataset Characteristics and Analysis

Scale and Diversity

Faithfulness-QA is generated from two complementary sources:

  • SQuAD (49,094 samples): Balanced entity type distribution, shorter and simpler contexts, mimicking single-paragraph retrieval.
  • TriviaQA (50,000 samples): PERSON-heavy question answering with multi-paragraph, longer contexts, more closely reflecting real-world RAG scenario diversity.

Combined, the dataset scales to an order of magnitude larger than prior counterfactual evaluation sets, with approximately equal contributions from each source to avoid skew.

Entity Type and Contextual Coverage

Entity type distributions differ across datasets: TriviaQA is heavily PERSON-centric while SQuAD is more uniform. This provides broad coverage and mitigates overfitting to specific entity types. Context lengths also vary substantially (median SQuAD: 701 chars; TriviaQA: 1,581 chars), further fostering generalization.

Failure and Filtering Analysis

The pipeline achieves a substitution success rate of 56.7%. The dominant failure mode (64.0%) is the inability to match non-entity, descriptive, or boolean answersโ€”an inevitable trade-off for ensuring only well-defined entity substitutions. No downstream evaluation is included; the focus here is dataset creation and validation.

Implications for Model Training and Evaluation

Faithfulness-QA enables, for the first time, systematic supervised training of RAG models to prefer retrieved context in the presence of context-memory conflicts. With paired (original, counterfactual) contexts and answers, it supplies not only core training signals for context-faithful generation but also facilitates discriminative evaluation paradigms: models can be scored for following context vs. defaulting to prior knowledge.

Furthermore, the explicit localization of substitutions provides fine-grained opportunities for developing and evaluating attention-based faithfulness regularizers and metrics, including direct supervision over cross-attention distributions.

By decoupling context-following from incidental agreement (i.e., cases with no conflict), this dataset allows for rigorous analysis of model behavior under controlled knowledge contradictionsโ€”an essential property for deployment in dynamic or brittle knowledge domains.

Limitations

  • Coreference Unaddressed: Substitutions are string-based only; pronouns and abbreviations referring to the replaced entity are not updated, which may introduce minor semantic inconsistencies.
  • Semantic Plausibility: Some entity substitutions, though syntactically valid, can be semantically implausible (e.g., non-local entities in geographical constructs).
  • NER-Restricted: Reliance on rule-based NER for answer-entity matching restricts recall; a significant fraction of QA examples are ignored.
  • No Multilingual Support: Entity bank and pipeline are English-only.
  • No NLI or LLM-based Verification: All filtering is rule-based; entailment or semantic verification is deferred to future work.
  • No Downstream Baselines: Evaluation of model gains from this dataset is left as future work.

Future Directions

Anticipated improvements include LLM-based entity matching to boost coverage, integration of coreference resolution, addition of NLI-based filtering for semantic coherence, and support for multi-entity and multi-hop substitutions. It is expected that systematic downstream evaluations on both open-source and proprietary LLMs fine-tuned with Faithfulness-QA will clarify its impact on context-faithful RAG.

Conclusion

Faithfulness-QA constitutes an authoritative, large-scale resource for research and development of context-faithful RAG systems. Its controlled counterfactual entity generation, type-consistent replacements, and rigorous quality filtering provide a high-precision substrate for both training and evaluation. The data enables fine-grained experimental investigations into how retrieval-augmented architectures resolve conflicts between external evidence and internalized knowledge. Its release fills a necessary gap for training datasets focused explicitly on the central desideratum of RAG: robust, automatic grounding in retrieved context rather than parametric priors.

This dataset, combined with the provided open-source pipeline and entity bank, offers the foundation for both empirical progress in faithfulness-critical applications and theoretical analysis of knowledge conflict, context adherence, and the limitations of current retrieval-augmented approaches.


Citation: "Faithfulness-QA: A Counterfactual Entity Substitution Dataset for Training Context-Faithful RAG Models" (2604.25313)

Paper to Video (Beta)

No one has generated a video about this paper yet.

Whiteboard

No one has generated a whiteboard explanation for this paper yet.

Open Problems

We haven't generated a list of open problems mentioned in this paper yet.

Collections

Sign up for free to add this paper to one or more collections.