SYNTOLOGY HomeExplorerAtlasCodeMethodologyAboutDevelopersFeedPricing
Paper · 2408.11039 · 2024

Transfusion: Predict the Next Token and Diffuse Images with One Multi-Modal Model

arXiv · PDF · Open in the Atlas

Code that ran

11 of 11 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, 3 violated it and 5 have no contract verdict; 1 failure of our instrument; 0 no recorded run), measured 2026-11-22; 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/2408.11039.json · badge: /api/ran/2408.11039.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
lucidrains/transfusion-pytorch community (classifier label)
classifier basis: plan_row
8 ran · 0 no recorded run
VachanVY/Transfusion.torch community (classifier label)
classifier basis not recorded on the link
3 ran · 0 no recorded run
FunctionStatusWhere it lives
apply_rotary_emb Ran
ran on a synthesized input
VachanVY/Transfusion.torch/src/llama2c.py
code served (permissive licence) · get_code("30c8848624ea177f")
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 5, 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

torch.manual_seed(0)

# Build tensors for the function
# xq and xk should have shape (batch, seq_len, head_dim) where head_dim is even
# freqs_cos and freqs_sin should have shape (seq_len, head_dim//2)

batch_size = 2
seq_len = 3
head_dim = 4

# xq: (batch, seq_len, head_dim)
xq = torch.randn(batch_size, seq_len, head_dim)

# xk: (batch, seq_len, head_dim)
xk = torch.randn(batch_size, seq_len, head_dim)

# freqs_cos: (seq_len, head_dim//2)
freqs_cos = torch.randn(seq_len, head_dim // 2)

# freqs_sin: (seq_len, head_dim//2)
freqs_sin = torch.randn(seq_len, head_dim // 2)

ARGS = {
    "xq": xq,
    "xk": xk,
    "freqs_cos": freqs_cos,
    "freqs_sin": freqs_sin,
}
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, ndim 5, 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
collate_fn Ran
ran on a synthesized input
lucidrains/transfusion-pytorch/train_mnist_with_unet.py
code served (permissive licence) · get_code("6e69bb84d453db1c")
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. 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 numpy as np

torch.manual_seed(0)

# The collate_fn function takes a 'data' parameter and converts it to a list of lists
# It uses map(list, data), so data must be an iterable of iterables
# Each element will be converted to a list

# Create sample data - a batch of tuples/lists that will be converted
# This could be typical dataloader output: list of (input, target) tuples
sample_batch = [
    (torch.randn(4, 3), torch.tensor([0])),
    (torch.randn(4, 3), torch.tensor([1]))
]

ARGS = {
    "data": sample_batch
}
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 list — a list 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
decode_token Ran
ran; our contract draft was wrong, not the code
lucidrains/transfusion-pytorch/train_latent_with_text.py
code served (permissive licence) · get_code("068b17b5ae41f738")
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
import numpy as np

torch.manual_seed(0)

# The function decode_token takes a single parameter 'token'
# It expects token to be an integer (or at least something that can be compared with 32)
# and converted to a character via chr()

token = 65  # ASCII code for 'A', a valid integer for the function

ARGS = {
    "token": token
}
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 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
decode_tokens Ran
ran on a synthesized input
lucidrains/transfusion-pytorch/train_latent_with_text.py
code served (permissive licence) · get_code("3eec335aee307a93")
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
from torch import nn, tensor, Tensor

torch.manual_seed(0)

# The function decode_tokens takes a Tensor of tokens and converts them to a string
# by mapping each token to a character (with a minimum ASCII value of 32)

# Create a small tensor of token values
# Tokens should be integers that represent character codes
tokens_tensor = torch.tensor([72, 101, 108, 108], dtype=torch.long)

ARGS = {
    "tokens": tokens_tensor
}
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
default Ran
ran, violated the contract we drafted
lucidrains/transfusion-pytorch/transfusion_pytorch/modality_processing.py
code served (permissive licence) · get_code("99b3563ebc6734ad")
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 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.

import torch

def exists(v):
    return v is not None

def default(v, d):
    return v if exists(v) else d

# Test case 1: v is not None
v_value = 42
d_value = 100
ARGS = {
    "v": v_value,
    "d": d_value
}
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 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
divisible_by Ran
ran, violated the contract we drafted
lucidrains/transfusion-pytorch/train_image_only_with_unet.py
code served (permissive licence) · get_code("f912c209e9c899ca")
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 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

torch.manual_seed(0)

# The function divisible_by(num, den) checks if num % den == 0
# It takes two numeric arguments and performs modulo operation

ARGS = {
    "num": 10,
    "den": 2
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1
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
exists Ran
ran, violated the contract we drafted
lucidrains/transfusion-pytorch/transfusion_pytorch/modality_processing.py
code served (permissive licence) · get_code("b7c3487f192e31b7")
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 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

torch.manual_seed(0)

# The function exists(v) simply checks if v is not None
# It takes a single parameter 'v' and returns True if v is not None, False otherwise

# Test with a non-None value
ARGS = {
    "v": 42
}
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 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
identity Ran
ran, honoured the contract we drafted
lucidrains/transfusion-pytorch/transfusion_pytorch/transfusion.py
code served (permissive licence) · get_code("f3232418205f7cbd")
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 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

torch.manual_seed(0)

# The identity function takes a single parameter 't' and returns it unchanged
# We'll provide a simple tensor as the argument
t = torch.randn(2, 4)

ARGS = {
    "t": t
}
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 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
join Ran
ran on a synthesized input
lucidrains/transfusion-pytorch/transfusion_pytorch/modality_processing.py
code served (permissive licence) · get_code("4e7ceb7d53efde9d")
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

ARGS = {
    'arr': ['hello', 'world', 'python'],
    'delimiter': ' '
}
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
precompute_freqs_cis Ran
ran, honoured the contract we drafted
VachanVY/Transfusion.torch/src/llama2c.py
code served (permissive licence) · get_code("5f447bdd807ed3c0")
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 tuple, 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

torch.manual_seed(0)

ARGS = {
    "dim": 8,
    "end": 4,
    "theta": 10000.0,
}
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 tuple, ndim 3, 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
reshape_for_broadcast Ran
ran on a synthesized input
VachanVY/Transfusion.torch/src/llama2c.py
code served (permissive licence) · get_code("df8a5213d3db1630")
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 (1, 5, 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
from torch import Tensor

torch.manual_seed(0)

# Analyze the function:
# - freqs_cis: Tensor with shape (x.shape[1], x.shape[-1])
# - x: Tensor with ndim >= 2 (assertion checks 0 <= 1 < ndim)
# - The function reshapes freqs_cis based on x's shape
# - freqs_cis.shape must equal (x.shape[1], x.shape[-1])

# Create x with ndim > 1, let's use ndim=3 (batch, seq, hidden)
# Shape: (batch=2, seq=5, hidden=4)
x = torch.randn(2, 5, 4)

# freqs_cis must have shape (x.shape[1], x.shape[-1]) = (5, 4)
freqs_cis = torch.randn(5, 4)

ARGS = {
    "freqs_cis": freqs_cis,
    "x": x,
}
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 (1, 5, 4) — shape (1, 5, 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

Also present in other papers' code

Of 11 samples lifted from this paper's linked repositories, 11 carry a function identity and 0 do not. Of the 11 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, 6 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.

FunctionAlso present inEarliest-datedOthers named
exists 27 other papers
15 dated earlier, 11 later, 1 same year, order not determinable · 3 only as an assembly brick
1810.00825 (2018-10)
Set Transformer: A Framework for Attention-based Permutation-Invariant Neural Networks
2006.15055 (2020-06)
Object-Centric Learning with Slot Attention
2010.10241 (2020-10)
BYOL works even without batch statistics
and 24 more not named here
default 21 other papers
12 dated earlier, 9 later · 1 only as an assembly brick
2006.15055 (2020-06)
Object-Centric Learning with Slot Attention
2110.00218 (2021-10)
On the Importance of Gradients for Detecting Distributional Shifts in the Wild
2309.02612 (2023-09)
Music Source Separation with Band-Split RoPE Transformer
and 18 more not named here
identity 21 other papers
8 dated earlier, 12 later, 1 undated · 2 only as an assembly brick
2011.10043 (2020-11)
Propagate Yourself: Exploring Pixel-Level Consistency for Unsupervised Visual Representation Learning
2203.08913 (2022-03)
Memorizing Transformers
2302.04761 (2023-02)
Toolformer: Language Models Can Teach Themselves to Use Tools
and 18 more not named here
divisible_by 16 other papers
8 dated earlier, 8 later · 2 only as an assembly brick
2006.07733 (2020-06)
Bootstrap your own latent: A new approach to self-supervised Learning
2010.10241 (2020-10)
BYOL works even without batch statistics
2102.06810 (2021-02)
Understanding self-supervised Learning Dynamics without Contrastive Pairs
and 13 more not named here
precompute_freqs_cis 5 other papers
4 dated earlier, 1 later · 2 only as an assembly brick
2203.15556 (2022-03)
Training Compute-Optimal Large Language Models
2307.09288 (2023-07)
Llama 2: Open Foundation and Fine-Tuned Chat Models
2309.00638 (2023-09)
Generative AI for End-to-End Limit Order Book Modelling: A Token-Level Autoregressive Generative Model of Message Flow Using a Deep State Space Network
and 2 more not named here
decode_token 2 other papers
1 dated earlier, 1 later
2005.09561 (2020-05)
Normalized Attention Without Probability Cage
ijcai2025_0370 (2025 (year only))
SEP: A General Lossless Compression Framework with Semantics Enhancement and Multi-Stream Pipelines

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 introduce Transfusion, a recipe for training a multi-modal model over discrete and continuous data. Transfusion combines the language modeling loss function (next token prediction) with diffusion to train a single transformer over mixed-modality sequences. We pretrain multiple Transfusion models up to 7B parameters from scratch on a mixture of text and image data, establishing scaling laws with respect to a variety of uni- and cross-modal benchmarks. Our experiments show that Transfusion scales significantly better than quantizing images and training a language model over discrete image tokens. By introducing modality-specific encoding and decoding layers, we can further improve the performance of Transfusion models, and even compress each image to just 16 patches. We further demonstrate that scaling our Transfusion recipe to 7B parameters and 2T multi-modal tokens produces a model that can generate images and text on a par with similar scale diffusion models and language models, reaping the benefits of both worlds.

For agents

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

get_harvested_code_for_paper("2408.11039")
get_code_for_paper("2408.11039")
have("2408.11039")

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

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

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

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

Connect an agent — have() is free.