Forensics Adapter: Adapting CLIP for Generalizable Face Forgery Detection

Xinjie Cui, Yuezun Li, Ao Luo, Jiaran Zhou, Junyu Dong

Abstract

Deepfake detection models often struggle with generalization, performing well on training data but failing on novel manipulation techniques. We present the Forensics Adapter, a lightweight (5.7M parameters) module designed to transform the CLIP vision-language model into a robust face forgery detector. By focusing on "blending boundaries"—the subtle artifacts created during the merging of forged content—and employing task-specific objectives including masked boundary learning and contrastive patch-wise analysis, our method achieves a significant performance boost. Experimental results across five major datasets demonstrate a 7% average AUC improvement over state-of-the-art techniques, particularly excelling on challenging datasets like the Deepfake Detection Challenge (DFDC).

Introduction

The rapid advancement of face forgery techniques necessitates highly generalizable detection methods. Current convolutional neural network (CNN)-based detectors often overfit to specific training textures, leading to a significant "generalization gap" when faced with novel forgery types. While large-scale foundation models like CLIP possess extensive visual knowledge, this information is often "entangled," making it difficult to extract forgery-specific cues directly.

Comparison of existing methods versus the proposed Forensics Adapter, highlighting the conceptual shift and overall performance gains across major datasets.

The Forensics Adapter addresses these challenges by steering CLIP's internal attention toward subtle manipulation artifacts. The authors identify the "smoking gun" of face forgery as the inconsistency at the blending boundary where a generated face meets a real head. Unlike previous methods that use CLIP as a static feature extractor, this approach uses a lightweight adapter to guide CLIP's broad visual understanding toward these specific forensic clues.

Methods

The Forensics Adapter framework utilizes a lightweight "Tiny ViT" operating in parallel with a frozen CLIP image encoder. The core innovation lies in the bidirectional interaction between the adapter and CLIP: the adapter "absorbs" visual tokens from CLIP's shallow layers to leverage its foundational knowledge, and in turn, "enhances" CLIP by injecting attention biases that highlight potential forgery regions.

Detailed architecture of the Forensics Adapter, illustrating the interaction with CLIP and the three task-specific loss functions: masked boundary learning ($L_1$), patch-wise contrastive learning ($L_2$), and sample-wise contrastive learning ($L_3$).

The training process is guided by three task-specific objectives:

  • Masked Blending Boundary Learning ($L_1$): The model predicts a map of the blending boundary. A masking strategy ensures the model focuses on these thin edges rather than large areas of real or fake pixels.
  • Patch-wise Contrastive Learning ($L_2$): The adapter learns to differentiate the feature representations of "real" patches from "fake" patches within the same image.
  • Sample-wise Contrastive Learning ($L_3$): This objective pulls global features of real images together while pushing fake images away in the feature space.

Results and Discussion

Evaluated on datasets including Celeb-DF (v1 & v2), DFDC, DFDCP, and DFD, the Forensics Adapter demonstrates superior cross-dataset generalization. Key results include:

  • Performance Boost: An average frame-level AUC improvement of ~7% across five standard datasets compared to previous leaders like LSDA.
  • Challenging Data: On the notoriously difficult DFDC dataset, the model outperformed the previous best method by 10.7% in AUC.
  • Robustness: The model maintains high performance even under heavy perturbations such as Gaussian blur, JPEG compression, and color saturation changes.
  • Efficiency: By keeping the massive CLIP model frozen and only training the 5.7M parameter adapter, the method achieves state-of-the-art results with high computational efficiency.

Conclusion

The Forensics Adapter demonstrates that task-specific steering of foundation models is a highly effective strategy for specialized computer vision tasks like deepfake detection. By focusing on the fundamental artifacts of blending, the model achieves state-of-the-art generalization. While primarily designed for local facial manipulations, future work will explore extending this framework to detect whole-image synthesis generated by GANs or Diffusion models.

Summary updated

BibTeX
@inproceedings{cui2025forensics,
  author = {Xinjie Cui and Yuezun Li and Ao Luo and Jiaran Zhou and Junyu Dong},
  title = {{Forensics Adapter: Adapting CLIP for Generalizable Face Forgery Detection}},
  booktitle = {IEEE/CVF Conference on Computer Vision and Pattern Recognition},
  year = {2025},
  doi = {10.1109/cvpr52734.2025.01789},
}
Figure