SYNTOLOGY HomeExplorerAtlasCodeMethodologyAboutDevelopersFeedPricing
Paper · 2310.03502 · EMNLP · 2023

Kandinsky: an Improved Text-to-Image Synthesis with Image Prior and Latent Diffusion

Vladimir Arkhipkin, Alexander Panchenko, Anton Razzhigaev, Denis Dimitrov, Andrey Kuznetsov, Arseniy Shakhmatov, Anastasia Maltseva, Igor Pavlov, Ilya Ryabov, Angelina Kuts

arXiv · PDF · Open in the Atlas

Code that ran

12 of 18 samples (functions and classes) lifted from this paper's linked repositories executed on a synthesized input in Syntology's jail (1 of them constructed an object rather than computing a result; 3 honoured the contract we drafted, 0 violated it and 2 have no contract verdict; 7 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/2310.03502.json · badge: /api/ran/2310.03502.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
deep-floyd/IF canonical (classifier label)
classifier basis not recorded on the link
9 ran · 0 no recorded run
ai-forever/Kandinsky-2 marked official in Papers with Code
Papers with Code archive
3 ran · 5 no recorded run
ai-forever/MoVQGAN community
Papers with Code archive
0 ran · 1 no recorded run
FunctionStatusWhere it lives
AttentionPooling Ran
ran on a synthesized input · constructed an object; no result was computed
ai-forever/Kandinsky-2/kandinsky2/model/text2im_model2_1.py
code served (permissive licence) · get_code("f60bca05893fa428")
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 an instance of its own class, AttentionPooling: the run constructed the object and did not call it, so no result was computed. 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
import math

torch.manual_seed(0)

# AttentionPooling parameters:
# - heads: number of attention heads
# - in_dim: input dimension
# - out_dim: output dimension

ARGS = {
    "heads": 2,
    "in_dim": 4,
    "out_dim": 3,
}
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 AttentionPooling — the run constructed an instance of its own class and did not call it; no shape is stated — the instrument coerces any output to an array; for a AttentionPooling 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
QKVAttention Ran
ran on a synthesized input
ai-forever/Kandinsky-2/kandinsky2/model/text2im_model2_1.py
code served (permissive licence) · get_code("317687cb15c56f85")
How it ran

Ran in Syntology's sandbox on this synthesized input (drafted by a language model, class construct-then-call prompt, model not recorded) and returned Tensor, ndim 3, 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 torch
import torch.nn as nn
import math

INIT_ARGS = {
    "n_heads": 2,
    "use_flash_attention": False,
}

ARGS = {
    "qkv": torch.randn(2, 12, 5),  # [batch=2, n_heads*3*ch=2*3*2=12, length=5]
    "encoder_kv": None,
}

if __name__ == "__main__":
    from torch import nn
    
    class QKVAttention(nn.Module):
        """
        A module which performs QKV attention. Matches legacy QKVAttention + input/ouput heads shaping
        """

        def __init__(self, n_heads, use_flash_attention=False):
            super().__init__()
            self.n_heads = n_heads
            self.use_flash_attention = use_flash_attention
            if self.use_flash_attention:
                from flash_attn.modules.mha import FlashCrossAttention
                self.flash_attention = FlashCrossAttention()

        def forward(self, qkv, encoder_kv=None):
            """
            Apply QKV attention.

            :param qkv: an [N x (H * 3 * C) x T] tensor of Qs, Ks, and Vs.
            :return: an [N x (H * C) x T] tensor after attention.
            """
            bs, width, length = qkv.shape
            assert width % (3 * self.n_heads) == 0
            ch = width // (3 * self.n_heads)
            q, k, v = qkv.reshape(bs * self.n_heads, ch * 3, length).split(ch, dim=1)
            if encoder_kv is not None:
                assert encoder_kv.shape[1] == self.n_heads * ch * 2
                ek, ev = encoder_kv.reshape(bs * self.n_heads, ch * 2, -1).split(ch, dim=1)
                k = torch.cat([ek, k], dim=-1)
                v = torch.cat([ev, v], dim=-1)
            if self.use_flash_attention:
                q = q.reshape(q.shape[0] // self.n_heads, q.shape[1] * self.n_heads, q.shape[2])
                k = k.reshape(k.shape[0] // self.n_heads, k.shape[1] * self.n_heads, k.shape[2])
                v = v.reshape(v.shape[0] // self.n_heads, v.shape[1] * self.n_heads, v.shape[2])
                q, k, v = (q.permute(0, 2, 1), k.permute(0, 2, 1), v.permute(0, 2, 1))
                q = q.reshape(q.shape[0], q.shape[1], self.n_heads, q.shape[2] // self.n_heads)
                k = k.reshape(k.shape[0], k.shape[1], self.n_heads, k.shape[2] // self.n_heads)
                v = v.reshape(v.shape[0], v.shape[1], self.n_heads, v.shape[2] // self.n_heads)
                k, v = (k.unsqueeze(2), v.unsqueeze(2))
                kv = torch.cat([k, v], dim=2)
                dtype_a = kv.dtype
                out = self.flash_attention(q.to(torch.float16), kv.to(torch.float16)).to(dtype_a)
                out = out.reshape(out.shape[0], out.shape[1], out.shape[2] * out.shape[3])
                out = out.permute(0, 2, 1)
                return out
            else:
                scale = 1 / math.sqrt(math.sqrt(ch))
                weight = torch.einsum('bct,bcs->bts', q * scale, k * scale)
                weight = torch.softmax(weight.float(), dim=-1).type(weight.dtype)
                a = torch.einsum('bts,bcs->bct', weight, v)
                return a.reshape(bs, -1, length)

    model = QKVAttention(**INIT_ARGS)
    output = model(**ARGS)
    print(f"Output shape: {output.shape}")
    print(f"Expected shape: [2, 4, 5]")
Setup block drafted by
a language model, class construct-then-call prompt, model not recorded
Imports
flash_attn, torch — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type Tensor, ndim 3, dtype family float — no output shape is stated: observe_signature.py observed this class with its constructor sizes canonicalised where it could, which the node does not record, so its shape is not stated as this setup block's
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: torch and numpy seeded to 0 by the harness immediately before the class was constructed from INIT_ARGS (fixture_check.py)
approx_standard_normal_cdf Ran
ran, honoured the contract we drafted
deep-floyd/IF/deepfloyd_if/model/losses.py
pointer only (licence: NONE); the stored copy get_code serves, from tsinghua-fib-lab/Spatio-temporal-Diffusion-Point-Processes, is pointer only (licence: NONE) · get_code("9deab2a47adbf3b7")
How it ran

The body of this sample is withheld: GitHub detected no licence in this paper's repository, deep-floyd/IF 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.

attention Ran
ran; our contract draft was wrong, not the code
ai-forever/Kandinsky-2/kandinsky2/model/text2im_model2_1.py
code served (permissive licence) · get_code("fe30479834a53868")
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 3, dtype family float, shape (2, 3, 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 math

torch.manual_seed(0)

# Create small tensors for query, key, value
# q: (batch=2, seq_len=3, d_k=4)
q = torch.randn(2, 3, 4)

# k: (batch=2, seq_len=3, d_k=4)
k = torch.randn(2, 3, 4)

# v: (batch=2, seq_len=3, d_v=4)
v = torch.randn(2, 3, 4)

# d_k: dimension of key (used for scaling)
d_k = 4

ARGS = {
    "q": q,
    "k": k,
    "v": v,
    "d_k": d_k
}
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 3, dtype family float, shape (2, 3, 4) — shape (2, 3, 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
betas_for_alpha_bar Ran
ran, honoured the contract we drafted
deep-floyd/IF/deepfloyd_if/model/gaussian_diffusion.py
pointer only (licence: NONE); the stored copy get_code serves, from blt2114/twisted_diffusion_sampler, is pointer only (licence: NONE) · get_code("6cdc8772f5db6f48")
How it ran

The body of this sample is withheld: GitHub detected no licence in this paper's repository, deep-floyd/IF 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.

discretized_gaussian_log_likelihood Ran
ran; our contract draft was wrong, not the code
deep-floyd/IF/deepfloyd_if/model/losses.py
pointer only (licence: NONE); the stored copy get_code serves, from vibe007/Denoising_MC_Renders_Diffusion, is pointer only (licence: NONE) · get_code("f702cecaa7981c73")
How it ran

The body of this sample is withheld: GitHub detected no licence in this paper's repository, deep-floyd/IF 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.

gelu Ran
ran; our contract draft was wrong, not the code
deep-floyd/IF/deepfloyd_if/model/nn.py
pointer only (licence: NONE); the stored copy get_code serves, from haiantyz/JGA-LBD, is pointer only (licence: NONE) · get_code("f51cf2cbd3e598d8")
How it ran

The body of this sample is withheld: GitHub detected no licence in this paper's repository, deep-floyd/IF 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.

gelu_jit Ran
ran; the contract check could not run (RAISES, DEP_MISSING or TIMEOUT)
deep-floyd/IF/deepfloyd_if/model/nn.py
pointer only (licence: NONE); the stored copy get_code serves, from haiantyz/JGA-LBD, is pointer only (licence: NONE) · get_code("cd23a508b079e2d4")
How it ran

The body of this sample is withheld: GitHub detected no licence in this paper's repository, deep-floyd/IF 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_named_beta_schedule Ran
ran; the contract check could not run (RAISES, DEP_MISSING or TIMEOUT)
deep-floyd/IF/deepfloyd_if/model/gaussian_diffusion.py
pointer only (licence: NONE) · get_code("141937afc98f8d1e")
How it ran

The body of this sample is withheld: GitHub detected no licence in this paper's repository, deep-floyd/IF 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.

mean_flat Ran
ran; our contract draft was wrong, not the code
deep-floyd/IF/deepfloyd_if/model/nn.py
pointer only (licence: NONE) · get_code("f6d7c009a8efb8b7")
How it ran

The body of this sample is withheld: GitHub detected no licence in this paper's repository, deep-floyd/IF 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.

normal_kl Ran
ran, honoured the contract we drafted
deep-floyd/IF/deepfloyd_if/model/losses.py
pointer only (licence: NONE); the stored copy get_code serves, from tsinghua-fib-lab/Spatio-temporal-Diffusion-Point-Processes, is pointer only (licence: NONE) · get_code("c3bf3f13d5f63d5b")
How it ran

The body of this sample is withheld: GitHub detected no licence in this paper's repository, deep-floyd/IF 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.

space_timesteps Ran
ran; the contract check could not run (RAISES, DEP_MISSING or TIMEOUT)
deep-floyd/IF/deepfloyd_if/model/respace.py
pointer only (licence: NONE); the stored copy get_code serves, from vibe007/Denoising_MC_Renders_Diffusion, is pointer only (licence: NONE) · get_code("4e881da877b25beb")
How it ran

The body of this sample is withheld: GitHub detected no licence in this paper's repository, deep-floyd/IF 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.

AttentionBlock Not yet run
unverified (harvested, no recorded run)
ai-forever/Kandinsky-2/kandinsky2/model/text2im_model2_1.py
code served (permissive licence) · get_code("88a5c5be88a2747b")
How it ran

no invocation recorded.

MOVQ Not yet run
unverified (harvested, no recorded run)
ai-forever/MoVQGAN/movqgan/models/vqgan.py
pointer only (licence: NONE) · get_code("47ec7613fe517e5e")
How it ran

The body of this sample is withheld: GitHub detected no licence in this paper's repository, ai-forever/MoVQGAN 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. No invocation recorded.

ResBlock Not yet run
unverified (harvested, no recorded run)
ai-forever/Kandinsky-2/kandinsky2/model/text2im_model2_1.py
code served (permissive licence) · get_code("99ce6c633e8c9151")
How it ran

no invocation recorded.

Text2ImUNet Not yet run
unverified (harvested, no recorded run)
ai-forever/Kandinsky-2/kandinsky2/model/text2im_model2_1.py
code served (permissive licence) · get_code("7759535afd6da808")
How it ran

no invocation recorded.

TimestepEmbedSequential Not yet run
unverified (harvested, no recorded run)
ai-forever/Kandinsky-2/kandinsky2/model/text2im_model2_1.py
code served (permissive licence) · get_code("e587c8596212bcdf")
How it ran

no invocation recorded.

UNetModel Not yet run
unverified (harvested, no recorded run)
ai-forever/Kandinsky-2/kandinsky2/model/text2im_model2_1.py
code served (permissive licence) · get_code("820bf30db90e06e6")
How it ran

no invocation recorded.

Also present in other papers' code

Of 18 samples lifted from this paper's linked repositories, 18 carry a function identity and 0 do not. Of the 18 distinct functions with an identity, 10 are also present in other papers whose code we hold (10 with at least one paper dated earlier, 3 the same month, 10 later) and 8 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
betas_for_alpha_bar 92 other papers
51 dated earlier, 3 the same month, 36 later, 2 same year, order not determinable · 3 only as an assembly brick
2006.11239 (2020-06)
Denoising Diffusion Probabilistic Models
2010.02502 (2020-10)
Denoising Diffusion Implicit Models
2102.09672 (2021-02)
Improved Denoising Diffusion Probabilistic Models
and 89 more not named here
get_named_beta_schedule 63 other papers
35 dated earlier, 27 later, 1 same year, order not determinable
2010.02502 (2020-10)
Denoising Diffusion Implicit Models
2108.02938 (2021-08)
ILVR: Conditioning Method for Denoising Diffusion Probabilistic Models
2111.11672 (2021-11)
Few-shot Image Generation with Mixup-based Distance Learning
and 60 more not named here
mean_flat 60 other papers
18 dated earlier, 2 the same month, 39 later, 1 same year, order not determinable · 25 only as an assembly brick
2010.02502 (2020-10)
Denoising Diffusion Implicit Models
2105.05233 (2021-05)
Diffusion Models Beat GANs on Image Synthesis
2201.06503 (2022-01)
Analytic-DPM: an Analytic Estimate of the Optimal Reverse Variance in Diffusion Probabilistic Models
and 57 more not named here
normal_kl 34 other papers
6 dated earlier, 3 the same month, 24 later, 1 same year, order not determinable
2006.11239 (2020-06)
Denoising Diffusion Probabilistic Models
2209.15421 (2022-09)
TabDDPM: Modelling Tabular Data with Diffusion Models
2211.13221 (2022-11)
Latent Video Diffusion Models for High-Fidelity Long Video Generation
and 31 more not named here
approx_standard_normal_cdf 10 other papers
4 dated earlier, 5 later, 1 same year, order not determinable
2006.11239 (2020-06)
Denoising Diffusion Probabilistic Models
2209.15421 (2022-09)
TabDDPM: Modelling Tabular Data with Diffusion Models
and 7 more not named here
discretized_gaussian_log_likelihood 8 other papers
2 dated earlier, 5 later, 1 same year, order not determinable
2006.11239 (2020-06)
Denoising Diffusion Probabilistic Models
2209.15421 (2022-09)
TabDDPM: Modelling Tabular Data with Diffusion Models
and 5 more not named here
space_timesteps 5 other papers
3 dated earlier, 1 later, 1 same year, order not determinable
2210.07574 (2022-10)
Is synthetic data from generative models ready for image recognition?
2211.15388 (2022-11)
Shifted Diffusion for Text-to-image Generation
and 2 more not named here
TimestepEmbedSequential
brick of this paper's assembly: helper
4 other papers
3 dated earlier, 1 later
2006.11239 (2020-06)
Denoising Diffusion Probabilistic Models
2112.10741 (2021-12)
GLIDE: Towards Photorealistic Image Generation and Editing with Text-Guided Diffusion Models
2205.11487 (2022-05)
Photorealistic Text-to-Image Diffusion Models with Deep Language Understanding
and 1 more not named here
gelu 4 other papers
1 dated earlier, 2 later, 1 same year, order not determinable · 1 only as an assembly brick
2205.11487 (2022-05)
Photorealistic Text-to-Image Diffusion Models with Deep Language Understanding
2404.00491 (2024-04)
Denoising Monte Carlo Renders with Diffusion Models
and 1 more not named here
gelu_jit 4 other papers
1 dated earlier, 2 later, 1 same year, order not determinable · 1 only as an assembly brick
2205.11487 (2022-05)
Photorealistic Text-to-Image Diffusion Models with Deep Language Understanding
2404.00491 (2024-04)
Denoising Monte Carlo Renders with Diffusion Models
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

Text-to-image generation is a significant domain in modern computer vision and has achieved substantial improvements through the evolution of generative architectures. Among these, there are diffusion-based models that have demonstrated essential quality enhancements. These models are generally split into two categories: pixel-level and latent-level approaches. We present Kandinsky 1 , a novel exploration of latent diffusion architecture, combining the principles of the image prior models with latent diffusion techniques. The image prior model is trained separately to map text embeddings to image embeddings of CLIP. Another distinct feature of the proposed model is the modified MoVQ implementation, which serves as the image autoencoder component. Overall, the designed model contains 3.3B parameters. We also deployed a user-friendly demo system that supports diverse generative modes such as text-to-image generation, image fusion, text and image fusion, image variations generation, and text-guided inpainting/outpainting. Additionally, we released the source code and checkpoints for the Kandinsky models. Experimental evaluations demonstrate a FID score of 8.03 on the COCO-30K dataset, marking our model as the top open-source performer in terms of measurable image generation quality.

For agents

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

get_harvested_code_for_paper("2310.03502")
get_code_for_paper("2310.03502")
have("2310.03502")

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

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

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

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

Connect an agent — have() is free.