SYNTOLOGY HomeExplorerAtlasCodeMethodologyAboutDevelopersFeedPricing
Paper · 2412.16112 · 2024

CLEAR: Conv-Like Linearization Revs Pre-Trained Diffusion Transformers Up

arXiv · PDF · Open in the Atlas

Code that ran

10 of 13 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, 1 violated it and 5 have no contract verdict; 3 failures of our instrument; 3 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.16112.json · badge: /api/ran/2412.16112.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
huage001/clear canonical (classifier label)
classifier basis not recorded on the link
10 ran · 3 no recorded run
FunctionStatusWhere it lives
c_crop Ran
ran on a synthesized input
huage001/clear/dataset.py
code served (permissive licence) · get_code("667cd02575574903")
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.

from PIL import Image
import numpy as np

# Create a simple test image using PIL
# The function expects an image object with .size attribute and .crop() method
# Let's create a rectangular image (width=10, height=8) so we can test the center crop
img_array = np.random.randint(0, 256, (8, 10, 3), dtype=np.uint8)
image = Image.fromarray(img_array, mode='RGB')

ARGS = {
    'image': image
}
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
calculate_shift Ran
ran, violated the contract we drafted
huage001/clear/pipeline_flux_img2img.py
code served (permissive licence) · get_code("4e3ad3679e5c37b2")
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 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 torch
import numpy as np

torch.manual_seed(0)

# Analyzing the function:
# - image_seq_len: a numeric value (int or float) representing sequence length
# - base_seq_len: int, default 256
# - max_seq_len: int, default 4096
# - base_shift: float, default 0.5
# - max_shift: float, default 1.16
# The function performs linear interpolation calculations on these numeric values

ARGS = {
    "image_seq_len": 512,
    "base_seq_len": 256,
    "max_seq_len": 4096,
    "base_shift": 0.5,
    "max_shift": 1.16
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1
Imports
numpy, torch — 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
crop_to_aspect_ratio Ran
ran on a synthesized input
huage001/clear/dataset.py
code served (permissive licence) · get_code("66a1a388e37620ac")
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.

from PIL import Image
import numpy as np

# Create a small test image with PIL
# Using a size that's wider than 16:9 to test the width-cropping branch
img_array = np.random.randint(0, 256, (100, 200, 3), dtype=np.uint8)
image = Image.fromarray(img_array, mode='RGB')

ARGS = {
    'image': image,
    'ratio': '16:9'
}
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
encode_prompt Ran
ran on a synthesized input
huage001/clear/cache_prompt_embeds.py
code served (permissive licence) · get_code("67daa643d2f19a49")
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 torch
import torch.nn as nn

torch.manual_seed(0)

# Minimal tokenizer stand-in
class MinimalTokenizer:
    def __call__(self, prompts, padding='max_length', max_length=77, truncation=True, 
                 return_overflowing_tokens=False, return_length=False, return_tensors='pt'):
        batch_size = len(prompts) if isinstance(prompts, list) else 1
        input_ids = torch.randint(0, 1000, (batch_size, max_length), dtype=torch.long)
        
        class TokenizerOutput:
            def __init__(self, input_ids):
                self.input_ids = input_ids
        
        return TokenizerOutput(input_ids)

# Minimal CLIP text encoder
class MinimalCLIPEncoder(nn.Module):
    def __init__(self, hidden_dim=4):
        super().__init__()
        self.hidden_dim = hidden_dim
        self.dtype = torch.float32
        self.device_attr = torch.device('cpu')
    
    @property
    def device(self):
        return self.device_attr
    
    def forward(self, input_ids, output_hidden_states=False):
        batch_size = input_ids.shape[0]
        pooled_output = torch.randn(batch_size, self.hidden_dim, dtype=self.dtype)
        
        class EncoderOutput:
            def __init__(self, pooler_output):
                self.pooler_output = pooler_output
        
        return EncoderOutput(pooler_output=pooled_output)

# Minimal T5 text encoder
class MinimalT5Encoder(nn.Module):
    def __init__(self, hidden_dim=5, seq_len=512):
        super().__init__()
        self.hidden_dim = hidden_dim
        self.seq_len = seq_len
        self.dtype = torch.float32
        self.device_attr = torch.device('cpu')
    
    @property
    def device(self):
        return self.device_attr
    
    def forward(self, input_ids):
        batch_size = input_ids.shape[0]
        seq_len = input_ids.shape[1]
        embeddings = torch.randn(batch_size, seq_len, self.hidden_dim, dtype=self.dtype)
        return (embeddings,)

# Create instances
clip_encoder = MinimalCLIPEncoder(hidden_dim=4)
t5_encoder = MinimalT5Encoder(hidden_dim=5, seq_len=512)

clip_tokenizer = MinimalTokenizer()
t5_tokenizer = MinimalTokenizer()

prompt = "a cat sitting on a mat"
device = torch.device('cpu')
max_sequence_length = 512
num_images_per_prompt = 2

ARGS = {
    'text_encoders': [clip_encoder, t5_encoder],
    'tokenizers': [clip_tokenizer, t5_tokenizer],
    'prompt': prompt,
    'max_sequence_length': max_sequence_length,
    'device': device,
    'num_images_per_prompt': num_images_per_prompt,
    'text_input_ids_list': None,
}
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
image_resize Ran
ran on a synthesized input
huage001/clear/dataset.py
code served (permissive licence) · get_code("3a2a628bb69065bf")
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.

from PIL import Image

# Create a small test image (100x80 pixels, RGB mode)
img = Image.new('RGB', (100, 80), color='red')

ARGS = {
    'img': img,
    'max_size': 512
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
PIL — 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
import_model_class_from_model_name_or_path Ran
ran; the contract check could not run (RAISES, DEP_MISSING or TIMEOUT)
huage001/clear/distill.py
pointer only (licence: Apache-2.0); the stored copy get_code serves, from DragonisCV/EyeControl, is pointer only (licence: NONE) · get_code("212f670149d23d38")
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 DragonisCV/EyeControl, 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. A run is recorded.

parse_args Ran
ran on a synthesized input
huage001/clear/cache_latent_codes.py
code served (permissive licence) · get_code("509fc25c579c767d")
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 Namespace. 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 argparse
import os
import tempfile

# Set up temporary directories for the test
temp_dir = tempfile.mkdtemp()
output_dir = os.path.join(temp_dir, 'flux-lora')

# Create the ARGS dictionary with all required and optional parameters
ARGS = {
    'input_args': [
        '--pretrained_model_name_or_path', 'gpt2',
        '--revision', 'main',
        '--variant', 'fp16',
        '--data_root', temp_dir,
        '--cache_dir', os.path.join(temp_dir, 'cache'),
        '--resolution', '512',
        '--output_dir', output_dir,
        '--batch_size', '2',
        '--mixed_precision', 'fp16',
        '--local_rank', '0',
        '--num_workers', '2',
    ]
}
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 Namespace — a Namespace output has no array shape of its own; none is stated — the instrument coerces any output to an array; for a Namespace 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
retrieve_latents Ran
ran, honoured the contract we drafted
huage001/clear/pipeline_flux_img2img.py
pointer only (licence: Apache-2.0); the stored copy get_code serves, from JS-CHU/RoamScene3D, is pointer only (licence: NONE) · get_code("98bcd15cf273e3b4")
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 JS-CHU/RoamScene3D, 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. A run is recorded.

retrieve_timesteps Ran
ran; our contract draft was wrong, not the code
huage001/clear/pipeline_flux_img2img.py
pointer only (licence: Apache-2.0); the stored copy get_code serves, from krafton-ai/Rare-to-Frequent, is pointer only (licence: NONE) · get_code("0b56680ee1708fee")
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 krafton-ai/Rare-to-Frequent, 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. A run is recorded.

tokenize_prompt Ran
ran; the contract check could not run (RAISES, DEP_MISSING or TIMEOUT)
huage001/clear/cache_prompt_embeds.py
pointer only (licence: Apache-2.0); the stored copy get_code serves, from DragonisCV/EyeControl, is pointer only (licence: NONE) · get_code("eb4f8a321d97a458")
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 DragonisCV/EyeControl, 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. A run is recorded.

load_text_encoders Not yet run
unverified (harvested, no recorded run)
huage001/clear/distill.py
pointer only (licence: Apache-2.0); the stored copy get_code serves, from DragonisCV/EyeControl, is pointer only (licence: NONE) · get_code("28a7c6dea6157b37")
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 DragonisCV/EyeControl, 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.

log_validation Not yet run
unverified (harvested, no recorded run)
huage001/clear/distill.py
code served (permissive licence) · get_code("8affca81b78ce6f7")
How it ran

no invocation recorded.

parse_args Not yet run
unverified (harvested, no recorded run)
huage001/clear/cache_prompt_embeds.py
code served (permissive licence) · get_code("9e59d8e6626d076b")
How it ran

no invocation recorded.

Also present in other papers' code

Of 13 samples lifted from this paper's linked repositories, 13 carry a function identity and 0 do not. Of the 13 distinct functions with an identity, 6 are also present in other papers whose code we hold (3 with at least one paper dated earlier, 4 the same month, 6 later) and 7 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
retrieve_timesteps 46 other papers
11 dated earlier, 2 the same month, 31 later, 2 undated
2312.04461 (2023-12)
PhotoMaker: Customizing Realistic Human Photos via Stacked ID Embedding
2402.10491 (2024-02)
Make a Cheap Scaling: A Self-Cascade Diffusion Model for Higher-Resolution Adaptation
2405.18991 (2024-05)
EasyAnimate: High-Performance Video Generation Framework with Hybrid Windows Attention and Reward Backpropagation
and 43 more not named here
retrieve_latents 19 other papers
8 dated earlier, 2 the same month, 8 later, 1 undated
2401.07519 (2024-01)
InstantID: Zero-shot Identity-Preserving Generation in Seconds
2403.14773 (2024-03)
StreamingT2V: Consistent, Dynamic, and Extendable Long Video Generation from Text
2404.06666 (2024-04)
SafeGen: Mitigating Sexually Explicit Content Generation in Text-to-Image Models
and 16 more not named here
calculate_shift 15 other papers
4 dated earlier, 1 the same month, 10 later
2406.04312 (2024-06)
ReNO: Enhancing One-step Text-to-Image Models through Reward-based Noise Optimization
2410.22376 (2024-10)
Rare-to-Frequent: Unlocking Compositional Generation Power of Diffusion Models on Rare Concepts with LLM Guidance
2411.06558 (2024-11)
Region-Aware Text-to-Image Generation via Hard Binding and Soft Refinement
and 12 more not named here
import_model_class_from_model_name_or_path 4 other papers
1 the same month, 3 later
2412.20413 (2024-12)
EraseAnything: Enabling Concept Erasure in Rectified Flow Transformers
Huang_ArtEditor_Learning_Customized_Instructional_Image_Editor_from_Few-Shot_Examples_ICCV_2025_paper (2025 (year only))
ArtEditor: Learning Customized Instructional Image Editor from Few-Shot Examples
2507.05964 (2025-07)
T-LoRA: Single Image Diffusion Model Customization Without Overfitting
and 1 more not named here
tokenize_prompt 3 other papers
3 later
Huang_ArtEditor_Learning_Customized_Instructional_Image_Editor_from_Few-Shot_Examples_ICCV_2025_paper (2025 (year only))
ArtEditor: Learning Customized Instructional Image Editor from Few-Shot Examples
2507.05964 (2025-07)
T-LoRA: Single Image Diffusion Model Customization Without Overfitting
2609.01148 (2026-09)
Dotting the Eye: An Intent-Driven Image Retouching Agent for Visual Focus Enhancement
load_text_encoders 1 other paper
1 later
2609.01148 (2026-09)
Dotting the Eye: An Intent-Driven Image Retouching Agent for Visual Focus Enhancement

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

Diffusion Transformers (DiT) have become a leading architecture in image generation. However, the quadratic complexity of attention mechanisms, which are responsible for modeling token-wise relationships, results in significant latency when generating high-resolution images. To address this issue, we aim at a linear attention mechanism in this paper that reduces the complexity of pre-trained DiTs to linear. We begin our exploration with a comprehensive summary of existing efficient attention mechanisms and identify four key factors crucial for successful linearization of pre-trained DiTs: locality, formulation consistency, high-rank attention maps, and feature integrity. Based on these insights, we introduce a convolution-like local attention strategy termed CLEAR, which limits feature interactions to a local window around each query token, and thus achieves linear complexity. Our experiments indicate that, by fine-tuning the attention layer on merely 10K self-generated samples for 10K iterations, we can effectively transfer knowledge from a pre-trained DiT to a student model with linear complexity, yielding results comparable to the teacher model. Simultaneously, it reduces attention computations by 99.5% and accelerates generation by 6.3 times for generating 8K-resolution images. Furthermore, we investigate favorable properties in the distilled attention layers, such as zero-shot generalization cross various models and plugins, and improved support for multi-GPU parallel inference. Models and codes are available here: https://github.com/Huage001/CLEAR.

For agents

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

get_harvested_code_for_paper("2412.16112")
get_code_for_paper("2412.16112")
have("2412.16112")

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

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

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

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

Connect an agent — have() is free.