CausalCLIP: Causally-Informed Feature Disentanglement and Filtering for Generalizable Detection of Generated Images¶
Conference: AAAI 2026
arXiv: 2512.13285
Code: Unavailable
Area: Image Generation
Keywords: Generated image detection, causal reasoning, CLIP, feature disentanglement, adversarial training
TL;DR¶
CausalCLIP is proposed to disentangle CLIP features into causal and non-causal subspaces via Gumbel-Softmax masking and HSIC constraints, combined with adversarial masking and counterfactual intervention to preserve stable forensic cues, achieving a 6.83% accuracy improvement in cross-generator generalization.
Background & Motivation¶
The rapid advancement of generative models (GANs, diffusion models) has substantially lowered the barrier to producing high-quality forged images, creating an urgent need for detection methods that generalize across diverse generators. Existing approaches face the following challenges:
Generator-specific detection: Early CNN-based classifiers rely on generator-specific artifacts such as upsampling traces and frequency-domain anomalies, resulting in poor generalization to unseen generators.
Entangled CLIP feature space: Recent methods leveraging pretrained vision-language models such as CLIP (UnivFD, CLIPping, C2P-CLIP) show improvement but still operate in highly entangled feature spaces where causal forensic cues are mixed with spurious patterns.
Coarse-grained filtering: VIB-Net suppresses irrelevant features via an information bottleneck but does not explicitly disentangle causal from non-causal components, resulting in coarse filtering that may discard task-relevant features.
Root cause: Achieving cross-generator generalization requires first explicitly separating causal forensic cues from spurious artifacts, and then performing filtering in the disentangled space (disentangle-then-filter), rather than applying coarse suppression in an entangled space.
Method¶
Overall Architecture¶
CausalCLIP follows the disentangle-then-filter paradigm:
- A frozen CLIP-ViT-L/14 encoder extracts image features.
- Factorization Module: Disentangles CLIP features into causal and non-causal components.
- Adversarial Masking Module: Suppresses the influence of non-causal features via an adversarial mechanism.
- The disentangled causal features are fed into a lightweight classifier for real/fake prediction.
Key Designs¶
1. Factorization Module¶
It is assumed that an image \(X\) is generated by a structural causal model containing two independent factors: \(Z_c\) (causal features, derived from a generator-agnostic content factor G) and \(Z_{nc}\) (non-causal features, derived from a generator-specific style/artifact factor C).
Given the CLIP embedding \(E = \text{CLIP}(X) \in \mathbb{R}^d\), a feature mask \(M \in [0,1]^d\) is learned to perform separation:
The mask \(M\) is parameterized via Gumbel-Softmax:
The temperature \(\tau\) controls the sparsity of feature selection. This differentiable feature selection mechanism ensures the purity of the causal subspace \(\tilde{Z}_c\).
2. Adversarial Masking Module¶
Even after factorization, residual non-causal signals may still influence the classifier. A minimax game is therefore introduced:
- Classifier h: Predicts real/fake based on causal features \(\tilde{Z}_c\).
- Adversary d: Attempts to predict real/fake from non-causal features \(\tilde{Z}_{nc}\).
The classifier and mask are optimized to ensure \(\tilde{Z}_{nc}\) contains no discriminative information, forcing the model to rely solely on \(\tilde{Z}_c\).
Mask regularization:
- The \(\ell_1\) norm encourages sparse feature selection.
- The empirical HSIC term encourages statistical independence between the causal and non-causal subspaces (Gaussian kernel with median heuristic bandwidth selection).
3. Counterfactual Intervention¶
Random masking is applied to causal features to simulate distributional perturbations:
Prediction consistency is enforced via KL divergence:
This compels the classifier to rely on stable causal semantics rather than generator-dependent cues.
Loss & Training¶
The overall objective is:
Training alternates among: minimizing \(\mathcal{L}_{\text{cls}} + \beta \mathcal{L}_{\text{inv}}\) for h, maximizing \(\mathcal{L}_{\text{adv}}\) for d, and minimizing \(\mathcal{L}_{\text{total}}\) for M.
Implementation details: Adam optimizer, lr=1e-4, batch=256, center-cropped input at 224ร224, trained on a V100 GPU.
Key Experimental Results¶
Main Results¶
Table 1: AP on 15 test sets, trained on Diffusion source (SDv1.4)
| Method | SD1.4 | ADM | GLIDE | ProGAN | CycleGAN | StyleGAN | GauGAN | Mean AP |
|---|---|---|---|---|---|---|---|---|
| CNNSpot | 99.98 | 51.10 | 58.80 | 53.15 | 50.23 | 49.79 | 47.07 | 63.24 |
| UnivFD | 96.04 | 66.34 | 93.73 | 51.77 | 63.42 | 75.81 | 54.12 | 75.31 |
| VIB-Net | 100.00 | 95.49 | 97.13 | 96.59 | 98.44 | 97.17 | 84.31 | 94.60 |
| CausalCLIP | 100.00 | 95.37 | 99.47 | 97.33 | 98.35 | 96.29 | 98.62 | 96.92 |
Table 2: ACC on 15 test sets, trained on Diffusion source
| Method | Mean ACC |
|---|---|
| CLIPping | 83.03 |
| VIB-Net | 85.83 |
| CausalCLIP | 90.45 |
CausalCLIP achieves +2.32% mean AP and +4.62% ACC over VIB-Net. On unseen GAN-based generators, it yields an additional +6.83% ACC and +4.06% AP improvement.
Tables 3โ4: Cross-diffusion generalization, trained on GAN source (ProGAN)
| Method | Mean AP | Mean ACC |
|---|---|---|
| VIB-Net | 93.04 | 82.97 |
| CausalCLIP | 94.27 | 86.23 |
CausalCLIP maintains superiority under the more challenging GANโDiffusion distribution shift.
Ablation Study¶
Table 5: Module contribution ablation (trained on SDv1.4)
| Factorization | Masking | ACC(OP) | ACC(GP) | AP(OP) | AP(GP) |
|---|---|---|---|---|---|
| โ | โ | 65.37 | 60.42 | 75.31 | 67.09 |
| โ | โ | 79.42 | 75.91 | 89.53 | 87.78 |
| โ | โ | 70.73 | 65.94 | 82.13 | 79.28 |
| โ | โ | 90.45 | 89.95 | 96.92 | 95.25 |
The factorization module alone yields +14.05% ACC; the masking module alone yields +5.36%; their combination achieves the best overall performance.
Key Findings¶
- UMAP visualization: Raw CLIP features are highly entangled between real and fake images; VIB achieves only partial separation, while CausalCLIP achieves clear separation on both seen and unseen generators.
- Robustness: Under JPEG compression and Gaussian blur perturbations, CausalCLIP maintains the most stable performance.
- The improvement from the factorization module substantially exceeds that of the masking module, confirming that explicit disentanglement is the critical factor.
Highlights & Insights¶
- Theory-driven design: The relationship between causal and non-causal features is formalized using a structural causal model, rather than treated as simple feature selection.
- Gumbel-Softmax + HSIC combination: The former ensures differentiable sparse selection; the latter ensures statistical independence between causal and non-causal subspaces, grounding the method in sound theoretical principles.
- Lightweight: Only downstream modules are trained on top of frozen CLIP, with computational overhead comparable to UnivFD but substantially improved performance.
Limitations & Future Work¶
- The method relies on fixed features from CLIP-ViT-L/14 and may be sensitive to artifact types not well represented in CLIP's pretraining data.
- The binary classification setting (real/fake) does not support generator attribution.
- The mask \(M\) operates as an element-wise mask over the entire embedding dimension; finer granularity (e.g., patch-level disentanglement) may be preferable.
- The selection of the Bernoulli probability \(p\) for counterfactual intervention lacks theoretical justification.
Related Work & Insights¶
- Compared to VIB-Net's information bottleneck approach, CausalCLIP's advantage lies in explicit disentanglement prior to filtering, avoiding the loss of useful features that can occur in entangled spaces.
- The successful application of causal representation learning (CausalVAE, DEAR) to image forensics provides a reference for other distribution-shift scenarios.
- The disentangle-then-filter paradigm is extensible to deepfake video detection, machine-generated text detection, and related domains.
Rating¶
- Novelty: โ โ โ โ โ โ First systematic application of causal disentanglement + adversarial masking to generated image detection
- Technical Depth: โ โ โ โ โ โ Theoretically complete, integrating SCM modeling, HSIC, Gumbel-Softmax, and counterfactual intervention
- Experimental Thoroughness: โ โ โ โ โ โ Comprehensive evaluation across 15 test sets, two training sources, with ablation, robustness, and visualization studies
- Writing Quality: โ โ โ โ โ โ Motivation is clearly articulated; methodological presentation is rigorous
- Value: โ โ โ โ โ โ Lightweight training on frozen CLIP enables straightforward deployment