arXiv:2610.37874cs.CVOct 2026

Manuscript Offprint

arXiv:2610.37874

PairCLIP-SWA: Similarity-Guided Balancing and Stochastic Weight Averaging for Generalized Deepfake Image Detection with OpenCLIP

Md. Nakib, Sudipto Sarkar, A. J. A. Jubayer Talukder, Mohammad Ariful Haque

Md. Nakib, Sudipto Sarkar, A. J. A. Jubayer Talukder, and Mohammad Ariful Haque

Department of Electrical and Electronic Engineering,

BUET, Dhaka 1205, Bangladesh

Abstract—Deepfake detectors are almost always deployed as the single checkpoint that scored best on a validation split, yet the reliability of that choice is rarely measured. We measure it with PairCLIP-SWA, a single-backbone detector that adapts an OpenCLIP ViT-L/14 visual tower by progressive block unfreezing on a class-balanced corpus built by CLIP-similarity-guided one-to-one subsampling, and averages the fine-tuning trajectory in weight space. Trained in-domain on the IEEE SP Cup 2025 (DF-Wild-Cup) benchmark under the same protocol as the strongest published three-backbone ensemble, the weight-averaged detector reaches 97.04% accuracy, 98.64% AU-ROC and a 4.07% equal error rate, against 94.46%, 97.60% and 5.00%. Its training log shows why averaging matters: over the averaged epochs the non-averaged checkpoint swings across 5.34 points of validation accuracy while its validation loss more than doubles, whereas the average is never worse and is up to 5.99 points better. On an OpenForensics-derived benchmark the same instability becomes a misranking: the checkpoint that validation accuracy selects (98.43%) scores 88.85% on a disjoint 10,905-image test partition, rejecting 21.1% of genuine photographs, while the terminal average, ranked last on validation, scores 94.76%. A study of twenty-two in-house configurations on the identical DF-Wild-Cup split, including preprocessing ablations, shows that CLIP pre-training rather than ensembling drives accuracy, that secondary face cropping costs about 34 points, and that frequency-domain inputs transfer poorly. We recommend per-class selection criteria measured off the early-stopping split.

Index Terms—Deepfake detection, model selection, stochastic weight averaging, CLIP, OpenCLIP, vision transformer, preprocessing, class imbalance, evaluation methodology, media forensics.

I. INTRODUCTION

GENERATIVE adversarial networks [1], [2] and latent diffusion models [3] have made photorealistic face manipulation a commodity, with well-documented consequences for fraud, non-consensual imagery and disinformation [4], [5]. Detection has become a safety-critical signal-processing problem, and its central difficulty is generalization: detectors that are near-saturated inside one manipulation family degrade sharply when the generator, the compression pipeline or the acquisition conditions change [6], [7].

The IEEE Signal Processing Cup 2025 (DF-Wild-Cup) corpus was assembled to stress exactly this regime. It merges eight public benchmarks under the DeepfakeBench protocol [8], removes provenance metadata, and has a 5:1 fake-to-real imbalance. The strongest published result on it, CAE-Net [9], reaches 94.46% by fusing EfficientNet-B0 [10], DeiT [11] and a wavelet-fed ConvNeXt [12], trained in five disjoint-subset stages. Like many forensic detectors, CAE-Net is reported as a configuration tuned on the very split it is evaluated on.

This paper started as a detector paper and became, in the course of the experiments, a measurement paper about that last habit. We built a single OpenCLIP ViT-L/14 detector that outperforms CAE-Net on every metric both systems report. Its training log, however, showed the non-averaged checkpoint oscillating by more than five points of validation accuracy from one epoch to the next, and a second run on an OpenForensics-derived benchmark showed the checkpoint that validation accuracy selected making twice as many errors on a held-out partition as the checkpoint it ranked last. We report the detector, but we organize the paper around what it revealed.

References (72)