SYNTOLOGY HomeExplorerAtlasCodeMethodologyAboutDevelopersFeedPricing
Paper · 2410.11817 · 2024

Improving Long-Text Alignment for Text-to-Image Diffusion Models

arXiv · PDF · Open in the Atlas

Code that ran

4 of 10 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; 4 failures of our instrument; 6 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/2410.11817.json · badge: /api/ran/2410.11817.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
luping-liu/longalign canonical (classifier label)
classifier basis: census
4 ran · 6 no recorded run
FunctionStatusWhere it lives
collate_fn Ran
ran; our contract draft was wrong, not the code
luping-liu/longalign/tools.py
code served (permissive licence) · get_code("4a2ce6bcf14dc444")
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 torch
import random
import os

torch.manual_seed(0)
random.seed(0)

# Set the environment variable that the function reads
os.environ['MY_ENVIRON_DROP'] = '0.1'

# Create example dictionaries with the required keys
# The function expects examples to be dicts with 'pixel_values' and 'caption' keys
examples = [
    {
        'pixel_values': torch.randn(3, 4, 4),  # 3 channels, 4x4 spatial dims
        'caption': 'A cat sits on the mat. It is fluffy! The cat is happy; very happy.'
    },
    {
        'pixel_values': torch.randn(3, 4, 4),
        'caption': 'A dog runs in the park. Dogs are fun! They play all day; jumping around.'
    }
]

ARGS = {
    'examples': examples
}
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
default Ran
ran; our contract draft was wrong, not the code
luping-liu/longalign/modules/adapters.py
pointer only (licence: Apache-2.0); the stored copy get_code serves, from Smith42/astroddpm, is pointer only (licence: AGPL-3.0) · get_code("b5c54401114d79c1")
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 Smith42/astroddpm, and AGPL-3.0, as GitHub detects it on that repository, is not in the permissive set Syntology serves inline. 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.

inject_trainable_lora Ran
ran; our contract draft was wrong, not the code
luping-liu/longalign/modules/lora.py
code served (permissive licence) · get_code("b91c26f2f37fcee6")
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)

class SimpleModule(nn.Module):
    def __init__(self):
        super().__init__()
        self.linear1 = nn.Linear(4, 8)
        self.linear2 = nn.Linear(8, 4)
    
    def forward(self, x):
        return self.linear2(self.linear1(x))

class CrossAttention(nn.Module):
    def __init__(self):
        super().__init__()
        self.linear = nn.Linear(4, 4)
    
    def forward(self, x):
        return self.linear(x)

class Attention(nn.Module):
    def __init__(self):
        super().__init__()
        self.linear = nn.Linear(4, 4)
    
    def forward(self, x):
        return self.linear(x)

class GEGLU(nn.Module):
    def __init__(self):
        super().__init__()
        self.linear = nn.Linear(4, 4)
    
    def forward(self, x):
        return self.linear(x)

class TestModel(nn.Module):
    def __init__(self):
        super().__init__()
        self.cross_attention = CrossAttention()
        self.attention = Attention()
        self.geglu = GEGLU()
        self.linear_layer = nn.Linear(4, 4)
        self.other_linear = nn.Linear(4, 4)
    
    def forward(self, x):
        return x

model = TestModel()

ARGS = {
    'model': model,
    'target_replace_module': {'CrossAttention', 'Attention', 'GEGLU'},
    'r': 2,
    'loras': None,
    'verbose': False,
    'dropout_p': 0.1,
    'scale': 1.0
}
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
inject_trainable_lora_extended Ran
ran; our contract draft was wrong, not the code
luping-liu/longalign/modules/lora.py
code served (permissive licence) · get_code("933f2ac15d91a31c")
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
from typing import Set, List, Optional, Type

torch.manual_seed(0)

# Build a minimal model that has modules matching the search criteria
class SimpleAttention(nn.Module):
    def __init__(self):
        super().__init__()
        self.linear1 = nn.Linear(4, 4)
        self.linear2 = nn.Linear(4, 4)
    
    def forward(self, x):
        return self.linear2(self.linear1(x))

class SimpleResnetBlock(nn.Module):
    def __init__(self):
        super().__init__()
        self.linear = nn.Linear(4, 4)
    
    def forward(self, x):
        return self.linear(x) + x

class SimpleUNet(nn.Module):
    def __init__(self):
        super().__init__()
        self.attention = SimpleAttention()
        self.resnet = SimpleResnetBlock()
        self.linear = nn.Linear(4, 4)
    
    def forward(self, x):
        x = self.attention(x)
        x = self.resnet(x)
        x = self.linear(x)
        return x

# Create a model instance
model = SimpleUNet()

# Define target_replace_module - should match class names in the model hierarchy
target_replace_module = {'SimpleAttention', 'SimpleResnetBlock'}

# Define parameters for ARGS
ARGS = {
    'model': model,
    'target_replace_module': target_replace_module,
    'r': 2,
    'loras': 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
clip_score Not yet run
unverified (harvested, no recorded run)
luping-liu/longalign/loss.py
code served (permissive licence) · get_code("cc39389134b52438")
How it ran

no invocation recorded.

dense_score Not yet run
unverified (harvested, no recorded run)
luping-liu/longalign/loss.py
code served (permissive licence) · get_code("092a0c6a9fe6a6e1")
How it ran

no invocation recorded.

extract_lora_ups_down Not yet run
unverified (harvested, no recorded run)
luping-liu/longalign/modules/lora.py
code served (permissive licence) · get_code("6d32de67cd5b96c3")
How it ran

no invocation recorded.

load_dataset Not yet run
unverified (harvested, no recorded run)
luping-liu/longalign/tools.py
code served (permissive licence) · get_code("d5f326859503a0ee")
How it ran

no invocation recorded.

pick_score Not yet run
unverified (harvested, no recorded run)
luping-liu/longalign/loss.py
code served (permissive licence) · get_code("57d3359ac8dcbf3a")
How it ran

no invocation recorded.

sample_images Not yet run
unverified (harvested, no recorded run)
luping-liu/longalign/tools.py
code served (permissive licence) · get_code("3689353a3c7a8a2b")
How it ran

no invocation recorded.

Also present in other papers' code

Of 10 samples lifted from this paper's linked repositories, 10 carry a function identity and 0 do not. Of the 10 distinct functions with an identity, 4 are also present in other papers whose code we hold (4 with at least one paper dated earlier, 3 the same month, 0 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
inject_trainable_lora 10 other papers
8 dated earlier, 1 the same month, 1 same year, order not determinable
2208.01618 (2022-08)
An Image is Worth One Word: Personalizing Text-to-Image Generation using Textual Inversion
2208.12242 (2022-08)
DreamBooth: Fine Tuning Text-to-Image Diffusion Models for Subject-Driven Generation
2308.06571 (2023-08)
ModelScope Text-to-Video Technical Report
and 7 more not named here
extract_lora_ups_down 8 other papers
6 dated earlier, 1 the same month, 1 same year, order not determinable
2208.12242 (2022-08)
DreamBooth: Fine Tuning Text-to-Image Diffusion Models for Subject-Driven Generation
2312.07315 (2023-12)
NVS-Adapter: Plug-and-Play Novel View Synthesis from a Single Image
2312.17250 (2023-12)
iFusion: Inverting Diffusion for Pose-Free Reconstruction from Sparse Views
and 5 more not named here
inject_trainable_lora_extended 6 other papers
5 dated earlier, 1 the same month
2208.12242 (2022-08)
DreamBooth: Fine Tuning Text-to-Image Diffusion Models for Subject-Driven Generation
2312.07315 (2023-12)
NVS-Adapter: Plug-and-Play Novel View Synthesis from a Single Image
2402.02347 (2024-02)
Riemannian Preconditioned LoRA for Fine-Tuning Foundation Models
and 3 more not named here
default 4 other papers
4 dated earlier
2111.01713 (2021-11)
Realistic galaxy image simulation via score-based generative models
2309.00073 (2023-09)
Diffusion Variational Autoencoder for Tackling Stochasticity in Multi-Step Regression Stock Price Prediction
2403.05751 (2024-03)
MG-TSD: Multi-Granularity Time Series Diffusion Models with Guided Learning Process
and 1 more not named here

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

The rapid advancement of text-to-image (T2I) diffusion models has enabled them to generate unprecedented results from given texts. However, as text inputs become longer, existing encoding methods like CLIP face limitations, and aligning the generated images with long texts becomes challenging. To tackle these issues, we propose LongAlign, which includes a segment-level encoding method for processing long texts and a decomposed preference optimization method for effective alignment training. For segment-level encoding, long texts are divided into multiple segments and processed separately. This method overcomes the maximum input length limits of pretrained encoding models. For preference optimization, we provide decomposed CLIP-based preference models to fine-tune diffusion models. Specifically, to utilize CLIP-based preference models for T2I alignment, we delve into their scoring mechanisms and find that the preference scores can be decomposed into two components: a text-relevant part that measures T2I alignment and a text-irrelevant part that assesses other visual aspects of human preference. Additionally, we find that the text-irrelevant part contributes to a common overfitting problem during fine-tuning. To address this, we propose a reweighting strategy that assigns different weights to these two components, thereby reducing overfitting and enhancing alignment. After fine-tuning $512 \times 512$ Stable Diffusion (SD) v1.5 for about 20 hours using our method, the fine-tuned SD outperforms stronger foundation models in T2I alignment, such as PixArt-$α$ and Kandinsky v2.2. The code is available at https://github.com/luping-liu/LongAlign.

For agents

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

get_harvested_code_for_paper("2410.11817")
get_code_for_paper("2410.11817")
have("2410.11817")

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

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

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

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

Connect an agent — have() is free.