Skip to content

EricTan7/Veritas

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

13 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

Veritas: Generalizable Deepfake Detection via Pattern-Aware Reasoning [ICLR 2026 Oral]

[ πŸ“„Paper | πŸ”—Data | πŸš€Model ]

In this work, we introduce:

πŸ“HydraFake Dataset: A deepfake detection dataset with rigorous training and evaluation protocol.

πŸ“Veritas Model: A reasoning model achieving remarkable generalization on OOD forgeries, capable of providing transparent and human-aligned decision process.

News

  • πŸ”₯ 2026.2.10 We release our new work πŸš€VideoVeritas for AI-generated video detectionπŸ”₯πŸ”₯πŸ”₯! Dataset and Model are released [ Paper | Data | Model ]
  • πŸ”₯ 2026.2.6 The training data is released. Veritas and Veritas-Cold-Start are both released. We recommend using Veritas-Cold-Start to customize your own detector (see below for more details).
  • πŸ”₯ 2026.2.6 Veritas is selected as ICLR 2026 Oral.
  • πŸ”₯ 2026.1.26 Veritas has been accepted to ICLR 2026.
  • πŸ”₯ 2025.9.17 We release the inference code for MLLMs and small vision models.
  • πŸ”₯ 2025.9.17 We release the HydraFake dataset (train/val/test).

Installation

conda create -n veritas python=3.10
conda activate veritas

# Install the dependencies
pip install -e .

πŸ”₯ Training

Download training data here, including sft_36k.json, mipo_3k.json, pgrpo_8k.json.

1. Cold-start (SFT)

sh self_scripts/train/train_sft.sh sft sft_36k

2. Cold-start (MiPO)

sh self_scripts/train/train_mipo.sh mipo mipo_3k

3. P-GRPO

1.Deploy reward model. Download reward model here, and replace the path in swift/plugin/prm.py and self_scripts/deploy/deploy_reward_model.sh.

Note: the choice of reward model is flexible. More powerful models may lead to better performance, e.g., UnifiedReward-qwen-7B, Qwen3-VL-8B or UnifiedReward-2.0-qwen3vl-8B.

sh self_scripts/deploy/deploy_reward_model.sh

2.P-GRPO training.

sh self_scripts/train/train_pgrpo.sh pgrpo pgrpo_8k

πŸš€ Customize your own detector

We recommend using Veritas-Cold-Start + P-GRPO for further customization:

  • Veritas is fine-tuned on in-domain datasets, i.e., the latest generative model is SD-XL. As mentioned in our paper, for practical usage, you can further fine-tune Veritas-Cold-Start on your own collected data.
  • If you adopt our P-GRPO, the only thing you should prepare is the binary labels of your data. Arrange them similar to our pgrpo_8k.json.
  • We also encourage the development of (1) novel GRPO-style algorithm, e.g., involving grounded reward design to deliver more precise cross-modal signals, and (2) collaborative framework with small vision models, which can be exciting furture works.

πŸ”Ž Inference on single image

We recommend using vLLM for model deployment:

sh self_scripts/deploy/deploy_model.sh /path/to/your/model

Inference on a single image:

python self_scripts/infer/infer_vllm_single.py \
--image_path /path/to/your/image

βŒ› Test your model on HydraFake Dataset

1. Data Preparation

Download the HydraFake dataset and the json files. Put the json files under ./datasets. The data structure should be like:

hydrafake
β”œβ”€β”€ test                # testing images
|   β”œβ”€β”€ AdobeFirefly
|   |   β”œβ”€β”€ 0_real
|   |   β”‚   └── *.png
|   |   β”œβ”€β”€ 1_fake
|   |   β”‚   └── *.png
|   |── ...
β”œβ”€β”€ val                 # validation images
|   β”œβ”€β”€ real
|   |   └── *.png
|   β”œβ”€β”€ fake
|   |   └── *.png
β”œβ”€β”€ train               # training images
|   β”œβ”€β”€ fake
|   |   β”œβ”€β”€ FS
|   |   |   β”œβ”€β”€ blendface
|   |   |   β”‚   └── *.png
|   |   |   β”œβ”€β”€ ...
|   |   β”œβ”€β”€ FR
|   |   |   β”œβ”€β”€ Aniportrait
|   |   |   β”‚   └── *.png
|   |   |   β”œβ”€β”€ ...
|   |   β”œβ”€β”€ EFG
|   |   |   β”œβ”€β”€ Dall-E1
|   |   |   β”‚   └── *.png
|   |   |   β”œβ”€β”€ ...
β”œβ”€β”€ jsons
|   β”œβ”€β”€ test
|   |   β”œβ”€β”€ id
|   |   β”‚   └── *.json 
|   |   β”œβ”€β”€ cm
|   |   β”‚   └── *.json 
|   |   β”œβ”€β”€ cf
|   |   β”‚   └── *.json 
|   |   β”œβ”€β”€ cd
|   |   β”‚   └── *.json 
|   β”œβ”€β”€ val
|   |   └── *.json 
|   β”œβ”€β”€ train
|   |   β”œβ”€β”€ fake
|   |   |   β”œβ”€β”€ FS
|   |   |   β”‚   └── *.json 
|   |   |   β”œβ”€β”€ FR
|   |   |   β”‚   └── *.json 
|   |   |   β”œβ”€β”€ EFG
|   |   |   β”‚   └── *.json 
|   |   β”œβ”€β”€ real
|   |   β”‚   └── *.json 

You can also put the dataset in other places, then you should change the json file path in ./swift/llm/dataset/dataset/data_utils.py and the image path in the json files.

2. Test your MLLMs

2.1 Inference with ms-swift

Run inference on HydraFake:

sh self_scripts/infer/infer_hydrafake.sh /path/to/your/model

Inference on a specific subset:

swift infer \
    --val_dataset cd_gpt4o \
    --model /path/to/your/model \
    --infer_backend pt \
    --max_model_len 8192 \
    --max_new_tokens 2048 \
    --dataset_num_proc 16 \
    --max_batch_size 8 \
    --metric self_acc_tags

2.2 Inference with vLLM

Step1: Deploy your model:

sh self_scripts/deploy/deploy_model.sh /path/to/your/model  # models/Qwen2.5-VL-7B-Instruct

Step2: Run inference (put your model path in self_scripts/infer/infer_vllm.py):

sh self_scripts/infer/infer_hydrafake_vllm.sh 

3. Test your vision models

We provide a script based on DeepfakeBench.

# Effort for example
python DeepfakeBench/training/test.py \
--detector_cfg DeepfakeBench/training/config/detector/effort.yaml \   
--dataset_cfg DeepfakeBench/training/config/dataset/hydrafake.yaml \
--weights_path /path/to/your/model

πŸ›‘οΈ HydraFake Dataset

πŸ“ Overview:

Dataset

(a) We carefully collect and reimplement advanced deepfake techniques to construct our HydraFake dataset. Real images are collected from 8 datasets. Fake images are from classic datasets, high-quality public datasets and our self-constructed deepfake data. (b) We introduce a rigorous and hierarchical evaluation protocol. Training data contains abundant samples but limited forgery types. Evaluations are split into four distinct levels. (c) Illustration of the subsets in different evaluation splits. (d) The performance of prevailing detectors on our HydraFake dataset. Most detectors shows strong generalization on Cross-Model setting but poor ability on Cross-Forgery and Cross-Domain scenarios.

πŸ“ Statistics:

Dataset overview

HydraFake contains 52K images in total for evaluation, with 14K in-domain testing, 11K cross-model testing, 12K cross-forgery testing and 15K cross-domain testing.

πŸ›°οΈ Method

πŸ“ We introduce a pattern-aware reasoning framework, including three basic thinking patterns (fast judgement, reasoning, conclusion) and two advanced patterns (planning and self-reflection).

πŸ“ Two-stage training pipeline:

(1) Pattern-guided Cold-Start (SFT + MiPO): Internalize thinking patterns and align reasoning process

(2) Pattern-aware Exploration (P-GRPO): Scale up effective patterns, improve reflection quality.

Training pipeline

Citation

If you find our work useful, please cite our paper:

@inproceedings{tan2025veritas,
  title={Veritas: Generalizable Deepfake Detection via Pattern-Aware Reasoning},
  author={Tan, Hao and Lan, Jun and Tan, Zichang and Liu, Ajian and Song, Chuanbiao and Shi, Senyuan and Zhu, Huijia and Wang, Weiqiang and Wan, Jun and Lei, Zhen},
  booktitle={International Conference on Learning Representations},
  year={2026}
}

License

This repo is released under the Apache 2.0 License.

Acknowledgements

This repo benefits from ms-swift and DeepfakeBench. Thanks for their great works!

About

[ICLR 2026 Oral] Veritas: Generalizable Deepfake Detection via Pattern-Aware Reasoning.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages