Prompt-Conditioned Semantic Bottleneck for Cross-Domain Face Attack Detection

Weihang Wang, Rongjie Liu, Min CaoNeurIPS 2026

TL;DR

Deepfake and face-spoofing detectors often fail in the wild because they memorize dataset-specific quirks—like camera noise or video compression—rather than true manipulation artifacts. This paper introduces a clever training trick: using a massive, frozen Vision-Language Model (VLM) prompted with the exact ground-truth attack type to create an "attack-aware" semantic target that guides a lightweight visual model. Best of all, you throw the heavy VLM away after training, leaving behind a fast, vision-only detector that generalizes remarkably well to unseen attacks.

What Problem Does This Paper Address?

Imagine training a neural network to spot digital face swaps or someone holding a printed photo up to a security camera—a field broadly known as Face Attack Detection (FAD). On your test split, it hits 99% accuracy. Then you deploy it on a different phone camera or against a newer diffusion generator, and performance falls off a cliff.

Why? Because neural networks are lazy learners. In FAD, genuine attack cues are subtle and tangled up with nuisance factors like lighting, capture devices, and compression artifacts. Standard binary supervision ("real" vs. "fake") doesn't tell the model why an image is fake, allowing it to latch onto spurious source-domain shortcuts.

Recently, researchers brought Vision-Language Models (VLMs) like CLIP into the mix, using text prompts to help classify images. However, keeping a massive VLM in the loop during deployment is computationally expensive, and standard image-text matching can still overfit to dataset-specific visual features. The authors ask: Instead of using prompts and VLMs to make predictions at test time, can we use them offline to teach a small vision model what actually matters?

Methods

The authors propose the Prompt-Conditioned Semantic Bottleneck, inspired by information bottleneck theory (maximizing information about the attack while squeezing out domain noise). The pipeline unfolds in three clean stages:

Figure 1: Overview of the proposed prompt-conditioned semantic bottleneck for cross-domain FAD.
  1. Offline Target Construction (What's New): Before training the detector, every training image is fed into a frozen VLM (Qwen3-VL-4B) alongside a ground-truth-informed prompt: "This image is [real/fake], the attack type is [type], please analyze the image based on this conclusion." Instead of generating text, the authors run a single forward pass and grab the last-layer hidden state of the final multimodal token. Because this token has attended to both the image and the specific attack prompt, it acts as a rich, task-focused summary—cached to disk once.
  2. Semantic Bottleneck Supervision: Next, a standard, lightweight ViT-B/16 visual backbone is trained. It branches into two heads: a standard MLP classification head (trained with cross-entropy loss) and a linear projection head that maps the ViT's 768-dimensional features to match the VLM's 2560-dimensional space. A cosine similarity loss forces the ViT features to align with the cached VLM targets, nudging the backbone toward transferable, manipulation-aware features.
  3. VLM-Free Inference: At test time, the VLM, the prompts, and even the projection head are completely discarded. You are left with a pure ViT-B/16 classifier.

Datasets

The authors do not introduce new datasets, instead stress-testing cross-domain generalization across established benchmarks across two tasks:

  • Face Anti-Spoofing (FAS): Evaluated via leave-one-out cross-validation (train on three, test on the fourth) using MSU-MFSD, CASIA-FASD, Replay-Attack, and OULU-NPU (covering physical print and video-replay attacks across varied cameras and lighting).
  • Face Forgery Detection (FFD): Trained strictly on FaceForensics++ (FF++) and tested zero-shot on Celeb-DF-v2 (CDFv2), DFDC, and DFDC-preview (DFDCP).
  • Cross-Generation Forgeries: Trained on FF++ and evaluated on DF40-EFS, testing generalization against unseen GANs (VQGAN, StyleGAN2) and modern diffusion models (DDIM, RDDM, DiT, SiT).

Key Insights and Ideas

  • Prompts as "Queries," Not Classifiers: Giving the VLM the answer (label + specific attack type) in the prompt during offline target extraction is the secret sauce. Without the prompt, the VLM extracts generic face features (like identity or expression). Conditioning on both label and attack type boosts cross-dataset AUC by 3.18% over unprompted VLM features.
  • Bigger Backbones Aren't Enough: Ablations show that simply distilling features from larger vision models (ViT-L, CLIP-L) or unprompted Qwen3-VL yields mediocre gains. The improvement specifically comes from eliciting task-conditioned semantics.
  • Synergy of Losses: Aligning with the semantic bottleneck alone fails to build a sharp decision boundary (~50–65% AUC), while classification alone overfits to shortcuts. Combining both yields the sweet spot.

Key Results

Across the board, the lightweight detector punches above its weight class:

  • Face Anti-Spoofing: Achieves state-of-the-art average performance across the four leave-one-out splits with 3.53% HTER (Half Total Error Rate—lower is better) and 99.13% AUC.
  • Deepfake Detection: Reaches the highest average cross-dataset AUC at both the video level (92.09%) and frame level (89.48%), outperforming recent CLIP-based adapters.
  • Unseen Diffusion Models: Despite only seeing traditional manipulations in FF++ during training, it achieves 93.87% average AUC on DF40, setting top marks on emerging diffusion architectures like DiT (88.34%) and SiT (91.19%).
  • Qualitative & Efficiency Gains: Class Activation Maps (CAM) confirm the model locks onto blending boundaries and facial anomalies rather than backgrounds. Meanwhile, inference requires just 87.87M parameters and 16.87G FLOPs—roughly one-third the compute cost of CLIP-based competitors (~51.8G FLOPs).

Limitations and Future Work

The authors note that compressing all multimodal context into a single final VLM token is a relatively coarse way to supervise the student network. Because facial forgeries often involve subtle, localized spatial flaws, future work could explore structured, multi-granularity semantic targets to better capture diverse, region-specific manipulation patterns.

Summary updated

Abstract

Learning visual representations that generalize across domains remains challenging when source-domain supervision is entangled with spurious dataset-specific cues. This issue is particularly pronounced in face attack detection (FAD), where attack artifacts vary substantially across capture devices, manipulation pipelines, and image quality. In this paper, we propose Prompt-Conditioned Semantic Bottleneck, an information-bottleneck-inspired representation learning framework for cross-domain FAD. Unlike prior methods that use prompts mainly for image-text alignment, our method uses label- and attack-type-conditioned prompts to extract attack-aware semantic targets from a frozen VLM. Specifically, the final multimodal token representation, obtained after contextual interactions between visual and prompt tokens, serves as a compact semantic bottleneck. This bottleneck provides offline supervision for a lightweight visual detector, promoting the learning of attack-relevant representations for cross-domain generalization. Extensive experiments on multiple face forgery detection benchmarks demonstrate consistent improvements under cross-dataset evaluation. Ablation studies further show that the gains are not simply due to stronger visual or multimodal models, but arise from attack-aware prompt-conditioned semantic supervision. Importantly, the VLM and prompts are removed during inference, enabling efficient vision-only deployment. Overall, our results demonstrate that prompt-conditioned VLM semantics provide an effective way to improve cross-domain FAD accuracy while maintaining efficient inference. The code is available at \url{https://github.com/WeihangWANG/Semantic-Bottleneck-FAD}.
BibTeX
@inproceedings{wang2026prompt,
  author = {Weihang Wang and Rongjie Liu and Min Cao},
  title = {{Prompt-Conditioned Semantic Bottleneck for Cross-Domain Face Attack Detection}},
  booktitle = {Advances in Neural Information Processing Systems},
  year = {2026},
  url = {https://openreview.net/forum?id=STzYbJFqBT},
}
Figure