SYNTOLOGY HomeExplorerAtlasCodeMethodologyAboutDevelopersFeedPricing
Paper · Ma_DeepCache_Accelerating_Diffusion_Models_for_Free_CVPR_2024_paper · CVPR · 2024

DeepCache: Accelerating Diffusion Models for Free

Xinchao Wang, Xinyin Ma, Gongfan Fang

Open in the Atlas

Code that ran

6 of 9 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 5 have no contract verdict; 1 failure of our instrument; 3 no recorded run), measured 2026-11-23; 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/Ma_DeepCache_Accelerating_Diffusion_Models_for_Free_CVPR_2024_paper.json · badge: /api/ran/Ma_DeepCache_Accelerating_Diffusion_Models_for_Free_CVPR_2024_paper.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
horseee/DeepCache canonical (classifier label)
classifier basis: census
6 ran · 3 no recorded run
FunctionStatusWhere it lives
get_class_obj_and_candidates Ran
ran on a synthesized input
horseee/DeepCache/DeepCache/sd/pipeline_utils.py
code served (permissive licence) · get_code("24f2eefe420578b3")
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 1, 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 importlib
import sys
from types import ModuleType

torch = __import__('torch')

# Create mock pipeline module with a test class
class MockPipelineClass:
    pass

mock_pipelines = ModuleType('pipelines')
mock_pipeline_module = ModuleType('pipeline_module')
mock_pipeline_module.TestPipelineClass = MockPipelineClass
mock_pipelines.test_library = mock_pipeline_module
sys.modules['pipelines'] = mock_pipelines

# Create mock library module for non-pipeline case
class UNet2DConditionModel:
    pass

class ClassA:
    pass

class ClassB:
    pass

mock_library = ModuleType('test_library')
mock_library.UNet2DConditionModel = UNet2DConditionModel
mock_library.ClassA = ClassA
mock_library.ClassB = ClassB
sys.modules['test_library'] = mock_library

mock_deepcache = ModuleType('DeepCache')
mock_sd = ModuleType('sd')
mock_unet = ModuleType('unet_2d_condition')
mock_unet.UNet2DConditionModel = UNet2DConditionModel
mock_sd.unet_2d_condition = mock_unet
mock_deepcache.sd = mock_sd
sys.modules['DeepCache'] = mock_deepcache
sys.modules['DeepCache.sd'] = mock_sd
sys.modules['DeepCache.sd.unet_2d_condition'] = mock_unet

# Test case 1: is_pipeline_module = True
ARGS = {
    'library_name': 'test_library',
    'class_name': 'TestPipelineClass',
    'importable_classes': {
        'class_a': ClassA,
        'class_b': ClassB,
    },
    'pipelines': mock_pipelines,
    'is_pipeline_module': True,
}
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 tuple, ndim 1, 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
rescale_noise_cfg Ran
ran; our contract draft was wrong, not the code
horseee/DeepCache/DeepCache/sdxl/pipeline_stable_diffusion_xl.py
code served (permissive licence) · get_code("bea2d776a332f2b0")
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 Tensor, ndim 4, dtype family float, shape (2, 4, 3, 3) 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)

# Create small tensors with distinct dimensions
# noise_cfg: shape (batch=2, channels=4, height=3, width=3)
noise_cfg = torch.randn(2, 4, 3, 3)

# noise_pred_text: shape (batch=2, channels=4, height=3, width=3)
noise_pred_text = torch.randn(2, 4, 3, 3)

# guidance_rescale: float between 0 and 1
guidance_rescale = 0.7

ARGS = {
    "noise_cfg": noise_cfg,
    "noise_pred_text": noise_pred_text,
    "guidance_rescale": guidance_rescale,
}
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 Tensor, ndim 4, dtype family float, shape (2, 4, 3, 3) — shape (2, 4, 3, 3) 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
rnn_flops Ran
ran on a synthesized input
horseee/DeepCache/DeepCache/flops.py
code served (permissive licence) · get_code("4883be8641ea59fd")
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 int, ndim 0, dtype family int, 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 torch.nn as nn

torch.manual_seed(0)

# Create a small LSTM module
rnn_module = nn.LSTM(input_size=4, hidden_size=3, num_layers=1)

# Extract weight matrices from the LSTM
# For LSTM, w_ih is the input-to-hidden weight and w_hh is the hidden-to-hidden weight
w_ih = rnn_module.weight_ih_l0  # Shape: (hidden_size * 4, input_size) = (12, 4)
w_hh = rnn_module.weight_hh_l0  # Shape: (hidden_size * 4, hidden_size) = (12, 3)

# Initial flops counter
flops = 0

# Input size parameter
input_size = 4

ARGS = {
    "flops": flops,
    "rnn_module": rnn_module,
    "w_ih": w_ih,
    "w_hh": w_hh,
    "input_size": input_size,
}
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 int, ndim 0, dtype family int, 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
sample_from_quad Ran
ran on a synthesized input
horseee/DeepCache/DeepCache/sd/pipeline_stable_diffusion.py
code served (permissive licence) · get_code("3689e3b02143a8d4")
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 numpy as np

ARGS = {
    'total_numbers': 1000,
    'n_samples': 50,
    'pow': 1.2
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
numpy — 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
sample_from_quad_center Ran
ran on a synthesized input
horseee/DeepCache/DeepCache/sd/pipeline_stable_diffusion.py
code served (permissive licence) · get_code("ee9aed6bdbf16a1f")
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 numpy as np

# Analyze the function:
# - total_numbers: int, used in arithmetic operations
# - n_samples: int, used to check length of indices list
# - center: numeric value, used in arithmetic operations
# - pow: float with default 1.2, used in while loop and arithmetic

ARGS = {
    "total_numbers": 100,
    "n_samples": 10,
    "center": 20,
    "pow": 1.2
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
numpy — 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
sample_gaussian_centered Ran
ran on a synthesized input
horseee/DeepCache/DeepCache/sd/pipeline_stable_diffusion.py
code served (permissive licence) · get_code("2469d3c031e61a02")
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 numpy as np

ARGS = {
    "n": 1000,
    "sample_size": 100,
    "std_dev": 100
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
numpy — 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
accumulate_flops Not yet run
unverified (harvested, no recorded run)
horseee/DeepCache/DeepCache/flops.py
code served (permissive licence) · get_code("c700427667c7da3b")
How it ran

no invocation recorded.

count_ops_and_params Not yet run
unverified (harvested, no recorded run)
horseee/DeepCache/DeepCache/flops.py
code served (permissive licence) · get_code("62f8d4634af9a38d")
How it ran

no invocation recorded.

sample_from_quad_center Not yet run
unverified (harvested, no recorded run)
horseee/DeepCache/DeepCache/sdxl/pipeline_stable_diffusion_xl.py
code served (permissive licence) · get_code("28636b8d477cbe0f")
How it ran

no invocation recorded.

Also present in other papers' code

Of 9 samples lifted from this paper's linked repositories, 9 carry a function identity and 0 do not. Of the 8 distinct functions with an identity, 2 are also present in other papers whose code we hold (2 with at least one paper dated earlier, 0 the same month, 1 later) and 6 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
rescale_noise_cfg 62 other papers
11 dated earlier, 10 later, 41 same year, order not determinable
2206.02779 (2022-06)
Blended Latent Diffusion
2304.06720 (2023-04)
Expressive Text-to-Image Generation with Rich Text
2309.06380 (2023-09)
InstaFlow: One Step is Enough for High-Quality Diffusion-Based Text-to-Image Generation
and 59 more not named here
rnn_flops 1 other paper
1 dated earlier
2210.05144 (2022-10)
Mixture of Attention Heads: Selecting Attention Heads Per Token

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 models have recently gained unprecedented attention in the field of image synthesis due to their remarkable generative capabilities. Notwithstanding their prowess, these models often incur substantial computational costs, primarily attributed to the sequential denoising process and cumbersome model size. Traditional methods for compressing diffusion models typically involve extensive retraining, presenting cost and feasibility challenges. In this paper, we introduce DeepCache, a novel training-free paradigm that accelerates diffusion models from the perspective of model architecture. DeepCache capitalizes on the inherent temporal redundancy observed in the sequential denoising steps of diffusion models, which caches and retrieves features across adjacent denoising stages, thereby curtailing redundant computations. Utilizing the property of the U-Net, we reuse the high-level features while up-dating the low-level features in a very cheap way. This innovative strategy, in turn, enables a speedup factor of 2.3× for Stable Diffusion v1.5 with only a 0.05 decline in CLIP Score, and 4.1× for LDM-4-G with a slight decrease of 0.22 in FID on ImageNet. Our experiments also demonstrate DeepCache's superiority over existing pruning and distillation methods that necessitate retraining and its compatibility with current sampling techniques. Furthermore, we find that under the same throughput, Deep-Cache effectively achieves comparable or even marginally improved results with DDIM or PLMS. Code is available at https://github.com/horseee/DeepCache.

For agents

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

get_harvested_code_for_paper("Ma_DeepCache_Accelerating_Diffusion_Models_for_Free_CVPR_2024_paper")
get_code_for_paper("Ma_DeepCache_Accelerating_Diffusion_Models_for_Free_CVPR_2024_paper")
have("Ma_DeepCache_Accelerating_Diffusion_Models_for_Free_CVPR_2024_paper")

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

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

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

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

Connect an agent — have() is free.