SYNTOLOGY HomeExplorerAtlasCodeMethodologyAboutDevelopersFeedPricing
Paper · 04534 · ECCV · 2024

UDiffText: A Unified Framework for High-quality Text Synthesis in Arbitrary Images via Character-aware Diffusion Models

Zhouhui Lian, Yiming Zhao

Open in the Atlas

Code that ran

7 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, 4 violated it and 1 has no contract verdict; 2 failures of our instrument; 3 no recorded run), measured 2026-11-22; 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/04534.json · badge: /api/ran/04534.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
ZYM-PKU/UDiffText canonical (classifier label)
classifier basis: census
7 ran · 3 no recorded run
FunctionStatusWhere it lives
default Ran
ran, violated the contract we drafted
ZYM-PKU/UDiffText/sgm/modules/attention.py
code served (permissive licence) · get_code("424012cb37b31172")
How it ran

Ran in Syntology's sandbox on this synthesized input (drafted by a language model, Claude Sonnet 4.5, prompt python_fixture_v1) 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.

from inspect import isfunction

def exists(val):
    return val is not None

def default(val, d):
    if exists(val):
        return val
    return d() if isfunction(d) else d

# Test case 1: val exists (not None), d is a regular value
ARGS_1 = {
    'val': 42,
    'd': 100
}

# Test case 2: val is None, d is a regular value
ARGS_2 = {
    'val': None,
    'd': 100
}

# Test case 3: val is None, d is a function
def default_func():
    return 200

ARGS_3 = {
    'val': None,
    'd': default_func
}

# Test case 4: val exists, d is a function
ARGS_4 = {
    'val': "existing_value",
    'd': lambda: "default_value"
}

# Use one of the test cases as the final ARGS
ARGS = ARGS_3
Setup block drafted by
a language model, Claude Sonnet 4.5, prompt python_fixture_v1
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 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
disabled_train Ran
ran, violated the contract we drafted
ZYM-PKU/UDiffText/sgm/util.py
code served (permissive licence) · get_code("4cb732f513d69dfd")
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 SimpleModel. 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 SimpleModel(nn.Module):
    def __init__(self):
        super().__init__()
        self.linear = nn.Linear(4, 3)
    
    def forward(self, x):
        return self.linear(x)

model = SimpleModel()

ARGS = {
    "self": model,
    "mode": True
}
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 SimpleModel — a SimpleModel output has no array shape of its own; none is stated — the instrument coerces any output to an array; for a SimpleModel 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
exists Ran
ran, violated the contract we drafted
ZYM-PKU/UDiffText/sgm/modules/attention.py
pointer only (licence: MIT); the stored copy get_code serves, from ThomasMrY/VCT, is pointer only (licence: NONE) · get_code("aa5486a3650902d8")
How it ran

The body of this sample is withheld: this paper's link allows the body inline (MIT), but get_code serves the stored copy, first harvested from ThomasMrY/VCT, 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.

get_dataloader Ran
ran on a synthesized input
ZYM-PKU/UDiffText/dataset/dataloader.py
code served (permissive licence) · get_code("17dcc91f8390dbcb")
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 DataLoader. 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.utils.data as data
from omegaconf import OmegaConf
import tempfile
import os

torch.manual_seed(0)

# Create a minimal Dataset class that matches the expected interface
class DummyDataset(data.Dataset):
    def __init__(self, params, datype='train'):
        self.params = params
        self.datype = datype
        self.length = 10
    
    def __len__(self):
        return self.length
    
    def __getitem__(self, idx):
        return torch.randn(4), torch.tensor(idx % 2)

# Create a temporary directory and config file
temp_dir = tempfile.mkdtemp()
config_path = os.path.join(temp_dir, 'dataset_config.yaml')

# Write a minimal dataset config
config_content = """
target: 'DummyDataset'
params:
  dummy_param: 42
"""

with open(config_path, 'w') as f:
    f.write(config_content)

# Create main config object
class MainConfig:
    def __init__(self):
        self.dataset_cfg_path = config_path
        self.batch_size = 2
        self.shuffle = True
        self.num_workers = 0

cfgs = MainConfig()

# Make DummyDataset available in the eval scope for the function
import sys
current_module = sys.modules[__name__]
setattr(current_module, 'DummyDataset', DummyDataset)

ARGS = {
    'cfgs': cfgs,
    'datype': 'train'
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
omegaconf, torch — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type DataLoader — a DataLoader output has no array shape of its own; none is stated — the instrument coerces any output to an array; for a DataLoader 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
get_string_from_tuple Ran
ran; our contract draft was wrong, not the code
ZYM-PKU/UDiffText/sgm/util.py
code served (permissive licence) · get_code("2036522d462af205")
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 str. 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

def get_string_from_tuple(s):
    try:
        if s[0] == '(' and s[-1] == ')':
            t = eval(s)
            if type(t) == tuple:
                return t[0]
            else:
                pass
    except:
        pass
    return s

# The function takes a string parameter and checks if it's a string representation
# of a tuple, evaluates it, and returns the first element if it is a tuple.
# Otherwise it returns the input string unchanged.

ARGS = {
    "s": "('hello', 'world')"
}
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 str — a str output has no array shape of its own; none is stated — the instrument coerces any output to an array; for a str 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
is_power_of_two Ran
ran, violated the contract we drafted
ZYM-PKU/UDiffText/sgm/util.py
code served (permissive licence) · get_code("3753e92206c00bb9")
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 bool, 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

# The function is_power_of_two takes a single integer parameter n
# It checks if n is a power of 2 using bitwise operations
# We need to provide valid integer arguments to test the function

ARGS = {
    "n": 8  # 8 is 2^3, so this should return True
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
numpy, torch — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type bool, 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
uniq Ran
ran; our contract draft was wrong, not the code
ZYM-PKU/UDiffText/sgm/modules/attention.py
pointer only (licence: MIT); the stored copy get_code serves, from JingWu321/MUNBa, is pointer only (licence: NONE) · get_code("9a299fe5ae09e407")
How it ran

The body of this sample is withheld: this paper's link allows the body inline (MIT), but get_code serves the stored copy, first harvested from JingWu321/MUNBa, 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.

deep_copy Not yet run
unverified (harvested, no recorded run)
ZYM-PKU/UDiffText/util.py
code served (permissive licence) · get_code("2f1b29be704dbc69")
How it ran

no invocation recorded.

init_sampling Not yet run
unverified (harvested, no recorded run)
ZYM-PKU/UDiffText/util.py
code served (permissive licence) · get_code("4d527bbbe0f56b07")
How it ran

no invocation recorded.

region_draw_text Not yet run
unverified (harvested, no recorded run)
ZYM-PKU/UDiffText/dataset/dataloader.py
code served (permissive licence) · get_code("f7a24cc069e801f4")
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, 6 are also present in other papers whose code we hold (6 with at least one paper dated earlier, 0 the same month, 4 later) and 4 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
exists 486 other papers
283 dated earlier, 53 later, 148 same year, order not determinable, 2 undated · 78 only as an assembly brick
1603.08155 (2016-03)
Perceptual Losses for Real-Time Style Transfer and Super-Resolution
1611.07004 (2016-11)
Image-to-Image Translation with Conditional Adversarial Networks
1804.04637 (2018-04)
EMBER: An Open Dataset for Training Static PE Malware Machine Learning Models
and 483 more not named here
default 207 other papers
117 dated earlier, 20 later, 70 same year, order not determinable · 41 only as an assembly brick
1711.11585 (2017-11)
High-Resolution Image Synthesis and Semantic Manipulation with Conditional GANs
2006.11239 (2020-06)
Denoising Diffusion Probabilistic Models
2010.08162 (2020-10)
SidechainNet: An All-Atom Protein Structure Dataset for Machine Learning
and 204 more not named here
disabled_train 173 other papers
75 dated earlier, 17 later, 81 same year, order not determinable · 5 only as an assembly brick
2012.09841 (2020-12)
Taming Transformers for High-Resolution Image Synthesis
2102.05379 (2021-02)
Argmax Flows and Multinomial Diffusion: Learning Categorical Distributions
2104.07652 (2021-04)
Geometry-Free View Synthesis: Transformers and no 3D Priors
and 170 more not named here
uniq 115 other papers
58 dated earlier, 6 later, 51 same year, order not determinable
2112.10752 (2021-12)
High-Resolution Image Synthesis with Latent Diffusion Models
2204.06125 (2022-04)
Hierarchical Text-Conditional Image Generation with CLIP Latents
2206.02779 (2022-06)
Blended Latent Diffusion
and 112 more not named here
get_string_from_tuple 4 other papers
2 dated earlier, 2 same year, order not determinable
2311.16813 (2023-11)
Panacea: Panoramic and Controllable Video Generation for Autonomous Driving
2312.06573 (2023-12)
ControlNet-XS: Rethinking the Control of Text-to-Image Diffusion Models as Feedback-Control Systems
2403.11207 (2024-03)
MindEye2: Shared-Subject Models Enable fMRI-To-Image With 1 Hour of Data
and 1 more not named here
is_power_of_two 4 other papers
2 dated earlier, 2 same year, order not determinable
2311.16813 (2023-11)
Panacea: Panoramic and Controllable Video Generation for Autonomous Driving
2312.06573 (2023-12)
ControlNet-XS: Rethinking the Control of Text-to-Image Diffusion Models as Feedback-Control Systems
2403.11207 (2024-03)
MindEye2: Shared-Subject Models Enable fMRI-To-Image With 1 Hour of Data
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-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

Text-to-Image (T2I) generation based on diffusion models has garnered significant attention in the last few years. Although these image synthesis methods produce visually appealing results, they frequently exhibit spelling errors when rendering text within the generated images. Such errors manifest as missing, incorrect or extraneous characters, thereby severely constraining the performance of text image generation based on diffusion models. To address the aforementioned issue, this paper proposes a novel approach for text image generation, utilizing a pre-trained diffusion model (i.e., Stable Diffusion). Our approach involves the design and training of a light-weight character-level text encoder, which replaces the original CLIP encoder and provides more robust text embeddings as conditional guidance. Then, we fine-tune the diffusion model using a large-scale dataset, incorporating local attention control under the supervision of character-level segmentation maps. Finally, by employing an inference stage refinement process, we achieve a notably high sequence accuracy when synthesizing text in arbitrarily given images. Both qualitative and quantitative results demonstrate the superiority of our method to the state of the art. Furthermore, we showcase several potential applications of the proposed UDiffText, including text-centric image synthesis, scene text inpainting, etc. Our code and model are available at https://github.com/ZYM-PKU/UDiffText.

For agents

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

get_harvested_code_for_paper("04534")
get_code_for_paper("04534")
have("04534")

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

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

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

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

Connect an agent — have() is free.