SYNTOLOGY HomeExplorerAtlasCodeMethodologyAboutDevelopersFeedPricing
Paper · 2310.05862 · 2023

Better Safe than Sorry: Pre-training CLIP against Targeted Data Poisoning and Backdoor Attacks

arXiv · PDF · Open in the Atlas

Code that ran

5 of 10 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; 4 failures of our instrument; 5 no recorded run), measured 2026-11-22; 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.05862.json · badge: /api/ran/2310.05862.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
bigml-cs-ucla/safeclip canonical (classifier label)
classifier basis: census
4 ran · 4 no recorded run
copy not recorded community
not in the paper's declared repositories
1 ran · 1 no recorded run
FunctionStatusWhere it lives
apply Ran
ran; our contract draft was wrong, not the code
this paper's copy was not recorded; identical code first harvested from goel-shashank/CyCLIP
pointer only; the stored copy get_code serves, from goel-shashank/CyCLIP, is pointer only (licence: NONE) · get_code("d36be288b124bd8b")
How it ran

The body of this sample is withheld: this paper's copy of the code was not recorded (its link names no repository or source path), so no licence was read for it. The setup block that called it is withheld with it, because it is written against that body. source_path and origin say where the code lives, to read under the repository's own terms. A run is recorded.

calcualte_num_batches Ran
ran, honoured the contract we drafted
bigml-cs-ucla/safeclip/SafeCLIP/src/scheduler.py
pointer only (licence: NONE) · get_code("18af334ee213157a")
How it ran

The body of this sample is withheld: GitHub detected no licence in this paper's repository, bigml-cs-ucla/safeclip when it was checked. The setup block that called it is withheld with it, because it is written against that body. source_path and origin say where the code lives, to read under the repository's own terms. A run is recorded.

cosine_scheduler Ran
ran; our contract draft was wrong, not the code
bigml-cs-ucla/safeclip/SafeCLIP/src/scheduler.py
pointer only (licence: NONE) · get_code("757591aac112e98e")
How it ran

The body of this sample is withheld: GitHub detected no licence in this paper's repository, bigml-cs-ucla/safeclip when it was checked. The setup block that called it is withheld with it, because it is written against that body. source_path and origin say where the code lives, to read under the repository's own terms. A run is recorded.

fit_gmm_to_cos_sim Ran
ran; our contract draft was wrong, not the code
bigml-cs-ucla/safeclip/SafeCLIP/src/samplers.py
pointer only (licence: NONE) · get_code("ce27383ada7b655d")
How it ran

The body of this sample is withheld: GitHub detected no licence in this paper's repository, bigml-cs-ucla/safeclip when it was checked. The setup block that called it is withheld with it, because it is written against that body. source_path and origin say where the code lives, to read under the repository's own terms. A run is recorded.

get_logger Ran
ran; our contract draft was wrong, not the code
bigml-cs-ucla/safeclip/SafeCLIP/src/logger.py
pointer only (licence: NONE); the stored copy get_code serves, from jam1ezhang/rankclip, is pointer only (licence: NONE) · get_code("75f67d27c89765cd")
How it ran

The body of this sample is withheld: GitHub detected no licence in this paper's repository, bigml-cs-ucla/safeclip when it was checked. The setup block that called it is withheld with it, because it is written against that body. source_path and origin say where the code lives, to read under the repository's own terms. A run is recorded.

build Not yet run
unverified (harvested, no recorded run)
bigml-cs-ucla/safeclip/SafeCLIP/pkgs/openai/model.py
pointer only (licence: NONE); the stored copy get_code serves, from jam1ezhang/rankclip, is pointer only (licence: NONE) · get_code("27b459903dd9ce81")
How it ran

The body of this sample is withheld: GitHub detected no licence in this paper's repository, bigml-cs-ucla/safeclip when it was checked. The setup block that called it is withheld with it, because it is written against that body. source_path and origin say where the code lives, to read under the repository's own terms. No invocation recorded.

get_linear_probe_metrics Not yet run
unverified (harvested, no recorded run)
bigml-cs-ucla/safeclip/SafeCLIP/src/evaluate.py
pointer only (licence: NONE) · get_code("37891dc545d9edac")
How it ran

The body of this sample is withheld: GitHub detected no licence in this paper's repository, bigml-cs-ucla/safeclip when it was checked. The setup block that called it is withheld with it, because it is written against that body. source_path and origin say where the code lives, to read under the repository's own terms. No invocation recorded.

get_validation_metrics Not yet run
unverified (harvested, no recorded run)
bigml-cs-ucla/safeclip/SafeCLIP/src/evaluate.py
pointer only (licence: NONE) · get_code("f7dab6ab4b974716")
How it ran

The body of this sample is withheld: GitHub detected no licence in this paper's repository, bigml-cs-ucla/safeclip when it was checked. The setup block that called it is withheld with it, because it is written against that body. source_path and origin say where the code lives, to read under the repository's own terms. No invocation recorded.

get_zeroshot_metrics Not yet run
unverified (harvested, no recorded run)
bigml-cs-ucla/safeclip/SafeCLIP/src/evaluate.py
pointer only (licence: NONE); the stored copy get_code serves, from xinyaocse/ToxicTextCLIP, is pointer only (licence: NONE) · get_code("3273b611e02f5586")
How it ran

The body of this sample is withheld: GitHub detected no licence in this paper's repository, bigml-cs-ucla/safeclip when it was checked. The setup block that called it is withheld with it, because it is written against that body. source_path and origin say where the code lives, to read under the repository's own terms. No invocation recorded.

multiprocess Not yet run
unverified (harvested, no recorded run)
this paper's copy was not recorded; identical code first harvested from goel-shashank/CyCLIP
pointer only; the stored copy get_code serves, from goel-shashank/CyCLIP, is pointer only (licence: NONE) · get_code("30c9fb7349669f71")
How it ran

The body of this sample is withheld: this paper's copy of the code was not recorded (its link names no repository or source path), so no licence was read for it. The setup block that called it is withheld with it, because it is written against that body. source_path and origin say where the code lives, to read under the repository's own terms. No invocation recorded.

Also present in other papers' code

Of 10 samples lifted from this paper's linked repositories, 10 carry a function identity and 0 do not. Of the 10 distinct functions with an identity, 5 are also present in other papers whose code we hold (2 with at least one paper dated earlier, 0 the same month, 3 later) and 5 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
apply 2 other papers
2 dated earlier
2205.14459 (2022-05)
CYCLIP: Cyclic Contrastive Language-Image Pretraining
2303.06854 (2023-03)
Robust Contrastive Language-Image Pre-training against Data Poisoning and Backdoor Attacks
multiprocess 2 other papers
2 dated earlier
2205.14459 (2022-05)
CYCLIP: Cyclic Contrastive Language-Image Pretraining
2303.06854 (2023-03)
Robust Contrastive Language-Image Pre-training against Data Poisoning and Backdoor Attacks
build 1 other paper
1 later
2404.09387 (2024-04)
RankCLIP: Ranking-Consistent Language-Image Pretraining
get_logger 1 other paper
1 later
2404.09387 (2024-04)
RankCLIP: Ranking-Consistent Language-Image Pretraining
get_zeroshot_metrics 1 other paper
1 later
2511.00446 (2025-11)
ToxicTextCLIP: Text-Based Poisoning and Backdoor Attacks on CLIP Pre-training

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-22.

Repositories linked to this paper

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

Abstract

Contrastive Language-Image Pre-training (CLIP) on large image-caption datasets has achieved remarkable success in zero-shot classification and enabled transferability to new domains. However, CLIP is extremely more vulnerable to targeted data poisoning and backdoor attacks, compared to supervised learning. Perhaps surprisingly, poisoning 0.0001% of CLIP pre-training data is enough to make targeted data poisoning attacks successful. This is four orders of magnitude smaller than what is required to poison supervised models. Despite this vulnerability, existing methods are very limited in defending CLIP models during pre-training. In this work, we propose a strong defense, SAFECLIP, to safely pre-train CLIP against targeted data poisoning and backdoor attacks. SAFECLIP warms up the model by applying unimodal contrastive learning (CL) on image and text modalities separately. Then, it divides the data into safe and risky sets, by applying a Gaussian Mixture Model to the cosine similarity of image-caption pair representations. SAFECLIP pre-trains the model by applying the CLIP loss to the safe set and applying unimodal CL to image and text modalities of the risky set separately. By gradually increasing the size of the safe set during pre-training, SAFECLIP effectively breaks targeted data poisoning and backdoor attacks without harming the CLIP performance. Our extensive experiments on CC3M, Visual Genome, and MSCOCO demonstrate that SAFECLIP significantly reduces the success rate of targeted data poisoning attacks from 93.75% to 0% and that of various backdoor attacks from up to 100% to 0%, without harming CLIP's performance.

For agents

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

get_harvested_code_for_paper("2310.05862")
get_code_for_paper("2310.05862")
have("2310.05862")

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

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

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

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

Connect an agent — have() is free.