SYNTOLOGY HomeExplorerAtlasCodeMethodologyAboutDevelopersFeedPricing
Paper · 2410.03558 · 2024

Not All Diffusion Model Activations Have Been Evaluated as Discriminative Features

arXiv · PDF · Open in the Atlas

Code that ran

3 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; 1 honoured the contract we drafted, 0 violated it and 0 have no contract verdict; 2 failures of our instrument; 2 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/2410.03558.json · badge: /api/ran/2410.03558.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
darkbblue/generic-diffusion-feature canonical (classifier label)
classifier basis: census
3 ran · 2 no recorded run
FunctionStatusWhere it lives
get_pipeline_embeds Ran
ran, honoured the contract we drafted
darkbblue/generic-diffusion-feature/feature/components/encode_long_prompt.py
code served (permissive licence) · get_code("218cb4664f6d8be5")
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, ndim 4, 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 MockTokenizer:
    def __init__(self):
        self.model_max_length = 4
    
    def __call__(self, text, return_tensors=None, truncation=False, padding=None, max_length=None):
        # Return a mock tokenizer output with input_ids
        # We need to create variable length sequences based on the text
        if max_length is None:
            # Count words and create appropriate length
            num_tokens = len(text.split(' ')) + 2  # +2 for start/end tokens
        else:
            num_tokens = max_length
        
        input_ids = torch.randint(0, 100, (1, num_tokens))
        
        class TokenizerOutput:
            def __init__(self, ids):
                self.input_ids = ids
        
        return TokenizerOutput(input_ids)

class MockTextEncoder(nn.Module):
    def __init__(self):
        super().__init__()
        self.linear = nn.Linear(100, 5)
    
    def forward(self, input_ids):
        # Return embeddings of shape (batch, seq_len, embed_dim)
        batch_size = input_ids.shape[0]
        seq_len = input_ids.shape[1]
        embeddings = torch.randn(batch_size, seq_len, 5)
        return (embeddings,)  # Return tuple as the function expects [0]

class MockPipeline:
    def __init__(self):
        self.tokenizer = MockTokenizer()
        self.text_encoder = MockTextEncoder()

pipeline = MockPipeline()
prompt = ["a cat sitting on a mat"]
negative_prompt = ["ugly bad"]
device = "cpu"

ARGS = {
    "pipeline": pipeline,
    "prompt": prompt,
    "negative_prompt": negative_prompt,
    "device": device,
}
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 tuple, ndim 4, dtype family float — a tuple 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
my_scaled_dot_product_attention Ran
ran; our contract draft was wrong, not the code
darkbblue/generic-diffusion-feature/feature/components/attention.py
code served (permissive licence) · get_code("9aac7d4d2e2bf7b5")
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 math
import torch

torch.manual_seed(0)

# Create small tensors for scaled dot product attention
# Using distinct sizes for different dimensions
batch_size = 2
seq_len_query = 4
seq_len_key = 5
head_dim = 3
num_heads = 2

# query: (batch, num_heads, seq_len_query, head_dim)
query = torch.randn(batch_size, num_heads, seq_len_query, head_dim)

# key: (batch, num_heads, seq_len_key, head_dim)
key = torch.randn(batch_size, num_heads, seq_len_key, head_dim)

# value: (batch, num_heads, seq_len_key, head_dim)
value = torch.randn(batch_size, num_heads, seq_len_key, head_dim)

# attn_mask: optional boolean or additive mask
attn_mask = None

# dropout probability
dropout_p = 0.1

# causal masking flag
is_causal = False

# custom scale factor (None means compute from head_dim)
scale = None

# grouped query attention flag
enable_gqa = False

ARGS = {
    "query": query,
    "key": key,
    "value": value,
    "attn_mask": attn_mask,
    "dropout_p": dropout_p,
    "is_causal": is_causal,
    "scale": scale,
    "enable_gqa": enable_gqa,
}
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 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
prepare_feature_extractor Ran
ran; our contract draft was wrong, not the code
darkbblue/generic-diffusion-feature/feature/components/feature_extractor.py
code served (permissive licence) · get_code("536cc6e48a448418")
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 FeatureStore. The image it ran in was not recorded. The code mentions cuda, and the harness aliases cuda to the CPU for every sample; whether this run needed that is 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 torch.nn as nn
from torch.nn import Module
import math

torch.manual_seed(0)

# Minimal transformer block with required attributes
class MinimalAttention(Module):
    def __init__(self):
        super().__init__()
        self.linear = nn.Linear(4, 4)
    
    def forward(self, x):
        return self.linear(x)

class MinimalBasicBlock(Module):
    def __init__(self):
        super().__init__()
        self.attn = MinimalAttention()
        self.ff = nn.Linear(4, 4)
        self.transformer_blocks = nn.ModuleList([
            MinimalAttention() for _ in range(2)
        ])
    
    def forward(self, x):
        return x

class MinimalTransformer(Module):
    def __init__(self):
        super().__init__()
        self.transformer_blocks = nn.ModuleList([
            MinimalBasicBlock() for _ in range(2)
        ])
        self.single_transformer_blocks = nn.ModuleList([
            MinimalBasicBlock() for _ in range(1)
        ])
    
    def forward(self, x):
        return x

class MinimalResnet(Module):
    def __init__(self):
        super().__init__()
        self.linear = nn.Linear(4, 4)
    
    def forward(self, x):
        return self.linear(x)

class MinimalAttentionBlock(Module):
    def __init__(self):
        super().__init__()
        self.transformer_blocks = nn.ModuleList([
            MinimalBasicBlock() for _ in range(2)
        ])
    
    def forward(self, x):
        return x

class MinimalLevel(Module):
    def __init__(self):
        super().__init__()
        self.resnets = nn.ModuleList([MinimalResnet() for _ in range(2)])
        self.attentions = nn.ModuleList([MinimalAttentionBlock() for _ in range(2)])
    
    def forward(self, x):
        return x

class MinimalUNet(Module):
    def __init__(self):
        super().__init__()
        self.down_blocks = nn.ModuleList([
            MinimalLevel() for _ in range(2)
        ])
    
    def forward(self, x):
        return x

class MinimalPipeFlux(Module):
    def __init__(self):
        super().__init__()
        self.transformer = MinimalTransformer()
    
    def forward(self, x):
        return x

class MinimalPipeUNet(Module):
    def __init__(self):
        super().__init__()
        self.unet = MinimalUNet()
    
    def forward(self, x):
        return x

# Create config dict
config = {
    "vit-block0": True,
    "vit-block1": True,
    "vit-block0-ffn": True,
}

# Create pipes
pipe_flux = MinimalPipeFlux()
pipe_unet = MinimalPipeUNet()

ARGS = {
    "version": "flux",
    "pipe": pipe_flux,
    "config": config,
    "resize_ratio": 1,
    "train_unet": True,
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
einops, torch, torchvision — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type FeatureStore — a FeatureStore output has no array shape of its own; none is stated — the instrument coerces any output to an array; for a FeatureStore 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
ddim_inversion Not yet run
unverified (harvested, no recorded run)
darkbblue/generic-diffusion-feature/feature/components/ddim_inversion.py
code served (permissive licence) · get_code("3272a3d0f35a2425")
How it ran

no invocation recorded.

register_attention_store Not yet run
unverified (harvested, no recorded run)
darkbblue/generic-diffusion-feature/feature/components/attention.py
code served (permissive licence) · get_code("d8997dc59575ad16")
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, 0 are also present in other papers whose code we hold (0 with at least one paper dated earlier, 0 the same month, 0 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.

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

Diffusion models are initially designed for image generation. Recent research shows that the internal signals within their backbones, named activations, can also serve as dense features for various discriminative tasks such as semantic segmentation. Given numerous activations, selecting a small yet effective subset poses a fundamental problem. To this end, the early study of this field performs a large-scale quantitative comparison of the discriminative ability of the activations. However, we find that many potential activations have not been evaluated, such as the queries and keys used to compute attention scores. Moreover, recent advancements in diffusion architectures bring many new activations, such as those within embedded ViT modules. Both combined, activation selection remains unresolved but overlooked. To tackle this issue, this paper takes a further step with a much broader range of activations evaluated. Considering the significant increase in activations, a full-scale quantitative comparison is no longer operational. Instead, we seek to understand the properties of these activations, such that the activations that are clearly inferior can be filtered out in advance via simple qualitative evaluation. After careful analysis, we discover three properties universal among diffusion models, enabling this study to go beyond specific models. On top of this, we present effective feature selection solutions for several popular diffusion models. Finally, the experiments across multiple discriminative tasks validate the superiority of our method over the SOTA competitors. Our code is available at https://github.com/Darkbblue/generic-diffusion-feature.

For agents

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

get_harvested_code_for_paper("2410.03558")
get_code_for_paper("2410.03558")
have("2410.03558")

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

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

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

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

Connect an agent — have() is free.