Cross_Attention_Fusion
AI image detector with text explanations
2 min readupdated
This multimodal model is designed to determine whether an image is real or AI-generated, providing both a verdict and a text explanation. At the architectural level, it combines features from the CLIP visual encoder and the NPR expert via a trainable cross-attention gateway block, feeding them into a LLaVA-NeXT language model based on Mistral 7B. The model was trained on a sample of 16,000 images from the AIGI-Holmes dataset with frozen visual modules and LoRA adapters (small adjustments for the language part). This solution is well-suited for researchers and developers working on media content verification.
Key features
- Hybrid architecture: combines CLIP and NPR via a cross-attention gateway.
- Language backend: uses the LLaVA-NeXT model based on Mistral 7B.
- Efficient training: applies rank-64 LoRA (low-rank adaptation) on a 4-bit language model.
- Text response: outputs not only a verdict but also a detailed explanation for it.
What you can do
- Image verification: run inference to classify images as authentic or generated.
- Detail analysis: receive text explanations detailing the reasons for classifying a specific frame.
Example
To run the model, you initialize the composite component and a custom runtime with cross-attention to load the projector and LoRA adapter using the Transformers and PEFT libraries.
Read more
DetailsBenchmarks: accuracy on held-out samples was not measured
Training details: 8,000 real and 8,000 generated images from AIGI-Holmes, 1 epoch in 2,000 steps
Parameters: batch size 8, final loss 0.3008, used Transformers 4.47.1 and PEFT 0.12.0










Comments