ViT–NPR Gated Cross-Attention for AI-Generated Image Detection
Given an image and a prompt such as “Is this image real or AI-generated? Explain briefly,” this model generates a verdict and a textual explanation. It combines features from a CLIP vision transformer and an NPR vision expert using a learned cross-attention gate. The fused features condition a LLaVA-NeXT model with a Mistral 7B language backbone.
Training
The training subset contained 8,000 real images and 8,000 AI-generated images from the AIGI-Holmes dataset. Training used frozen visual backbones, a trainable fusion projector, and rank-64 LoRA adapters on the 4-bit language model. With an effective batch size of 8, the run completed one epoch in 2,000 optimizer steps. Training resumed from step 1,000 and finished with a last logged training loss of 0.3008.
Checkpoint and inference
The final training checkpoint is in checkpoint-2000/. For inference, use the matching composite model initialization and the project's custom cross-attention runtime to load the trained projector and LoRA adapter. The run used Transformers 4.47.1 and PEFT 0.12.0.
Verification and limitations
After training, the project reloaded the full model in a fresh process. On a sample labeled AI-generated, the model answered “This is a fake image” and generated a description. This check demonstrates that the saved checkpoint can produce an image-conditioned response. Accuracy on held-out images and the reliability of the generated explanations remain unmeasured.