SYNTOLOGY HomeExplorerAtlasCodeMethodologyAboutDevelopersFeedPricing
Paper · 2405.01434 · 2024

StoryDiffusion: Consistent Self-Attention for Long-Range Image and Video Generation

arXiv · PDF · Open in the Atlas

Code that ran

7 of 7 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; 7 failures of our instrument; 0 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/2405.01434.json · badge: /api/ran/2405.01434.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
hvision-nku/storydiffusion canonical (classifier label)
classifier basis not recorded on the link
7 ran · 0 no recorded run
FunctionStatusWhere it lives
add_caption Ran
ran; the contract check could not run (RAISES, DEP_MISSING or TIMEOUT)
hvision-nku/storydiffusion/utils/utils.py
code served (permissive licence) · get_code("293847aedbd19e46")
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.

import torch
from PIL import Image, ImageDraw, ImageFont
import numpy as np

# Create a small test image (100x100 pixels, RGB mode)
test_image = Image.new('RGB', (100, 100), color='white')

# Create a simple font - using default font
try:
    font = ImageFont.load_default()
except Exception:
    font = None

# Define the ARGS dictionary with all parameters for add_caption
ARGS = {
    'image': test_image,
    'text': 'This is a test caption with multiple words',
    'position': 'bottom-mid',
    'font': font,
    'text_color': 'black',
    'bg_color': (255, 255, 255),
    'bg_opacity': 200
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
PIL, numpy, torch — 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
add_white_border Ran
ran; our contract draft was wrong, not the code
hvision-nku/storydiffusion/utils/utils.py
code served (permissive licence) · get_code("fbe121fea006a44e")
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
img_array = np.random.randint(0, 256, (50, 60, 3), dtype=np.uint8)
test_image = Image.fromarray(img_array, mode='RGB')

ARGS = {
    'input_image': test_image,
    'border_width': 10
}
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
cal_attn_indice_xl_effcient_memory Ran
ran; our contract draft was wrong, not the code
hvision-nku/storydiffusion/utils/gradio_utils.py
code served (permissive licence) · get_code("b109efdd314c37ba")
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. 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

torch.manual_seed(0)

ARGS = {
    "total_length": 2,
    "id_length": 1,
    "sa32": 0.5,
    "sa64": 0.3,
    "height": 64,
    "width": 32,
    "device": "cpu",
    "dtype": torch.float16,
}
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
cal_attn_mask Ran
ran; our contract draft was wrong, not the code
hvision-nku/storydiffusion/utils/gradio_utils.py
code served (permissive licence) · get_code("2bf55a5e0aed32ff")
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. 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

torch.manual_seed(0)

ARGS = {
    'total_length': 2,
    'id_length': 1,
    'sa16': 0.5,
    'sa32': 0.5,
    'sa64': 0.5,
    'device': 'cpu',
    'dtype': torch.float16
}
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
cal_attn_mask_xl Ran
ran; our contract draft was wrong, not the code
hvision-nku/storydiffusion/utils/gradio_utils.py
code served (permissive licence) · get_code("1c16defbfcfd003b")
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. 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

torch.manual_seed(0)

# Analyze the function:
# - total_length: int, used in loops and arithmetic
# - id_length: int, used in arithmetic
# - sa32: float, used in comparison with torch.rand
# - sa64: float, used in comparison with torch.rand
# - height: int, used in division (height // 32, height // 16)
# - width: int, used in division (width // 32, width // 16)
# - device: str, passed to torch functions
# - dtype: torch dtype, passed to torch.rand

# Choose reasonable dimensions that satisfy the arithmetic:
# height and width should be divisible by 32 and 16
height = 64
width = 96

# total_length and id_length for reasonable matrix sizes
total_length = 4
id_length = 2

# Attention probabilities (between 0 and 1)
sa32 = 0.5
sa64 = 0.3

ARGS = {
    'total_length': total_length,
    'id_length': id_length,
    'sa32': sa32,
    'sa64': sa64,
    'height': height,
    'width': width,
    'device': 'cpu',
    'dtype': torch.float32
}
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
get_image_path_list Ran
ran; our contract draft was wrong, not the code
hvision-nku/storydiffusion/gradio_app_sdxl_specific_id_low_vram.py
code served (permissive licence) · get_code("4397f62f7d8c4e57")
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 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 os
import tempfile

# Create a temporary directory with some test image files
temp_dir = tempfile.mkdtemp()

# Create some dummy image files
test_image_names = ["image1.jpg", "image2.png", "image3.jpg"]
for image_name in test_image_names:
    image_path = os.path.join(temp_dir, image_name)
    with open(image_path, 'w') as f:
        f.write("dummy image content")

ARGS = {
    "folder_name": temp_dir
}
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 list, ndim 1, dtype family float — 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
process_mulline_text Ran
ran; our contract draft was wrong, not the code
hvision-nku/storydiffusion/utils/utils.py
code served (permissive licence) · get_code("ac2390fc5e5bbe10")
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 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.

from PIL import Image, ImageDraw, ImageFont

# Create a simple image and drawing context
image = Image.new('RGB', (800, 600), color='white')
draw = ImageDraw.Draw(image)

# Use default font (available on all systems)
try:
    font = ImageFont.load_default()
except:
    font = ImageFont.load_default()

# Sample text with multiple words
text = "The quick brown fox jumps over the lazy dog and continues with more words"

# Maximum width for wrapping (in pixels)
max_width = 200

ARGS = {
    'draw': draw,
    'text': text,
    'font': font,
    'max_width': max_width
}
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 list, ndim 1, dtype family float — 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

Also present in other papers' code

Of 7 samples lifted from this paper's linked repositories, 7 carry a function identity and 0 do not. Of the 7 distinct functions with an identity, 7 are also present in other papers whose code we hold (0 with at least one paper dated earlier, 0 the same month, 7 later) and 0 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
add_caption 1 other paper
1 later
2510.14553 (2025-10)
Consistent text-to-image generation via scene de-contextualization
add_white_border 1 other paper
1 later
2510.14553 (2025-10)
Consistent text-to-image generation via scene de-contextualization
cal_attn_indice_xl_effcient_memory 1 other paper
1 later
2510.14553 (2025-10)
Consistent text-to-image generation via scene de-contextualization
cal_attn_mask 1 other paper
1 later
2510.14553 (2025-10)
Consistent text-to-image generation via scene de-contextualization
cal_attn_mask_xl 1 other paper
1 later
2510.14553 (2025-10)
Consistent text-to-image generation via scene de-contextualization
get_image_path_list 1 other paper
1 later
2510.14553 (2025-10)
Consistent text-to-image generation via scene de-contextualization
process_mulline_text 1 other paper
1 later
2510.14553 (2025-10)
Consistent text-to-image generation via scene de-contextualization

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

For recent diffusion-based generative models, maintaining consistent content across a series of generated images, especially those containing subjects and complex details, presents a significant challenge. In this paper, we propose a new way of self-attention calculation, termed Consistent Self-Attention, that significantly boosts the consistency between the generated images and augments prevalent pretrained diffusion-based text-to-image models in a zero-shot manner. To extend our method to long-range video generation, we further introduce a novel semantic space temporal motion prediction module, named Semantic Motion Predictor. It is trained to estimate the motion conditions between two provided images in the semantic spaces. This module converts the generated sequence of images into videos with smooth transitions and consistent subjects that are significantly more stable than the modules based on latent spaces only, especially in the context of long video generation. By merging these two novel components, our framework, referred to as StoryDiffusion, can describe a text-based story with consistent images or videos encompassing a rich variety of contents. The proposed StoryDiffusion encompasses pioneering explorations in visual story generation with the presentation of images and videos, which we hope could inspire more research from the aspect of architectural modifications. Our code is made publicly available at https://github.com/HVision-NKU/StoryDiffusion.

For agents

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

get_harvested_code_for_paper("2405.01434")
get_code_for_paper("2405.01434")
have("2405.01434")

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

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

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

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

Connect an agent — have() is free.