SYNTOLOGY HomeExplorerAtlasCodeMethodologyAboutDevelopersFeedPricing
Paper · 2505.23742 · 2025

MAGREF: Masked Guidance for Any-Reference Video Generation with Subject Disentanglement

arXiv · PDF · Open in the Atlas

Code that ran

10 of 14 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; 1 honoured the contract we drafted, 2 violated it and 2 have no contract verdict; 5 failures of our instrument; 4 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/2505.23742.json · badge: /api/ran/2505.23742.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
magref-video/magref canonical (classifier label)
classifier basis not recorded on the link
10 ran · 4 no recorded run
FunctionStatusWhere it lives
basic_clean Ran
ran; our contract draft was wrong, not the code
magref-video/magref/magref/modules/tokenizers.py
pointer only (licence: Apache-2.0); the stored copy get_code serves, from ltpwy/MSCI, is pointer only (licence: NONE) · get_code("98f385d847636a3e")
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 ltpwy/MSCI, 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.

canonicalize Ran
ran; our contract draft was wrong, not the code
magref-video/magref/magref/modules/tokenizers.py
pointer only (licence: Apache-2.0); the stored copy get_code serves, from sais-fuxi/omni-video, is pointer only (licence: NONE) · get_code("1066f2140d4e9845")
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 sais-fuxi/omni-video, 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.

count_conv3d Ran
ran, honoured the contract we drafted
magref-video/magref/magref/modules/vae.py
pointer only (licence: Apache-2.0); the stored copy get_code serves, from sais-fuxi/omni-video, is pointer only (licence: NONE) · get_code("78d2ce0959095290")
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 sais-fuxi/omni-video, 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.

fp16_clamp Ran
ran, violated the contract we drafted
magref-video/magref/magref/modules/t5.py
pointer only (licence: Apache-2.0); the stored copy get_code serves, from sais-fuxi/omni-video, is pointer only (licence: NONE) · get_code("d3d53f877a9af3a3")
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 sais-fuxi/omni-video, 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.

pad_freqs Ran
ran on a synthesized input
magref-video/magref/magref/distributed/xdit_context_parallel.py
code served (permissive licence) · get_code("fc80adbc3ff1d836")
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 (7, 4, 5) 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)

# Create a small original tensor with shape (seq_len, s1, s2)
# Using distinct dimensions: seq_len=3, s1=4, s2=5
original_tensor = torch.randn(3, 4, 5, dtype=torch.float32)

# Target length should be greater than original seq_len (3)
target_len = 7

ARGS = {
    "original_tensor": original_tensor,
    "target_len": target_len,
}
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 (7, 4, 5) — shape (7, 4, 5) 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
rope_apply Ran
ran; our contract draft was wrong, not the code
magref-video/magref/magref/modules/model.py
code served (permissive licence) · get_code("1d28c4a06c930d63")
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 4, dtype family float, shape (2, 10, 4, 12) as a later run recorded it. 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, 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)

# Analyze the function:
# - x: indexed as x[i, :seq_len] and x[i, seq_len:], so batch dimension at 0
#      .size(2) and .size(3) accessed, so 4D tensor
#      reshaped to (seq_len, n, -1, 2), so shape is (batch, seq, n, c) where c is even
# - grid_sizes: .tolist() called, iterated over to get (f, h, w) tuples
#              .tolist() suggests it's a tensor
# - freqs: .split() called with 3 parts, indexed [0], [1], [2]
#         each part indexed with [:f], [:h], [:w]
#         so shape is (max_len, c) where c = c - 2*(c//3) + c//3 + c//3

batch_size = 2
n = 4  # spatial dimension from x.size(2)
c = 6  # half of x.size(3), must be divisible by 3 for split
seq_max = 10  # max sequence length for frequency table

# x: shape (batch, seq_max, n, 2*c)
# We'll use different seq_len per batch item
x = torch.randn(batch_size, seq_max, n, 2 * c, dtype=torch.float32)

# grid_sizes: tensor of shape (batch, 3) with (f, h, w) for each batch
# f*h*w should equal seq_len for each batch item
# Batch 0: f=2, h=2, w=2, seq_len=8
# Batch 1: f=2, h=3, w=1, seq_len=6
grid_sizes = torch.tensor([[2, 2, 2], [2, 3, 1]], dtype=torch.long)

# freqs: shape (seq_max, c)
# Will be split into [c - 2*(c//3), c//3, c//3] = [2, 2, 2]
freqs = torch.randn(seq_max, c, dtype=torch.float32)

ARGS = {
    "x": x,
    "grid_sizes": grid_sizes,
    "freqs": freqs,
}
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 4, dtype family float, shape (2, 10, 4, 12) — shape (2, 10, 4, 12) 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
rope_params Ran
ran, violated the contract we drafted
magref-video/magref/magref/modules/model.py
code served (permissive licence) · get_code("dc160d63c5846f4a")
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 (8, 2) as a later run recorded it. 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, 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.cuda.amp as amp

torch.manual_seed(0)

ARGS = {
    "max_seq_len": 8,
    "dim": 4,
    "theta": 10000
}
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 (8, 2) — shape (8, 2) 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
sinusoidal_embedding_1d Ran
ran; the contract check could not run (RAISES, DEP_MISSING or TIMEOUT)
magref-video/magref/magref/modules/model.py
code served (permissive licence) · get_code("e34a97853e924d88")
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 (4, 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)

# Analyze the function:
# - dim: int, must be even, used as dimension for embedding
# - position: tensor, used with .type(torch.float64), torch.outer(), and .to() operations
#   position should be 1D tensor of positions

dim = 4  # Must be even
position = torch.tensor([0, 1, 2, 3], dtype=torch.int64)

ARGS = {
    "dim": dim,
    "position": position,
}
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 (4, 4) — shape (4, 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
whitespace_clean Ran
ran; our contract draft was wrong, not the code
magref-video/magref/magref/modules/tokenizers.py
pointer only (licence: Apache-2.0); the stored copy get_code serves, from ltpwy/MSCI, is pointer only (licence: NONE) · get_code("9542161e9640b858")
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 ltpwy/MSCI, 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.

xlm_roberta_large Ran
ran on a synthesized input
magref-video/magref/magref/modules/xlm_roberta.py
code served (permissive licence) · get_code("dd27a4bda5e8824c")
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 XLMRoberta. 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)

ARGS = {
    'pretrained': False,
    'return_tokenizer': False,
    'device': 'cpu',
}
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 XLMRoberta — a XLMRoberta output has no array shape of its own; none is stated — the instrument coerces any output to an array; for a XLMRoberta 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
attention Not yet run
unverified (harvested, no recorded run)
magref-video/magref/magref/modules/attention.py
code served (permissive licence) · get_code("2659ec11ef2cea0d")
How it ran

no invocation recorded.

flash_attention Not yet run
unverified (harvested, no recorded run)
magref-video/magref/magref/modules/attention.py
code served (permissive licence) · get_code("7ea44a4680b76539")
How it ran

no invocation recorded.

pos_interpolate Not yet run
unverified (harvested, no recorded run)
magref-video/magref/magref/modules/clip.py
code served (permissive licence) · get_code("cbc3565ced3e12b6")
How it ran

no invocation recorded.

shard_model Not yet run
unverified (harvested, no recorded run)
magref-video/magref/magref/distributed/fsdp.py
code served (permissive licence) · get_code("f0b4a00c14f06595")
How it ran

no invocation recorded.

Also present in other papers' code

Of 14 samples lifted from this paper's linked repositories, 14 carry a function identity and 0 do not. Of the 14 distinct functions with an identity, 12 are also present in other papers whose code we hold (12 with at least one paper dated earlier, 2 the same month, 9 later) and 2 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
whitespace_clean 231 other papers
194 dated earlier, 1 the same month, 25 later, 10 same year, order not determinable, 1 undated · 4 only as an assembly brick
1901.07441 (2019-01)
PadChest: A large chest x-ray image dataset with multi-label annotated reports
2107.06383 (2021-07)
How Much Can CLIP Benefit Vision-and-Language Tasks?
2108.10904 (2021-08)
SimVLM: Simple Visual Language Model Pretraining with Weak Supervision
and 228 more not named here
basic_clean 218 other papers
194 dated earlier, 1 the same month, 12 later, 10 same year, order not determinable, 1 undated · 4 only as an assembly brick
1901.07441 (2019-01)
PadChest: A large chest x-ray image dataset with multi-label annotated reports
2107.06383 (2021-07)
How Much Can CLIP Benefit Vision-and-Language Tasks?
2108.10904 (2021-08)
SimVLM: Simple Visual Language Model Pretraining with Weak Supervision
and 215 more not named here
sinusoidal_embedding_1d 4 other papers
2 dated earlier, 2 later
2502.11079 (2025-02)
Phantom: Subject-Consistent Video Generation via Cross-Modal Alignment
2503.07598 (2025-03)
VACE: All-in-One Video Creation and Editing
2507.06119 (2025-07)
Omni-Video: Democratizing Unified Video Understanding and Generation
and 1 more not named here
attention 3 other papers
1 dated earlier, 2 later
2502.11079 (2025-02)
Phantom: Subject-Consistent Video Generation via Cross-Modal Alignment
2507.06119 (2025-07)
Omni-Video: Democratizing Unified Video Understanding and Generation
2602.15922 (2026-02)
World Action Models are Zero-shot Policies
flash_attention 3 other papers
2 dated earlier, 1 later
2502.11079 (2025-02)
Phantom: Subject-Consistent Video Generation via Cross-Modal Alignment
2503.07598 (2025-03)
VACE: All-in-One Video Creation and Editing
2604.18215 (2026-04)
Memorize When Needed: Decoupled Memory Control for Spatially Consistent Long-Horizon Video Generation
canonicalize 2 other papers
1 dated earlier, 1 later
2502.11079 (2025-02)
Phantom: Subject-Consistent Video Generation via Cross-Modal Alignment
2507.06119 (2025-07)
Omni-Video: Democratizing Unified Video Understanding and Generation
count_conv3d 2 other papers
1 dated earlier, 1 later
2502.11079 (2025-02)
Phantom: Subject-Consistent Video Generation via Cross-Modal Alignment
2507.06119 (2025-07)
Omni-Video: Democratizing Unified Video Understanding and Generation
fp16_clamp 2 other papers
1 dated earlier, 1 later
2502.11079 (2025-02)
Phantom: Subject-Consistent Video Generation via Cross-Modal Alignment
2507.06119 (2025-07)
Omni-Video: Democratizing Unified Video Understanding and Generation
rope_params 2 other papers
1 dated earlier, 1 later
2503.07598 (2025-03)
VACE: All-in-One Video Creation and Editing
2604.18215 (2026-04)
Memorize When Needed: Decoupled Memory Control for Spatially Consistent Long-Horizon Video Generation
pos_interpolate 1 other paper
1 dated earlier
2502.11079 (2025-02)
Phantom: Subject-Consistent Video Generation via Cross-Modal Alignment
rope_apply 1 other paper
1 dated earlier
2503.07598 (2025-03)
VACE: All-in-One Video Creation and Editing
xlm_roberta_large 1 other paper
1 dated earlier
2502.11079 (2025-02)
Phantom: Subject-Consistent Video Generation via Cross-Modal Alignment

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

We tackle the task of any-reference video generation, which aims to synthesize videos conditioned on arbitrary types and combinations of reference subjects, together with textual prompts. This task faces persistent challenges, including identity inconsistency, entanglement among multiple reference subjects, and copy-paste artifacts. To address these issues, we introduce MAGREF, a unified and effective framework for any-reference video generation. Our approach incorporates masked guidance and a subject disentanglement mechanism, enabling flexible synthesis conditioned on diverse reference images and textual prompts. Specifically, masked guidance employs a region-aware masking mechanism combined with pixel-wise channel concatenation to preserve appearance features of multiple subjects along the channel dimension. This design preserves identity consistency and maintains the capabilities of the pre-trained backbone, without requiring any architectural changes. To mitigate subject confusion, we introduce a subject disentanglement mechanism which injects the semantic values of each subject derived from the text condition into its corresponding visual region. Additionally, we establish a four-stage data pipeline to construct diverse training pairs, effectively alleviating copy-paste artifacts. Extensive experiments on a comprehensive benchmark demonstrate that MAGREF consistently outperforms existing state-of-the-art approaches, paving the way for scalable, controllable, and high-fidelity any-reference video synthesis. Code and model can be found at: https://github.com/MAGREF-Video/MAGREF

For agents

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

get_harvested_code_for_paper("2505.23742")
get_code_for_paper("2505.23742")
have("2505.23742")

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

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

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

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

Connect an agent — have() is free.