Manuscript Offprint
arXiv:2610.37874PairCLIP-SWA: Similarity-Guided Balancing and Stochastic Weight Averaging for Generalized Deepfake Image Detection with OpenCLIP
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.
G2: Narrow pre-training priors. Nearly all detectors reported on DF-Wild-Cup initialize from ImageNet-supervised weights [17]. Contrastive image-text pre-training at web scale [18]–[20] yields features that separate synthetic from natural imagery across unseen generators [21]–[23], but frozen probes under-fit fine-grained forensic evidence while unconstrained fine-tuning distorts the pre-trained geometry [24]. How much to adapt, and whether a single adapted CLIP tower can replace a heterogeneous ensemble, are open questions.
G3: Preprocessing choices are rarely justified or ablated. Face cropping, frequency transforms, augmentation and class balancing are usually adopted by convention. Several of these choices can remove the very evidence a detector needs —
Manuscript prepared September 2026.
blending boundaries [25], [26], high-frequency residues [27] — or open shortcuts through class-conditional content such as identity [28].
B. Contributions
-
A measurement of checkpoint-selection reliability. From the complete training log we show that the non-averaged checkpoint swings across 5.34 points of DF-Wild-Cup validation accuracy while its validation loss rises by a factor of 2.15, and that the weight average is never worse and up to 5.99 points better (Section IV-E). On a disjoint 10,905-image OpenForensics test partition, the validation-selected checkpoint makes as many errors as the terminal average, through a one-sided collapse of real-class recall that scalar accuracy on a balanced split cannot detect (Section IV-H).
-
A single-backbone detector that exceeds the best published ensemble. Trained in-domain under the same protocol, PairCLIP-SWA improves on CAE-Net in accuracy (97.04 vs. 94.46%), AU-ROC (98.64 vs. 97.60%), equal error rate (4.07 vs. 5.00%) and , while training on 32.6% of the available training images in a single stage (Section IV-F).
-
A justified, ablated preprocessing pipeline. We state each preprocessing and data-preparation decision together with its rationale, and support them with ablations on the identical split: secondary face cropping, FFT and wavelet inputs, class-balancing strategy, augmentation and training objective (Sections III-B and V-A).
-
A twenty-two-configuration design-space study, including negative results, showing that CLIP pre-training, not ensembling, is the dominant factor, and that a weight-averaged single model outperforms a five-model prediction ensemble with one forward pass instead of five (Section V-B).
-
Evidence that cluster separability is not decision quality. On two corpora, t-SNE separation scores move independently of — or opposite to — classifier accuracy, and an unsupervised partition of the 768-dimensional feature space shows only weak cluster structure (Section IV-I).
Section II reviews related work; Section III presents the preprocessing pipeline and the method; Section IV reports experiments; Section V gives ablations, the design-space study, discussion and limitations; and Section VI concludes.
II. RELATED WORK
A. Spatial, Frequency and Hybrid Detection
CNN classifiers such as Xception [29] and EfficientNet [10] remain strong single-model baselines on FaceForensics++ [30] and Celeb-DF [31], refined by attention modules [32]–[34]. Up-sampling in generative decoders leaves spectral signatures [27], motivating detectors on the DCT [35], [36], learned frequency bands [37] and wavelet packets [38]; these cues are sharp but attenuated by re-compression and resizing. Face X-ray [25] and self-blended images [26] instead target the blending boundary, arguably the most generator-agnostic trace.
CAE-Net [9] fuses spatial, attention and wavelet experts and addresses imbalance by splitting the 219,470 DF-Wild-Cup fakes into five disjoint subsets trained sequentially with all 42,690 reals.
B. CLIP for Forensics
CLIP [18] and OpenCLIP [19], [39] learn joint image-text embeddings from web-scale pairs. Ojha et al. [21] showed that frozen CLIP features with a nearest neighbour or linear classifier transfer across generators far better than fine-tuned CNNs; Cozzolino et al. [22] and Khan and Dang-Nguyen [23] studied calibration and adaptation strategies. Our progressive unfreezing, which descends from gradual unfreezing in NLP [40], sits between the frozen and fully fine-tuned extremes, as the analysis of Kumar et al. [24] recommends. Neither component is new; our interest is in how such a model behaves under selection.
C. Shortcuts and Data Construction
Detectors can exploit identity rather than manipulation traces [28], and self-blended images remove that route by construction, at the price of biasing fakes towards one synthesis operator [26]. Count-based balancing — oversampling, SMOTE [41], loss reweighting, or partitioning — leaves such content differences untouched. Our subsampling step selects fakes by similarity to reals in CLIP space, formally a greedy approximation to an assignment problem [42], [43].
D. Weight Averaging and Model Selection
Stochastic weight averaging (SWA) [44] averages iterates along a trajectory and finds wider optima; model soups [45] average independently fine-tuned models. Selection on a validation set incurs an optimistic bias that grows with the number of candidates compared [13], [14], and re-collected test sets reveal gaps that validation accuracy did not predict [15]. Gulrajani and Lopez-Paz [16] showed that under a fixed selection protocol many domain-generalization methods fail to beat empirical risk minimization. SWA itself is off-the-shelf; the contribution here is empirical — measuring, in a forensic setting, what the trajectory looks like and what selecting from it costs.
III. PREPROCESSING AND METHOD
A. Problem Statement and Notation
Let be an RGB image and its label. Our implementation uses for real and for fake; all precision, recall and values in this paper are nevertheless reported with the fake class positive, matching [9]. A training corpus with real pool and fake pool yields a trajectory of parameters ; a selection rule maps the trajectory to one deployed classifier . We study both the classifier and the rule.
Stage 1: class balancing by CLIP-similarity-guided subsampling (P6)

Fig. 1. Overview of PairCLIP-SWA and of the analyses in this paper. Labels P1–P8 refer to the preprocessing steps of Table I. Stage 1 builds a balanced training corpus from the DF-Wild-Cup training partition by selecting, for each real image, its most similar unused fake in CLIP space. Stage 2 applies trace-preserving preprocessing, adapts an OpenCLIP ViT-L/14 tower with a widening unfreezing schedule, and averages the trajectory. Stage 3 evaluates the resulting checkpoints and analyses selection and representation geometry.
B. Preprocessing Pipeline and Design Rationale
Table I lists every transformation between a stored image and the network input, with the reason for each choice and the evidence that supports it. Formally, with R an anisotropic bilinear resampling to , a horizontal flip applied when b = 1, and N the per-channel standardization
with the CLIP statistics and , the training and evaluation transforms are
Three of these choices deserve emphasis because they depart from common practice. P1 and P3 keep the full released frame: whatever crop is applied upstream, we do not crop again, because the evidence most likely to transfer across generators lives at the boundary between the manipulated region and its surroundings. P5 is deliberately minimal: in forensics, photometric augmentation is not neutral, since blur, noise and compression are themselves forgery-like transformations. We return in Section V to the cost of this choice — a detector that has never seen degraded real images can learn that degradation implies synthesis. P6 replaces multistage partitioning by a single subsampled corpus; its motivation and its limits are discussed next.
C. Stage 1: CLIP-Similarity-Guided Subsampling
- Motivation: Decompose an image into a content factor c (identity, pose, illumination, background, capture pipeline)
and a manipulation factor . If in the training corpus, empirical risk minimization can lower the loss using alone, a route that does not transfer [28]. When the majority class must be subsampled anyway, it is preferable to keep the fakes that most resemble the reals rather than a random fifth of them.
- Objective and greedy solution: With a frozen CLIP ViT-L/14 image encoder and row-normalized embeddings , , the similarity matrix and the ideal injective assignment are
a linear assignment problem [42], [43] whose exact solution costs . We solve it greedily, processing reals in order and excluding fakes already used:
The no-reuse constraint prevents a few generic fakes from absorbing many real partners. Rows are streamed in blocks of , so peak memory is — one block occupies 837 MB in float32 — while total work stays for similarities. Algorithm 1 states the procedure.
- Data usage: Applied to the DF-Wild-Cup training partition (, ), Algorithm 1 returns 42,690 pairs, a 1:1 corpus of 85,380 images: 32.6% of the available training images, keeping 19.5% of the fakes and discarding 176,780. By comparison, one stage of CAE-Net's schedule already uses 86,584 images and the full schedule visits all 262,160 five times [9]. The subsample is therefore
TABLE I
PREPROCESSING AND DATA-PREPARATION PIPELINE. "EVIDENCE" POINTS TO THE ABLATION OR MEASUREMENT THAT BEARS ON EACH CHOICE; "DESIGN" MARKS CHOICES MOTIVATED BY ARGUMENT ONLY.
| Step | Setting | Rationale | Evidence | |
|---|---|---|---|---|
| P1 | Input region | Image as released; no secondary face detection or crop | Blending boundaries and face-context inconsistencies are among the most generator-agnostic cues [25], [26]; a tight crop removes them. DF-Wild-Cup images are already aligned by DeepfakeBench [8], so a second detector pass compounds rather than removes variation, and fails silently on profile, occluded or low-resolution faces. | dlib crop: 56.05% val., ≈ 34 points below full frame (Table XI) |
| P2 | Decoding | 3-channel RGB (greyscale and alpha converted) | Matches the input contract of CLIP pre-training; greyscale captures occur in the wild (Fig. 6). | design |
| P3 | Resampling | Bilinear resize to 224 × 224, no crop | Reproduces the pre-training token grid (16 × 16 patches of 14 pixels) so positional embeddings need no interpolation; resizing rather than cropping keeps peripheral boundary evidence; the aspect distortion is identical for both classes and cannot act as a label cue. | design |
| P4 | Normalization | Eq. (1), CLIP | The frozen patch embedding and at least 41.98% of the tower cannot adapt to a different input scale; ImageNet statistics would shift the distribution the frozen prefix sees. | Section IV-B: a double rescale compresses inputs 255× |
| P5 | Augmentation | Horizontal flip, , training only | Flipping is label-preserving and leaves pixel statistics untouched; colour jitter, blur, JPEG re-compression and random crops alter exactly the high-frequency and colour evidence of manipulation, or remove peripheral boundaries (P1, P3). | ViT+LoRA: augmentation raises the early peak but the gain is not retained (Table XI) |
| P6 | Class balancing | One-to-one CLIP-similarity-guided subsample of the fake pool, without replacement (Section III-C) | One balanced corpus in one training stage, instead of oversampling (repeated reals), reweighting (majority domination), SMOTE (synthetic "reals" are invalid for authenticity) or five sequential stages [9]; intended to reduce class-conditional content differences [28]. | Random undersampling, same backbone, different schedule: 93.36% (Table XI) |
| P7 | Batch composition | Interleaved class-exact sampler, batch 32 | Removes batch-level label variance (standard deviation 8.8 points of real fraction under random batching); interleaving keeps each DataParallel shard exactly balanced. | design |
| P8 | Evaluation | ; no flip, no test-time augmentation | Deterministic predictions, so that checkpoint comparisons reflect weights only. | design |
Algorithm 1 CLIP-Similarity-Guided One-to-One Subsampling
Require: real pool , fake pool , frozen encoder , block size
Ensure: balanced corpus
1:
2:
3: for each row block do
4:
5: for each row of block do
6:
7:
8: end for
9: free
10: end for
11: return
also a data-efficiency choice, and it has a cost: most of the generator diversity in the fake pool never reaches the detector.
- Scope of the claim: Two caveats bound what this stage can be credited with. First, we have no controlled comparison against a random one-to-one subsample under an identical schedule (Section V-A). Second, the implementation that produced the reported corpus computed on inputs that had been rescaled twice (Section IV-B), so the similarities that drove the selection were computed on strongly attenuated images rather than on the semantic descriptor that motivates the design. For the reported run, Stage 1 should therefore be read as a deterministic similarity-guided one-to-one subsample whose content alignment has not been established.
D. Stage 2: Class-Exact Sampling
Each epoch draws independent permutations of the real and fake indices of , interleaves them as , truncates to a multiple of the batch size 32, and cuts it into contiguous batches. Every batch holds exactly 16 real and 16 fake images, and because the order is interleaved, each of the two halves that nn.DataParallel scatters to its replicas is also exactly balanced. The ViT tower uses layer normalization [46], which is per-sample, so the shard split does not change the forward computation.
E. Stage 2: Backbone
The detector is the visual tower of OpenCLIP ViT-L/14 [39] with the original OpenAI weights [18], followed by a linear head; the text tower is discarded. An input is split into patches of pixels, embedded to width , prefixed with a class token and summed with
TABLE II
PARAMETER BUDGET AND TRAINABLE FRACTION. THE DESIGN CAP WAS NOT REACHED WITHIN THE 20-EPOCH BUDGET OF THE REPORTED RUN, WHICH ENDED AT k = 11 BLOCKS.
| Component | Parameters | Share |
|---|---|---|
| Patch embedding ( ) | 602,112 | 0.20% |
| Class token and positional embedding | 264,192 | 0.09% |
| Pre-/post-layer normalization | 4,096 | < 0.01% |
| Transformer blocks ( ) | 302,309,376 | 99.45% |
| Output projection (1024→768) | 786,432 | 0.26% |
| Linear head (768→2) | 1,538 | < 0.01% |
| Total | 303,967,746 | 100% |
| Trainable parameters | ||
| k = 2 blocks (epoch 0) | 25,193,986 | 8.29% |
| k = 8 blocks (epochs 12–13) | 100,771,330 | 33.15% |
| k = 11 blocks (epochs 18–19, reported run) | 138,560,002 | 45.58% |
| k = 14 blocks (design cap) | 176,348,674 | 58.02% |
| Frozen, reported run | 165,407,744 | 54.42% |
| Frozen, design guarantee | 127,619,072 | 41.98% |
positional embeddings: . Each of pre-norm blocks [47], [48] applies
with 16-head scaled dot-product attention of head width 64 and an expansion-4 GELU MLP [49]. The representation is the projected class token and the classifier is affine:
We keep because the projected space is where CLIP's contrastive geometry was learned and where frozen-feature transfer has been demonstrated [21]. Table II gives the parameter budget.
F. Stage 2: Progressive Unfreezing and Optimization
At epoch e the head and the last blocks are trainable,
and everything else, including the embeddings and , stays frozen. At the model is a linear probe plus two blocks, so early gradients act on an essentially intact CLIP manifold [24]; newly unfrozen tensors join AdamW as fresh parameter groups with zero moment estimates. Training minimizes the unweighted two-way cross-entropy — the sampler already balances every batch — with AdamW [50] at and weight decay (so the update is Adam [51]), under float16 automatic mixed precision [52] with dynamic loss scaling. Early stopping monitors the non-averaged validation accuracy with patience 8.
G. Stage 2: Stochastic Weight Averaging
From epoch we maintain the running mean
Algorithm 2 PairCLIP-SWA Training and Checkpointing
Require: corpus , validation set , epochs , patience , SWA start
1: CLIP weights + random head; ; ;
2: for do
3: unfreeze last blocks (Eq. (10)); extend optimizer
4: for each class-exact batch do
5: AMP forward, scaled backward, AdamW step
6: end for
7:
8: if then
9: update (Eq. (11)); step SWALR
10:
11: if then
12: ; save best SWA
13: end if
14: end if
15: if then
16: ; ; save best regular
17: else
18: ; if then break
19: end if
20: end for
21: normalization pass on ; save final SWA
the online form of [44], and anneal the learning rate towards with the ten-epoch cosine schedule of torch.optim.swa_utils.SWALR, stepped once per epoch. Both the running average and the non-averaged iterate are evaluated and checkpointed every epoch, giving three deployable models: best regular, the non-averaged iterate with the highest validation accuracy; best SWA, the running average truncated at its best validation epoch; and final SWA, the average over the whole averaged trajectory. A normalization-statistics pass is applied to the final average; it leaves a layer-normalized tower unchanged, but is required for backbones with batch normalization [53]. Algorithm 2 summarizes training.
H. Stage 3: Representation Geometry
For a subsample of held-out images we project the features of Eq. (8) to two dimensions with t-SNE [54]. With class centroids and root-mean-square radial dispersions , we report the inter-centroid distance and the scale-free ratio
a two-cluster analogue of a Fisher ratio. A k-nearest-neighbour classifier fit in the embedding serves as a probe of how much class information survives the projection. As an independent check that does not depend on a projection, we also partition the 768-dimensional features with DBSCAN [55] and report the silhouette coefficient [56] and Davies–Bouldin index [57].
TABLE III
SPLITS AND THEIR ROLES. ONLY THE OPENFORENSICS TEST PARTITION IS UNTOUCHED BY BOTH TRAINING AND SELECTION.
| Corpus | Split | Images | Real/Fake | Role |
|---|---|---|---|---|
| DF-Wild-Cup | train* val. | 85,3803,072 | 1:11548/1524 | trainingselection, eval. |
| Open-Forensics | train val. test | —39,42810,905 | —19787/196415413/5492 | trainingselectionheld-out test |
*Stage-1 subsample of 262,160 training images.
IV. EXPERIMENTS
A. Datasets and Splits
SP-Cup 2025 (DF-Wild-Cup). Eight benchmarks — Celeb-DF v1 and v2 [31], FaceForensics++ [30], DeepfakeDetection, FaceShifter [58], UADFV [59], and the DFDC preview and full releases [60] — under DeepfakeBench preprocessing [8]. The training partition has 42,690 real and 219,470 fake images; the official validation partition has 1,548 real and 1,524 fake images. The detector is trained on the Stage-1 subsample of the training partition and selected and evaluated on the validation partition. CAE-Net [9] is likewise trained on the training partition and evaluated on the same 3,072 images, with fusion weights tuned on them, so the comparison is in-domain and like-for-like.
OpenForensics-derived benchmark. A public in-the-wild face corpus derived from OpenForensics [61] with fixed partitions. A second, independent run of the same backbone, schedule and averaging procedure is trained on its training partition, selected on its validation partition (39,428 images; 19,641 fake, 19,787 real) and evaluated once on its test partition (10,905 images; 5,492 fake, 5,413 real), which is used for neither gradients nor selection. Table III summarizes the role of every split.
B. Implementation and Reproducibility
The reported DF-Wild-Cup run was trained on two NVIDIA T4 GPUs with nn.DataParallel in PyTorch [62]; several earlier exploratory runs of Section V-B used a single Tesla P100. Table IV lists the configuration. Training starts from the OpenAI CLIP weights with a randomly initialized head, which scores 45.80% on the validation set before adaptation, and runs for epochs 0–19. Averaging starts at ; because AveragedModel copies rather than averages on its first update, the final average comprises the seven iterates of epochs 13–19.
Three implementation details matter for reproduction.
Double rescaling in Stage 1. The subsampling code loads CLIP ViT-L/14 through HuggingFace transformers [63] — the same OpenAI weights as the training tower — but applies torchvision's ToTensor, which already maps intensities to [0, 1], before CLIPProcessor, whose default do_rescale divides by 255 again. We reproduced this path with transformers 4.46.3: the processor emits a warning and rescales, so that the normalized inputs become instead of spanning
TABLE IV
CONFIGURATION OF THE REPORTED DF-WILD-CUP RUN.
| Setting | Value |
|---|---|
| Backbone | OpenCLIP ViT-L/14, OpenAI weights |
| Initialization | pre-trained tower, random linear head |
| Preprocessing | Table I (P1–P8) |
| Training corpus | 85,380-image 1:1 subsample |
| Batch size | 32 (16+16), 2× T4, DataParallel |
| Optimizer | AdamW, , |
| Precision | AMP float16, dynamic loss scaling |
| Epochs | 0–19 |
| Unfreezing | ; reached |
| SWA | start epoch 12; SWALR to , cosine, 10 epochs |
| Early stopping | patience 8 on non-averaged val. accuracy |
| Stage-1 encoder | CLIP ViT-L/14 (HF transformers), frozen |
| Stage-1 block size |
roughly [-1.8, 2.1]. Each channel's dynamic range shrinks by ; a random noise image and a flat grey image map to nearly identical tensors. The Stage-1 similarities of the reported run were therefore computed on near-black inputs, which is why Section III-C limits the claim made for this stage. Passing PIL images, or setting do_rescale=False, restores the intended path.
QuickGELU. Instantiating ViT-L-14 with the openai tag in open_clip pairs weights trained with QuickGELU with a configuration using standard GELU. Fine-tuning absorbs the mismatch, but frozen-feature reproductions should be aware of it.
In-loop versus re-evaluated accuracy. Validation accuracy logged inside the training loop is computed under float16 autocast; saved checkpoints are re-evaluated in full precision. The two differ by up to 0.21 points (for example, best SWA: 97.17% in-loop at epoch 18, 97.04% re-evaluated). All comparisons use re-evaluated values; trajectory figures necessarily use in-loop values.
C. Evaluation Protocol
We report accuracy with 95% Wilson score intervals [64],
For the best-SWA DF-Wild-Cup checkpoint, softmax scores were retained and swept over 1,000 thresholds, giving AU-ROC, equal error rate (EER), the accuracy-optimal threshold and the precision, recall and at . That sweep logged precision, recall and with the real class positive; because the class counts are known, the confusion matrix at is uniquely recoverable from the logged values (1,533 of 1,548 real and 1,456 of 1,524 fake images correct, the only integer solution consistent with all four logged figures), and we report fake-positive values derived from it. For the OpenForensics splits, full confusion matrices were logged at . We also report specificity and the Matthews correlation coefficient (MCC) [65].
(a) Accuracy on SP-Cup validation (n = 3,072)

(b) Loss: the running iterate overfits, the average does not

Training (running iterate) Validation, non-averaged checkpoint Validation, SWA running average
Fig. 2. Training dynamics of the reported DF-Wild-Cup run. (a) Validation accuracy of the non-averaged checkpoint oscillates across 5.34 points while the weight average stays within 1.86 points and is never below it; at epoch 17 the gap is 5.99 points. (b) Training loss falls by 78% while the non-averaged validation loss rises by a factor of 2.15 — overfitting of the adapted suffix — whereas the averaged model's validation loss falls by 30%. Shading marks the number of unfrozen blocks.
TABLE V
ACCURACY (%) OF THE THREE CHECKPOINTS ON EVERY EVALUATED SPLIT, AT , WITH 95% WILSON INTERVALS. BEST PER SPLIT IN BOLD.
| Split (n) | Best regular | Best SWA | Final SWA |
|---|---|---|---|
| DF-Wild-Cup val. (3,072) | 95.67 | 97.04 | 97.04 |
| 95% CI | [94.89, 96.34] | [96.38, 97.58] | [96.38, 97.58] |
| OpenForensics val. (39,428) | 98.43 | 98.43 | 97.67 |
| 95% CI | [98.30, 98.55] | [98.30, 98.55] | [97.52, 97.81] |
| OpenForensics test (10,905) | 88.85 | 88.85 | 94.76 |
| 95% CI | [88.24, 89.43] | [88.24, 89.43] | [94.33, 95.17] |
D. Results Across Splits
Table V already contains the paper's argument in compressed form. On the two selection splits, the checkpoint that wins differs: averaging wins by 1.37 points on DF-Wild-Cup and loses by 0.76 points on OpenForensics. On the only split used for neither training nor selection, averaging wins by 5.91 points. Sections IV-E–IV-H explain both patterns.
E. Training Dynamics: the Case for Averaging
Table VI and Fig. 2 give the complete log over the averaged epochs. Three observations follow.
The selected checkpoint is a noisy maximum. Between consecutive epochs the non-averaged validation accuracy moves by 2.33 points on average, and over eight epochs it spans 5.34 points, from 95.70 to 90.36%. Any selection rule that picks one of these iterates is picking from a distribution whose width is almost three times the 1.87-point margin separating the three best systems reported in [9].
The iterate overfits; the average does not. Training loss falls from 0.1628 to 0.0351 (-78%) and training accuracy rises to 98.48%, while the non-averaged validation loss climbs to 0.3603 at epoch 17, 2.15 times its epoch-12 value, with a train-validation accuracy gap of 7.53 points. Over the same

Fig. 3. Accuracy versus inference cost on DF-Wild-Cup; marker area is proportional to parameter count. Grey markers are the single models and ensembles of [9].
epochs the averaged model's validation loss falls to 0.1178 (-30%) and its gap at epoch 19 is 1.44 points. The first large increase in non-averaged validation loss (epoch 14, +0.087) coincides with the first unfreezing event inside the averaged window; the largest (epoch 17, +0.126) follows the second.
Averaging dominates at every epoch. From epoch 14, where the average first differs from the iterate, the average is better at every epoch, by 1.37 to 5.99 points (3.44 on average). Whatever epoch early stopping might have landed on, the averaged model was the better deployable choice. This is the in-sample half of the selection argument; the out-of-sample half requires a split untouched by selection (Section IV-H).
TABLE VI
TRAINING LOG OF THE REPORTED DF-WILD-CUP RUN OVER THE AVERAGED EPOCHS (IN-LOOP VALUES). “GAP” IS SWA MINUS NON-AVERAGED VALIDATION ACCURACY; THE TWO COINCIDE AT EPOCHS 12–13 BECAUSE THE FIRST SWA UPDATE COPIES THE ITERATE. OVER EPOCHS 12–19 THE NON-AVERAGED VALIDATION ACCURACY SPANS 5.34 POINTS (S.D. 2.13) AGAINST 1.86 (S.D. 0.70) FOR THE AVERAGE, WITH A MEAN CHANGE BETWEEN CONSECUTIVE EPOCHS OF 2.33 VS. 0.34 POINTS. ACCURACY BEFORE ADAPTATION IS 45.80%.
| Epoch | Blocks | Trainable | Training | Non-averaged val. | SWA val. | Gap | |||
|---|---|---|---|---|---|---|---|---|---|
| Loss | Acc. | Loss | Acc. | Loss | Acc. | ||||
| 12 | 8 | 33.15% | 0.1628 | 93.58 | 0.1677 | 95.70 | 0.1677 | 95.70 | — |
| 13 | 8 | 33.15% | 0.0802 | 97.01 | 0.1684 | 95.61 | 0.1684 | 95.61 | — |
| 14 | 9 | 37.30% | 0.1060 | 95.93 | 0.2552 | 91.05 | 0.1383 | 95.61 | +4.56 |
| 15 | 9 | 37.30% | 0.0669 | 97.44 | 0.2005 | 93.88 | 0.1426 | 95.31 | +1.43 |
| 16 | 10 | 41.44% | 0.0885 | 96.65 | 0.2344 | 92.22 | 0.1386 | 95.80 | +3.58 |
| 17 | 10 | 41.44% | 0.0538 | 97.89 | 0.3603 | 90.36 | 0.1334 | 96.35 | +5.99 |
| 18 | 11 | 45.58% | 0.0697 | 97.29 | 0.2307 | 93.49 | 0.1178 | 97.17 | +3.68 |
| 19 | 11 | 45.58% | 0.0351 | 98.48 | 0.2226 | 95.67 | 0.1227 | 97.04 | +1.37 |
TABLE VII
ACCURACY ON THE DF-WILD-CUP VALIDATION SET (). BASELINES AS REPORTED IN [9]; ENSEMBLE ROWS ARE MEANS OVER FIVE SEEDS. ALL SYSTEMS ARE TRAINED ON THE DF-WILD-CUP TRAINING PARTITION.
| Family | Model | Params | Acc. (%) |
|---|---|---|---|
| Spatial CNN | VGG-19 [66] | 144 M | 62.25 |
| ResNet-50 [67] | 25.6 M | 69.00 | |
| MobileNet-V2 | 3.5 M | 78.12 | |
| ResNet-34 [67] | 21.3 M | 80.32 | |
| Inception-V3 | 26 M | 84.38 | |
| ResNet-34 + SE [32] | 21.3 M | 88.90 | |
| EfficientNet-B0 [10] | 3.96 M | 90.79 | |
| Transformer | ViT-B [48] | 86.6 M | 78.12 |
| Swin-T [68] | 28.3 M | 86.52 | |
| MobileViT | 5.6 M | 87.04 | |
| DeiT-B [11] | 85.6 M | 89.32 | |
| Frequency | ResNet-34 + FFT | 21.3 M | 66.55 |
| ResNet-34 + DCT [35] | 21.3 M | 71.48 | |
| Xception + Wavelet | 20.8 M | 87.76 | |
| ConvNeXt + Wavelet [12] | 27.8 M | 89.49 | |
| Ensemble | EfficientNet + DeiT | 89.6 M | 92.59 |
| EfficientNet + ConvNeXt | 31.8 M | 93.14 | |
| CAE-Net [9] | 117.4 M | 94.46 | |
| OpenCLIP (ours) | PairCLIP, best regular | 304.0 M | 95.67 |
| PairCLIP-SWA, best/final SWA | 304.0 M | 97.04 | |
| at tuned threshold | 304.0 M | 97.30 |
Threshold selected on the same split; optimistic.
F. Comparison on DF-Wild-Cup
PairCLIP-SWA improves on CAE-Net on every metric both systems report (Tables VII and VIII). At the default threshold, accuracy rises from 94.46 to 97.04%, a 46.5% reduction in error ( misclassified images), and the two Wilson intervals do not overlap. The threshold-free metrics, which do not depend on any operating point, show the same ordering: AU-ROC 98.64 vs. 97.60% (43% less area above the curve) and EER 4.07 vs. 5.00%. The margin of 2.58 points is 4.4 times the seed standard deviation CAE-Net reports for its final ensemble (); we cannot report our own seed dispersion (Section V-G). Even the non-averaged checkpoint (95.67%) exceeds the ensemble.
At the operating point is strongly asymmetric: specificity is 99.03% and fake-class recall 95.54%, so 68 of the 83 remaining errors are forgeries accepted as real. Moving the
TABLE VIII
HEAD-TO-HEAD ON THE DF-WILD-CUP VALIDATION SET (), FAKE CLASS POSITIVE. CAE-NET VALUES AS PUBLISHED [9]. PAIRCLIP-SWA IS THE BEST-SWA CHECKPOINT.
| Metric | CAE-Net | PairCLIP-SWA | |
|---|---|---|---|
| Accuracy (%) | 94.46 | 97.04 | 97.30 |
| 95% CI | [93.60, 95.22] | [96.38, 97.58] | [96.66, 97.82] |
| Errors / 3,072 | 170 | 91 | 83 |
| AU-ROC (%) | 97.60 | 98.64 | |
| EER (%) | 5.00 | 4.07 | |
| Precision (%) | 93.70 | n/l | 98.98 |
| Recall (%) | 95.60 | n/l | 95.54 |
| Specificity (%) | — | n/l | 99.03 |
| (%) | 94.64 | n/l | 97.23 |
| MCC | — | n/l | 0.947 |
| Backbones / passes | 3 / 3 | 1 / 1 | |
| Parameters | 117.4 M | 304.0 M | |
| GMACs | 24.8 | 81.0 | |
| ms / image | 10.4 (P100) | 28.1 (2T4) | |
| Training images | 262,160 | 85,380 | |
| Training stages | 5 | 1 | |
Accuracy-optimal threshold on (real), selected on this split; optimistic. Precision/recall/ at were not logged (n/l).
Threshold-free.
Ours computed analytically, Eq. (14).
Different hardware; CAE-Net from its reported throughput of 96.42 images/s at batch 32; ours is the average per-image time over the validation pass.
TABLE IX
COMPLETE METRICS ON OPENFORENSICS AT , FAKE CLASS POSITIVE, FROM THE CONFUSION MATRICES OF FIG. 4.
| Split | Checkpoint | Acc. | Prec. | Rec. | Spec. | MCC | |
|---|---|---|---|---|---|---|---|
| Validation (39,428) | Best reg./SWA | 98.43 | 97.84 | 99.03 | 97.83 | 98.43 | 0.969 |
| Final SWA | 97.67 | 99.58 | 95.73 | 99.60 | 97.61 | 0.954 | |
| Test (10,905) | Best reg./SWA | 88.85 | 82.58 | 98.67 | 78.88 | 89.91 | 0.792 |
| Final SWA | 94.76 | 94.97 | 94.61 | 94.92 | 94.79 | 0.895 |
threshold on (real) from 0.5 to 0.680 gains only 0.26 points of accuracy, and because is chosen on the evaluation split, that gain is an upper bound.
The cost side is explicit. The detector is larger, needs the MACs, and measured the per-image latency of CAE-Net, although on different hardware. In exchange it
| Best regular / Best SWAValidation -- accuracy 98.43% | Final SWAValidation -- accuracy 97.67% |
|---|---|
| FakeTrue | 19451(99.0%)190(1.0%) |
| RealFakePredicted | 429(2.2%)19358(97.8%) |
| Best regular / Best SWATest (held out) -- accuracy 88.85% | Final SWATest (held out) -- accuracy 94.76% |
| FakeTrue | 5419(98.7%)73(1.3%) |
| RealFakePredicted | 1143(21.1%)4270(78.9%) |
| Final SWATest (held out) -- accuracy 94.76% | 5196(94.6%)296(5.4%) |
| TrueFake | 275(5.1%)5138(94.9%) |
Fig. 4. OpenForensics confusion matrices for the validation-selected checkpoint (left) and the terminal average (right), on validation (top) and held-out test (bottom). Row percentages are per-class recall.
TABLE X
GEOMETRY AND K-NN PROBE IN T-SNE SPACE. DF-WILD-CUP: 1,000 VALIDATION IMAGES; OPENFORENSICS: 1,000 HELD-OUT IMAGES (513 FAKE, 487 REAL). “HEAD” IS CLASSIFIER ACCURACY ON THE FULL SPLIT.
| Corpus | Checkpoint | S | Probe | Head | |||
|---|---|---|---|---|---|---|---|
| DF-Wild-Cup | Best regular | 43.90 | 10.70 | 10.90 | 2.033 | 96.00 | 95.67 |
| Best SWA | 40.73 | 10.41 | 10.72 | 1.927 | 97.20 | 97.04 | |
| Final SWA | 39.08 | 10.32 | 10.07 | 1.917 | 97.20 | 97.04 | |
| Open-Forensics | Best regular | 40.42 | 8.42 | 9.72 | 2.228 | 97.80 | 88.85 |
| Best SWA | 40.42 | 8.42 | 9.72 | 2.228 | 97.80 | 88.85 | |
| Final SWA | 43.02 | 8.97 | 10.09 | 2.257 | 97.80 | 94.76 |
Test partition.
uses one backbone, one forward pass, one training stage and a third of the training images, with no wavelet branch and no fusion weights to tune (Fig. 3).
G. OpenForensics: Convergence and Validation
The OpenForensics run converges quickly: at epoch 11 training and in-loop validation accuracy are 98.46 and 98.64%, with a validation loss of 0.0426; re-evaluated in full precision, the best-regular and best-SWA checkpoints score 98.43% (38,809/39,428) and the final average 97.67% (38,509/39,428). Under the schedule of Eq. (10) at most seven of the 24 blocks are trainable by that epoch, and the validation accuracy slightly exceeds the training accuracy, so there is no sign of memorization on the training distribution. A small train-validation gap says nothing, however, about how the selected checkpoint behaves on a split it was not selected on.
On validation the selected checkpoint is nearly symmetric (fake recall 99.03%, specificity 97.83%, MCC 0.969) and beats the terminal average, which trades recall for specificity (95.73 vs. 99.60%). Read in isolation, this split recommends the best-regular checkpoint without hesitation.
TABLE XI
ABLATIONS ON THE DF-WILD-CUP VALIDATION SPLIT (). ROWS MARKED ✓ DIFFER FROM THE REPORTED CONFIGURATION ONLY IN THE STATED FACTOR; THE OTHERS ALSO DIFFER IN SCHEDULE OR BACKBONE AND BOUND, RATHER THAN ISOLATE, THE EFFECT. TRAIN ACCURACY SHOWS THE MEMORIZATION GAP WHERE LOGGED.
| Variant | Train | Val. | Ctrl. |
|---|---|---|---|
| A. Input representation (P1) | |||
| Full released frame (reported run) | 98.48 | 97.04 | ref. |
| Face crop (dlib [69]) + OpenCLIP | 84.34 | 56.05 | — |
| FFT-domain input | 83.72 | 49.61 | — |
| Wavelet-coefficient input, 30 ep | 91.60 | 73.20 | — |
| B. Class balancing (P6), OpenCLIP ViT-L/14 | |||
| Similarity-guided 1:1, , non-avg. | — | 95.67 | ref. |
| Random 1:1, : 2 5 | — | 93.36 | — |
| C. Augmentation (P5), ViT + LoRA [70] | |||
| None, 3 ep | — | 86.75 | — |
| Augmented, 10 ep: peak / final | — | 91.44/87.99 | — |
| D. Training objective | |||
| Cross-entropy (reported run) | 98.48 | 97.04 | ref. |
| Triplet loss [71] + classifier | 98.70 | 90.85 | — |
| E. Same run, single factor | |||
| SWA vs. non-averaged | — | 97.04/95.67 | ✓ |
| vs. 0.5 (tuned on split) | — | 97.30/97.04 | ✓ |
| Before adaptation (random head) | — | 45.80 | ✓ |
H. OpenForensics: the Held-Out Test Partition
The test partition is drawn from the same corpus as the validation partition, so the shift it measures is the residual difference between two disjoint samples of in-the-wild imagery — the kind of shift that separates any benchmark split from deployment data [15]. It is enough to reverse the ranking (Fig. 5, Table IX).
The validation-selected checkpoints fall to 88.85%, 9.58 points below their validation accuracy. The loss is one-sided: fake-class recall barely moves (99.03 98.67%) while specificity collapses (97.83 78.88%). Of 1,216 test errors, 1,143 (94.0%) are genuine photographs rejected as forgeries, a 15.7:1 asymmetry. The terminal average, ranked last on validation, reaches 94.76%: false positives fall from 1,143 to 275, false negatives rise from 73 to 296, the asymmetry becomes 0.93:1, MCC rises from 0.792 to 0.895, and test error falls by 53.0%. The Wilson intervals, [88.24, 89.43] and [94.33, 95.17], are more than five points apart. Selecting by validation accuracy would have deployed the model that makes as many errors.
Fig. 6 shows the mechanism in miniature. The sample spans sensor noise, low light, greyscale, motion blur, JPEG blocking, colour casts, occlusion and multi-face crops. The two images the selected checkpoint misclassifies are both genuine and both severely degraded, and it rejects them with high confidence. The average gets both right, but with low confidence. This is consistent with the selected checkpoint having learned that low-level degradation indicates synthesis — an association that preprocessing step P5, which never shows the network degraded real images, does nothing to discourage (Section V). Ten images illustrate; the 10,905 quantify.
(a) Validation-to-test generalization gap

(b) Per-class recall on the held-out test partition

Fig. 5. (a) OpenForensics accuracy on validation (grey) and held-out test (blue). The validation-selected checkpoints lose 9.58 points in transfer; the terminal average loses 2.91. (b) Test recall per class: the entire loss of the selected checkpoints is carried by the real class.

Fig. 6. Ten randomly drawn OpenForensics test images under the validation-selected checkpoint (top) and the terminal average (bottom); same images, different order. Titles give label, prediction and softmax confidence; red borders mark errors. Both errors in the top panel are degraded genuine photographs — a heavily noised crowd scene (0.90) and a portrait with an extreme magenta cast (0.99) — rejected as fake. The average classifies both correctly, with its two lowest confidences (0.93 and 0.62).
1. Representation Geometry
Table X and Fig. 7 support one conclusion from two directions.
On DF-Wild-Cup, separation and accuracy move in opposite directions. The best-regular checkpoint has the highest separation score () and the lowest accuracy. Averaging shrinks by 11.0% but the pooled dispersion by only

Fig. 7. t-SNE embeddings of 1,000 DF-Wild-Cup validation images (493 fake, 507 real) for the three checkpoints; green is real, red fake, crosses are centroids.
(a) In-house configurations, identical 3,072-image split

(b) Input representation / objective
Fig. 8. (a) In-house configurations evaluated on the identical DF-Wild-Cup validation split, coloured by backbone family; the dashed line is CAE-Net. (b) Train (open) and validation (filled) accuracy for alternative input representations and objectives; the gap is the memorization that each fails to convert into validation accuracy.
5.6%, so falls to 1.917, while the probe removes 14 of its 35 fake-side errors (fake recall 92.90 → 95.74%, MCC 0.922 → 0.944) and the head gains 1.37 points.
On OpenForensics, near-identical geometry hides a six-point gap. The checkpoints differ by at most 0.03 in and not at all in probe accuracy (97.80%), yet by 5.91 points on the held-out test partition. What averaging changes is not the arrangement of the embedding but the decision boundary laid over it — precisely the quantity a separability index does not measure.
Without projection, cluster structure is weak. DBSCAN on 768-dimensional OpenCLIP features gives silhouette coefficients of 0.109 and 0.315 with Davies–Bouldin indices of 0.911 and 0.700 for its two parameter settings — moderate unsupervised structure at best, in a feature family on which a linear head exceeds 97%. Cluster indices, projected or not, are not proxies for classifier quality, and reporting them as
evidence of representation quality, as is common (e.g., [9]), warrants that caveat. The DF-Wild-Cup probe agrees with the head to within 0.16 points, but it is fit on a single 1,000-image subsample, and the differences in are small enough that subsample variance cannot be excluded (Section V-G).
V. ABLATIONS, DESIGN-SPACE STUDY AND DISCUSSION
A. Preprocessing and Data-Preparation Ablations
Table XI and Fig. 8(b) collect every preprocessing and data-preparation alternative we evaluated on the identical split. Only block E is controlled; the others are honest bounds.
Secondary face cropping is the most damaging choice we tested. Cropping to a dlib face box before an OpenCLIP classifier yields 56.05%, about 34 points below the same model on full frames, while still fitting 84.34% of the training data. The 28-point memorization gap is the signature of a
TABLE XII
IN-HOUSE CONFIGURATIONS ON THE DF-WILD-CUP VALIDATION SPLIT, GROUPED BY BACKBONE. DATA: S = SP-CUP TRAINING PARTITION, P = STAGE-1 SUBSAMPLE, U = RANDOM 1:1 UNDERSAMPLE. "INIT." IS ACCURACY WITH AN UNTRAINED HEAD. SCHEDULES DIFFER BETWEEN ROWS.
| Configuration | Data | Init. | Val. |
|---|---|---|---|
| ImageNet-initialized CNNs | |||
| ResNet-50, gradual unfreezing, 40 ep | P | — | 71.70 |
| Xception, 5 ep (two runs) | S | — | 75.16, 75.79 |
| Xception, undersampled to 85,380 | U | — | 75.03 |
| Non-CLIP transformers | |||
| ViT, 0.69% unfrozen (probe), 30 ep | P | 53.74 | 80.70 |
| ViT + LoRA, 3 ep | S | — | 86.75 |
| ViT, full fine-tuning, 2 ep (ends 87.60) | S | — | 89.58 |
| ViT + LoRA + aug., 10 ep (ends 87.99) | S | — | 91.44 |
| ViT + Swin, 10 ep | S | — | 93.03 |
| Fusion and prediction ensembles | |||
| ViT + OpenCLIP + Xception fusion, 8 ep | S | — | 81.22 |
| 5× B/32, disjoint parts (MV 94.66) | P | — | 94.95 |
| OpenCLIP ViT-B/32 | |||
| 20 ep | P | 51.76 | 90.20 |
| 24 ep | P | 50.10 | 93.07 |
| 30 ep | P | 49.80 | 93.62 |
| OpenCLIP ViT-L/14 | |||
| 8 ep | P | 45.61 | 94.11 |
| Unfreezing 2 → 5 blocks | U | — | 93.36 |
| Earlier checkpoint, re-evaluated | — | — | 95.51 |
| k: 2→11, non-averaged (reported) | P | 45.80 | 95.67 |
| k: 2→11 + SWA (reported) | P | 45.80 | 97.04 |
model that has lost access to transferable evidence and has fitted something corpus-specific instead. This is the empirical basis for P1: DF-Wild-Cup images are already aligned face regions, and the band of context around the face — where blending boundaries [25] live — is worth more than the extra resolution a tighter crop buys.
Frequency-domain inputs transferred poorly. A classifier on FFT spectra fits 83.72% of the training data and scores 49.61% — chance — on validation; a wavelet-coefficient input reaches 73.20%, 16 points below the ConvNeXt+wavelet result reported in [9]. That result shows wavelet inputs can work with a suitable backbone, but even it remains 7.55 points below spatial RGB with CLIP initialization. We therefore feed the network spatial RGB (P2–P4) and leave spectral sensitivity to the pre-trained filters.
Balancing strategy. With the same OpenCLIP ViT-L/14 backbone, the similarity-guided subsample reaches 95.67% (non-averaged) against 93.36% for a random one-to-one undersample. The runs also differ in unfreezing depth (11 vs. 5 blocks) and, given the Stage-1 preprocessing issue of Section IV-B, the 2.31-point difference cannot be attributed to semantic content matching. It is consistent with, but does not establish, a benefit from Stage 1.
Augmentation. For a ViT with LoRA adapters, augmentation raised the early validation peak from 86.75 to 91.44% but the model ended at 87.99% after ten epochs, retaining little of the gain. Together with the forensic argument for P5, this led us to flip-only training. The OpenForensics error analysis suggests where that choice may fall short: a detector never shown degraded real images can learn that degradation implies forgery. The principled remedy is class-symmetric corruption — applying the same noise, blur and compression [72] to both classes, so degradation carries no label information — which we have not yet tested.
Objective. Triplet metric learning reaches the highest training accuracy of any variant (98.70%) and a validation accuracy 6.19 points below cross-entropy: a pair-based alternative to Stage 1 that memorizes rather than generalizes.
B. Backbone and Adaptation: a Design-Space Study
Table XII and Fig. 8(a) record twenty-two configurations on the identical split, counting the four of Table XI not repeated here. Their schedules, epochs and in some cases training data differ, so the table is a survey of the design space rather than a controlled ablation, and single differences should not be over-read. Four regularities are nevertheless robust to those confounds.
Pre-training dominates. Grouped by initialization, ImageNet CNNs span 71.70–75.79%, non-CLIP transformers 80.70–93.03%, OpenCLIP ViT-B/32 90.20–93.62% and OpenCLIP ViT-L/14 93.36–97.04%. Every untrained head starts at chance (45.61–53.74%), so the ordering reflects adaptation, not leakage. CLIP initialization is worth more than any architectural or schedule change within a family — the empirical form of gap G2.
Adapting too little or too much both lose. A near-linear probe on a non-CLIP ViT reaches 80.70%; full fine-tuning reaches 89.58% after one epoch and degrades to 87.60% after two; adapter-based tuning with LoRA sits between. Progressive unfreezing of an OpenCLIP tower is the best-performing strategy we tried, consistent with [24].
Averaging weights beats averaging predictions. Five OpenCLIP ViT-B/32 models trained on disjoint data parts average 92.75% individually and reach 94.95% as an ensemble (94.66% by majority vote), at five forward passes. A single ViT-L/14 with SWA reaches 97.04% in one pass, although at higher per-pass cost. Feature-level fusion of three heterogeneous backbones (81.22%) falls below every single-backbone transformer except the near-linear probe.
Scale within CLIP helps, but schedule helps more. OpenCLIP ViT-L/14 after eight epochs (94.11%) is only 0.49 points above the best ViT-B/32; the reported ViT-L/14 run gains a further 1.56 points with a longer schedule and deeper progressive unfreezing, and 1.37 from averaging.
C. What Weight Averaging Buys, and Why
The two selection splits disagree about averaging (+1.37 on DF-Wild-Cup, −0.76 on OpenForensics), and a single mechanism accounts for both. The non-averaged iterate is a high-variance object: on DF-Wild-Cup its validation accuracy has a standard deviation of 2.13 points over eight epochs, its validation loss doubles while its training loss falls, and its best epoch is a maximum over noise. Averaging integrates over that noise.
When the iterate’s noise happens to align with the selection split, as on OpenForensics validation, the selected iterate beats the average by a small margin; when it does not, as throughout the DF-Wild-Cup trajectory, the average wins at every epoch. On data used for neither training nor selection, the selected iterate's advantage is not merely lost but reversed, by 5.91 points. This is the pattern that selection bias predicts [13]: the more variable the candidates, the more the maximum over them overstates the performance of the chosen one. Weight averaging reduces that variance at zero inference cost, and the flat-minimum account of SWA [44] explains why the averaged solution degrades less under shift.
D. Validation Accuracy Is a Poor Deployment Proxy
The OpenForensics result is the most transferable lesson in this paper. The standard protocol — select the checkpoint with the best validation accuracy — chose a model that makes as many errors on held-out data, and the failure was invisible to it for a structural reason: the loss was confined to one class, and scalar accuracy on a balanced split weights a specificity collapse no more heavily than a symmetric error. We therefore recommend that forensic detectors be (i) selected on balanced accuracy or MCC, (ii) on a partition disjoint from the one used for early stopping, with (iii) per-class recall reported alongside accuracy, and (iv) weight averaging preferred to a single selected iterate. The same caution applies to every DF-Wild-Cup number in Table VII, ours included: each is measured on the split its system was selected or tuned on, and should be read as an upper bound on deployment accuracy.
E. Computational Complexity
The forward cost is dominated by the 24 blocks. For tokens of width , a block costs MACs in its projections, in attention and in its MLP:
With , , , this is 81.0 GMACs (162.0 GFLOPs) per image; the quadratic attention term contributes 4.0%. Parameter memory is 1,160 MB in float32 and 580 MB in float16, against 448 MB for CAE-Net; measured latency was 28.1 ms per image on 2×T4. Training is cheaper than these figures suggest, because between 8.3% and 45.6% of parameters received gradients in the reported run, and one stage on 85,380 images replaces five stages on 86,584 each. Stage 1 costs frozen forward passes plus similarities, once.
F. On the Absence of Weight Decay
With , regularization is structural: 54.42% of the tower never moves in the reported run, batches are exactly balanced, and averaging smooths the trajectory. An explicit penalty would pull the trainable suffix away from its pre-trained values, the distortion [24] associates with lost robustness. The trajectory of Fig. 2(b) shows, however, that the non-averaged suffix does overfit, so a sweep over remains worth running.
G. Limitations
-
Single seed. The reported runs are single trajectories. CAE-Net reports five-seed means; our 2.58-point margin is its seed deviation, but our own dispersion is unknown.
-
Stage 1 is not isolated, and its reported implementation double-rescaled its inputs. No control with a random one-to-one subsample under an identical schedule exists, and the similarities used for the reported corpus were computed on attenuated inputs (Section IV-B).
-
Selection on the evaluation split. DF-Wild-Cup numbers, including CAE-Net's, are selection-split numbers; is also tuned there.
-
Uncontrolled design-space runs. Apart from block E of Table XI, comparisons in Section V confound schedule, epochs and, in places, training data and hardware.
-
Metric coverage. Threshold-free metrics exist only for the DF-Wild-Cup best-SWA checkpoint; the OpenForensics analysis is at .
-
Geometry from one subsample. t-SNE, separation scores and probes are computed on one 1,000-image subsample per corpus.
-
No adversarial evaluation, unlike [9].
-
Cost. 304M parameters and 81 GMACs rule out edge deployment without distillation.
VI. CONCLUSION AND FUTURE WORK
We set out to build a single-backbone deepfake detector and found that the way its checkpoints are selected matters as much as the detector. On DF-Wild-Cup, PairCLIP-SWA — an OpenCLIP ViT-L/14 tower adapted by progressive unfreezing on a one-to-one balanced subsample and averaged in weight space — improves on the best published three-backbone ensemble in accuracy (97.04 vs. 94.46%), AU-ROC (98.64 vs. 97.60%), EER (4.07 vs. 5.00%) and , under the same in-domain protocol and with a third of the training images. Its training log shows the non-averaged checkpoint swinging across 5.34 points while the average is never worse. On an OpenForensics-derived benchmark, the checkpoint chosen by validation accuracy made as many errors on a held-out partition as the checkpoint ranked last, through a one-sided specificity collapse that scalar accuracy could not see. Twenty-two configurations on the identical split show that CLIP pretraining, not ensembling, drives accuracy, that secondary face cropping and frequency-domain inputs discard transferable evidence, and that cluster separability does not track decision quality.
The next experiments follow directly from the limitations. (i) Re-run Stage 1 with corrected preprocessing and train a random-subsample control under an identical schedule, to measure what similarity-guided balancing contributes. (ii) Repeat the main run with additional seeds, and re-run the threshold sweep on the OpenForensics splits, so that selection effects carry dispersion and threshold-free metrics. (iii) Evaluate FGSM [73] and PGD [74] robustness. (iv) Test class-symmetric corruption augmentation against the degradation shortcut identified in Section IV-H. (v) Distil the averaged tower into a smaller student and measure how much of its accuracy and its selection robustness survive.
ACKNOWLEDGMENT
The authors thank the IEEE Signal Processing Society for organizing the Signal Processing Cup 2025 and releasing the DF-Wild-Cup dataset, and the maintainers of OpenCLIP for the pre-trained models used in this study.
REFERENCES
[1] I. Goodfellow, J. Pouget-Abadie, M. Mirza, B. Xu, D. Warde-Farley, S. Ozair, A. Courville, and Y. Bengio, "Generative adversarial nets," in Advances in Neural Information Processing Systems (NeurIPS), 2014, pp. 2672–2680.
[2] T. Karras, S. Laine, M. Aittala, J. Hellsten, J. Lehtinen, and T. Aila, "Analyzing and improving the image quality of StyleGAN," in Proc. IEEE/CVF Conf. Computer Vision and Pattern Recognition (CVPR), 2020, pp. 8110–8119.
[3] R. Rombach, A. Blattmann, D. Lorenz, P. Esser, and B. Ommer, "High-resolution image synthesis with latent diffusion models," in Proc. IEEE/CVF Conf. Computer Vision and Pattern Recognition (CVPR), 2022, pp. 10684–10695.
[4] L. Verdoliva, "Media forensics and DeepFakes: An overview," IEEE Journal of Selected Topics in Signal Processing, vol. 14, no. 5, pp. 910–932, 2020.
[5] R. Tolosana, R. Vera-Rodriguez, J. Fierrez, A. Morales, and J. Ortega-Garcia, "Deepfakes and beyond: A survey of face manipulation and fake detection," Information Fusion, vol. 64, pp. 131–148, 2020.
[6] S.-Y. Wang, O. Wang, R. Zhang, A. Owens, and A. A. Efros, "CNN-generated images are surprisingly easy to spot...for now," in Proc. IEEE/CVF Conf. Computer Vision and Pattern Recognition (CVPR), 2020, pp. 8695–8704.
[7] R. Corvi, D. Cozzolino, G. Zingarini, G. Poggi, K. Nagano, and L. Verdoliva, "On the detection of synthetic images generated by diffusion models," in Proc. IEEE Int. Conf. Acoustics, Speech and Signal Processing (ICASSP), 2023, pp. 1–5.
[8] Z. Yan, Y. Zhang, X. Yuan, S. Lyu, and B. Wu, "DeepfakeBench: A comprehensive benchmark of deepfake detection," in Advances in Neural Information Processing Systems (NeurIPS) Datasets and Benchmarks Track, 2023.
[9] A. Bhattacharjee, K. Islam, K. Anan, A. Intesher, A. A. Fuad, U. Saha, and H. Imtiaz, "CAE-Net: Generalized deepfake image detection using convolution and attention mechanisms with spatial and frequency domain features," Journal of Visual Communication and Image Representation, 2026, also available as arXiv preprint arXiv:2502.10682.
[10] M. Tan and Q. V. Le, "EfficientNet: Rethinking model scaling for convolutional neural networks," in Proc. Int. Conf. Machine Learning (ICML), 2019, pp. 6105–6114.
[11] H. Touvron, M. Cord, M. Douze, F. Massa, A. Sablayrolles, and H. Jégou, "Training data-efficient image transformers and distillation through attention," in Proc. Int. Conf. Machine Learning (ICML), 2021, pp. 10347–10357.
[12] Z. Liu, H. Mao, C.-Y. Wu, C. Feichtenhofer, T. Darrell, and S. Xie, "A ConvNet for the 2020s," in Proc. IEEE/CVF Conf. Computer Vision and Pattern Recognition (CVPR), 2022, pp. 11976–11986.
[13] G. C. Cawley and N. L. C. Talbot, "On over-fitting in model selection and subsequent selection bias in performance evaluation," Journal of Machine Learning Research, vol. 11, pp. 2079–2107, 2010.
[14] S. Varma and R. Simon, "Bias in error estimation when using cross-validation for model selection," BMC Bioinformatics, vol. 7, no. 91, 2006.
[15] B. Recht, R. Roelofs, L. Schmidt, and V. Shankar, "Do ImageNet classifiers generalize to ImageNet?" in Proc. Int. Conf. Machine Learning (ICML), 2019, pp. 5389–5400.
[16] I. Gulrajani and D. Lopez-Paz, "In search of lost domain generalization," in Proc. Int. Conf. Learning Representations (ICLR), 2021.
[17] J. Deng, W. Dong, R. Socher, L.-J. Li, K. Li, and L. Fei-Fei, "ImageNet: A large-scale hierarchical image database," in Proc. IEEE Conf. Computer Vision and Pattern Recognition (CVPR), 2009, pp. 248–255.
[18] A. Radford, J. W. Kim, C. Hallacy, A. Ramesh, G. Goh, S. Agarwal, G. Sastry, A. Askell, P. Mishkin, J. Clark, G. Krueger, and I. Sutskever, "Learning transferable visual models from natural language supervision," in Proc. Int. Conf. Machine Learning (ICML), 2021, pp. 8748–8763.
[19] M. Cherti, R. Beaumont, R. Wightman, M. Wortsman, G. Ilharco, C. Gordon, C. Schuhmann, L. Schmidt, and J. Jitsev, "Reproducible scaling laws for contrastive language-image learning," in Proc. IEEE/CVF Conf. Computer Vision and Pattern Recognition (CVPR), 2023, pp. 2818–2829.
[20] C. Schuhmann, R. Beaumont, R. Vencu, C. Gordon, R. Wightman, M. Cherti, T. Coombes, A. Katta, C. Mullis, M. Wortsman, P. Schramowski, S. Kundurthy, K. Crowson, L. Schmidt, R. Kaczmarczyk, and J. Jitsev, "LAION-5B: An open large-scale dataset for training next generation image-text models," in Advances in Neural Information Processing Systems (NeurIPS), 2022.
[21] U. Ojha, Y. Li, and Y. J. Lee, "Towards universal fake image detectors that generalize across generative models," in Proc. IEEE/CVF Conf. Computer Vision and Pattern Recognition (CVPR), 2023, pp. 24480–24489.
[22] D. Cozzolino, G. Poggi, R. Corvi, M. Nießner, and L. Verdoliva, "Raising the bar of AI-generated image detection with CLIP," in Proc. IEEE/CVF Conf. Computer Vision and Pattern Recognition Workshops (CVPRW), 2024, pp. 4356–4366.
[23] S. A. Khan and D.-T. Dang-Nguyen, "CLIPping the deception: Adapting vision-language models for universal deepfake detection," in Proc. ACM Int. Conf. Multimedia Retrieval (ICMR), 2024, pp. 1006–1015.
[24] A. Kumar, A. Raghunathan, R. Jones, T. Ma, and P. Liang, "Fine-tuning can distort pretrained features and underperform out-of-distribution," in Proc. Int. Conf. Learning Representations (ICLR), 2022.
[25] L. Li, J. Bao, T. Zhang, H. Yang, D. Chen, F. Wen, and B. Guo, "Face X-ray for more general face forgery detection," in Proc. IEEE/CVF Conf. Computer Vision and Pattern Recognition (CVPR), 2020, pp. 5001–5010.
[26] K. Shiohara and T. Yamasaki, "Detecting deepfakes with self-blended images," in Proc. IEEE/CVF Conf. Computer Vision and Pattern Recognition (CVPR), 2022, pp. 18720–18729.
[27] R. Durall, M. Keuper, and J. Keuper, "Watch your up-convolution: CNN based generative deep neural networks are failing to reproduce spectral distributions," in Proc. IEEE/CVF Conf. Computer Vision and Pattern Recognition (CVPR), 2020, pp. 7890–7899.
[28] S. Dong, J. Wang, R. Ji, J. Liang, H. Fan, and Z. Ge, "Implicit identity leakage: The stumbling block to improving deepfake detection generalization," in Proc. IEEE/CVF Conf. Computer Vision and Pattern Recognition (CVPR), 2023, pp. 3994–4004.
[29] F. Chollet, "Xception: Deep learning with depthwise separable convolutions," in Proc. IEEE Conf. Computer Vision and Pattern Recognition (CVPR), 2017, pp. 1251–1258.
[30] A. Rössler, D. Cozzolino, L. Verdoliva, C. Riess, J. Thies, and M. Nießner, "FaceForensics++: Learning to detect manipulated facial images," in Proc. IEEE/CVF Int. Conf. Computer Vision (ICCV), 2019, pp. 1–11.
[31] Y. Li, X. Yang, P. Sun, H. Qi, and S. Lyu, "Celeb-DF: A large-scale challenging dataset for deepfake forensics," in Proc. IEEE/CVF Conf. Computer Vision and Pattern Recognition (CVPR), 2020, pp. 3207–3216.
[32] J. Hu, L. Shen, and G. Sun, "Squeeze-and-excitation networks," in Proc. IEEE/CVF Conf. Computer Vision and Pattern Recognition (CVPR), 2018, pp. 7132–7141.
[33] S. Woo, J. Park, J.-Y. Lee, and I. S. Kweon, "CBAM: Convolutional block attention module," in Proc. European Conf. Computer Vision (ECCV), 2018, pp. 3–19.
[34] H. Zhao, W. Zhou, D. Chen, T. Wei, W. Zhang, and N. Yu, "Multi-attentional deepfake detection," in Proc. IEEE/CVF Conf. Computer Vision and Pattern Recognition (CVPR), 2021, pp. 2185–2194.
[35] J. Frank, T. Eisenhofer, L. Schönherr, A. Fischer, D. Kolossa, and T. Holz, "Leveraging frequency analysis for deep fake image recognition," in Proc. Int. Conf. Machine Learning (ICML), 2020, pp. 3247–3258.
[36] J. Ricker, S. Damm, T. Holz, and A. Fischer, "Towards the detection of diffusion model deepfakes," in Proc. Int. Conf. Computer Vision Theory and Applications (VISAPP), 2024, pp. 446–457.
[37] Y. Qian, G. Yin, L. Sheng, Z. Chen, and J. Shao, "Thinking in frequency: Face forgery detection by mining frequency-aware clues," in Proc. European Conf. Computer Vision (ECCV), 2020, pp. 86–103.
[38] M. Wolter, F. Blanke, R. Heese, and J. Garcke, "Wavelet-packets for deepfake image analysis and detection," Machine Learning, vol. 111, no. 11, pp. 4295–4327, 2022.
[39] G. Ilharco, M. Wortsman, R. Wightman, C. Gordon, N. Carlini, R. Taori, A. Dave, V. Shankar, H. Namkoong, J. Miller, H. Hajishirzi, A. Farhadi, and L. Schmidt, "OpenCLIP," Zenodo software release, 2021.
[40] J. Howard and S. Ruder, "Universal language model fine-tuning for text classification," in Proc. Annual Meeting of the Association for Computational Linguistics (ACL), 2018, pp. 328–339.
[41] N. V. Chawla, K. W. Bowyer, L. O. Hall, and W. P. Kegelmeyer, "SMOTE: Synthetic minority over-sampling technique," Journal of Artificial Intelligence Research, vol. 16, pp. 321–357, 2002.
[42] H. W. Kuhn, “The Hungarian method for the assignment problem,” Naval Research Logistics Quarterly, vol. 2, no. 1–2, pp. 83–97, 1955.
[43] R. Burkard, M. Dell'Amico, and S. Martello, Assignment Problems. Society for Industrial and Applied Mathematics, 2012.
[44] P. Izmailov, D. Podoprikhin, T. Garipov, D. Vetrov, and A. G. Wilson, "Averaging weights leads to wider optima and better generalization," in Proc. Conf. Uncertainty in Artificial Intelligence (UAI), 2018, pp. 876–885.
[45] M. Wortsman, G. Ilharco, S. Y. Gadre, R. Roelofs, G. Gontijo-Lopes, A. S. Morcos, H. Namkoong, A. Farhadi, Y. Carmon, S. Kornblith, and L. Schmidt, "Model soups: Averaging weights of multiple fine-tuned models improves accuracy without increasing inference time," in Proc. Int. Conf. Machine Learning (ICML), 2022, pp. 23965–23998.
[46] J. L. Ba, J. R. Kiros, and G. E. Hinton, “Layer normalization,” arXiv preprint arXiv:1607.06450, 2016.
[47] A. Vaswani, N. Shazeer, N. Parmar, J. Uszkoreit, L. Jones, A. N. Gomez, E. Kaiser, and I. Polosukhin, “Attention is all you need,” in Advances in Neural Information Processing Systems (NeurIPS), 2017, pp. 5998–6008.
[48] A. Dosovitskiy, L. Beyer, A. Kolesnikov, D. Weissenborn, X. Zhai, T. Unterthiner, M. Dehghani, M. Minderer, G. Heigold, S. Gelly, J. Uszkoreit, and N. Houlshby, “An image is worth words: Transformers for image recognition at scale,” in Proc. Int. Conf. Learning Representations (ICLR), 2021.
[49] D. Hendrycks and K. Gimpel, “Gaussian error linear units (GELUs),” arXiv preprint arXiv:1606.08415, 2016.
[50] I. Loshchilov and F. Hutter, “Decoupled weight decay regularization,” in Proc. Int. Conf. Learning Representations (ICLR), 2019.
[51] D. P. Kingma and J. Ba, “Adam: A method for stochastic optimization,” in Proc. Int. Conf. Learning Representations (ICLR), 2015.
[52] P. Micikevicius, S. Narang, J. Alben, G. Diamos, E. Elsen, D. Garcia, B. Ginsburg, M. Houston, O. Kuchaiev, G. Venkatesh, and H. Wu, "Mixed precision training," in Proc. Int. Conf. Learning Representations (ICLR), 2018.
[53] S. Ioffe and C. Szegedy, “Batch normalization: Accelerating deep network training by reducing internal covariate shift,” in Proc. Int. Conf. Machine Learning (ICML), 2015, pp. 448–456.
[54] L. van der Maaten and G. Hinton, “Visualizing data using t-SNE,” Journal of Machine Learning Research, vol. 9, pp. 2579–2605, 2008.
[55] M. Ester, H.-P. Kriegel, J. Sander, and X. Xu, “A density-based algorithm for discovering clusters in large spatial databases with noise,” in Proc. Int. Conf. Knowledge Discovery and Data Mining (KDD), 1996, pp. 226–231.
[56] P. J. Rousseew, “Silhouettes: A graphical aid to the interpretation and validation of cluster analysis,” Journal of Computational and Applied Mathematics, vol. 20, pp. 53–65, 1987.
[57] D. L. Davies and D. W. Bouldin, “A cluster separation measure,” IEEE Trans. Pattern Analysis and Machine Intelligence, vol. PAMI-1, no. 2, pp. 224–227, 1979.
[58] L. Li, J. Bao, H. Yang, D. Chen, and F. Wen, “FaceShifter: Towards high fidelity and occlusion aware face swapping,” arXiv preprint arXiv:1912.13457, 2019.
[59] X. Yang, Y. Li, and S. Lyu, “Exposing deep fakes using inconsistent head poses,” in Proc. IEEE Int. Conf. Acoustics, Speech and Signal Processing (ICASSP), 2019, pp. 8261–8265.
[60] B. Dolhansky, J. Bitton, B. Pflaum, J. Lu, R. Howes, M. Wang, and C. C. Ferrer, “The deepfake detection challenge (DFDC) dataset,” arXiv preprint arXiv:2006.07397, 2020.
[61] T.-N. Le, H. H. Nguyen, J. Yamagishi, and I. Echizen, “OpenForensics: Large-scale challenging dataset for multi-face forgery detection and segmentation in-the-wild,” in Proc. IEEE/CVF Int. Conf. Computer Vision (ICCV), 2021, pp. 10117–10127.
[62] A. Paszke, S. Gross, F. Massa, A. Lerer, J. Bradbury, G. Chanan, T. Killeen, Z. Lin, N. Gimelshein, L. Antiga et al., “PyTorch: An imperative style, high-performance deep learning library,” in Advances in Neural Information Processing Systems (NeurIPS), 2019, pp. 8024–8035.
[63] T. Wolf, L. Debut, V. Sanh, J. Chaumond, C. Delangue, A. Moi, P. Cistac, T. Rault, R. Louf, M. Funtowicz et al., “Transformers: State-of-the-art natural language processing,” in Proc. Conf. Empirical Methods
in Natural Language Processing: System Demonstrations (EMNLP), 2020, pp. 38–45.
[64] E. B. Wilson, “Probable inference, the law of succession, and statistical inference,” Journal of the American Statistical Association, vol. 22, no. 158, pp. 209–212, 1927.
[65] B. W. Matthews, “Comparison of the predicted and observed secondary structure of T4 phage lysozyme,” Biochimica et Biophysica Acta (BBA) – Protein Structure, vol. 405, no. 2, pp. 442–451, 1975.
[66] K. Simonyan and A. Zisserman, “Very deep convolutional networks for large-scale image recognition,” in Proc. Int. Conf. Learning Representations (ICLR), 2015.
[67] K. He, X. Zhang, S. Ren, and J. Sun, “Deep residual learning for image recognition,” in Proc. IEEE Conf. Computer Vision and Pattern Recognition (CVPR), 2016, pp. 770–778.
[68] Z. Liu, Y. Lin, Y. Cao, H. Hu, Y. Wei, Z. Zhang, S. Lin, and B. Guo, “Swin transformer: Hierarchical vision transformer using shifted windows,” in Proc. IEEE/CVF Int. Conf. Computer Vision (ICCV), 2021, pp. 10012–10022.
[69] D. E. King, “Dlib-ml: A machine learning toolkit,” Journal of Machine Learning Research, vol. 10, pp. 1755–1758, 2009.
[70] E. J. Hu, Y. Shen, P. Wallis, Z. Allen-Zhu, Y. Li, S. Wang, L. Wang, and W. Chen, “LoRA: Low-rank adaptation of large language models,” in Proc. Int. Conf. Learning Representations (ICLR), 2022.
[71] F. Schroff, D. Kalenichenko, and J. Philbin, “FaceNet: A unified embedding for face recognition and clustering,” in Proc. IEEE Conf. Computer Vision and Pattern Recognition (CVPR), 2015, pp. 815–823.
[72] D. Hendrycks and T. Dietterich, “Benchmarking neural network robustness to common corruptions and perturbations,” in Proc. Int. Conf. Learning Representations (ICLR), 2019.
[73] I. J. Goodfellow, J. Shlens, and C. Szegedy, “Explaining and harnessing adversarial examples,” in Proc. Int. Conf. Learning Representations (ICLR), 2015.
[74] A. Madry, A. Makelov, L. Schmidt, D. Tsipras, and A. Vladu, “Towards deep learning models resistant to adversarial attacks,” in Proc. Int. Conf. Learning Representations (ICLR), 2018.