SYNTOLOGY HomeExplorerAtlasCodeMethodologyAboutDevelopersFeedPricing
Paper · 2310.17419 · 2023

AntifakePrompt: Prompt-Tuned Vision-Language Models are Fake Image Detectors

arXiv · PDF · Open in the Atlas

Code that ran

7 of 8 samples (functions and classes) lifted from this paper's linked repositories executed on a synthesized input in Syntology's jail (0 of them constructed an object rather than computing a result; 1 honoured the contract we drafted, 0 violated it and 0 have no contract verdict; 6 failures of our instrument; 1 no recorded run), measured 2026-11-23; repository links from the Papers with Code archive attributed under CC BY-SA, no affiliation; bodies inline only under a permissive licence as GitHub detects it. Not a reproduction of the paper's results.

"Ran" means the function executed on a synthesized input and returned a value. It is not a reproduction of the paper's results. This record, dated, as JSON: /api/ran/2310.17419.json · badge: /api/ran/2310.17419.svg

Each repository's role is a label: a classifier's output recorded on the link, or, where no role is recorded, what the Papers with Code archive marked. The line under it names its basis. Neither says who wrote the code.

RepositoryRoleRan
nctu-eva-lab/antifakeprompt canonical (classifier label)
classifier basis: census
7 ran · 1 no recorded run
FunctionStatusWhere it lives
generate_caption Ran
ran; the contract check could not run (RAISES, DEP_MISSING or TIMEOUT)
nctu-eva-lab/antifakeprompt/app/caption.py
code served (permissive licence) · get_code("56f02812d66a0d11")
How it ran

Ran in Syntology's sandbox on this synthesized input (drafted by a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API) and returned list, ndim 1, dtype family float; no output shape is stated. The image it ran in was not recorded. If your copy returns the same type and ndim on these inputs, it matched what we observed; nothing here checks that. It does NOT mean the output is correct: nothing has compared it to the paper.

import torch
import torch.nn as nn

torch.manual_seed(0)

class MockCaptionModel(nn.Module):
    def __init__(self):
        super().__init__()
        self.linear = nn.Linear(4, 8)
    
    def generate(self, samples, use_nucleus_sampling=False, num_beams=3, max_length=40, min_length=5, top_p=0.9):
        # Mock generate method that returns a list of captions
        # Each caption is a string
        batch_size = samples['image'].shape[0]
        captions = ["a cat on a mat"] * batch_size
        return captions

# Create a small image tensor (batch_size=2, channels=3, height=4, width=4)
image = torch.randn(2, 3, 4, 4)

# Create the model
model = MockCaptionModel()

ARGS = {
    'model': model,
    'image': image,
    'use_nucleus_sampling': False,
    'num_beams': 3,
    'max_length': 40,
    'min_length': 5
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
torch — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type list, ndim 1, dtype family float — a list output has no array shape of its own; none is stated
dtype family
int means an integer dtype; float means any other dtype the instrument saw, bool and complex included (fixture_check.py records only these two families)
Environment
image not recorded; re-verify against syntology-harvest-sandbox:v5-deps; not recorded for this sample: the harness installs a cuda-to-cpu shim (cuda_shim.py) before every sample and no run records whether a sample needed it; seed: none by the harness; any seed is in the setup block
get_concat_v Ran
ran; our contract draft was wrong, not the code
nctu-eva-lab/antifakeprompt/app/dataset_browser.py
code served (permissive licence) · get_code("92f2e16ee0d3a24d")
How it ran

Ran in Syntology's sandbox on this synthesized input (drafted by a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API) and returned Image. The image it ran in was not recorded. If your copy returns the same type on these inputs, it matched what we observed; nothing here checks that. It does NOT mean the output is correct: nothing has compared it to the paper.

from PIL import Image

# Create two small PIL images for testing
im1 = Image.new('RGB', (100, 50), color='Red')
im2 = Image.new('RGB', (80, 60), color='Blue')

ARGS = {
    'im1': im1,
    'im2': im2
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
PIL — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type Image — a Image output has no array shape of its own; none is stated — the instrument coerces any output to an array; for a Image output the recorded ndim 3 and dtype family int describe that coercion, not the output, and are not stated
Environment
image not recorded; re-verify against syntology-harvest-sandbox:v5-deps; not recorded for this sample: the harness installs a cuda-to-cpu shim (cuda_shim.py) before every sample and no run records whether a sample needed it; seed: none by the harness; any seed is in the setup block
print_combine_result Ran
ran; our contract draft was wrong, not the code
nctu-eva-lab/antifakeprompt/deepfake-detection/blip2_t5_instruct.py
code served (permissive licence) · get_code("3d63c3c2af355251")
How it ran

Ran in Syntology's sandbox on this synthesized input (drafted by a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API) and returned tuple. The image it ran in was not recorded. If your copy returns the same type on these inputs, it matched what we observed; nothing here checks that. It does NOT mean the output is correct: nothing has compared it to the paper.

import numpy as np
import tempfile
import os

# Create a temporary log file
temp_dir = tempfile.gettempdir()
log_path = os.path.join(temp_dir, "test_log.txt")

# Create sample data
# pretrained_ans: predictions from pretrained model (binary: 0 or 1)
pretrained_ans = np.array([0, 1, 0, 1, 0, 1, 0, 1], dtype=np.int64)

# finetuned_ans: predictions from finetuned model (binary: 0 or 1)
finetuned_ans = np.array([0, 1, 1, 0, 0, 1, 1, 0], dtype=np.int64)

# label: ground truth labels (0=real, 1=fake)
label = np.array([0, 0, 0, 0, 1, 1, 1, 1], dtype=np.int64)

ARGS = {
    "pretrained_ans": pretrained_ans,
    "finetuned_ans": finetuned_ans,
    "label": label,
    "logPath": log_path
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
numpy, sklearn — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type tuple — a tuple output has no array shape of its own; none is stated
Environment
image not recorded; re-verify against syntology-harvest-sandbox:v5-deps; not recorded for this sample: the harness installs a cuda-to-cpu shim (cuda_shim.py) before every sample and no run records whether a sample needed it; seed: none by the harness; any seed is in the setup block
read_img Ran
ran, honoured the contract we drafted
nctu-eva-lab/antifakeprompt/app/calculate_coco_features.py
code served (permissive licence) · get_code("13a43a7d815937e6")
How it ran

Ran in Syntology's sandbox on this synthesized input (drafted by a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API) and returned Image. The image it ran in was not recorded. If your copy returns the same type on these inputs, it matched what we observed; nothing here checks that. It does NOT mean the output is correct: nothing has compared it to the paper.

import tempfile
import os
from PIL import Image

# Create a temporary image file for testing
temp_dir = tempfile.mkdtemp()
temp_image_path = os.path.join(temp_dir, "test_image.png")

# Create a simple RGB image and save it
test_image = Image.new('RGB', (4, 3), color=(255, 0, 0))
test_image.save(temp_image_path)

ARGS = {
    'filepath': temp_image_path
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
PIL — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type Image — a Image output has no array shape of its own; none is stated — the instrument coerces any output to an array; for a Image output the recorded ndim 3 and dtype family int describe that coercion, not the output, and are not stated
Environment
image not recorded; re-verify against syntology-harvest-sandbox:v5-deps; not recorded for this sample: the harness installs a cuda-to-cpu shim (cuda_shim.py) before every sample and no run records whether a sample needed it; seed: none by the harness; any seed is in the setup block
resize_img Ran
ran; our contract draft was wrong, not the code
nctu-eva-lab/antifakeprompt/app/utils.py
code served (permissive licence) · get_code("926bb38f979a61ef")
How it ran

Ran in Syntology's sandbox on this synthesized input (drafted by a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API) and returned Image. The image it ran in was not recorded. If your copy returns the same type on these inputs, it matched what we observed; nothing here checks that. It does NOT mean the output is correct: nothing has compared it to the paper.

from PIL import Image
import torch

torch.manual_seed(0)

# Create a small PIL Image object
# The function calls .size on it and .resize()
# We need an image with width > 240 so the scaling factor makes sense
raw_img = Image.new('RGB', (480, 360))

ARGS = {
    'raw_img': raw_img
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
PIL, torch — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type Image — a Image output has no array shape of its own; none is stated — the instrument coerces any output to an array; for a Image output the recorded ndim 3 and dtype family int describe that coercion, not the output, and are not stated
Environment
image not recorded; re-verify against syntology-harvest-sandbox:v5-deps; not recorded for this sample: the harness installs a cuda-to-cpu shim (cuda_shim.py) before every sample and no run records whether a sample needed it; seed: none by the harness; any seed is in the setup block
resize_img_w Ran
ran; our contract draft was wrong, not the code
nctu-eva-lab/antifakeprompt/app/dataset_browser.py
code served (permissive licence) · get_code("f809f2ecf34c1c99")
How it ran

Ran in Syntology's sandbox on this synthesized input (drafted by a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API) and returned Image. The image it ran in was not recorded. If your copy returns the same type on these inputs, it matched what we observed; nothing here checks that. It does NOT mean the output is correct: nothing has compared it to the paper.

from PIL import Image

# Create a small test image
def create_test_image(width=100, height=80):
    return Image.new('RGB', (width, height), color='red')

# Test case 1: single image
single_image = create_test_image(100, 80)

# Test case 2: list of images
image_list = [create_test_image(100, 80), create_test_image(120, 90), create_test_image(110, 85)]

ARGS = {
    "raw_img": single_image,
    "new_w": 224
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
PIL — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type Image — a Image output has no array shape of its own; none is stated — the instrument coerces any output to an array; for a Image output the recorded ndim 3 and dtype family int describe that coercion, not the output, and are not stated
Environment
image not recorded; re-verify against syntology-harvest-sandbox:v5-deps; not recorded for this sample: the harness installs a cuda-to-cpu shim (cuda_shim.py) before every sample and no run records whether a sample needed it; seed: none by the harness; any seed is in the setup block
sample_dataset Ran
ran; our contract draft was wrong, not the code
nctu-eva-lab/antifakeprompt/app/dataset_browser.py
code served (permissive licence) · get_code("3d4bbb5ca53fd24a")
How it ran

Ran in Syntology's sandbox on this synthesized input (drafted by a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API) and returned list, ndim 1, dtype family float; no output shape is stated. The image it ran in was not recorded. If your copy returns the same type and ndim on these inputs, it matched what we observed; nothing here checks that. It does NOT mean the output is correct: nothing has compared it to the paper.

import torch
import torch.nn as nn

torch.manual_seed(0)

class MockDataset:
    def __init__(self):
        self.data = {
            0: {"id": 0, "value": torch.randn(4)},
            1: {"id": 1, "value": torch.randn(4)},
            2: {"id": 2, "value": torch.randn(4)},
        }
    
    def displ_item(self, idx):
        return self.data[idx]

dataset = MockDataset()
indices = [0, 1, 2]

ARGS = {
    "dataset": dataset,
    "indices": indices,
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
torch — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type list, ndim 1, dtype family float — a list output has no array shape of its own; none is stated
dtype family
int means an integer dtype; float means any other dtype the instrument saw, bool and complex included (fixture_check.py records only these two families)
Environment
image not recorded; re-verify against syntology-harvest-sandbox:v5-deps; not recorded for this sample: the harness installs a cuda-to-cpu shim (cuda_shim.py) before every sample and no run records whether a sample needed it; seed: none by the harness; any seed is in the setup block
compute_gradcam_batch Not yet run
unverified (harvested, no recorded run)
nctu-eva-lab/antifakeprompt/app/multimodal_search.py
code served (permissive licence) · get_code("3e12ea8c09674aa8")
How it ran

no invocation recorded.

Also present in other papers' code

Of 8 samples lifted from this paper's linked repositories, 8 carry a function identity and 0 do not. Of the 8 distinct functions with an identity, 7 are also present in other papers whose code we hold (7 with at least one paper dated earlier, 0 the same month, 7 later) and 1 are only here among the 52,977 papers whose code Syntology holds (as of 2026-09-26).

Only here means: among the 52,977 papers whose code Syntology holds (51,887 with lifted samples, 1,090 through their assemblies only), as of 2026-09-26, no other paper's lifted samples or current assembly bricks contain an identical function body after normalisation.

FunctionAlso present inEarliest-datedOthers named
generate_caption 12 other papers
3 dated earlier, 9 later
2305.01278 (2023-05)
VPGTrans: Transfer Visual Prompt Generator across LLMs
2305.06988 (2023-05)
Self-Chained Image-Language Model for Video Localization and Question Answering
2307.07063 (2023-07)
Bootstrapping Vision-Language Learning with Decoupled Language Pre-training
and 9 more not named here
read_img 12 other papers
3 dated earlier, 9 later
2305.01278 (2023-05)
VPGTrans: Transfer Visual Prompt Generator across LLMs
2305.06988 (2023-05)
Self-Chained Image-Language Model for Video Localization and Question Answering
2307.07063 (2023-07)
Bootstrapping Vision-Language Learning with Decoupled Language Pre-training
and 9 more not named here
compute_gradcam_batch 10 other papers
3 dated earlier, 7 later
2305.01278 (2023-05)
VPGTrans: Transfer Visual Prompt Generator across LLMs
2305.06988 (2023-05)
Self-Chained Image-Language Model for Video Localization and Question Answering
2307.07063 (2023-07)
Bootstrapping Vision-Language Learning with Decoupled Language Pre-training
and 7 more not named here
get_concat_v 10 other papers
3 dated earlier, 7 later
2305.01278 (2023-05)
VPGTrans: Transfer Visual Prompt Generator across LLMs
2305.06988 (2023-05)
Self-Chained Image-Language Model for Video Localization and Question Answering
2307.07063 (2023-07)
Bootstrapping Vision-Language Learning with Decoupled Language Pre-training
and 7 more not named here
resize_img_w 10 other papers
3 dated earlier, 7 later
2305.01278 (2023-05)
VPGTrans: Transfer Visual Prompt Generator across LLMs
2305.06988 (2023-05)
Self-Chained Image-Language Model for Video Localization and Question Answering
2307.07063 (2023-07)
Bootstrapping Vision-Language Learning with Decoupled Language Pre-training
and 7 more not named here
sample_dataset 10 other papers
3 dated earlier, 7 later
2305.01278 (2023-05)
VPGTrans: Transfer Visual Prompt Generator across LLMs
2305.06988 (2023-05)
Self-Chained Image-Language Model for Video Localization and Question Answering
2307.07063 (2023-07)
Bootstrapping Vision-Language Learning with Decoupled Language Pre-training
and 7 more not named here
resize_img 9 other papers
3 dated earlier, 6 later
2305.01278 (2023-05)
VPGTrans: Transfer Visual Prompt Generator across LLMs
2305.06988 (2023-05)
Self-Chained Image-Language Model for Video Localization and Question Answering
2307.07063 (2023-07)
Bootstrapping Vision-Language Learning with Decoupled Language Pre-training
and 6 more not named here

Presence, not direction: an identical function body in two papers' repositories does not say who wrote it, which came from which, or that either paper's method rests on it. Matching is exact after normalisation, so a renamed or edited function is not matched. Dates are when papers appeared, not when code was written. Only .py files the harvester lifted are covered; notebooks are not read. A new-style arXiv id YYMM.NNNN dates a paper to the month 20YY-MM; otherwise Paper.year dates it to the year; otherwise it is undated. Dates are when the paper appeared, not when the code was written. Read 2026-11-23.

Repositories linked to this paper

Some links come from the archived Papers with Code dataset (CC BY-SA 4.0): attribution and licence.

Abstract

Deep generative models can create remarkably photorealistic fake images while raising concerns about misinformation and copyright infringement, known as deepfake threats. Deepfake detection technique is developed to distinguish between real and fake images, where the existing methods typically learn classifiers in the image domain or various feature domains. However, the generalizability of deepfake detection against emerging and more advanced generative models remains challenging. In this paper, being inspired by the zero-shot advantages of Vision-Language Models (VLMs), we propose a novel approach called AntifakePrompt, using VLMs (e.g., InstructBLIP) and prompt tuning techniques to improve the deepfake detection accuracy over unseen data. We formulate deepfake detection as a visual question answering problem, and tune soft prompts for InstructBLIP to answer the real/fake information of a query image. We conduct full-spectrum experiments on datasets from a diversity of 3 held-in and 20 held-out generative models, covering modern text-to-image generation, image editing and adversarial image attacks. These testing datasets provide useful benchmarks in the realm of deepfake detection for further research. Moreover, results demonstrate that (1) the deepfake detection accuracy can be significantly and consistently improved (from 71.06% to 92.11%, in average accuracy over unseen domains) using pretrained vision-language models with prompt tuning; (2) our superior performance is at less cost of training data and trainable parameters, resulting in an effective and efficient solution for deepfake detection. Code and models can be found at https://github.com/nctu-eva-lab/AntifakePrompt.

For agents

The same record, over MCP at https://syntology.ai/mcp:

get_harvested_code_for_paper("2310.17419")
get_code_for_paper("2310.17419")
have("2310.17419")

The run record, dated, one paper per request, free:

curl https://syntology.ai/api/ran/2310.17419.json

A badge for a README (the split and the date, never a ratio):

[![Syntology run record](https://syntology.ai/api/ran/2310.17419.svg)](https://syntology.ai/paper/2310.17419)

Connect an agent — have() is free.