NeurIPS 2026Coming to NeurIPS?Explore papers, orals & directions

All Patches Matter, More Patches Better: Enhance AI-Generated Image Detection via Panoptic Patch Learning

Zheng Yang, Ruoxin Chen, Zhiyuan Yan, Ke-Yue Zhang, Xinghe Fu, Shuang Wu, Xiujun Shu, Taiping Yao, Shouhong Ding, Zequn Qin, Xi Li

TL;DR

Current AI-generated image detectors suffer from "Few-Patch Bias," over-relying on a tiny fraction of an image to spot fakes while ignoring the rest. This paper introduces Panoptic Patch Learning (PPL), a framework that combines randomized patch reconstruction with patch-wise contrastive learning to force detectors to distribute their attention across the entire image, significantly boosting robustness and real-world generalization.

What Problem Does This Paper Address?

Detecting AI-generated images (AIGIs) is a fast-paced cat-and-mouse game. As generative models continuously evolve, detectors trained on older architectures often struggle to generalize to new ones.

The authors identify a key reason for this failure: the Lazy Learner effect. Because modern generative models synthesize images uniformly, synthetic artifacts are actually distributed across every single patch of an image. However, standard deep learning models are inherently "lazy"—once they find a few easy-to-spot artifacts in a couple of patches to minimize their training loss, they stop looking further. This creates a severe Few-Patch Bias. Naively trained detectors become incredibly fragile; the authors found that masking just a single key patch can drop a detector's recall rate by an average of 18.7%.

Figure 3: (a) Attention maps reveal the few-patch bias of naively trained detectors, where attention concentrates on a small number of dominant patches, reflecting over-reliance on limited regions. (b) Recall degradation occurs when single patches of varying sizes are occluded, showing that detectors are overly sensitive to corruption in specific regions and suffer notable performance drops.

Methods

To break this bias and enforce the principles of "All Patches Matter, More Patches Better," the authors propose the Panoptic Patch Learning (PPL) framework. It consists of two core components:

  1. Randomized Patch Reconstruction (RPR): Instead of standard data augmentations like masking (which can destroy global image semantics), RPR takes a real image, runs it through a diffusion inpainting pipeline, and randomly replaces a percentage of the original patches with their reconstructed, artifact-laden counterparts. This forces the model to actively hunt for synthetic cues in randomly distributed regions.
  2. Patch-wise Contrastive Learning (PCL): To ensure the model treats all patches uniformly, PCL applies a margin-based contrastive loss at the patch token level. It pulls embeddings of patches with identical labels (real-real or fake-fake) closer together in the feature space while pushing different pairs apart, preventing the model from shortcutting to a minority of dominant patches.

Datasets

The authors evaluated PPL across a comprehensive suite of benchmarks:

  • GenImage: A million-scale dataset used here for training (specifically the SDv1.4 subset) and cross-generator evaluation.
  • DRCT-2M: A large-scale benchmark containing diverse GAN and diffusion variants.
  • AIGCDetectionBenchmark & UniversalFakeDetect: Standard benchmarks used to evaluate cross-dataset and cross-model generalization.
  • Chameleon: A highly challenging, "in-the-wild" dataset composed of real-world AI images collected from online websites.

Key Insights and Ideas

  • Universal Artifact Distribution: Unlike traditional image classification where discriminative features are object-centric (e.g., looking at the dog in the center), AI generation leaves traces everywhere. In fact, isolating and replicating a single random patch across an entire image still yields a 90% detection accuracy.
  • Causal Quantification of Bias: The authors utilized Controlled Direct Effect (CDE)—a tool from causal inference—to mathematically prove that stronger, more generalizable detectors naturally exhibit a much more uniform patch-contribution distribution than weaker ones.
  • Preserving Global Semantics: Injecting artifacts via diffusion reconstruction (RPR) rather than naive cut-and-paste stitching ensures that the global context remains intact, preventing the detector from simply overfitting to sharp, unrealistic edge boundaries.

Key Results

PPL achieved state-of-the-art (SoTA) performance across multiple backbones (CLIP and DINOv2), demonstrating remarkable stability and robustness:

  • Top-Tier Accuracy: On the GenImage benchmark, PPL achieved a mean accuracy of 97.2% (using a CLIP backbone), outperforming recent competitive baselines like C2P-CLIP and DRCT while maintaining a significantly lower standard deviation (±1.7%).
  • Balanced Performance on DRCT-2M: While prior methods like DRCT showed poor performance on SDXL-related subsets, PPL maintained a highly balanced performance across all variants, achieving an overall mean accuracy of 99.50%.
  • Conquering the Wild: On the challenging Chameleon dataset, where most existing detectors hovered near random guessing (~50-55%), PPL achieved an impressive 72.07% accuracy (via DINOv2), proving its real-world viability.
Figure 1: (a) PPL produces a more uniform attention distribution across patches, indicating its effectiveness in capturing artifacts comprehensively. (b) PPL outperforms peer methods on GenImage, DRCT-2M, AIGCDetectionBenchmark, and the in-the-wild Chameleon. More details are in Section 5.

Limitations and Future Work

The primary trade-off of PPL is its moderate computational overhead:

  • Memory & Runtime: Incorporating the patch-wise contrastive loss increases GPU memory consumption from 16 GB to 19 GB when fine-tuning a CLIP-Large backbone with LoRA. Furthermore, training time per epoch on GenImage increased from 3 hours to 4 hours on an NVIDIA V100 GPU.

The authors note that future work could focus on optimizing this patch-level alignment to reduce training overhead or exploring how these panoptic patch principles translate to video deepfake detection.

Summary updated

BibTeX
@inproceedings{yang2026all,
  author = {Zheng Yang and Ruoxin Chen and Zhiyuan Yan and Ke-Yue Zhang and Xinghe Fu and Shuang Wu and Xiujun Shu and Taiping Yao and Shouhong Ding and Zequn Qin and Xi Li},
  title = {{All Patches Matter, More Patches Better: Enhance AI-Generated Image Detection via Panoptic Patch Learning}},
  booktitle = {International Conference on Learning Representations},
  year = {2026},
  url = {https://openreview.net/forum?id=ob7PJs8kPU},
}
Figure