Training-free deepfake image verification via VQA-style probing with LVLMs + LLM reasoning.
TruthLens reframes fake image detection as a Visual Question Answering (VQA) problem. Instead of an opaque binary classifier, it:
- Probes an input image with a set of artifact-focused prompts using a Large Vision-Language Model (LVLM) (e.g., Chat-UniVi).
- Aggregates the LVLM’s natural-language answers into a structured evidence summary.
- Reasons over that evidence with an LLM to output a final verdict (
REAL/FAKE) and a concise justification.
The goal is instance-level, explainable data verification without detector fine-tuning.
conda create -n truthlens python=3.10 -y
conda activate truthlens
pip install --upgrade pip
pip install -r requirements.txtThis installs:
- torch==2.5.1
- tqdm==4.67.1
- Pillow==10.0.1
- openai==0.28.0 (legacy client used by
evaluation_gpt.py)
inference_image_chatunivi.py imports ChatUniVi.*, so you must install Chat-UniVi in the same environment.
One common approach:
git clone https://github.com/PKU-YuanGroup/Chat-UniVi
cd Chat-UniVi
pip install -e .
cd ..Validate:
python -c "import ChatUniVi; print('ChatUniVi import OK')"inference_image_chatunivi.py expects a dataset directory with two subfolders:
<dataset_path>/
fake1000/
*.png|*.jpg|*.jpeg|*.bmp|*.tiff
first1000/
*.png|*.jpg|*.jpeg|*.bmp|*.tiff
It will write JSON output files into each subfolder and a combined JSON at the dataset root.
Open inference_image_chatunivi.py and set:
dataset_path = "your path"- GPU selection: the script currently hardcodes
os.environ["CUDA_VISIBLE_DEVICES"] = "1"
Change"1"to the GPU you want (or remove the line).
Run:
python inference_image_chatunivi.pyTo run the full TruthLens probe set, repeat the probing pass with different query strings (see Prompt set below) and save each pass to a separate JSON.
Edit concatinate_jsons.py to point json_paths at the JSON files produced by your different prompt runs, then:
python concatinate_jsons.pyOutput:
combined_descriptions.json
Run:
python evaluation_gpt.py --description_file combined_descriptions.json --output_dir outputs/ --api_key YOUR_OPENAI_KEYOutputs:
outputs/<image_name>_analysis.jsonfor each imageoutputs/analysis_metrics.json
Metrics note: evaluation_gpt.py currently computes accuracy as fake_count / total_images, which only makes sense if your description file contains only fake images. If you mix real and fake images together, you should update the metrics logic to use labels.
Recommended categories (adapt these into separate probe runs):
- Lighting and Shadows
- Texture and Skin Details
- Symmetry and Proportions
- Reflections and Highlights
- Facial Features and Expression
- Facial Hair (if applicable)
- Eyes and Pupils
- Background and Depth Perception
- Overall Realism
Tip: save one JSON per prompt category so aggregation is clean and debuggable.
CNN-based binary classifier baseline. Includes its own scripts, dataset download helpers, and weights.
Follow CNNDetection-master/README.md.
Diffusion Reconstruction Error baseline. Includes guided diffusion utilities and its own scripts.
Follow DIRE-main/README.md.
If you use TruthLens, cite the paper:
- ICML 2025 page: paper