SYNTOLOGY HomeExplorerAtlasCodeMethodologyAboutDevelopersFeedPricing
Paper · 2311.18815 · 2023

IMMA: Immunizing text-to-image Models against Malicious Adaptation

arXiv · PDF · Open in the Atlas

Code that ran

11 of 17 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; 0 honoured the contract we drafted, 0 violated it and 10 have no contract verdict; 1 failure of our instrument; 6 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/2311.18815.json · badge: /api/ran/2311.18815.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
zhengyjzoe/imma canonical (classifier label)
classifier basis: census
1 ran · 5 no recorded run
amberyzheng/imma canonical (classifier label)
classifier basis: classifier_2025
0 ran · 1 no recorded run
MindCode-4/code-14 community (classifier label)
classifier basis not recorded on the link
10 ran · 0 no recorded run
FunctionStatusWhere it lives
Getdcg Ran
ran on a synthesized input
MindCode-4/code-14/DiffNet++/Metrics.py
code served (permissive licence) · get_code("690566e1b97cef9c")
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 float, ndim 0, dtype family float, shape () as a later run recorded it. The image it ran in was not recorded. If your copy returns the same type, ndim and shape 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 math

def Getdcg(idx):
    """Get dcg value"""
    dcg = math.log(2) / math.log(idx + 2)
    return dcg

ARGS = {
    "idx": 5
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
none outside the standard library — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type float, ndim 0, dtype family float, shape () — shape () as a later run recorded it
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
Getidcg Ran
ran on a synthesized input
MindCode-4/code-14/DiffNet++/Metrics.py
code served (permissive licence) · get_code("084eae410e04a51d")
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 float, ndim 0, dtype family float, shape () as a later run recorded it. The image it ran in was not recorded. If your copy returns the same type, ndim and shape 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 math

def Getidcg(length):
    """Get idcg value"""
    idcg = 0.0
    for i in range(length):
        idcg = idcg + math.log(2) / math.log(i + 2)
    return idcg

ARGS = {
    "length": 10
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
none outside the standard library — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type float, ndim 0, dtype family float, shape () — shape () as a later run recorded it
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
collate_fn Ran
ran; our contract draft was wrong, not the code
zhengyjzoe/imma/train/defend_dreambooth_lora.py
code served (permissive licence) · get_code("256040ccde7473f2")
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) and returned dict. 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 torch

torch.manual_seed(0)

# Create example data structures that match what collate_fn expects
example_with_mask = {
    'instance_prompt_ids': torch.randint(0, 100, (5,)),
    'instance_images': torch.randn(3, 4, 4),
    'instance_attention_mask': torch.ones(5),
    'class_prompt_ids': torch.randint(0, 100, (5,)),
    'class_images': torch.randn(3, 4, 4),
    'class_attention_mask': torch.ones(5),
}

example_without_mask = {
    'instance_prompt_ids': torch.randint(0, 100, (5,)),
    'instance_images': torch.randn(3, 4, 4),
    'class_prompt_ids': torch.randint(0, 100, (5,)),
    'class_images': torch.randn(3, 4, 4),
}

# Test case 1: with prior preservation and attention masks
examples_with_prior = [example_with_mask, example_with_mask]

# Test case 2: without prior preservation, with attention masks
examples_no_prior = [example_with_mask, example_with_mask]

# Test case 3: without attention masks
examples_no_mask = [example_without_mask, example_without_mask]

ARGS = {
    'examples': examples_with_prior,
    'with_prior_preservation': True,
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1
Imports
torch — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type dict — a dict output has no array shape of its own; none is stated — the instrument coerces any output to an array; for a dict output the recorded ndim 0 and dtype family float 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
decode Ran
ran on a synthesized input
MindCode-4/code-14/AECRNet/data.py
code served (permissive licence) · get_code("72814d7de33e5aef")
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 numpy as np
from PIL import Image

# Create a small valid image array (Height=4, Width=3, Channels=3 for RGB)
# PIL.Image.fromarray expects a numpy array with shape (H, W) for grayscale
# or (H, W, 3) for RGB or (H, W, 4) for RGBA
img_array = np.random.randint(0, 256, size=(4, 3, 3), dtype=np.uint8)

ARGS = {
    "img": img_array
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
PIL, numpy — 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
get_eval_data_from_source Ran
ran on a synthesized input
MindCode-4/code-14/DiffNet++/datahelper.py
code served (permissive licence) · get_code("cd833e611f7a9e4e")
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 dict. 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 torch
import numpy as np

# Construct a record_dict that maps user IDs to lists of item IDs
# This represents user-item interaction records
record_dict = {
    'user_1': ['item_a', 'item_b', 'item_c'],
    'user_2': ['item_d', 'item_e'],
    'user_3': ['item_f']
}

ARGS = {
    'record_dict': record_dict
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
numpy, torch — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type dict — a dict output has no array shape of its own; none is stated — the instrument coerces any output to an array; for a dict output the recorded ndim 0 and dtype family float 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
get_val_data_from_source Ran
ran on a synthesized input
MindCode-4/code-14/DiffNet++/datahelper.py
code served (permissive licence) · get_code("e82646a1b0adaae5")
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 dict. 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 torch

torch.manual_seed(0)

# Construct a record_dict for the function
# The function expects a dict where keys are user IDs and values are lists of item IDs
record_dict = {
    0: [10, 11, 12],
    1: [20, 21],
    2: [30, 31, 32, 33]
}

ARGS = {
    'record_dict': record_dict
}
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 dict — a dict output has no array shape of its own; none is stated — the instrument coerces any output to an array; for a dict output the recorded ndim 0 and dtype family float 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
load_data Ran
ran on a synthesized input
MindCode-4/code-14/DiffNet++/datahelper.py
code served (permissive licence) · get_code("e7901acf683fac85")
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 pandas as pd
import tempfile
import os

# Create a temporary CSV file with space-separated values
temp_file = tempfile.NamedTemporaryFile(mode='w', delete=False, suffix='.csv')
temp_file.write("1 10 1\n")
temp_file.write("1 11 0\n")
temp_file.write("2 10 1\n")
temp_file.write("2 12 1\n")
temp_file.write("3 11 0\n")
temp_file.close()

file_path = temp_file.name

ARGS = {
    'file_path': file_path
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
pandas — 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
load_data Ran
ran on a synthesized input
MindCode-4/code-14/DiffNet++/dataset.py
code served (permissive licence) · get_code("191312b83f4e21ea")
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 pandas as pd
import tempfile
import os

# Create a temporary CSV file with space-separated values
temp_file = tempfile.NamedTemporaryFile(mode='w', suffix='.csv', delete=False)
temp_file.write("1 10 1\n")
temp_file.write("2 20 0\n")
temp_file.write("1 30 1\n")
temp_file.write("3 10 0\n")
temp_file.close()

ARGS = {
    'file_path': temp_file.name
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
pandas — 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
load_variavle Ran
ran on a synthesized input
MindCode-4/code-14/Alexnet-ABeffect/feature_predict_abm.py
code served (permissive licence) · get_code("ea40ca66b8b3349e")
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 dict. 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 pickle
import tempfile
import os

# Create a temporary file and pickle some data to it
temp_dir = tempfile.gettempdir()
temp_file = os.path.join(temp_dir, "test_pickle_data.pkl")

# Create test data to pickle
test_data = {
    "key1": "value1",
    "key2": [1, 2, 3],
    "key3": {"nested": "dict"}
}

# Write the test data to a pickle file
with open(temp_file, 'wb') as f:
    pickle.dump(test_data, f)

ARGS = {
    "filename": temp_file
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
none outside the standard library — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type dict — a dict output has no array shape of its own; none is stated — the instrument coerces any output to an array; for a dict output the recorded ndim 0 and dtype family float 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
save_variable Ran
ran on a synthesized input
MindCode-4/code-14/Alexnet-ABeffect/feature_predict_abm.py
code served (permissive licence) · get_code("f34618312c4fa9c9")
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 str. 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 pickle
import tempfile
import os

# Create a temporary file path for the output
temp_dir = tempfile.gettempdir()
temp_filename = os.path.join(temp_dir, "test_variable.pkl")

# Define a variable to save - can be any picklable object
v = {
    "key1": "value1",
    "key2": [1, 2, 3, 4],
    "key3": {"nested": "dict"}
}

ARGS = {
    "v": v,
    "filename": temp_filename
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
none outside the standard library — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type str — a str output has no array shape of its own; none is stated — the instrument coerces any output to an array; for a str output the recorded ndim 0 and dtype family float 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
set_random_seed Ran
ran on a synthesized input
MindCode-4/code-14/AECRNet/data.py
code served (permissive licence) · get_code("14c181fabe865cbf")
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 str. 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 random
import torch

torch.manual_seed(0)

ARGS = {
    "img_name": "test_image.jpg",
    "seed": 42
}
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 str — a str output has no array shape of its own; none is stated — the instrument coerces any output to an array; for a str output the recorded ndim 0 and dtype family float 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
compute_acc Not yet run
unverified (harvested, no recorded run)
zhengyjzoe/imma/eval/imgnet_cls.py
code served (permissive licence) · get_code("9c1fd5d9c8bc4f4e")
How it ran

no invocation recorded.

import_model_class_from_model_name_or_path Not yet run
unverified (harvested, no recorded run)
zhengyjzoe/imma/train/defend_dreambooth.py
pointer only (licence: Apache-2.0); the stored copy get_code serves, from KU-VGI/APDM, is pointer only (licence: NONE) · get_code("0eb3e94e8635150e")
How it ran

The body of this sample is withheld: this paper's link allows the body inline (Apache-2.0), but get_code serves the stored copy, first harvested from KU-VGI/APDM, and GitHub detected no licence in that repository 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.

parse_args Not yet run
unverified (harvested, no recorded run)
amberyzheng/imma/train/defend_dreambooth.py
code served (permissive licence) · get_code("71a0f97a99f2dca6")
How it ran

no invocation recorded.

parse_args Not yet run
unverified (harvested, no recorded run)
zhengyjzoe/imma/train/defend_dreambooth_lora.py
code served (permissive licence) · get_code("406be0a733f187e9")
How it ran

no invocation recorded.

parse_args Not yet run
unverified (harvested, no recorded run)
zhengyjzoe/imma/train/train_dreambooth.py
code served (permissive licence) · get_code("1a4e15d300f9ff4e")
How it ran

no invocation recorded.

parse_args Not yet run
unverified (harvested, no recorded run)
zhengyjzoe/imma/train/train_dreambooth_lora.py
code served (permissive licence) · get_code("ecc1b168c8cc280f")
How it ran

no invocation recorded.

Also present in other papers' code

Of 17 samples lifted from this paper's linked repositories, 17 carry a function identity and 0 do not. Of the 17 distinct functions with an identity, 6 are also present in other papers whose code we hold (2 with at least one paper dated earlier, 0 the same month, 6 later) and 11 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
import_model_class_from_model_name_or_path 13 other papers
2 dated earlier, 11 later
2305.19327 (2023-05)
Cones 2: Customizable Image Synthesis with Multiple Subjects
2307.06949 (2023-07)
HyperDreamBooth: HyperNetworks for Fast Personalization of Text-to-Image Models
2312.00084 (2023-12)
Can Protective Perturbation Safeguard Personal Data from Being Exploited by Stable Diffusion?
and 10 more not named here
collate_fn 5 other papers
1 dated earlier, 4 later
2306.14435 (2023-06)
DragDiffusion: Harnessing Diffusion Models for Interactive Point-based Image Editing
2312.00084 (2023-12)
Can Protective Perturbation Safeguard Personal Data from Being Exploited by Stable Diffusion?
2401.06442 (2024-01)
RotationDrag: Point-based Image Editing with Rotated Diffusion Features
and 2 more not named here
decode 2 other papers
2 later
2408.14512 (2024-08)
LLMs as Zero-shot Graph Learners: Alignment of GNN Representations with LLM Token Embeddings
2503.09573 (2025-03)
BLOCK DIFFUSION: INTERPOLATING BETWEEN AU-TOREGRESSIVE AND DIFFUSION LANGUAGE MODELS
set_random_seed 2 other papers
2 later
2408.14512 (2024-08)
LLMs as Zero-shot Graph Learners: Alignment of GNN Representations with LLM Token Embeddings
2503.09573 (2025-03)
BLOCK DIFFUSION: INTERPOLATING BETWEEN AU-TOREGRESSIVE AND DIFFUSION LANGUAGE MODELS
load_variavle 1 other paper
1 later
2503.09573 (2025-03)
BLOCK DIFFUSION: INTERPOLATING BETWEEN AU-TOREGRESSIVE AND DIFFUSION LANGUAGE MODELS
save_variable 1 other paper
1 later
2503.09573 (2025-03)
BLOCK DIFFUSION: INTERPOLATING BETWEEN AU-TOREGRESSIVE AND DIFFUSION LANGUAGE MODELS

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

Advancements in open-sourced text-to-image models and fine-tuning methods have led to the increasing risk of malicious adaptation, i.e., fine-tuning to generate harmful/unauthorized content. Recent works, e.g., Glaze or MIST, have developed data-poisoning techniques which protect the data against adaptation methods. In this work, we consider an alternative paradigm for protection. We propose to ``immunize'' the model by learning model parameters that are difficult for the adaptation methods when fine-tuning malicious content; in short IMMA. Specifically, IMMA should be applied before the release of the model weights to mitigate these risks. Empirical results show IMMA's effectiveness against malicious adaptations, including mimicking the artistic style and learning of inappropriate/unauthorized content, over three adaptation methods: LoRA, Textual-Inversion, and DreamBooth. The code is available at \url{https://github.com/amberyzheng/IMMA}.

For agents

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

get_harvested_code_for_paper("2311.18815")
get_code_for_paper("2311.18815")
have("2311.18815")

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

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

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

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

Connect an agent — have() is free.