SYNTOLOGY HomeExplorerAtlasCodeMethodologyAboutDevelopersFeedPricing
Paper · openreview_ky9RAeT6ie

MOSAIC: Unlocking Over 30× Context Length for Diffusion LLMs Inference via Global Memory Planning and Dynamic Peak Taming

Jiawei Zhang, Sheng Chen, Liang Zheng, Tao Xie, Bowen Shi, Yitao Hu, Wenxin Li, Dezhi Ran, Ruofan Li, Keqiu Li, Zhengchao Wang, Guotao Yang, and 1 more

OpenReview · Open in the Atlas

Code that ran

4 of 7 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, 0 violated it and 4 have no contract verdict; 0 failures of our instrument; 3 no recorded run), measured 2026-11-24; 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/openreview_ky9RAeT6ie.json · badge: /api/ran/openreview_ky9RAeT6ie.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
flashserve/Mosaic canonical (classifier label)
classifier basis: census
4 ran · 3 no recorded run
FunctionStatusWhere it lives
analyze_components_from_timeline Ran
ran on a synthesized input
flashserve/Mosaic/diffusion_tools/online_searcher.py
code served (permissive licence) · get_code("d520af9aed67a9bb")
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)

# Construct a valid timeline list that the function expects
# Each element should be a dict with 'node_name' and 'total_memory_mb' keys

timeline = [
    {'node_name': 'embedding_layer', 'total_memory_mb': 10.5},
    {'node_name': 'attention_fixed', 'total_memory_mb': 15.3},
    {'node_name': 'mlp_layer_1', 'total_memory_mb': 25.7},
    {'node_name': 'cache_buffer', 'total_memory_mb': 18.2},
    {'node_name': 'logits_computation', 'total_memory_mb': 22.1},
    {'node_name': 'moe_router', 'total_memory_mb': 12.9},
    {'node_name': 'x_gate_layer', 'total_memory_mb': 8.4},
    {'node_name': 'x_up_layer', 'total_memory_mb': 16.8},
    {'node_name': 'x_mlp_layer', 'total_memory_mb': 19.5},
    {'node_name': 'barrier_sync', 'total_memory_mb': 9.1},
    {'node_name': 'final_norm', 'total_memory_mb': 11.2},
]

ARGS = {
    'timeline': timeline
}
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
create_model_config_from_pretrained_config Ran
ran on a synthesized input
flashserve/Mosaic/vllm_add_llada_moe/llada_moe_model.py
code served (permissive licence) · get_code("d4e1ce2e4240d652")
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 MockConfig. 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)

# The function simply returns the config parameter as-is
# So we need to provide a valid config object
# Based on HuggingFace conventions, this is typically a dict or a config class

class MockConfig:
    """Minimal config class that mimics HF config behavior."""
    def __init__(self):
        self.hidden_size = 768
        self.num_hidden_layers = 12
        self.num_attention_heads = 12
        self.intermediate_size = 3072
        self.hidden_act = "gelu"
        self.hidden_dropout_prob = 0.1
        self.attention_probs_dropout_prob = 0.1
        self.max_position_embeddings = 512
        self.type_vocab_size = 2
        self.initializer_range = 0.02
        self.layer_norm_eps = 1e-12
        self.vocab_size = 30522

# Create a config instance
config = MockConfig()

ARGS = {
    "config": config
}
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 MockConfig — a MockConfig output has no array shape of its own; none is stated — the instrument coerces any output to an array; for a MockConfig 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
search_optimal_config_online Ran
ran on a synthesized input
flashserve/Mosaic/diffusion_tools/online_searcher.py
code served (permissive licence) · get_code("c7dc22af1acdd4c0")
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
import torch.nn as nn
from typing import Dict, Any, List

torch.manual_seed(0)

# Mock the MemoryAnalyzer and graph builder functions since they're from vllm
class MockMemoryAnalyzer:
    def __init__(self, graph):
        self.graph = graph
    
    def analyze(self):
        # Return a realistic memory analysis structure
        return {
            'reuse_plan': {
                '_total_buffer_size_bytes': 2_000_000_000  # 2GB
            },
            'memory_timeline': [
                {
                    'node_name': 'fixed_layer_1',
                    'total_memory_mb': 150.0
                },
                {
                    'node_name': 'mlp_up_projection',
                    'total_memory_mb': 250.0
                },
                {
                    'node_name': 'cache_buffer',
                    'total_memory_mb': 180.0
                },
                {
                    'node_name': 'logits_computation',
                    'total_memory_mb': 320.0
                },
                {
                    'node_name': 'fixed_layer_2',
                    'total_memory_mb': 140.0
                }
            ]
        }

class MockGraph:
    def __init__(self, P, O, **kwargs):
        self.P = P
        self.O = O
        self.config = kwargs

def mock_define_llada_block_graph(P, O):
    return MockGraph(P, O)

def mock_define_llada_block_graph_chunkwise(P, O, chunk_logits=False, chunk_mlp=False, 
                                            num_chunks_logits=1, num_chunks_mlp=1):
    return MockGraph(P, O, chunk_logits=chunk_logits, chunk_mlp=chunk_mlp,
                     num_chunks_logits=num_chunks_logits, num_chunks_mlp=num_chunks_mlp)

def mock_define_dream_block_graph(P, O):
    return MockGraph(P, O)

def mock_define_dream_block_graph_chunkwise(P, O, chunk_logits=False, chunk_mlp=False,
                                            num_chunks_logits=1, num_chunks_mlp=1):
    return MockGraph(P, O, chunk_logits=chunk_logits, chunk_mlp=chunk_mlp,
                     num_chunks_logits=num_chunks_logits, num_chunks_mlp=num_chunks_mlp)

def mock_define_llada_moe_block_graph(P, O):
    return MockGraph(P, O)

def mock_define_llada_moe_block_graph_chunkwise(P, O, chunk_logits=False, chunk_moe=False,
                                                num_chunks_logits=1, num_chunks_moe=1):
    return MockGraph(P, O, chunk_logits=chunk_logits, chunk_moe=chunk_moe,
                     num_chunks_logits=num_chunks_logits, num_chunks_moe=num_chunks_moe)

# Monkey-patch the imports in the module namespace
import sys
class MockVllmModule:
    class v1:
        class worker:
            class graph_builder:
                MemoryAnalyzer = MockMemoryAnalyzer
                define_llada_block_graph = staticmethod(mock_define_llada_block_graph)
                define_llada_block_graph_chunkwise = staticmethod(mock_define_llada_block_graph_chunkwise)
                define_dream_block_graph = staticmethod(mock_define_dream_block_graph)
                define_dream_block_graph_chunkwise = staticmethod(mock_define_dream_block_graph_chunkwise)
                define_llada_moe_block_graph = staticmethod(mock_define_llada_moe_block_graph)
                define_llada_moe_block_graph_chunkwise = staticmethod(mock_define_llada_moe_block_graph_chunkwise)

sys.modules['vllm'] = MockVllmModule()
sys.modules['vllm.v1'] = MockVllmModule.v1
sys.modules['vllm.v1.worker'] = MockVllmModule.v1.worker
sys.modules['vllm.v1.worker.graph_builder'] = MockVllmModule.v1.worker.graph_builder

ARGS = {
    'P': 128,  # Prompt token count
    'O': 64,   # Output token count
    'pool_size': 4_000_000_000,  # 4GB activation pool
    'model_name': 'llada'  # Standard LLaDA model
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
torch, vllm — 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
search_optimal_config_online Ran
ran on a synthesized input
flashserve/Mosaic/diffusion_tools/online_searcher_moe_specific.py
code served (permissive licence) · get_code("d4e11af290635439")
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
import torch.nn as nn
from typing import Dict, Any, List
import logging

logging.basicConfig(level=logging.INFO)

# Mock the graph builder module components
class MockGraph:
    """Minimal mock graph for MemoryAnalyzer"""
    def __init__(self):
        self.nodes = []

def mock_define_llada_block_graph(P: int, O: int) -> MockGraph:
    """Mock graph definition for llada"""
    return MockGraph()

def mock_define_llada_block_graph_chunkwise(P: int, O: int, chunk_logits: bool = False, 
                                            chunk_mlp: bool = False, num_chunks_logits: int = 1,
                                            num_chunks_mlp: int = 1) -> MockGraph:
    """Mock graph definition for llada with chunking"""
    return MockGraph()

def mock_define_dream_block_graph(P: int, O: int) -> MockGraph:
    """Mock graph definition for dream"""
    return MockGraph()

def mock_define_dream_block_graph_chunkwise(P: int, O: int, chunk_logits: bool = False,
                                            chunk_mlp: bool = False, num_chunks_logits: int = 1,
                                            num_chunks_mlp: int = 1) -> MockGraph:
    """Mock graph definition for dream with chunking"""
    return MockGraph()

def mock_define_llada_moe_block_graph(P: int, O: int) -> MockGraph:
    """Mock graph definition for llada-moe"""
    return MockGraph()

def mock_define_llada_moe_block_graph_chunkwise(P: int, O: int, chunk_logits: bool = False,
                                                chunk_moe: bool = False, num_chunks_logits: int = 1,
                                                num_chunks_moe: int = 1) -> MockGraph:
    """Mock graph definition for llada-moe with chunking"""
    return MockGraph()

class MockMemoryAnalyzer:
    """Mock MemoryAnalyzer that returns minimal valid memory analysis"""
    def __init__(self, graph: MockGraph):
        self.graph = graph
    
    def analyze(self) -> Dict[str, Any]:
        """Return a minimal valid analysis result"""
        return {
            'reuse_plan': {
                '_total_buffer_size_bytes': 500 * 1024 * 1024  # 500 MB
            },
            'memory_timeline': [
                {'node_name': 'fixed_layer_1', 'total_memory_mb': 100},
                {'node_name': 'mlp_up', 'total_memory_mb': 150},
                {'node_name': 'logits_proj', 'total_memory_mb': 120},
            ]
        }

# Monkey patch the imports
import sys
from types import ModuleType

vllm_mock = ModuleType('vllm')
vllm_v1_mock = ModuleType('vllm.v1')
vllm_v1_worker_mock = ModuleType('vllm.v1.worker')
graph_builder_mock = ModuleType('vllm.v1.worker.graph_builder')

graph_builder_mock.MemoryAnalyzer = MockMemoryAnalyzer
graph_builder_mock.define_llada_block_graph = mock_define_llada_block_graph
graph_builder_mock.define_llada_block_graph_chunkwise = mock_define_llada_block_graph_chunkwise
graph_builder_mock.define_dream_block_graph = mock_define_dream_block_graph
graph_builder_mock.define_dream_block_graph_chunkwise = mock_define_dream_block_graph_chunkwise
graph_builder_mock.define_llada_moe_block_graph = mock_define_llada_moe_block_graph
graph_builder_mock.define_llada_moe_block_graph_chunkwise = mock_define_llada_moe_block_graph_chunkwise

vllm_v1_worker_mock.graph_builder = graph_builder_mock
vllm_v1_mock.worker = vllm_v1_worker_mock
vllm_mock.v1 = vllm_v1_mock

sys.modules['vllm'] = vllm_mock
sys.modules['vllm.v1'] = vllm_v1_mock
sys.modules['vllm.v1.worker'] = vllm_v1_worker_mock
sys.modules['vllm.v1.worker.graph_builder'] = graph_builder_mock

# Build arguments
ARGS = {
    'P': 128,  # Prompt token count
    'O': 32,   # Output token count
    'pool_size': 2 * 1024 * 1024 * 1024,  # 2 GB activation pool
    'model_name': 'llada'  # Model name
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
torch, vllm — 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
advance_step_flashattn Not yet run
unverified (harvested, no recorded run)
flashserve/Mosaic/vllm/_custom_ops.py
code served (permissive licence) · get_code("f30c23ac5c22014e")
How it ran

no invocation recorded.

convert_vertical_slash_indexes Not yet run
unverified (harvested, no recorded run)
flashserve/Mosaic/vllm/_custom_ops.py
code served (permissive licence) · get_code("89f4968f0bf052d7")
How it ran

no invocation recorded.

convert_vertical_slash_indexes_mergehead Not yet run
unverified (harvested, no recorded run)
flashserve/Mosaic/vllm/_custom_ops.py
code served (permissive licence) · get_code("8c9d2bd2211f1bda")
How it ran

no invocation recorded.

Also present in other papers' code

Of 7 samples lifted from this paper's linked repositories, 7 carry a function identity and 0 do not. Of the 7 distinct functions with an identity, 2 are also present in other papers whose code we hold (0 with at least one paper dated earlier, 0 the same month, 0 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
convert_vertical_slash_indexes 1 other paper
1 same year, order not determinable
2606.00516 (2026-06)
Threshold-Based Exclusive Batching for LLM Inference
convert_vertical_slash_indexes_mergehead 1 other paper
1 same year, order not determinable
2606.00516 (2026-06)
Threshold-Based Exclusive Batching for LLM Inference

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-24.

Repositories linked to this paper

Some links come from the archived Papers with Code dataset (CC BY-SA 4.0): attribution and licence.

Abstract

Diffusion-based large language models (dLLMs) have emerged as a promising alternative to autoregressive models, leveraging simultaneous denoising to enable global planning and iterative refinement. These properties make dLLMs attractive for long-context generation. However, deploying dLLMs faces a prohibitive memory barrier, as existing inference systems are inefficient for the diffusion paradigm. We observe that current inference systems are misaligned with dLLMs. Unlike autoregressive models, whose memory footprint is dominated by the KV-Cache, dLLMs are bottlenecked by transient activations rematerialized per step. Moreover, generic memory reuse mechanisms lack the global visibility to handle dynamic memory peaks of dLLMs, which alternate between logits and feed-forward networks. To address these challenges, we present MOSAIC, a memory-efficient inference system that shifts dLLM execution from local, static management to a global, dynamic paradigm. MOSAIC integrates (i) a mask-only logits kernel eliminating redundant activation materialization, (ii) a lazy chunking optimizer using online heuristics to tame dynamic memory peaks, and (iii) a global memory manager leveraging virtual addressing to mitigate memory fragmentation. Evaluations show that MOSAIC reduces the memory peak-to-average ratio by 2.71× on average and increases the maximum inference sequence length on identical hardware by 15.30-32.34×. Crucially, MOSAIC is training-free and preserves exact model outputs, while reducing end-to-end latency by 2.5%-55.4%. Our code is publicly available at https: //github.com/flashserve/Mosaic.

For agents

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

get_harvested_code_for_paper("openreview_ky9RAeT6ie")
get_code_for_paper("openreview_ky9RAeT6ie")
have("openreview_ky9RAeT6ie")

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

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

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

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

Connect an agent — have() is free.