Skip to content
Other

mars-dfd-hr

deepfake and manipulated video detector

2 min readupdated

This model detects whether a video has been digitally manipulated or AI-generated, outputting a manipulation probability (P(manipulated)) for the entire clip. Built on a frozen OpenAI CLIP ViT-L/14 encoder paired with trainable MoE adapters (Mixture-of-Experts, an architecture with multiple specialized expert sub-networks), this reimplementation was released by researchers at the Vector Institute as part of the MARS paper. Unlike basic frame-by-frame classifiers, it processes every frame at 448×448 resolution across two scales simultaneously—as a 224×224 global view and a 2×2 grid of 224×224 patches—while using token and layer routers in the upper layers for key feature selection and early exit. It is well suited for content moderation developers, media verification specialists, and security researchers.

Key features

  • Dual-scale frame analysis: Every second frame is resized to 448×448 and processed simultaneously as a full image and as four 224×224 tiles.
  • Standalone ONNX graph: Alongside the model.safetensors weights (415 MB), the repo includes a self-contained model.onnx file (1.63 GB) with the CLIP encoder baked in, letting you run inference via ONNX Runtime without PyTorch.
  • Dynamic routing: Token and layer routers in blocks 21–23 skip unnecessary computation on simpler regions.
  • Permissive license: The adapter weights are released under Apache 2.0 (the base encoder is fetched separately from OpenAI under its own license).

What you can do

  • Drop incoming video checks into a moderation or anti-fraud pipeline using a single model.onnx file on CPU or GPU.
  • Use the model as an out-of-the-box baseline to benchmark your own deepfake detectors on standard datasets like FaceForensics++ and Celeb-DF v2.
  • Calibrate the fake_prob threshold on your own validation set to filter out synthetic videos from various generators.

Example

import numpy as np
import onnxruntime as ort
from huggingface_hub import hf_hub_download

session = ort.InferenceSession(
    hf_hub_download("vector-institute/mars-dfd-hr", "model.onnx"),
    providers=["CUDAExecutionProvider", "CPUExecutionProvider"],
)
# frames: (1, 64, 3, 448, 448) float32 в [-1, 1]; n_valid: число реальных кадров
prob = session.run(["fake_prob"], {"frames": frames, "n_valid": np.array([64], dtype=np.int64)})[0][0]
Read moreDetails
Benchmarks (video-level AUROC): FaceForensics++ — 99.80%, DeepfakeTIMIT — 99.59%, Celeb-DF v2 — 93.89%, GenVideo — 79.48%, 7-dataset average — 90.03%.
Training: 3 epochs on FaceForensics++ (c23) and synthetic GTA-V scenes (SAIL-VOS 3D) on 4× NVIDIA A40.
Input: 64-frame clips (sampling every 2nd frame) at 448×448 resolution.
Limitations: Output probabilities are uncalibrated, so binary classification requires tuning a threshold on your own data; the ONNX export uses float32 instead of bfloat16.
Discuss Telegram 0 8

Will it run?

Runs in F32

Fits without quantisation.

  • F32weights 0.4 GB · ready files0.9 GB
  • BF16weights 0.2 GB0.7 GB
  • FP8 / INT8recommendedweights 0.1 GB0.6 GB
  • 4-bitweights 0.1 GB0.6 GB

Tip: go 8-bit.FP8 / INT8 is within about a percent of full precision in quality, takes half the memory and runs faster on RTX 40/50 and H100. Full precision only pays off for fine-tuning.

What to get for this model

Massed ComputeOpen Massed Compute

Your own GPU: FP8 / INT8 — from RTX 2060 · F32 — from RTX 2060

Massed Compute hourly prices, November 2026. The discounted price applies with the coupon at checkout.

Estimate: weights plus working memory. Long videos, high resolutions and long contexts need more.

Run it on Massed Compute

The script downloads the model to the rented machine. How to run it is in the model card.

  1. 1. Rent a machine with a fitting GPU

    Open Massed Compute
  2. 2. Paste the script into the machine's terminal

    Connect over SSH (the Massed Compute panel shows the command) or open a terminal on the machine's desktop.

    HF_TOKEN / CIVITAI_TOKENThe script starts with token lines: paste yours between the quotes. The Hugging Face token is for gated models, the Civitai one for Civitai models.

    # vector-institute/mars-dfd-hr
    mkdir -p ~/models
    curl -LsSf https://astral.sh/uv/install.sh | sh
    source "$HOME/.local/bin/env"
    uv tool install "huggingface_hub[cli]"
    hf download vector-institute/mars-dfd-hr --local-dir ~/models/mars-dfd-hr
    # The model is in ~/models. How to run it is in the model card (link above).
    Add more LoRAs to mars-dfd-hr
  3. 3. Use it

    The model is in ~/models. How to run it is in the model card (link above).

Stop the machine in the panel when you are done: it bills by the minute while it runs.

How to speed it up

Picked for this model type. Choose your hardware above to see what fits you exactly.

  • FlashAttention 44.0.0b40from November 18, 2026new release

    fastest exact attention on B200

    Kernels for Blackwell (beta). Exact attention without quantisation — fine for everything, LLMs included.

    How to enable: pip install flash-attn-4; vLLM and SGLang pick it up themselves.

    Earlier generations (2)
    • FlashAttention 3 — The Hopper (H100/H200) version with FP8.
    • FlashAttention 2 — The standard for RTX 30/40/50 and A100: exact attention without the memory cost of long contexts.
  • torch.compile2.15.0from October 28, 2026new release

    10–30% for free

    Compiles the model for your GPU. Slower first run, faster afterwards.

    How to enable: model = torch.compile(model); in ComfyUI the TorchCompileModel node.

Model family

New posts about versions of clip-vit-large-patch14 (quants, finetunes, LoRAs) will show up under the bell.

Quantised versions 6All on Hugging Face
Fine-tunes 12All on Hugging Face
LoRAs and adapters 1All on Hugging Face

About the model

vector-institute/mars-dfd-hr
Author
vector-institute
Category
Other
Released
Posted

On NeyroLearn

Hugging Face

80

Ask AI about this model

Answered by Gemini 4 · the chat is kept only in this tab

Comments