Smaug-AI-Image-Detector

Homepage Hugging Face
License

1. About

The official GGUF build of Smaug-AI-Image-Detector for llama.cpp, converted by Abacus.AI from the released weights and checked image by image against the PyTorch model.

The detector is an image encoder followed by a small classification head. llama.cpp runs the encoder and returns an image embedding; head.json (768 weights and a bias) and smaug_image_detect_gguf.py turn that embedding into the probability that the image is AI-generated, using the same 528 ร— 528 crops as the PyTorch release. A GGUF file on its own returns an embedding, not a verdict.

2. Files

FileSizeUse
Smaug-AI-Image-Detector-f16.gguf558 MBLanguage model (f16): reference, closest to PyTorch
Smaug-AI-Image-Detector-Q8_0.gguf310 MBLanguage model (Q8_0): recommended
mmproj-Smaug-AI-Image-Detector-f16.gguf367 MBVision encoder (f16): reference, closest to PyTorch
mmproj-Smaug-AI-Image-Detector-Q8_0.gguf226 MBVision encoder (Q8_0): recommended
head.json10 KBClassification head: 768 weights and a bias
smaug_image_detect_gguf.py4 KBClient: crops, llama.cpp embedding, head

Use a language model and a vision encoder (mmproj) of the same precision: f16 with f16, or Q8_0 with Q8_0.

3. Accuracy vs. the PyTorch Release

Language model + vision encoderDownloadAUCAverage probability differenceLargest probability differenceVerdicts changedSeconds per image (CPU)
f16 + f16925 MB0.97220.00790.17140 of 2002.0
Q8_0 + Q8_0 (recommended)536 MB0.97200.00650.19810 of 2002.4

Measured on 200 real-world images from the OpenFake Reddit test split (100 real photos, 100 AI-generated), three crops each, against the PyTorch release on the same images (AUC 0.9723). "Verdicts changed" counts images that land on the other side of the 0.5 threshold. The token sequence and pixels are identical to the PyTorch release; the small remaining differences come from floating-point arithmetic and are largest for images close to the threshold. CPU timings: 16-core (32-thread) Intel Xeon, llama.cpp default threads, f174553. Full benchmark results are on the main model card.

4. Usage

# 1. Download one language model, one vision encoder, the head and the client
hf download abacusai/Smaug-AI-Image-Detector-GGUF \
  Smaug-AI-Image-Detector-Q8_0.gguf mmproj-Smaug-AI-Image-Detector-Q8_0.gguf head.json smaug_image_detect_gguf.py \
  --local-dir smaug

# 2. Serve the image encoder with llama.cpp
llama-server -m smaug/Smaug-AI-Image-Detector-Q8_0.gguf --mmproj smaug/mmproj-Smaug-AI-Image-Detector-Q8_0.gguf \
  --embeddings --pooling mean --image-max-tokens 140 --port 8080

# 3. Score images
pip install pillow requests
python smaug/smaug_image_detect_gguf.py photo.jpg another.png
from smaug_image_detect_gguf import SmaugImageDetectGGUF

detector = SmaugImageDetectGGUF("http://127.0.0.1:8080")   # the llama-server from step 2
detector("photo.jpg")                                       # -> float in [0, 1]
detector(["a.jpg", "b.png", pil_image])                    # -> list of floats
detector("photo.jpg", crops=1)                              # 3x faster

--pooling mean and --image-max-tokens 140 are required: they match how the detector was trained. 0.5 is a good default threshold; raise it when a false alarm is costly.

5. How It Works

1. CropsShorter side resized to 576 px, then three 528 ร— 528 crops along the long side (client)
2. EmbeddingEmbeddingGemma-2 vision encoder and language model, mean-pooled and L2-normalized, 768 dimensions (llama.cpp)
3. ScoreLinear head on each crop's embedding, logits averaged, then a sigmoid (client, head.json)

6. License

Apache 2.0, the same license as the base model, EmbeddingGemma-2.

7. Citation

@misc{abacusai2026smaugaiimagedetector,
  title  = {Smaug-AI-Image-Detector},
  author = {Abacus.AI},
  year   = {2026},
  url    = {https://huggingface.co/abacusai/Smaug-AI-Image-Detector}
}
Downloads last month
71
GGUF
Model size
0.3B params
Architecture
gemma-embedding2
Hardware compatibility
Log In to add your hardware

8-bit

16-bit

Inference Providers NEW
This model isn't deployed by any Inference Provider. ๐Ÿ™‹ Ask for provider support

Model tree for abacusai/Smaug-AI-Image-Detector-GGUF

Quantized
(2)
this model