SYNTOLOGY HomeExplorerAtlasCodeMethodologyAboutDevelopersFeedPricing
Paper · 2403.05135 · 2024

ELLA: Equip Diffusion Models with LLM for Enhanced Semantic Alignment

arXiv · PDF · Open in the Atlas

Code that ran

5 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; 2 honoured the contract we drafted, 0 violated it and 0 have no contract verdict; 3 failures of our instrument; 0 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/2403.05135.json · badge: /api/ran/2403.05135.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
tencentqqgylab/ella canonical (classifier label)
classifier basis: classifier_2025
5 ran · 0 no recorded run
FunctionStatusWhere it lives
compute_dpg_one_sample Ran
ran; our contract draft was wrong, not the code
tencentqqgylab/ella/dpg_bench/compute_dpg_bench.py
code served (permissive licence) · get_code("d7c600805e21bbc6")
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 tempfile
import os
from PIL import Image
import io

# Create a temporary directory for test files
temp_dir = tempfile.mkdtemp()

# Create a small test image (4x8 pixels, 2 crops horizontally and vertically)
test_image = Image.new('RGB', (8, 8), color=(255, 0, 0))
image_path = os.path.join(temp_dir, 'test_image.png')
test_image.save(image_path)

# Create a temporary file for results
res_path = os.path.join(temp_dir, 'results.txt')

# Create args object
class Args:
    def __init__(self):
        self.pic_num = 2  # Use 2 crops instead of 4
        self.res_path = res_path

args = Args()

# Create question_dict with the required structure
question_dict = {
    'test_image': {
        'qid2tuple': {1: (0, 0, 4, 4), 2: (4, 0, 8, 4)},
        'qid2question': {
            1: 'Is there a red object?',
            2: 'Is the object round?'
        },
        'qid2dependency': {
            1: [0],
            2: [1]
        }
    }
}

# Create a mock VQA model
class MockVQAModel:
    def vqa(self, image, question):
        # Return 'yes' or 'no' deterministically based on question
        if 'red' in question.lower():
            return 'yes'
        else:
            return 'no'

vqa_model = MockVQAModel()

resolution = 4

ARGS = {
    'args': args,
    'question_dict': question_dict,
    'image_path': image_path,
    'vqa_model': vqa_model,
    'resolution': resolution
}
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 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
crop_image Ran
ran; our contract draft was wrong, not the code
tencentqqgylab/ella/dpg_bench/compute_dpg_bench.py
code served (permissive licence) · get_code("10dc0d8ce3bf1721")
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 PIL Image for testing
# Create a 10x10 RGB image with some pixel data
image_array = np.random.randint(0, 256, (10, 10, 3), dtype=np.uint8)
input_image = Image.fromarray(image_array, mode='RGB')

# Define crop_tuple as (left, top, right, bottom)
# This will crop a 5x5 region from the image
crop_tuple = (1, 2, 6, 7)

ARGS = {
    'input_image': input_image,
    'crop_tuple': crop_tuple
}
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
generate_image_with_fixed_max_length Ran
ran, honoured the contract we drafted
tencentqqgylab/ella/inference.py
code served (permissive licence) · get_code("90e281d5839c51db")
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 4, dtype family float, shape (1, 3, 64, 64) 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)

# Mock T5 encoder that returns embeddings
class MockT5Encoder(nn.Module):
    def __init__(self):
        super().__init__()
        self.device_attr = 'cpu'
        self.dtype_attr = torch.float32
    
    def __call__(self, prompts, max_length=128):
        # Return embeddings of shape (batch_size, seq_len, hidden_dim)
        batch_size = len(prompts) if isinstance(prompts, list) else 1
        return torch.randn(batch_size, max_length, 4)

# Mock diffusion pipeline
class MockPipe(nn.Module):
    def __init__(self):
        super().__init__()
        self.device = 'cpu'
        self.dtype = torch.float32
    
    def __call__(self, prompt_embeds, negative_prompt_embeds, output_type='pt', **kwargs):
        # Return a mock output with images attribute
        batch_size = prompt_embeds.shape[0]
        mock_images = torch.randn(batch_size, 3, 64, 64)
        
        class Output:
            def __init__(self, images):
                self.images = images
        
        return Output(mock_images)

# Create instances
t5_encoder = MockT5Encoder()
pipe = MockPipe()

# Define arguments
ARGS = {
    'pipe': pipe,
    't5_encoder': t5_encoder,
    'prompt': 'a beautiful landscape',
    'output_type': 'pt',
}
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 4, dtype family float, shape (1, 3, 64, 64) — shape (1, 3, 64, 64) 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
generate_image_with_flexible_max_length Ran
ran, honoured the contract we drafted
tencentqqgylab/ella/inference.py
code served (permissive licence) · get_code("c9b4fcb3221db452")
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 4, dtype family float, shape (1, 3, 64, 64) 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 minimal UNet module
class MinimalUNet(nn.Module):
    def __init__(self):
        super().__init__()
        self.conv = nn.Conv2d(4, 4, 3, padding=1)
        self.flexible_max_length_workaround = None
    
    def forward(self, x):
        return self.conv(x)

# Create a minimal diffusion pipeline
class MinimalPipeline(nn.Module):
    def __init__(self):
        super().__init__()
        self.unet = MinimalUNet()
        self.device = torch.device('cpu')
        self.dtype = torch.float32
    
    def __call__(self, prompt_embeds, negative_prompt_embeds, output_type='pt', **kwargs):
        # Minimal pipeline that just returns dummy images
        batch_size = prompt_embeds.shape[0]
        # Return a simple output object with images attribute
        class DummyOutput:
            def __init__(self, images):
                self.images = images
        
        # Create dummy images tensor (batch_size, 3, 64, 64)
        dummy_images = torch.randn(batch_size, 3, 64, 64, dtype=self.dtype, device=self.device)
        return DummyOutput(dummy_images)

# Create a minimal T5 encoder
class MinimalT5Encoder(nn.Module):
    def __init__(self):
        super().__init__()
        self.embedding_dim = 8  # Small embedding dimension
    
    def __call__(self, prompts, max_length=None):
        # Return embeddings of shape (batch_size, seq_length, embedding_dim)
        batch_size = len(prompts) if isinstance(prompts, list) else 1
        if max_length is None:
            # Variable length based on prompt (simulate)
            seq_length = 16 + batch_size  # Make it variable
        else:
            seq_length = max_length
        
        embeddings = torch.randn(batch_size, seq_length, self.embedding_dim, dtype=torch.float32)
        return embeddings

# Instantiate the components
pipe = MinimalPipeline()
t5_encoder = MinimalT5Encoder()
prompt = "a cat sitting on a table"

ARGS = {
    'pipe': pipe,
    't5_encoder': t5_encoder,
    'prompt': prompt,
    'fixed_negative': False,
    'output_type': 'pt'
}
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 4, dtype family float, shape (1, 3, 64, 64) — shape (1, 3, 64, 64) 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
prepare_dpg_data Ran
ran; our contract draft was wrong, not the code
tencentqqgylab/ella/dpg_bench/compute_dpg_bench.py
code served (permissive licence) · get_code("6e653207d66d539a")
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. 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 pandas as pd
import tempfile
import os

# Create a temporary CSV file with the expected structure
csv_content = """item_id,proposition_id,dependency,tuple,question_natural_language
item_1,1,"0, 1",tuple_1_1,Category A (subcategory)
item_1,2,"1",tuple_1_2,Category A (subcategory)
item_2,3,"0",tuple_2_1,Category B (subcategory)
item_2,4,"2, 3",tuple_2_2,Category B (subcategory)
item_3,5,"0",tuple_3_1,Category C (subcategory)
"""

# Write CSV to a temporary file
temp_dir = tempfile.gettempdir()
csv_path = os.path.join(temp_dir, "test_dpg_data.csv")
with open(csv_path, 'w') as f:
    f.write(csv_content)

# Create a simple args object with the csv attribute
class Args:
    def __init__(self, csv_path):
        self.csv = csv_path

args_obj = Args(csv_path)

ARGS = {
    'args': args_obj
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
pandas — 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

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-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 demonstrated remarkable performance in the domain of text-to-image generation. However, most widely used models still employ CLIP as their text encoder, which constrains their ability to comprehend dense prompts, encompassing multiple objects, detailed attributes, complex relationships, long-text alignment, etc. In this paper, we introduce an Efficient Large Language Model Adapter, termed ELLA, which equips text-to-image diffusion models with powerful Large Language Models (LLM) to enhance text alignment without training of either U-Net or LLM. To seamlessly bridge two pre-trained models, we investigate a range of semantic alignment connector designs and propose a novel module, the Timestep-Aware Semantic Connector (TSC), which dynamically extracts timestep-dependent conditions from LLM. Our approach adapts semantic features at different stages of the denoising process, assisting diffusion models in interpreting lengthy and intricate prompts over sampling timesteps. Additionally, ELLA can be readily incorporated with community models and tools to improve their prompt-following capabilities. To assess text-to-image models in dense prompt following, we introduce Dense Prompt Graph Benchmark (DPG-Bench), a challenging benchmark consisting of 1K dense prompts. Extensive experiments demonstrate the superiority of ELLA in dense prompt following compared to state-of-the-art methods, particularly in multiple object compositions involving diverse attributes and relationships.

For agents

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

get_harvested_code_for_paper("2403.05135")
get_code_for_paper("2403.05135")
have("2403.05135")

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

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

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

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

Connect an agent — have() is free.