SYNTOLOGY HomeExplorerAtlasCodeMethodologyAboutDevelopersFeedPricing
Paper · Gu_Vector_Quantized_Diffusion_Model_for_Text-to-Image_Synthesis_CVPR_2022_paper · CVPR · 2022

Vector Quantized Diffusion Model for Text-to-Image Synthesis

Dongdong Chen, Jianmin Bao, Lu Yuan, Bo Zhang, Fang Wen, Baining Guo, Shuyang Gu

Open in the Atlas

Code that ran

6 of 6 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; 3 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-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/Gu_Vector_Quantized_Diffusion_Model_for_Text-to-Image_Synthesis_CVPR_2022_paper.json · badge: /api/ran/Gu_Vector_Quantized_Diffusion_Model_for_Text-to-Image_Synthesis_CVPR_2022_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
cientgu/VQ-Diffusion canonical (classifier label)
classifier basis: census
6 ran · 0 no recorded run
FunctionStatusWhere it lives
all_gather Ran
ran; our contract draft was wrong, not the code
cientgu/VQ-Diffusion/image_synthesis/distributed/distributed.py
code served (permissive licence) · get_code("5d1755bb165b0225")
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. 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 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 torch
import pickle

torch.manual_seed(0)

# The function all_gather takes a single parameter 'data'
# Looking at the function body, it:
# 1. Pickles the data
# 2. Converts it to a ByteTensor
# 3. Gathers it across processes
# 4. Unpickles it back

# Since we're in a non-distributed setting (world_size == 1),
# the function will just pickle and unpickle the data.
# We can pass any picklable Python object.

# Create some sample data - a dictionary with various types
sample_data = {
    'tensor': torch.randn(2, 4),
    'list': [1, 2, 3, 4],
    'string': 'test_data',
    'number': 42,
    'nested': {'a': 1, 'b': 2}
}

ARGS = {
    'data': sample_data
}
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 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
all_reduce Ran
ran, honoured the contract we drafted
cientgu/VQ-Diffusion/image_synthesis/distributed/distributed.py
code served (permissive licence) · get_code("68d08cf984f9fe2d")
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 2, dtype family float, shape (2, 4) 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
from torch import distributed as dist

torch.manual_seed(0)

# The function all_reduce takes a tensor and optional parameters op and async_op
# It checks world_size and if > 1, calls dist.all_reduce on the tensor
# For a single process (world_size == 1), it just returns the tensor unchanged

# Create a small tensor (batch=2, dim=4)
tensor = torch.randn(2, 4)

# op parameter - use the default SUM reduction operation
op = dist.ReduceOp.SUM

# async_op parameter - boolean flag
async_op = False

ARGS = {
    "tensor": tensor,
    "op": op,
    "async_op": async_op,
}
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 2, dtype family float, shape (2, 4) — shape (2, 4) 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
log_1_min_a Ran
ran, honoured the contract we drafted
cientgu/VQ-Diffusion/image_synthesis/modeling/transformers/diffusion_transformer.py
pointer only (licence: MIT); the stored copy get_code serves, from MuhangTian/TimeDiff, is pointer only (licence: NONE) · get_code("479771b269fc5883")
How it ran

The body of this sample is withheld: MIT, as GitHub detects it on this paper's repository, cientgu/VQ-Diffusion, is in the permissive set, but a licence decision keeps the body a pointer: the reason for that decision is not recorded with it. 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.

log_add_exp Ran
ran, honoured the contract we drafted
cientgu/VQ-Diffusion/image_synthesis/modeling/transformers/diffusion_transformer.py
pointer only (licence: MIT); the stored copy get_code serves, from MuhangTian/TimeDiff, is pointer only (licence: NONE) · get_code("032c0dece6594020")
How it ran

The body of this sample is withheld: MIT, as GitHub detects it on this paper's repository, cientgu/VQ-Diffusion, is in the permissive set, but a licence decision keeps the body a pointer: the reason for that decision is not recorded with it. 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.

reduce_dict Ran
ran; our contract draft was wrong, not the code
cientgu/VQ-Diffusion/image_synthesis/distributed/distributed.py
code served (permissive licence) · get_code("7dbdda0920e3d074")
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

torch.manual_seed(0)

# Create a simple input dictionary with tensor values
input_dict = {
    'loss': torch.tensor(1.5),
    'accuracy': torch.tensor(0.95),
    'metric_a': torch.tensor([0.1, 0.2, 0.3, 0.4]),
}

ARGS = {
    'input_dict': input_dict,
    'average': True,
}
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
sum_except_batch Ran
ran; our contract draft was wrong, not the code
cientgu/VQ-Diffusion/image_synthesis/modeling/transformers/diffusion_transformer.py
pointer only (licence: MIT); the stored copy get_code serves, from MuhangTian/TimeDiff, is pointer only (licence: NONE) · get_code("5eb945b1f970f6af")
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 MuhangTian/TimeDiff, 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.

Also present in other papers' code

Of 6 samples lifted from this paper's linked repositories, 6 carry a function identity and 0 do not. Of the 6 distinct functions with an identity, 6 are also present in other papers whose code we hold (3 with at least one paper dated earlier, 0 the same month, 6 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
log_add_exp 14 other papers
1 dated earlier, 10 later, 3 same year, order not determinable · 3 only as an assembly brick
2102.05379 (2021-02)
Argmax Flows and Multinomial Diffusion: Learning Categorical Distributions
2205.16007 (2022-05)
Improved Vector Quantized Diffusion Models
2206.07771 (2022-06)
Discrete Contrastive Diffusion for Cross-Modal Music and Image Generation
and 11 more not named here
log_1_min_a 13 other papers
1 dated earlier, 9 later, 3 same year, order not determinable · 3 only as an assembly brick
2102.05379 (2021-02)
Argmax Flows and Multinomial Diffusion: Learning Categorical Distributions
2205.16007 (2022-05)
Improved Vector Quantized Diffusion Models
2206.07771 (2022-06)
Discrete Contrastive Diffusion for Cross-Modal Music and Image Generation
and 10 more not named here
sum_except_batch 9 other papers
1 dated earlier, 6 later, 2 same year, order not determinable · 2 only as an assembly brick
2102.05379 (2021-02)
Argmax Flows and Multinomial Diffusion: Learning Categorical Distributions
2205.16007 (2022-05)
Improved Vector Quantized Diffusion Models
2206.07771 (2022-06)
Discrete Contrastive Diffusion for Cross-Modal Music and Image Generation
and 6 more not named here
all_gather 3 other papers
2 later, 1 same year, order not determinable
2205.16007 (2022-05)
Improved Vector Quantized Diffusion Models
2308.07228 (2023-08)
RestoreFormer++: Towards Real-World Blind Face Restoration from Undegraded Key-Value Pairs
2404.11949 (2024-04)
Sketch-guided Image Inpainting with Partial Discrete Diffusion Process
all_reduce 3 other papers
2 later, 1 same year, order not determinable
2205.16007 (2022-05)
Improved Vector Quantized Diffusion Models
2404.11949 (2024-04)
Sketch-guided Image Inpainting with Partial Discrete Diffusion Process
2405.18765 (2024-05)
Large Brain Model for Learning Generic Representations with Tremendous EEG Data in BCI
reduce_dict 3 other papers
2 later, 1 same year, order not determinable
2205.16007 (2022-05)
Improved Vector Quantized Diffusion Models
2308.07228 (2023-08)
RestoreFormer++: Towards Real-World Blind Face Restoration from Undegraded Key-Value Pairs
2404.11949 (2024-04)
Sketch-guided Image Inpainting with Partial Discrete Diffusion Process

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

We present the vector quantized diffusion (VQ-Diffusion) model for text-to-image generation. This method is based on a vector quantized variational autoencoder (VQ-VAE) whose latent space is modeled by a conditional variant of the recently developed Denoising Diffusion Probabilistic Model (DDPM). We find that this latent-space method is well-suited for text-to-image generation tasks because it not only eliminates the unidirectional bias with existing methods but also allows us to incorporate a mask-andreplace diffusion strategy to avoid the accumulation of errors, which is a serious problem with existing methods. Our experiments show that the VQ-Diffusion produces significantly better text-to-image generation results when compared with conventional autoregressive (AR) models with similar numbers of parameters. Compared with previous GAN-based text-to-image methods, our VQ-Diffusion can handle more complex scenes and improve the synthesized image quality by a large margin. Finally, we show that the image generation computation in our method can be made highly efficient by reparameterization. With traditional AR methods, the text-to-image generation time increases linearly with the output image resolution and hence is quite time consuming even for normal size images. The VQ-Diffusion allows us to achieve a better trade-off between quality and speed. Our experiments indicate that the VQ-Diffusion model with the reparameterization is fifteen times faster than traditional AR methods while achieving a better image quality. The code and models are available at https://github.com/cientgu/VQ-Diffusion.

For agents

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

get_harvested_code_for_paper("Gu_Vector_Quantized_Diffusion_Model_for_Text-to-Image_Synthesis_CVPR_2022_paper")
get_code_for_paper("Gu_Vector_Quantized_Diffusion_Model_for_Text-to-Image_Synthesis_CVPR_2022_paper")
have("Gu_Vector_Quantized_Diffusion_Model_for_Text-to-Image_Synthesis_CVPR_2022_paper")

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

curl https://syntology.ai/api/ran/Gu_Vector_Quantized_Diffusion_Model_for_Text-to-Image_Synthesis_CVPR_2022_paper.json

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

[![Syntology run record](https://syntology.ai/api/ran/Gu_Vector_Quantized_Diffusion_Model_for_Text-to-Image_Synthesis_CVPR_2022_paper.svg)](https://syntology.ai/paper/Gu_Vector_Quantized_Diffusion_Model_for_Text-to-Image_Synthesis_CVPR_2022_paper)

Connect an agent — have() is free.