SYNTOLOGY HomeExplorerAtlasCodeMethodologyAboutDevelopersFeedPricing
Paper · 2412.05276 · ICLR · 2025

Sparse autoencoders reveal selective remapping of visual concepts during adaptation

Jaegul Choo, Steffen Schneider, Hyesu Lim, Jinho Choi

arXiv · PDF · Open in the Atlas

Code that ran

5 of 6 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 0 have no contract verdict; 5 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/2412.05276.json · badge: /api/ran/2412.05276.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
dynamical-inference/patchsae canonical (classifier label)
classifier basis: census
5 ran · 1 no recorded run
FunctionStatusWhere it lives
calculate_entropy Ran
ran; our contract draft was wrong, not the code
dynamical-inference/patchsae/analysis/utils.py
code served (permissive licence) · get_code("c0113839c1642005")
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 1, dtype family float, shape (2,) 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

torch.manual_seed(0)

# Construct arguments for calculate_entropy
# The function expects:
# - top_val: tensor of shape (dict_size, seq_len) with probability-like values
# - top_label: tensor of shape (dict_size, seq_len) with label indices
# - ignore_label_idx: optional int to ignore certain labels
# - eps: small float for numerical stability

dict_size = 2
seq_len = 4

# top_val: probability/confidence scores for each position
top_val = torch.rand(dict_size, seq_len)

# top_label: label indices at each position
# Use labels 0, 1, 2 with some repetition to ensure counts > 10 in some cases
top_label = torch.tensor([
    [0, 0, 1, 1],
    [2, 2, 2, 1]
], dtype=torch.long)

# ignore_label_idx: optional label to ignore during entropy calculation
ignore_label_idx = None

# eps: small value for numerical stability
eps = 1e-09

ARGS = {
    "top_val": top_val,
    "top_label": top_label,
    "ignore_label_idx": ignore_label_idx,
    "eps": eps
}
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 Tensor, ndim 1, dtype family float, shape (2,) — shape (2,) 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
get_predictions Ran
ran; the contract check could not run (RAISES, DEP_MISSING or TIMEOUT)
dynamical-inference/patchsae/tasks/classification_with_top_k_masking.py
code served (permissive licence) · get_code("8b00d270f0a5a818")
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 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 torch.nn as nn

torch.manual_seed(0)

# Create a minimal ViT-like model that satisfies the function's usage
class MinimalViT(nn.Module):
    def __init__(self, vit_type='base'):
        super().__init__()
        self.vit_type = vit_type
        self.model = nn.Module()
        self.model.logit_scale = nn.Parameter(torch.tensor(1.0))
        
    def __call__(self, return_type=None, **inputs):
        # Return image_embeds attribute when vit_type is 'base'
        batch_size = inputs['input_ids'].shape[0] if 'input_ids' in inputs else 2
        output = nn.Module()
        output.image_embeds = torch.randn(batch_size, 4)
        return output
    
    def run_with_hooks(self, hooks, return_type=None, **inputs):
        # Called when hooks are provided
        batch_size = inputs['input_ids'].shape[0] if 'input_ids' in inputs else 2
        output = nn.Module()
        output.image_embeds = torch.randn(batch_size, 4)
        return output

# Create instances for the function arguments
vit_base = MinimalViT(vit_type='base')

# Create inputs dict with required keys
inputs = {
    'input_ids': torch.randint(0, 100, (2, 8))
}

# Create text_features tensor (num_classes, embedding_dim)
text_features = torch.randn(3, 4)  # 3 classes, 4-dim embeddings

vit_type = 'base'

hooks = None  # Can be None or a list of hooks

ARGS = {
    'vit': vit_base,
    'inputs': inputs,
    'text_features': text_features,
    'vit_type': vit_type,
    'hooks': hooks
}
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 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
get_scheduler Ran
ran; our contract draft was wrong, not the code
dynamical-inference/patchsae/src/sae_training/utils.py
code served (permissive licence) · get_code("4a7cb61e02537776")
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 LambdaLR. 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 torch.nn as nn
import torch.optim as optim
import torch.optim.lr_scheduler as lr_scheduler

torch.manual_seed(0)

# Create a simple model
model = nn.Linear(4, 3)

# Create an optimizer
optimizer = optim.SGD(model.parameters(), lr=0.1)

# Test with different scheduler names
ARGS = {
    'scheduler_name': 'linearwarmupdecay',
    'optimizer': optimizer,
    'warm_up_steps': 500,
    'training_steps': 10000,
    'lr_end': 0.0,
    'num_cycles': 1,
}
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 LambdaLR — a LambdaLR output has no array shape of its own; none is stated — the instrument coerces any output to an array; for a LambdaLR 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_checkpoint Ran
ran; our contract draft was wrong, not the code
dynamical-inference/patchsae/src/models/utils.py
code served (permissive licence) · get_code("b251e3420ace47d7")
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. 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 os
import pickle
import tempfile
import torch

torch.manual_seed(0)

# Create a temporary checkpoint file
temp_dir = tempfile.mkdtemp()
checkpoint_path = os.path.join(temp_dir, 'test_checkpoint.pth')

# Create a simple checkpoint dict with a tiny tensor
checkpoint_data = {
    'model_state': torch.randn(2, 4),
    'epoch': 1,
    'loss': 0.5
}

# Save the checkpoint
torch.save(checkpoint_data, checkpoint_path)

ARGS = {
    'fpath': checkpoint_path
}
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_state_dict_without_prompt_learner Ran
ran; our contract draft was wrong, not the code
dynamical-inference/patchsae/src/models/utils.py
code served (permissive licence) · get_code("effece23664132b2")
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. 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 os
import pickle
import tempfile
import torch

torch.manual_seed(0)

# Create a temporary checkpoint file with the expected structure
temp_dir = tempfile.mkdtemp()
checkpoint_path = os.path.join(temp_dir, 'checkpoint.pth')

# Create a checkpoint with state_dict containing prompt_learner tokens
checkpoint_data = {
    'state_dict': {
        'prompt_learner.token_prefix': torch.randn(2, 4),
        'prompt_learner.token_suffix': torch.randn(3, 4),
        'model.layer1.weight': torch.randn(4, 4),
        'model.layer1.bias': torch.randn(4),
    }
}

# Save the checkpoint
torch.save(checkpoint_data, checkpoint_path)

ARGS = {
    'ckpt_path': checkpoint_path,
}
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_stats Not yet run
unverified (harvested, no recorded run)
dynamical-inference/patchsae/analysis/utils.py
code served (permissive licence) · get_code("daa2ff5af7df15ac")
How it ran

no invocation recorded.

Also present in other papers' code

Of 6 samples lifted from this paper's linked repositories, 6 carry a function identity and 0 do not. Of the 6 distinct functions with an identity, 3 are also present in other papers whose code we hold (0 with at least one paper dated earlier, 0 the same month, 3 later) and 3 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
get_scheduler 2 other papers
2 later
2510.26186 (2025-10)
ConceptScope: Characterizing Dataset Bias via Disentangled Visual Concepts
2604.14925 (2026-04)
Improving Sparse Autoencoder with Dynamic Attention
calculate_entropy 1 other paper
1 later
2604.14925 (2026-04)
Improving Sparse Autoencoder with Dynamic Attention
load_stats 1 other paper
1 later
2604.14925 (2026-04)
Improving Sparse Autoencoder with Dynamic Attention

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

Adapting foundation models for specific purposes has become a standard approach to build machine learning systems for downstream applications. Yet, it is an open question which mechanisms take place during adaptation. Here we develop a new Sparse Autoencoder (SAE) for the CLIP vision transformer, named PatchSAE, to extract interpretable concepts at granular levels (e.g., shape, color, or semantics of an object) and their patch-wise spatial attributions. We explore how these concepts influence the model output in downstream image classification tasks and investigate how recent state-of-the-art prompt-based adaptation techniques change the association of model inputs to these concepts. While activations of concepts slightly change between adapted and non-adapted models, we find that the majority of gains on common adaptation tasks can be explained with the existing concepts already present in the non-adapted foundation model. This work provides a concrete framework to train and use SAEs for Vision Transformers and provides insights into explaining adaptation mechanisms.

For agents

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

get_harvested_code_for_paper("2412.05276")
get_code_for_paper("2412.05276")
have("2412.05276")

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

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

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

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

Connect an agent — have() is free.