Inspiration

The rapid advancement of generative AI models has made it increasingly easy to create highly realistic fake images. These images can be used to spread misinformation, manipulate public opinion, or create misleading digital content. While many AI systems can detect manipulated images, most of them only provide a prediction without explaining why the image is considered fake. Our inspiration was to build a system that not only detects AI-generated or manipulated images but also explains the reasoning behind the prediction. We wanted to combine computer vision, explainable AI, and large language models to create a transparent and trustworthy detection system. This project aims to help users understand how AI systems make decisions, improving trust in AI-powered verification tools.

What it does

Our project, VisionXplain: LLM for Fake Image Detection, is an AI-powered system that analyzes images to determine whether they are real or AI-generated. The system processes an uploaded image through a machine learning pipeline and produces a prediction along with an explanation.

The system performs the following tasks:

  1. Accepts an image upload through a web interface.
  2. Extracts semantic visual features using a CLIP vision encoder.
  3. Uses a trained neural network classifier to predict whether the image is real or fake.
  4. Generates an attention heatmap highlighting the regions that influenced the decision.
  5. Uses a BLIP vision-language model to generate a description of the image.
  6. Uses an LLM reasoning module to produce a human-readable explanation of the prediction.
  7. Generates a downloadable analysis report including the prediction, confidence score, and explanation.

The goal is to provide both detection and explainability, making the system more transparent and trustworthy.

How we built it

We built the system using a combination of deep learning, computer vision models, and a web-based interface.

The workflow of the system is as follows: Frontend Interface

  • Built using a Node.js server and web interface.
  • Allows users to upload images and view analysis results.

Backend Processing

  • Implemented using Python and Flask.
  • Handles image uploads, runs the machine learning pipeline, and returns results to the frontend.

Image Preprocessing

  • Images are resized and normalized using PyTorch preprocessing pipelines.
  • The image is converted into a tensor format suitable for neural networks.

Feature Extraction

  • We use the CLIP (Contrastive Language–Image Pretraining) vision model to extract semantic image embeddings.
  • The model converts the image into a high-dimensional feature vector representing visual patterns.

Fake Image Classification

  • A custom neural network classifier trained on extracted features predicts whether the image is real or fake.
  • The classifier outputs both a prediction and a confidence score.

Visual Explainability

  • An attention-based heatmap highlights which regions of the image influenced the model's decision.

Vision-Language Understanding

  • The BLIP image captioning model generates a textual description of the image.

LLM Reasoning

  • A large language model processes the prediction, heatmap summary, and visual evidence to generate a detailed explanation.

Report Generation

  • The system generates a report containing the prediction, explanation, and visualizations.

Challenges we ran into

  • One of the major challenges was integrating multiple AI models into a single pipeline. Each model operates differently, and coordinating them required careful preprocessing and data handling.

  • Another challenge was ensuring compatibility between feature extraction and the trained classifier. Different versions of the CLIP model produce embeddings of different dimensions, so aligning the feature dimensions with the classifier was critical.

  • We also encountered issues with model outputs and tensor formats when working with transformer-based models. Debugging these issues required a deep understanding of how vision transformer outputs are structured.

  • Additionally, generating meaningful explanations was challenging. Simply detecting fake images is not enough; the system must also produce explanations that are understandable to users.

Accomplishments that we're proud of

We are proud of successfully building an end-to-end explainable fake image detection system.

Some of our key accomplishments include:

  • Developing a full machine learning pipeline for image authenticity detection.
  • Integrating CLIP, BLIP, and LLM reasoning into a unified system.
  • Implementing visual explainability using attention heatmaps.
  • Creating a web-based interface that allows users to upload and analyze images easily.
  • Generating automated analysis reports that provide both predictions and explanations.

Most importantly, the system demonstrates how AI can be made more transparent and interpretable, which is crucial for building trust in AI technologies.

What we learned

Throughout this project, we gained valuable experience in several areas of AI and software development.

  • We learned how to work with vision-language models, how to extract and use semantic embeddings from pretrained models like CLIP, and how to build machine learning pipelines that integrate multiple AI components.
  • We also learned the importance of model compatibility, debugging deep learning systems, and designing explainable AI systems that provide interpretable outputs instead of black-box predictions.
  • In addition, building the frontend and backend integration helped us understand how to deploy machine learning systems as interactive applications.

What's next for LLM for Fake Image Detection

In the future, we plan to extend this system in several ways.

  • First, we want to improve the accuracy of the classifier by training it on larger and more diverse datasets containing various types of AI-generated images.
  • Second, we plan to integrate advanced explainability techniques such as Grad-CAM and attention rollout to provide more precise visual explanations.
  • Third, we aim to expand the system to detect deepfake videos and AI-generated media, not just images.
  • Finally, we want to deploy the system as a cloud-based verification tool that journalists, researchers, and social media platforms can use to detect manipulated digital media in real time.
Share this project:

Updates

Submission history