Teaching Large Language Models to Maintain Contextual Faithfulness via Synthetic Tasks and Reinforcement Learning

Shuzheng Si, Haozhe Zhao, Cheng Gao, Yuzhuo Bai, Zhitong Wang, Bofei Gao, Kangyang Luo, Wenhao Li, Yufei Huang, Gang Chen, Fanchao Qi, Minjia Zhang, Baobao Chang, Maosong Sun

TL;DR

The paper introduces CANOE, a post-training framework that significantly reduces "faithfulness hallucinations" in Large Language Models (LLMs) without relying on costly human annotations. By combining automated synthetic data generation with a novel reinforcement learning algorithm called Dual-GRPO, CANOE trains models to remain strictly grounded in provided contexts. Remarkably, a 7B-parameter model optimized with CANOE can outperform proprietary giants like GPT-4o and OpenAI o1 on contextual faithfulness benchmarks.

What Problem Does This Paper Address?

When LLMs are used in information-seeking systems—like Retrieval-Augmented Generation (RAG) or text summarization—they frequently suffer from faithfulness hallucinations, generating text that contradicts or cannot be grounded in the provided reference context.

This issue stems from three core challenges:

  1. Scaling parameters doesn't fix it: As models grow, their internal parametric knowledge expands, increasing "knowledge conflicts" where the model prefers its pre-trained memory over a provided context that contradicts it.
  2. Task generalization is hard: Existing alignment techniques are highly task-specific, failing to consistently boost faithfulness across both short-form question answering (QA) and long-form text generation.
  3. Data scaling bottlenecks: Evaluating and labeling the faithfulness of long-form generation typically requires expensive, non-scalable human annotation.

Methods

The authors tackle these challenges using a two-part framework: Synthetic Data Construction and Dual-GRPO (Group Relative Policy Optimization).

An overview of the CANOE framework, showing the synthetic data generation pipeline and the Dual-GRPO training process.

1. Automated Data Synthesis

To build a high-quality training set without human intervention, the authors extract factual triples (head, relation, tail) from Wikidata. They then use GPT-4o to generate questions and accompanying contexts based on these triples, using the tail entity as an easily verifiable short-form ground truth answer. To ensure robustness, they generate data across four complexity levels:

  • Straightforward Context: The answer is explicitly stated.
  • Reasoning-required Context: Requires multi-hop reasoning across a chain of facts.
  • Inconsistent Context: Contains noisy, mixed, or conflicting information.
  • Counterfactual Context: Contexts containing assertions that deliberately contradict common sense (forcing the model to rely only on the text, not its pre-trained memory).

2. Dual-GRPO Reinforcement Learning

Standard RLHF requires training a separate reward model based on human preferences. CANOE bypasses this by using a rule-based variant of GRPO. The policy model is prompted to generate three distinct sections wrapped in XML tags: a reasoning process (<think>), a detailed long-form answer (<long answer>), and a concise short-form answer (<short answer>).

The framework then applies three automated, rule-based rewards:

  • Accuracy Reward: Evaluates whether the generated short-form answer exactly matches the ground truth.
  • Proxy Reward (The Core Innovation): To evaluate the long-form answer without human grading, the framework replaces the original context with the model's own generated long-form answer. It then checks if the model can still derive the correct short-form answer from this new text. If it can, the long-form response is deemed faithful and clear.
  • Format Reward: Rewards the model for correctly adhering to the requested XML tag structure.

Datasets

  • Training Data: 10,000 entirely synthesized QA pairs generated from Wikidata triples.
  • Evaluation Benchmarks: The model was evaluated across 11 downstream tasks:
  • Short-form QA: ConFiQA, CNQ, FaithEval, FiQA, and FollowRAG (comprising NaturalQA, TriviaQA, HotpotQA, and WebQSP).
  • Long-form Generation: XSum (summarization), WikiLarge (simplification), and CLAPNQ (grounded long-form QA).
  • Multilingual/Long-Context: MultiFieldQA-zh, DuReader, and VCSUM to test Chinese language and long-context transferability.

Key Insights and Ideas

  • The Power of the Proxy Reward: Automatically evaluating long-form text for factual grounding is notoriously difficult. Using the model's own generated text as a new context to see if it still yields the correct short answer provides an elegant, entirely automated loop for enforcing long-form faithfulness.
  • Counterfactuals as an Anti-Hallucination Shield: Training models on counterfactual data (e.g., "the moon is made of marshmallows") acts as a regularizer, breaking the model's stubborn reliance on its internal pre-trained facts and forcing it to pay attention to the prompt's context.
  • Dual-Output Prevents Optimization Collapse: The authors noted that applying standard GRPO to short-form data causes models to simply copy-paste raw text fragments, ruining their conversational utility. Forcing a dual long-form and short-form output structure maintains conversational fluency while enforcing strict factual precision.

Key Results

  • Outperforming the Giants: As shown in Figure 1, CANOE-tuned 7B and 14B models achieved massive performance leaps. With only 7B/8B parameters, CANOE-LLaMA-8B and CANOE-Qwen-7B outperformed massive proprietary SOTA models like GPT-4o, DeepSeek-V3, and OpenAI o1 on the average score across 11 downstream tasks.
Average score on 11 downstream tasks vs model size, highlighting that CANOE models achieve optimal performance-to-parameter ratios.
  • Quantifiable Faithfulness Boosts: CANOE improved the overall average score of LLaMA-3-8B-Instruct by 22.6% and Qwen-2.5-7B-Instruct by 19.0% in Average Exact Match (EM) metrics.
  • Mitigating Overconfidence Bias: When evaluated on unfaithful or false statements, CANOE models demonstrated significantly higher perplexity scores compared to vanilla models. This indicates that the model is much less confident when it is forced to generate unfaithful text, effectively mitigating dangerous overconfidence biases.
The average perplexity score of 110 negative samples, showing that CANOE models exhibit higher perplexity (lower confidence) on bad cases.

Limitations and Future Work

  • Data Scaling with Model Size: While 10,000 synthetic samples were sufficient to optimize 7B and 14B models, the authors note that larger models may require a larger volume of synthetic data to reach optimal performance.
  • Teacher Model Dependency: The initial dataset generation pipeline still relies on a highly capable proprietary teacher model (like GPT-4o) to synthesize the diverse contexts and questions.
  • Future Directions: Promising next steps include expanding this rule-based dual-reward structure to handle even more complex multi-step reasoning tasks and exploring its limits in ultra-long context windows.

Summary updated

BibTeX
@inproceedings{si2026teaching,
  author = {Shuzheng Si and Haozhe Zhao and Cheng Gao and Yuzhuo Bai and Zhitong Wang and Bofei Gao and Kangyang Luo and Wenhao Li and Yufei Huang and Gang Chen and Fanchao Qi and Minjia Zhang and Baobao Chang and Maosong Sun},
  title = {{Teaching Large Language Models to Maintain Contextual Faithfulness via Synthetic Tasks and Reinforcement Learning}},
  booktitle = {AAAI Conference on Artificial Intelligence},
  year = {2026},
  doi = {10.1609/aaai.v40i39.40582},
}
Figure