Counter-DECEIVR: Counterfactual Explanations for Deepfake Detectors using Detector-Guided Rectified Flow Inversion

Mariano V. Ntrougkas, Vasileios Mezaris, Ioannis PatrasarXiv 2026

TL;DR

Deepfake detectors often flag fake images based on invisible, high-frequency quirks, leaving human analysts with unhelpful heatmaps pointing at seemingly normal pixels. Counter-DECEIVR solves this by generating counterfactuals—showing the smallest, most realistic visual tweak needed to make a detector change its mind from "Fake" to "Real." Best of all, it works out-of-the-box with pretrained models and requires zero extra training.

What Problem Does This Paper Address?

Imagine a newsroom analyst checking a suspicious photo. A deepfake detector screams "FAKE!" and outputs a heatmap (like Grad-CAM) highlighting a cheek. The analyst zooms in, sees normal skin, and is stuck: should they trust the black box? Because modern generators leave behind imperceptible, high-frequency artifacts, knowing where a detector looked doesn't tell us what it saw.

Counterfactual explanations offer a better way: instead of a heatmap, they show a minimally edited, realistic version of the query image that flips the detector's verdict to "Real." By comparing the original and edited images, a human can actually see what evidence drove the decision.

However, existing counterfactual generators have a major catch: they require heavy customization. You either have to train a representation network for every single image, train a diffusion model on the target dataset, or fine-tune Stable Diffusion for every new detector. Furthermore, standard diffusion models follow curved, noisy paths, making it hard to get clean feedback from a detector early in the generation process without expensive workarounds or settling for invisible, adversarial-style pixel fuzz.

Methods

Counter-DECEIVR (DEtector-guided reCtifiEd flow InVeRsion) is a completely training-free framework that pairs an off-the-shelf deepfake detector with a pretrained rectified flow model (specifically, FLUX.1-dev). Unlike standard diffusion models, rectified flows move between images and noise along nearly straight trajectories.

Conceptual trajectory of Counter-DECEIVR steering a query image across the detector's decision boundary.

The method unfolds in two stages:

  1. Inversion (Standard): Using RF-Inversion, the query deepfake is mapped into structured Gaussian noise along a controlled path.
  2. Guided Editing (Novel): The process reverses from noise back to an image, split by a stopping-time parameter $\tau$. Before $\tau$, it faithfully reconstructs the original image. After $\tau$, it switches to counterfactual steering using three clever tricks:
  3. One-step clean-image lookahead: Detectors can't evaluate noisy latents. Because rectified flow paths are straight, Counter-DECEIVR can take a single forward step to estimate the clean image, pass it to the detector, and grab the gradient pushing toward "Real." Backpropagation bypasses the massive flow transformer, flowing only through the decoder and detector.
  4. Velocity-normalized gradients: Raw detector gradients vary wildly, so the authors normalize and scale the gradient to match a fraction of the current flow step's magnitude, treating it like a superposed velocity vector.
  5. Saliency masking: To keep background details intact, the detector's own Grad-CAM heatmap is used as a soft spatial mask. Inside the mask, the flow diverges and applies detector gradients; outside, it strictly reconstructs the original pixels.
Overview of Counter-DECEIVR's inversion and detector-guided editing pipeline.

Datasets

Because Counter-DECEIVR is training-free, datasets are used strictly to train the target detectors/baselines and evaluate counterfactuals:

  • FaceForensics++ (FF++): Used to train the two target detectors (an EfficientNet multi-class model and a Swin-v2 binary model) as well as the competing baseline generators, and evaluated on 400 disjoint manipulated test images.
  • Celeb-DF: Evaluated on 400 manipulated test images to test cross-dataset performance. No new benchmarks were introduced.

Key Insights and Ideas

  • Straight trajectories unlock cheap, early guidance: In standard DDPM diffusion, one-step clean estimates from high noise are blurry messes, forcing prior methods into slow nested loops (DiME) or shallow noise that only yields adversarial static (ACE). Rectified flows make one-step lookaheads sharp enough to guide semantic edits from high noise.
  • Heatmaps are bad final answers, great priors: While Grad-CAM alone can't explain invisible artifacts, using it to spatially gate generative edits prevents the flow model from hallucinating new backgrounds—turning a weak where map into a crisp what edit.
  • One knob rules the trade-off: Varying the single step parameter $\tau$ smoothly slides the output along the frontier between exact reconstruction and aggressive counterfactual editing at inference time.

Key Results

The authors measure Flip Rate (FR) (how often the detector changes its mind to "Real"), COUT (ranging from -1 to 1, rewarding sparse edits that quickly flip confidence), and FID (distributional realism/fidelity).

Within a realistic operating window ($\text{FID} = 20 \pm 10$), Counter-DECEIVR consistently outperforms training-based baselines (DISC, ACE, DiME, and fine-tuned Stable Diffusion v1.4):

  • FF++: Achieves 0.815 COUT (99.8% FR, 18.65 FID) on EfficientNet—nearly doubling Stable Diffusion's 0.437 COUT—and 0.754 COUT (95.0% FR) on Swin-v2.
  • Celeb-DF: Reaches 0.607 COUT (100% FR) on EfficientNet and a near-perfect 0.990 COUT (100% FR) on Swin-v2.
  • Masking Ablation: Removing the Grad-CAM mask causes COUT to drop from 0.815 to 0.617 and SSIM to fall from 0.963 to 0.866; without the mask, the model flips the detector by sloppily altering the whole image rather than isolating evidence.

Limitations and Future Work

  • White-box access required: Because Counter-DECEIVR relies on detector gradients and Grad-CAM maps, it cannot explain black-box detectors locked behind commercial APIs. (The authors note this also limits misuse, as standard white-box adversarial attacks are already much cheaper if someone simply wants to evade an open detector.)
  • Prior bleed at extreme settings: If $\tau$ is pushed too low (editing from pure noise), the masked face region is heavily resampled from FLUX's general prior—occasionally removing things like eyeglasses simply because of the generative prior rather than detector evidence.
  • Future Work: Extending this training-free counterfactual framework from static images to video deepfakes.

Summary updated

Abstract

Deep-learning-generated media are increasingly passed off as real, driving an arms race between image generators and deepfake detectors. Trust in the latter is limited by their often black-box nature; and, while region-based explanations can sometimes be extracted, these become less useful as generation quality improves. Counterfactual examples, which show the minimal change that flips a detector's decision, reveal what evidence drives a verdict, helping analysts decide whether to trust it. This work introduces Counter-DECEIVR (DEtector-guided reCtifiEd flow InVeRsion for counterfactuals), a novel training-free framework that generates counterfactual examples. Counter-DECEIVR steers latents in the velocity field of a rectified flow model using gradients from off-the-shelf deepfake detectors, without training a generator or adapting the detector; unlike prior methods, it requires no per-instance or per-detector fitting and no diffusion training on the target data. It also leverages the detector's explanation maps to concentrate editing to salient regions, turning low-level feature importance into localised counterfactual edits. A single parameter controls the strength of the edits. Across two deepfake detectors and two widely used forensics datasets, Counter-DECEIVR outperforms prior counterfactual generation methods, including training-based ones. Code will be made available upon acceptance.
BibTeX
@misc{ntrougkas2026counter,
  author = {Mariano V. Ntrougkas and Vasileios Mezaris and Ioannis Patras},
  title = {{Counter-DECEIVR: Counterfactual Explanations for Deepfake Detectors using Detector-Guided Rectified Flow Inversion}},
  year = {2026},
  eprint = {2611.34032},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/2611.34032},
}
Figure