DocShield: Towards AI Document Safety via Evidence-Grounded Agentic Reasoning

Fanwei Zeng, Changtao Miao, Jing Huang, Zhiya Tan, Shutao Gong, Xiaoming Yu, Yang Wang, Weibin Yao, Joey Tianyi Zhou, Jianshu Li, Ying YanarXiv 2026

TL;DR

DocShield is a novel, unified generative framework that tackles text-centric document forgery by combining visual and logical co-reasoning. Driven by a six-stage Cross-Cues-aware Chain of Thought (CCT) mechanism and optimized via Group Relative Policy Optimization (GRPO), it simultaneously detects, localizes, and explains document manipulations, significantly outperforming both specialized forensic models and large proprietary MLLMs like GPT-4o.

What Problem Does This Paper Address?

The explosion of generative AI and diffusion models has made it incredibly easy to forge text-centric images—such as financial receipts, legal contracts, and official notices. Subtle text edits can completely alter the meaning of a document while remaining visually flawless.

Traditional digital forensics tools fall short because they focus almost exclusively on visual anomalies (like edge inconsistencies or splicing artifacts) and treat detection, localization, and explanation as isolated, decoupled tasks. This leads to two major issues:

  1. Missing Logical Flaws: If a forgery is visually perfect but contains a logical contradiction (e.g., a receipt where the line items don't add up to the total), visual-only models miss it entirely.
  2. Error Propagation: Decoupled pipelines that first detect and then explain often suffer from cascading errors and reasoning hallucinations, producing plausible-sounding but factually ungrounded explanations.

DocShield addresses these challenges by treating document forensic analysis as a unified visual-logical co-reasoning problem.

Methods

DocShield integrates detection, spatial grounding, and explanation into a single end-to-end generative process that outputs a structured, machine-readable forensic report. Its architecture relies on two core innovations:

1. Cross-Cues-aware Chain of Thought (CCT)

Instead of standard prompting, DocShield enforces a strict, six-stage iterative reasoning pipeline:

  • Knowledge Preparation: Extracts text via implicit OCR and activates domain-specific world knowledge (e.g., mathematical rules, historical context).
  • Visual Cues Extraction: Inspects global and local pixel-level features for physical tampering artifacts.
  • Logical Cues Extraction: Checks for internal consistency (e.g., math errors, timeline contradictions) and scenario logic.
  • Cross-Cues Validation & Filtering: Cross-references visual and logical findings to filter out low-confidence clues and resolve visual blind spots.
  • Spatial Grounding: Maps the validated anomalies back to precise image coordinates.
  • Report Synthesis: Outputs the final authenticity verdict, bounding boxes, and explanations in a structured JSON format.
Figure 2: Overview of the DocShield framework. Given an input image and a prompt, the model autoregressively generates a structured, machine-readable Report. The analytical core is the Cross-Cues-aware Chain of Thought (CCT), a six-stage mechanism that iteratively extracts and cross-validates visual and logical anomalies. To ensure forensic faithfulness, the framework is optimized via Group Relative Policy Optimization (GRPO) using a Weighted Multi-Task Reward, strictly aligning spatial evidence, format compliance, and explanation fidelity.

2. Weighted Multi-Task Reward Function

To train the model effectively without cascading errors, the authors utilize Group Relative Policy Optimization (GRPO). The model is incentivized through a composite reward function ($R_{\text{total}}$) that balances three objectives:

  • Format Reward: Ensures the model correctly uses structural tags (<think>, <report>).
  • Grounding Reward: Evaluates binary classification accuracy, object count precision, and Intersection over Union (IoU) for bounding boxes.
  • Explanation Reward: Measures the semantic fidelity of the generated rationale against ground truth using sentence embeddings.

Datasets

Because existing document forgery datasets lack fine-grained, multi-step reasoning annotations, the authors introduced RealText-V1.

  • RealText-V1: A large-scale benchmark containing 5,397 images featuring multilingual support and dense-text scenarios. It provides pixel-level manipulation masks and expert-level textual explanations.
  • Curation Pipeline (PR²): To build RealText-V1, the authors designed a hierarchical multi-agent pipeline consisting of a Perceiver (powered by Gemini-2.5-Pro for visual analysis), a Reasoner (Qwen3-Max for structuring the CCT), and a Reviewer that enforces a strict quality-control loop.

The model was also evaluated in a zero-shot setting on public benchmarks including T-IC13 (for sparse scene text) and T-SROIE (for dense text robustness).

The PR² multi-agent pipeline used to curate the RealText-V1 dataset.

Key Insights and Ideas

  • The Power of Mutual Compensation: Visual and logical cues are fundamentally complementary. A manipulated statistic table might look visually pristine but fail a basic math check; conversely, a text string might be logically sound but show clear pixel-level splicing artifacts. DocShield's CCT explicitly forces these modalities to cross-validate before making a final judgment.
  • RL for Reasoning Efficiency: Applying GRPO alignment didn't just improve accuracy—it optimized the model's inference policy. Training curves showed that as the format and grounding rewards converged, the mean generation length decreased from ~4,100 to 3,400 tokens, effectively penalizing verbose or uncertain outputs and making the model more computationally efficient.

Key Results

DocShield-7B achieved state-of-the-art (SOTA) performance across all evaluated benchmarks, significantly outperforming much larger proprietary models.

  • Overall Performance: On the RealText-V1 benchmark, DocShield achieved a Macro-F1 score of 68.9%, compared to 55.8% for GPT-4o and 40.6% for FakeShield.
  • Zero-Shot Generalization: On the T-IC13 dataset, DocShield improved the macro-average F1 by 41.4% over specialized frameworks and 23.4% over GPT-4o.
  • Robustness to Distortions: When subjected to extreme image degradations (heavy Gaussian blur, noise, or JPEG compression), DocShield maintained stable performance. For instance, under severe noise ($\sigma=0.3$), Gemini-2.5-Pro's detection F1 dropped by 22.0%, while DocShield only decreased by 8.5% due to its ability to rely on logical cues when visual inputs were degraded.
Figure 1: Performance comparison on the RealText-V1 bench- mark. DocShield (pink area) achieves state-of-the-art results across Detection (D), Grounding (G), and Explanation (E) tasks. M-F1 (macro-average F1 over the three tasks) serves as the unified evaluation metric, demonstrating DocShield’s superior and balanced multi-task capability.
Qualitative comparison showing DocShield accurately identifying both visual and logical contradictions compared to other models.

Limitations and Future Work

The authors note two primary boundary cases where DocShield can fail:

  1. Low-Resolution / Chaotic Layouts: In highly degraded or visually complex documents, benign variations are sometimes misinterpreted as malicious manipulations, leading to false positives.
  2. Flawless, Consistent Forgeries: If an attacker creates a forgery that is both visually perfect and completely logical within the context of the document, the model can suffer from false negatives.

Future work will focus on improving cross-cue reasoning under heavily degraded imagery and integrating deeper contextual priors to catch highly sophisticated, semantically consistent frauds.

Summary updated

BibTeX
@misc{zeng2026docshield,
  author = {Fanwei Zeng and Changtao Miao and Jing Huang and Zhiya Tan and Shutao Gong and Xiaoming Yu and Yang Wang and Weibin Yao and Joey Tianyi Zhou and Jianshu Li and Ying Yan},
  title = {{DocShield: Towards AI Document Safety via Evidence-Grounded Agentic Reasoning}},
  year = {2026},
  eprint = {2604.02694},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/2604.02694},
}
Figure