AI-Generated Image Detectors Exploit Global Artifacts: Evidence from Inpainting Exchange
Authors: Elif Nebioglu, Emirhan Bilgiç, Adrian Popescu
Organizations: Independent Researcher · Université Sorbonne, Pierre et Marie Curie, ISIR · Institut Polytechnique de Paris, U2IS · Université Paris-Saclay, CEA, LIST
Modern diffusion-based inpainting enables realistic, localized image manipulation, raising critical challenges for reliable detection. We show that state-of-the-art AI-generated image detectors largely fail to identify what was synthesized and instead exploit a global artifact introduced as a side effect of the generation pipeline: latent-diffusion inpainting passes the entire image through a VAE encoder--decoder, inducing a subtle but pervasive spectral shift even in unedited regions. We turn this observation into a simple, model-free diagnostic, Inpainting Exchange (INP-X), that restores the original pixels outside the edited region while preserving all synthesized content. To study the effect at scale, we build a benchmark of 30K matched real, standard-inpainted, and exchanged triplets (90K images) spanning four datasets and three inpainters. INP-X requires no model access and is a single compositing step, yet it collapses pretrained detectors, commercial APIs, and bias-aware methods toward chance (commercial APIs: >$$90\%\!\to\!\sim$$55\%; the bias-aware DDA: 97.6%→58.4%). We give formal propositions linking the effect to high-frequency attenuation from the VAE information bottleneck, and we causally isolate it with a factorial battery and a variance decomposition that attributes 97% of the background spectral shift to the autoencoder round-trip alone. A perceptual study (n=153) shows the shift is also perceptible to humans, whose accuracy falls from 63.8% to 56.2% (p=0.002): significantly reduced, though not eliminated. Finally, we show that mechanism-driven mitigations (mixed-distribution and localization-supervised training) improve robustness, but detecting INP-X edits remains an open problem. Our benchmark and code are available at: https://github.com/emirhanbilgic/INP-X
Figures & tables
Figure 1: Inpainting Exchange (INP-X). (a) The unedited regions of a diffusion-inpainted image are replaced with the corresponding original pixels, preserving the synthesized masked content while removing the global VAE artifact. (b) Difference maps: standard inpainting (Original − Inpainted) differs across the whole image, whereas INP-X (Original − Ours) differs only inside the mask. (c) The latent-diffusion inpainting pipeline (INP) that produces the global artifact.
Figure 2: Impact of standard inpainting on unmasked regions. Although the mask targets the nose, the VAE encode–decode cycle alters unmasked pixels ( e.g . , the highlighted distortion around the eye), distinguishing them from the original. Inpainting via Stable Diffusion v1.4.
Figure 3: Verification of VAE-induced artifacts. Left to right: (1) original; (2) mask; (3) inpainted; (4) high-frequency content of the original (Laplacian high-pass); (5) pure VAE reconstruction error, ∣D(E(x))−x∣ , no diffusion; (6) inpainting difference ∣x~−x∣ . The strong structural correlation between (5) and (6) identifies the VAE as the primary source of the global artifact.
Detector
Data
Acc
AUC
Prec
Rec
F1
SPAI [ 29 ]
INP
0.661
0.743
0.638
0.744
0.687
INP-X
0.542
0.567
0.546
0.506
0.525
Corvi2023 [ 10 ]
INP
0.942
0.989
0.995
0.890
0.939
INP-X
0.554
0.519
0.959
0.114
0.203
C2P-CLIP [ 54 ]
INP
0.696
0.780
0.712
0.660
0.685
INP-X
0.562
0.604
0.598
0.381
0.465
Table 1: Pretrained detectors and commercial APIs : real vs. standard inpainting (INP) and Inpainting Exchange (INP-X). Every family collapses toward chance once the global artifact is removed; the semantic detector C2P-CLIP is not exempt. UnivFD is already at chance on INP (floor effect), not robust. Full detector results in Tab. S1 . †
Variant
Gen.
VAE bg
Seam
Fake rate
Real photo
✗
✗
✗
0.01
VAE-ONLY D(E(x))
✗
✓
✗
0.91
X-INV (real FG, inp. bg)
✗
✓
✓
0.88
INP (standard)
✓
✓
✗
0.89
INP-X (ours)
✓
✗
✓
0.11
RePaint (pixel-space)
✓
✗
✗
0.10
Table 2: Factorial battery (detector: Corvi2023; fake rate, ground truth = real, lower is more correct). Toggling generated content, VAE background, and seam independently isolates the VAE-processed background as the cause. Other detectors agree in sign ( Sec. C.1 ).
Full Image
Mask-Only
BG-Only
Detector
INP
INP-X
INP
INP-X
INP
INP-X
Corvi2023
0.942
0.554
0.747
0.753
0.949
0.561
CLIP 10+
0.658
0.563
0.875
0.874
0.687
0.615
SPAI
0.661
0.542
0.432
0.434
0.567
0.433
Sightengine
0.926
0.555
0.650
0.650
0.891
0.530
Hive Mod.
0.914
0.548
0.600
0.600
0.866
0.520
Table 3: Mask-only vs. background-only accuracy. BG-only mirrors full-image accuracy under INP but collapses under INP-X; mask-only is unchanged, confirming content is preserved and the lost signal is the background artifact.
Classification
Localiz.
Arch.
Train → Test
Acc
AUC
F1
mIoU
mAP
CLIP ViT B/32
INP → INP
0.984
0.998
0.984
0.373
0.201
INP → INP-X
0.598
0.825
0.350
0.376
0.205
INP-X → INP-X
0.753
0.890
0.795
0.380 ∗
0.212 ∗
INP-X → INP
0.688
0.831
0.726
0.382 ∗
0.224 ∗
EfficientNet
INP → INP
0.952
0.991
0.952
0.466
0.369
Table 4: Fine-tuned detectors (2 of 4 architectures). Standard inpainting is easy to learn; INP-X stays hard; transfer is asymmetric; INP-X training improves localization. †
Figure 4: Detection accuracy vs. mask coverage, per detector. Larger masks generally enable better detection.
FID ↓
SSIM ↑
LPIPS ↓
Dataset
INP
INP-X
INP
INP-X
INP
INP-X
CelebA-HQ
46.69
38.57
0.781
0.911
0.190
0.089
CityScapes
29.44
23.50
0.811
0.918
0.220
0.091
OpenImages
33.91
29.58
0.739
0.880
0.221
0.114
SUN-RGBD
10.63
7.03
0.851
0.950
0.171
0.057
Table 5: Perceptual quality of INP vs. INP-X. Restoring original background pixels improves pixel-fidelity (SSIM) and perceptual quality (FID, LPIPS) on every dataset.
Appendix figures & tables27 assets
Supplementary material from the paper’s appendix.
Appendix
Detector
Data
Acc
AUC
Prec
Rec
F1
SPAI [ 29 ]
INP
0.661
0.743
0.638
0.744
0.687
INP-X
0.542
0.567
0.546
0.506
0.525
CO-SPY [ 6 ]
INP
0.549
0.649
0.638
0.229
0.337
INP-X
0.547
0.594
0.633
0.224
0.331
DNF [ 61 ]
INP
0.646
0.779
0.632
0.697
0.663
INP-X
0.599
0.643
0.598
0.602
0.600
Appendix
Table S1 : All pretrained detectors: real vs. INP and INP-X. †
Arch.
Train
Test
Acc
AUC
F1
mIoU
mAP
CLIP B/32
INP
INP
0.984
0.998
0.984
0.373
0.201
INP
INP-X
0.598
0.825
0.350
0.376
0.205
INP-X
INP-X
0.753
0.890
0.795
0.380 ∗
0.212 ∗
INP-X
INP
0.688
0.831
0.726
0.382 ∗
0.224 ∗
ViT B/16
INP
INP
0.819
0.908
0.826
0.393
0.226
INP
INP-X
0.603
0.689
0.519
0.393
0.227
Appendix
Table S2 : Fine-tuned detectors trained on INP and INP-X: classification (Acc, AUC, F1) and localization (mIoU, mAP). †
INP:INP-X
INP
INP-X
INP-X (FLUX)
OABench
100:0
0.952
0.567
0.541
0.591
50:50
0.888
0.681
0.578
0.627
25:75
0.866
0.694
0.586
0.631
Appendix
Table S3 : Mixed-ratio training (EfficientNet, 5 seeds). Test accuracy on INP, seen INP-X, unseen FLUX.1 INP-X, and OABench.
B-Free
INP
INP-X
INP-X sm.
INP-X FLUX
pretrained
0.974
0.811
0.56
0.549
ft. INP
0.991
0.628
0.44
0.532
ft. INP-X
0.842
0.847
0.65
0.612
ft. 50:50
0.968
0.836
0.64
0.609
Appendix
Table S4 : Fine-tuning the SOTA B-Free detector. INP-X training helps aggregate but not small masks or unseen inpainters; INP training worsens INP-X.
Probe ( Ωbg only)
real vs. INP
real vs. INP-X
Radially-averaged power spectrum
0.941
0.500
Colour moments
0.612
0.500
GLCM texture
0.658
0.500
All combined
0.958
0.500
Appendix
Table S5 : Background-only linear probes ( Ωbg ), AUC. The INP shift is overwhelmingly spectral; the INP-X column is 0.500 by construction.
Pipeline
Exch. by us?
Corvi
B-Free
diffusers default ( = INP)
no
0.951
0.977
diffusers pad_crop=32
no
0.567
0.818
A1111 “Only masked”
no
0.572
0.823
Photoshop Gen. Fill
no
0.581
0.829
INP-X (ours)
yes
0.554
0.811
Appendix
Table S6 : Deployed tools with native background preservation, run unmodified. Detector accuracy (real vs. output).
Mask area
B-Free INP
B-Free INP-X
0–5%
0.95
0.51
10–20%
0.98
0.65
20–40%
0.995
0.90
> 40%
1.00
0.99
Appendix
Table S7 : Detection rate on fakes within matched mask-size bins. The 44 -pt INP → INP-X gap at 0 – 5% (pixel-identical generated region) cannot come from region size.
INP
Denoise+PG
INP-X
Detector
Acc
AUC
Acc
AUC
Acc
AUC
Corvi2023
0.942
0.989
0.833
0.974
0.554
0.519
CLIP 10
0.556
0.845
0.558
0.763
0.509
0.606
CLIP 10+
0.658
0.844
0.593
0.813
0.563
0.673
SPAI
0.661
0.743
0.604
0.726
0.542
0.567
Appendix
Table S8 : Denoise-re-noise (BM3D + Poisson–Gaussian) vs. INP-X.
Model
Method
Acc
AUC
Prec
Rec
F1
Corvi2023
INP-X
0.554
0.519
0.959
0.114
0.203
Alpha
0.593
0.646
0.975
0.190
0.318
CLIP 10
INP-X
0.509
0.606
0.779
0.025
0.048
Alpha
0.513
0.566
0.823
0.033
0.063
CLIP 10+
INP-X
0.563
0.673
0.800
0.169
0.279
Alpha
0.588
0.728
0.838
0.218
0.346
Appendix
Table S9 : INP-X (sharp) vs. soft alpha blending. Both yield low detection.
Detector
Attack
Acc
AUC
Prec
Rec
F1
SPAI
Blur
0.712
0.813
0.668
0.846
0.746
Light
0.553
0.576
0.551
0.516
0.533
JPEG
0.699
0.797
0.661
0.820
0.732
INP-X
0.542
0.567
0.546
0.506
0.525
Corvi2023
Blur
0.768
0.944
0.991
0.541
0.700
Light
0.924
0.985
0.994
0.852
0.918
Appendix
Table S10 : Robustness to corruptions vs. INP-X (JPEG quality 80).
Stage ( Ωbg only)
BG spectral dist.
Share
VAE round-trip D(E(x))
17.9
97.3%
+ diffusion (latents frozen)
18.2
98.9%
Full INP
18.4
100%
INP-X (ours)
0.0
0%
Appendix
Table S11 : Variance decomposition of the background spectral shift ( Ωbg only). The VAE round-trip alone accounts for 97.3% of the shift; the denoiser (latents frozen) adds 1.6% . INP-X removes it entirely.
Figure S1 : Correlations between VAE reconstruction loss, high-frequency content, and inpainting artifacts.
Figure S2 : Correlation matrices between error metrics across datasets.
Figure S3 : Histograms of pixel-level correlations across the dataset.
Figure S4 : Boxplots of pixel-level correlations across the dataset.
Figure S5 : Frequency-domain analysis: standard inpainting introduces global spectral artifacts that INP-X eliminates.
Figure S6 : Accuracy breakdown by sub-folder for each dataset.
Figure S7 : Detector accuracy on real images across datasets.
Figure S8 : Improved models still exhibit VAE reconstruction artifacts correlated with the inpainting error. Columns as in main Figure 3 .
Pipeline
Latent
BG resid.
Corvi INP
Corvi INP-X
SD 1.4
4-ch
2.41
0.951
0.549
SDXL
4-ch
2.18
0.917
0.566
FLUX.1 Fill
16-ch
1.63
0.882
0.571
RePaint
pixel
0.00
0.548
0.548
Appendix
Table S13 : Dose–response: detectability is monotone in background latent residual (Pearson r=0.99 ); INP-X is flat.
Inpainter
Corvi
DDA
B-Free
Hive
SDXL
0.917 → 0.566
0.961 → 0.593
0.968 → 0.796
0.897 → 0.559
FLUX
0.882 → 0.571
0.943 → 0.601
0.959 → 0.782
0.874 → 0.566
Appendix
Table S14 : INP → INP-X collapse holds for modern inpainters across detectors.
Figure S9 : RePaint (VAE-less): the unmasked region is perfectly preserved (zero difference), but inference is prohibitively slow and needs dataset-specific training.
Figure S10 : Detector attention (Grad-CAM). (a) mask; (b) INP triggers global attention across the image; (c) INP-X localizes attention to the edited region.
Figure S11 : Standard inpainting vs. INP-X. Left to right: original, mask, INP, difference (Original − INP), INP-X, difference (Original − INP-X). INP differs across the whole image; INP-X differs only inside the mask.
Subset
Out-of-mask salience
INP
INP-X
Δ
CelebA-HQ
faces
70.6
55.1
15.5
CityScapes
signage/text
61.7
56.5
5.2
SUN-RGBD
none
57.9
57.3
0.6
Appendix
Table S15 : Human accuracy by out-of-mask salience. The INP → INP-X drop tracks background salience, not the edit.
Figure S12 : Human study interface: task instructions (left) and a representative trial (right).
AI-generated image detection identifies synthetic or AI-edited images and develops methods that generalize across generators, domains, and image transformations.