Hefei University's LTD Catches AI Fakes Where Every Other Detector Breaks
A new synthetic image detector exploits how real and fake images evolve differently through the middle layers of a frozen CLIP ViT, hitting 96.9% mean accuracy across 16 generators.
ProTakeaways
- LTD detects AI-generated images by measuring feature drift between adjacent mid-level layers of a frozen CLIP ViT.
- Real images show smooth layer transitions; synthetics show abrupt attention shifts between foreground and background.
- Hits 96.90% on UFD, 99.54% on DRCT-2M, 91.62% on GenImage, beating FatFormer, ForgeLens, and RINE.
- Trained on just 2 ProGAN classes, converges in 5 epochs on a single RTX 4090.
- Robust to JPEG compression and downsampling where competitors like ForgeLens collapse.
- Code and pretrained checkpoints available at github.com/yywencs/LTD.
Telling a diffusion-generated image apart from a real photograph is getting harder every quarter, and most detectors that look sharp on paper collapse the moment they meet a generator they weren't trained on. A new method called Layer Transition Discrepancy (LTD) from Hefei University of Technology takes a different route: instead of hunting for pixel-level fingerprints, it watches how features change from layer to layer inside a frozen CLIP Vision Transformer, and uses that trajectory as the giveaway.
The result is a compact detector that ships as open-source code and beats every recent baseline the authors compared against on three cross-generator benchmarks.
Why previous detectors keep breaking
Most existing approaches suffer from poor generalization to unseen data due to their reliance on model-specific artifacts or low-level statistical cues. A detector trained on ProGAN images tends to learn the frequency quirks of ProGAN's upsampling, then falls apart on Stable Diffusion outputs that have a completely different generation paradigm.
The more recent wave of detectors, led by UnivFD, tried to sidestep this by using a pretrained CLIP encoder as a fixed backbone. UnivFD trains a linear probe on CLIP's final-layer features, while follow-ups like FatFormer and RINE mix in features from every ViT layer. The problem is that CLIP's general-purpose features contain a lot of information that has nothing to do with whether an image is real, and that noise leaks into the classifier.
The observation that changes the game
The authors ran class activation maps on CLIP ViT-L/14 layer by layer, comparing real photos against outputs from ProGAN and Stable Diffusion v1.4. The pattern that emerged is the paper's core insight:
- Shallow layers (0-7) look basically the same for real and fake images because they capture low-level textures both share.
- Deep layers (16-23) also look similar because CLIP's text-image training pulls both toward the same semantic manifold.
- Middle layers (roughly 11-19) are where things diverge. Real images keep their attention smoothly focused on the same regions from one layer to the next, while ProGAN and SD v1.4 show noticeable attention shifts between foreground and background regions in mid-level features, indicating unstable representations and discrepancies in layer transition.

The intuition is that generative models optimize for pixel realism and semantic plausibility, but not for the physical consistency that mid-level features encode. When the ViT tries to compose local textures into structural parts, synthetic images break that assembly, and the break shows up as a jump between adjacent layer activations.
How LTD turns this into a detector
The method uses a frozen CLIP ViT-L/14 as the backbone and only trains a lightweight head on top. The pipeline has three moving parts:
- Dynamic layer selection. Rather than hard-coding which layers to look at, the model learns to pick a window of
nconsecutive mid-level layers per input using Gumbel-Softmax, which keeps the selection differentiable during training. - Discrepancy calculation. For the selected layers, it computes feature differences between adjacent CLS tokens:
d_k = f_(k+1) - f_k. These difference vectors are what the paper calls the LTD features. - Dual-branch classification. One branch processes the raw selected features for holistic consistency, the other processes the LTD differences to amplify inter-layer variation. A weight-shared ViT block handles both, and an MLP does the final real/fake call.

Ablations show the weight sharing matters: an unshared variant loses 1.46% on UFD and 4.81% on DRCT-2M. The layer selection sweet spot lands at 5 consecutive layers spanning layers 11 to 19.
The numbers
The team trained on just two classes (chair and tvmonitor) from 72k ProGAN images plus real LSUN samples, and the model converges in just 5 epochs on a NVIDIA RTX 4090 GPU. Across three benchmarks:
| Benchmark | LTD mean Acc | Previous best | Gap |
|---|---|---|---|
| UFD (16 generators) | 96.90% | 95.98% (FatFormer) | +0.92% |
| DRCT-2M (13 SD variants) | 99.54% | 98.22% (ForgeLens) | +1.32% |
| GenImage (8 generators) | 91.62% | 89.18% (ForgeLens) | +2.44% |
The paper claims our approach exceeds the base model by 14.35% in mean Acc across three datasets containing diverse GANs and DMs. The gains are largest on the hardest slices: on ADM, a diffusion generator with complex noise scheduling, LTD hits 88% accuracy where most baselines struggle to break 80%.
What holds up and what doesn't
Robustness testing tells a more interesting story than the headline accuracy. Under JPEG compression at quality 80 and downsampling at 0.5x, LTD loses only 1.2% and 0.18% accuracy respectively on the Chameleon in-the-wild dataset. Under Gaussian blur it loses 6.52%, and under all three combined it drops 4.77%.
The comparison with ForgeLens is revealing. ForgeLens implicitly relies on high-frequency local artifacts, so when JPEG or downsampling smooths those out, its clusters collapse into overlap. LTD's cross-layer consistency cues live at a coarser granularity that survives these degradations. That makes it a better fit for the social-media distribution channel where synthetic images actually get shared.
The limitations are real. When trained only on ProGAN, LTD still struggles on modern generators like SDXL-Turbo, hitting roughly 58% accuracy on Chameleon. Training on more recent generators like LCM-SDv1.5 pushes that to 75.66%, but it confirms that no amount of clever architecture beats the need for training data from contemporary generators.
Using it
The official repo ships training and evaluation scripts, along with pretrained checkpoints for the UFD/GenImage and DRCT-2M settings on both Google Drive and Baidu Netdisk. Setup is a standard conda environment with a requirements.txt, and the training loop runs from train.sh after pointing it at your dataset paths. The project builds on the UniversalFakeDetect codebase, so anyone already familiar with that framework will find the interface immediately recognizable.
For content authenticity pipelines, moderation systems, or forensic tooling that has to handle images from generators the training set never saw, LTD offers a lightweight upgrade path: swap in the head, keep the frozen CLIP backbone, and get generalization gains without a full retraining cycle.