01DataShortcuts and twins
Less data, better results: how I made an AI image detector reliable
The problem wasn't missing data. It was a shortcut hidden in the data I already had. How I found it and closed it.
The case
Imagine you are looking for a flat and find a listing with a perfect kitchen. Too perfect: the photo was made by an AI, and the flat doesn't exist. A detector has to catch it.
One of the early versions of my detector caught it almost every time. Its test scores were excellent. But a high score doesn't tell you how the model reaches its answer. And I wanted to know that before I could trust it.
The discovery: the blind check
To understand what a model has learned, I run a simple test. I build a second, small model and don't show it the photo at all. I only give it information that shouldn't matter: how big the image is, what shape it has, how the file is saved. It's a "blindfolded" model.
If the "blindfolded" model gets it right, the data contains a shortcut: a clue that separates real photos from fake ones without even looking at them.
The result surprised me. Looking only at how many megapixels the image had, the "blindfolded" model spotted the AI-made one 91 times out of 100.
The rule of 64
So I looked at the sizes, one by one. The test set contained 629 AI-generated images: all 629 had sides divisible by 64. Generators produce images in standard sizes, multiples of 64 pixels. Cameras and smartphones don't.
A very basic rule, "if the sides divide by 64, it's fake", would have caught them all. My model had learned something very similar. Instead of looking at the photo, it was measuring the frame.

1024 × 768 pixels
1024 ÷ 64 = 16768 ÷ 64 = 12
Fake
0 pixels cropped
The damage
A shortcut works as long as the world looks like the training data. In reality, real photos come in a thousand sizes: cropped, resized, taken with different phones.
On a public collection of over 3,000 photos taken with real cameras, that model mistook 20 out of 100 for fakes. One real photo in five. For anyone who has to decide whether a piece of evidence is authentic, that is an unacceptable error.
What didn't work
Faced with a problem like this, the usual answer is: more data, or a bigger model. I tried both.
- More data. One of the early versions was trained on about 610,000 images from 7 different collections. It recognised AI images, but mistook half of the real photos for fakes.
- A huge model. I tried a model with 7 billion parameters. Good numbers, but expensive, and only usable with a high-end graphics card.
The problem wasn't quantity. The data contained an easy answer, and any model, big or small, would have found it.
The idea: twins
If real and fake photos can be told apart "from the outside", they have to become identical from the outside. Every AI image gets its real twin: same size, same crop, same compression, same file format. Only one difference is left, the one that matters: who made the pixels.
I created the twins myself, systematically. I started from real photos and, from each one, generated its fake version with AI. Then I applied exactly the same size, crop, compression and format to every pair. One fixed rule, the same for every pair, no exceptions.


The first attempt wasn't enough. With only the crop matched, the "blindfolded" model still got it right 100 times out of 100, just by reading the file header: every program leaves its signature there. I had to match everything at once: size, crop, compression and format.
In the end the "blindfolded" model got it right 51 times out of 100. Like flipping a coin. The shortcut was closed, and the real model had only one thing left to learn: the pixels.
The proof
Same task, same type of model. Only the data changes.
From one real photo in five mistaken for a fake, to one in two hundred.
The lesson
Today's model is trained on about 120,000 images: five times fewer than the 610,000 version. And the model it builds on is small, 22 million parameters: 300 times smaller than the 7-billion giant, with the same result. It even runs on an ordinary laptop processor.
More data and more computing power cost money, and often don't solve the problem. What made the difference was the method: first ask what the model is learning, then measure it, then fix the data. It's how a science lab works, applied to AI.
The same happened with my audio detector. On a public collection of almost 2,000 audio clips taken from social media, it went from 50 to 93 out of 100 at recognising the generated voice. Same model: I only changed the data.
In short
- Before I can trust a number, I check how the model gets there.
- I found a shortcut hidden in the data and closed it with twins.
- The result came from the method, not from more data or a bigger model.