SYNTOLOGY HomeExplorerAtlasCodeMethodologyAboutDevelopersFeedPricing
Paper · 2406.12042 · 2024

Not All Prompts Are Made Equal: Prompt-based Pruning of Text-to-Image Diffusion Models

arXiv · PDF · Open in the Atlas

Code that ran

4 of 5 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; 3 honoured the contract we drafted, 0 violated it and 0 have no contract verdict; 1 failure of our instrument; 1 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/2406.12042.json · badge: /api/ran/2406.12042.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
rezashkv/diffusion_pruning canonical (classifier label)
classifier basis: census
4 ran · 1 no recorded run
FunctionStatusWhere it lives
compute_embeddings_for_dir Ran
ran, honoured the contract we drafted
rezashkv/diffusion_pruning/cmmd-pytorch/io_util.py
code served (permissive licence) · get_code("f8b1eb63e72dcf86")
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 ndarray, ndim 2, dtype family float, shape (1, 4) 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 torch
import numpy as np
from unittest.mock import Mock, MagicMock
import tempfile
import os
from PIL import Image

torch.manual_seed(0)

# Create a temporary directory with a small test image
temp_dir = tempfile.mkdtemp()
test_img = Image.new('RGB', (64, 64), color=(100, 100, 100))
test_img.save(os.path.join(temp_dir, 'test_image.png'))

# Create a mock embedding model
class MockEmbeddingModel:
    def __init__(self):
        self.input_image_size = 32
    
    def embed(self, image_batch):
        # image_batch shape: (batch_size, height, width, channels)
        # Return embeddings of shape (batch_size, embedding_dim)
        batch_size = image_batch.shape[0]
        embedding_dim = 4
        return np.random.randn(batch_size, embedding_dim).astype(np.float32)

embedding_model = MockEmbeddingModel()

ARGS = {
    'img_dir': temp_dir,
    'embedding_model': embedding_model,
    'batch_size': 2,
    'max_count': -1
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
PIL, numpy, torch, tqdm — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type ndarray, ndim 2, dtype family float, shape (1, 4) — shape (1, 4) 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
generate_images Ran
ran, honoured the contract we drafted
rezashkv/diffusion_pruning/cmmd-pytorch/generate_images.py
code served (permissive licence) · get_code("67af82f9a75b4a53")
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 4, dtype family int; 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 pandas as pd
from unittest.mock import Mock, MagicMock
from PIL import Image

torch.manual_seed(0)

# Create a mock args object
class Args:
    def __init__(self):
        self.chunk_size = 2
        self.pipeline_id = "stable-diffusion-v1-5"
        self.num_inference_steps = 1

args = Args()

# Create a mock dataframe with captions
dataframe = pd.DataFrame({
    'caption': ['a cat sitting on a mat', 'a dog running in the park', 'a bird flying in the sky', 'a fish swimming in water']
})

# Create a mock pipeline that returns images
class MockPipeline:
    def __call__(self, prompts, num_inference_steps, generator, guidance_scale=None):
        # Return mock images (PIL Images)
        mock_result = Mock()
        mock_result.images = [
            Image.new('RGB', (4, 3), color=(73, 109, 137)) 
            for _ in range(len(prompts))
        ]
        return mock_result

pipeline = MockPipeline()

ARGS = {
    'args': args,
    'dataframe': dataframe,
    'pipeline': pipeline
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
PIL, pandas, torch — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type list, ndim 4, dtype family int — 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
load_coco_dataset Ran
ran; our contract draft was wrong, not the code
rezashkv/diffusion_pruning/pdm/datasets/coco.py
code served (permissive licence) · get_code("228ab600d55e08e3")
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 Dataset. 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 json
import os
import tempfile
from datasets import Dataset

# Create temporary directories and files for testing
temp_dir = tempfile.mkdtemp()
images_dir = os.path.join(temp_dir, 'val2014')
os.makedirs(images_dir, exist_ok=True)

# Create a mock annotations file
annotations_data = {
    'annotations': [
        {'image_id': 1, 'caption': 'A dog playing in the park'},
        {'image_id': 2, 'caption': 'A cat sleeping on a bed'},
    ]
}

annotations_file = os.path.join(temp_dir, 'annotations.json')
with open(annotations_file, 'w') as f:
    json.dump(annotations_data, f)

ARGS = {
    'images_dir': images_dir,
    'annotations_file': annotations_file,
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
datasets — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type Dataset — a Dataset output has no array shape of its own; none is stated — the instrument coerces any output to an array; for a Dataset output the recorded ndim 1 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
mmd Ran
ran, honoured the contract we drafted
rezashkv/diffusion_pruning/cmmd-pytorch/distance.py
code served (permissive licence) · get_code("cbf43bceb31b386b")
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 Tensor, 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 torch
import numpy as np

torch.manual_seed(0)

# Create small embedding sets
# x and y should have shape (n, embedding_dim)
# The function converts them from numpy to torch tensors
n_samples = 2
embedding_dim = 4

x = np.random.randn(n_samples, embedding_dim).astype(np.float32)
y = np.random.randn(n_samples, embedding_dim).astype(np.float32)

ARGS = {
    "x": x,
    "y": y,
}
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 Tensor, 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
load_cc3m_dataset Not yet run
unverified (harvested, no recorded run)
rezashkv/diffusion_pruning/pdm/datasets/cc3m.py
code served (permissive licence) · get_code("7da93e65f7335b8a")
How it ran

no invocation recorded.

Also present in other papers' code

Of 5 samples lifted from this paper's linked repositories, 5 carry a function identity and 0 do not. Of the 5 distinct functions with an identity, 3 are also present in other papers whose code we hold (3 with at least one paper dated earlier, 0 the same month, 0 later) and 2 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
compute_embeddings_for_dir 1 other paper
1 dated earlier
2401.09603 (2024-01)
Rethinking FID: Towards a Better Evaluation Metric for Image Generation
generate_images 1 other paper
1 dated earlier
2401.09603 (2024-01)
Rethinking FID: Towards a Better Evaluation Metric for Image Generation
mmd 1 other paper
1 dated earlier
2401.09603 (2024-01)
Rethinking FID: Towards a Better Evaluation Metric for Image Generation

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

Text-to-image (T2I) diffusion models have demonstrated impressive image generation capabilities. Still, their computational intensity prohibits resource-constrained organizations from deploying T2I models after fine-tuning them on their internal target data. While pruning techniques offer a potential solution to reduce the computational burden of T2I models, static pruning methods use the same pruned model for all input prompts, overlooking the varying capacity requirements of different prompts. Dynamic pruning addresses this issue by utilizing a separate sub-network for each prompt, but it prevents batch parallelism on GPUs. To overcome these limitations, we introduce Adaptive Prompt-Tailored Pruning (APTP), a novel prompt-based pruning method designed for T2I diffusion models. Central to our approach is a prompt router model, which learns to determine the required capacity for an input text prompt and routes it to an architecture code, given a total desired compute budget for prompts. Each architecture code represents a specialized model tailored to the prompts assigned to it, and the number of codes is a hyperparameter. We train the prompt router and architecture codes using contrastive learning, ensuring that similar prompts are mapped to nearby codes. Further, we employ optimal transport to prevent the codes from collapsing into a single one. We demonstrate APTP's effectiveness by pruning Stable Diffusion (SD) V2.1 using CC3M and COCO as target datasets. APTP outperforms the single-model pruning baselines in terms of FID, CLIP, and CMMD scores. Our analysis of the clusters learned by APTP reveals they are semantically meaningful. We also show that APTP can automatically discover previously empirically found challenging prompts for SD, e.g. prompts for generating text images, assigning them to higher capacity codes.

For agents

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

get_harvested_code_for_paper("2406.12042")
get_code_for_paper("2406.12042")
have("2406.12042")

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

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

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

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

Connect an agent — have() is free.