Write-up · November 2026
Does a deepfake detector still work on fakes it has never seen?
I trained two detectors on images from one generator, Stable Diffusion 1.4, and tested both on eight. The fine-tuned CNN was slightly better at home and fell apart away from it. A linear probe on frozen CLIP features held up much better, but not everywhere.
Setup
- Data: GenImage. Real ImageNet photos, plus fakes from eight generators.
- Training: SD 1.4 only, 5,000 real and 5,000 fake images.
- Testing: about 1,000 held-out images per generator, half real and half fake. Train and test files never overlap (checked by hash). SD 1.5 and Wukong are SD-based, so I count them as the same family. Midjourney, GLIDE, VQDM, ADM and BigGAN are the real test.
- Model A: ConvNeXt-Tiny, fine-tuned end to end.
- Model B: CLIP ViT-L/14 kept frozen, with a logistic-regression probe on its image features.
- Metric: AUC, the chance that a random fake scores higher than a random real image. 1.0 is perfect, 0.5 is a coin flip, and below 0.5 the scores are upside down.
Results
| Generator | A: ConvNeXt | B: CLIP probe |
|---|---|---|
| SD 1.4 trained on | 0.995 | 0.986 |
| SD 1.5 same family | 0.993 | 0.984 |
| Wukong same family | 0.976 | 0.959 |
| Midjourney | 0.702 | 0.907 |
| GLIDE | 0.581 | 0.877 |
| VQDM | 0.569 | 0.716 |
| ADM | 0.467 | 0.699 |
| BigGAN | 0.376 | 0.675 |
A wins on its home ground by less than 0.02 AUC. Everywhere else B wins, often by a lot: Midjourney 0.91 against 0.70, GLIDE 0.88 against 0.58. A is below chance on ADM and BigGAN, which means it rates those fakes as more real than the real photos. B is still weak on ADM, VQDM and BigGAN.
The shortcut I had to rule out first
In the raw dataset the real photos are JPEGs and most fakes are PNGs. A model could get a perfect score by reading the file format and never look at the picture. To check, I trained a small classifier on file metadata only: format, size, byte count and the JPEG quantisation table. On the raw files it scored 1.00 AUC.
So I resized every image to 224 by 224 and saved it as a JPEG, and JPEG-compressed the fakes first at a random quality so they carry the same artefacts as the real photos. After that, metadata alone scored 0.52, close to chance. As a second check, B's scores with and without this format matching agree within about 0.01 AUC on every generator except BigGAN, so B isn't just detecting compression.
Ranking survives, the threshold doesn't
B's AUC stays well above its accuracy at a 0.5 cut-off, and the gap grows the further a generator is from SD 1.4: 0.05 on SD 1.4, 0.16 on BigGAN. At 0.5 it catches 94% of SD 1.4 fakes but only 9% of BigGAN fakes. B still orders the images sensibly, but a threshold learned on one generator doesn't carry over to the others, and in the real world you don't know which generator you're facing.
What failed
Each grid shows a model's 20 most confident mistakes, labelled generator, true label and score. I checked every pattern below against the score files.
- Every confident mistake is a missed fake, never a false alarm. All 40 images are fakes that the models called real. False alarms stay low and flat: A flags 1 to 4% of real photos, B 6 to 9%. Anything that doesn't look like SD 1.4 falls back to "real".
- A is confidently wrong. B is mostly unsure. A misses all 500 BigGAN fakes and gives 462 of them a score below 0.01. B also misses 455, but only 67 of them score that low. B's misses sit closer to the line, which matches the threshold problem above.
- The two models fail on different images. A's worst cases are 15 BigGAN fakes: small, soft, smeared animals on plain backgrounds. B's are mostly ADM and VQDM fakes of busy everyday snapshots, like foliage, crowds and people. My reading, which I haven't tested: A learned SD 1.4's texture fingerprint, while B judges content, so fakes with realistic snapshot content fool it.
Limitations
- BigGAN is sensitive to preprocessing (0.675 AUC with format matching, 0.524 without) and weak either way. Its images are 128px and get upscaled, which may matter more than anything the model learned.
- One training run per model, so there are no confidence intervals. Small gaps, like A against B on SD 1.5, mean nothing.
- Images only. Nothing re-compressed by a social app, edited or screenshotted.
Images from GenImage (Zhu et al.), licensed CC BY-NC-SA and shown here for non-commercial research. Full method, code and reproduction steps are in the repository.