SYNTOLOGY HomeExplorerAtlasCodeMethodologyAboutDevelopersFeedPricing
Paper · 2407.19985 · 2024

Mixture of Nested Experts: Adaptive Processing of Visual Tokens

arXiv · PDF · Open in the Atlas

Code that ran

8 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, 0 violated it and 5 have no contract verdict; 2 failures of our instrument; 6 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/2407.19985.json · badge: /api/ran/2407.19985.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
usryokousha/mone-pytorch community (classifier label)
classifier basis not recorded on the link
8 ran · 6 no recorded run
FunctionStatusWhere it lives
capacity Ran
ran on a synthesized input
usryokousha/mone-pytorch/mone_pytorch/layers/routing.py
code served (permissive licence) · get_code("e7237603e96b6121")
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 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
import torch.nn as nn

torch.manual_seed(0)

ARGS = {
    "num_experts": 8,
    "num_tokens": 1024,
    "capacity_factor": 2.0,
}
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 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
drop_path Ran
ran; the contract check could not run (RAISES, DEP_MISSING or TIMEOUT)
usryokousha/mone-pytorch/mone_pytorch/layers/block.py
code served (permissive licence) · get_code("c157f5b112b3a392")
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 4, dtype family float, shape (2, 4, 3, 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
import torch.nn as nn

torch.manual_seed(0)

# Create a small tensor for drop_path
# The function uses x.shape[0] for batch dimension and x.ndim for number of dimensions
# It also calls x.new_empty() and performs element-wise operations
x = torch.randn(2, 4, 3, 5)  # batch=2, then 3 other dimensions with distinct sizes

ARGS = {
    "x": x,
    "drop_prob": 0.5,
    "training": True
}
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 4, dtype family float, shape (2, 4, 3, 5) — shape (2, 4, 3, 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
experts_choose_masked_contract Ran
ran on a synthesized input
usryokousha/mone-pytorch/mone_pytorch/layers/experts_choose_linear.py
code served (permissive licence) · get_code("3ee734d9e881f9c6")
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, 2, 6, 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)

# Define parameters
batch = 2
tokens = 3
in_features = 4
num_experts = 2
expert_out_features = 5
out_features = num_experts * expert_out_features  # 10

# Construct tensors
x = torch.randn(batch, tokens, in_features)
weight = torch.randn(out_features, in_features)
bias = torch.randn(out_features)
dispatch_mask = torch.randn(batch, tokens, num_experts, 6)  # capacity = 6

ARGS = {
    "x": x,
    "weight": weight,
    "bias": bias,
    "dispatch_mask": dispatch_mask,
    "num_experts": num_experts,
}
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, 2, 6, 5) — shape (2, 2, 6, 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
make_2tuple Ran
ran, honoured the contract we drafted
usryokousha/mone-pytorch/mone_pytorch/layers/mlp.py
code served (permissive licence) · get_code("3c04490a215299f2")
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 1, dtype family int; 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 numpy as np

torch.manual_seed(0)

# Test case 1: tuple input with length 2
test_tuple = (5, 7)

# Test case 2: integer input
test_int = 3

# We'll create ARGS with the integer case
ARGS = {
    "x": test_int
}
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 tuple, ndim 1, dtype family int — 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
named_apply Ran
ran; our contract draft was wrong, not the code
usryokousha/mone-pytorch/mone_pytorch/models/vision_transformer.py
code served (permissive licence) · get_code("dbdf6fbba8af2996")
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 NestedModule. 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 Callable

torch.manual_seed(0)

# Build a simple nested module structure
class SimpleModule(nn.Module):
    def __init__(self):
        super().__init__()
        self.linear = nn.Linear(4, 3)
        self.relu = nn.ReLU()

class NestedModule(nn.Module):
    def __init__(self):
        super().__init__()
        self.simple1 = SimpleModule()
        self.simple2 = SimpleModule()
        self.conv = nn.Conv1d(4, 3, kernel_size=1)

# Create the module
module = NestedModule()

# Create a callback function that will be applied to each module
call_log = []

def callback_fn(module, name):
    """Simple callback that logs module information"""
    call_log.append({'module': type(module).__name__, 'name': name})

# Define ARGS with all parameters for named_apply
ARGS = {
    'fn': callback_fn,
    'module': module,
    'name': '',
    'depth_first': True,
    'include_root': False
}
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 NestedModule — a NestedModule output has no array shape of its own; none is stated — the instrument coerces any output to an array; for a NestedModule 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
nested_linear_expand Ran
ran on a synthesized input
usryokousha/mone-pytorch/mone_pytorch/layers/nested_experts_linear.py
code served (permissive licence) · get_code("d038c3fd8fece745")
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, 1, 6) as a later run recorded it. The image it ran in was not recorded. If your copy returns the same type, ndim and shape on these inputs, it matched what we observed; nothing here checks that. It does NOT mean the output is correct: nothing has compared it to the paper.

import torch
import torch.nn.functional as F

torch.manual_seed(0)

# Analyze the function:
# - x: torch.Tensor, reshaped to (batch_seq, in_dim), then padded
# - w: torch.Tensor, shape (out_dim, in_dim) used in F.linear
# - expert_mask: torch.Tensor, compared with integers 0 to num_experts-1
# - b: Optional[torch.Tensor], passed to F.linear
# - num_experts: int, loop range and bit shift operations

# Dimensions:
# - in_dim: derived from w.shape[1]
# - out_dim: derived from w.shape[0]
# - batch_seq: product of all dims except last in x

batch_seq = 2
in_dim = 4
out_dim = 6
num_experts = 4

# x: shape (batch, seq, in_dim) -> will be reshaped to (batch_seq, in_dim)
x = torch.randn(2, 1, in_dim)

# w: shape (out_dim, in_dim)
w = torch.randn(out_dim, in_dim)

# expert_mask: shape (batch_seq,) with values in [0, num_experts)
expert_mask = torch.tensor([0, 1], dtype=torch.long)

# b: optional bias, shape (out_dim,)
b = torch.randn(out_dim)

ARGS = {
    'x': x,
    'w': w,
    'expert_mask': expert_mask,
    'b': b,
    'num_experts': num_experts
}
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, 1, 6) — shape (2, 1, 6) 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
normalize Ran
ran on a synthesized input
usryokousha/mone-pytorch/mone_pytorch/layers/routing.py
code served (permissive licence) · get_code("9233bff4190475e0")
How it ran

Ran in Syntology's sandbox on this synthesized input (drafted by a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API) and returned Tensor, ndim 2, dtype family float, shape (2, 4) as a later run recorded it. The image it ran in was not recorded. If your copy returns the same type, ndim and shape on these inputs, it matched what we observed; nothing here checks that. It does NOT mean the output is correct: nothing has compared it to the paper.

import torch

torch.manual_seed(0)

# Create a small tensor with shape (2, 4) - batch size 2, dimension 4
x = torch.randn(2, 4)

# axis parameter - normalize along the last dimension
axis = -1

# eps parameter - small constant for numerical stability
eps = 1e-06

ARGS = {
    "x": x,
    "axis": axis,
    "eps": eps,
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
torch — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type Tensor, ndim 2, dtype family float, shape (2, 4) — shape (2, 4) as a later run recorded it
dtype family
int means an integer dtype; float means any other dtype the instrument saw, bool and complex included (fixture_check.py records only these two families)
Environment
image not recorded; re-verify against syntology-harvest-sandbox:v5-deps; not recorded for this sample: the harness installs a cuda-to-cpu shim (cuda_shim.py) before every sample and no run records whether a sample needed it; seed: none by the harness; any seed is in the setup block
scatter_experts Ran
ran on a synthesized input
usryokousha/mone-pytorch/mone_pytorch/layers/experts_choose_linear.py
code served (permissive licence) · get_code("ae348fbef238474c")
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, 6, 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)

# Construct arguments for scatter_experts
B = 2  # batch size
E = 3  # number of experts
C = 4  # number of channels/capacity
D = 5  # feature dimension
num_tokens = 6  # T - total number of tokens

# x_expert: (B, E, C, D) - expert outputs
x_expert = torch.randn(B, E, C, D)

# expert_indices: (B, C, E) - indices mapping experts to token positions
# Values should be in range [0, num_tokens) to be valid scatter indices
expert_indices = torch.randint(0, num_tokens, (B, C, E))

ARGS = {
    "x_expert": x_expert,
    "expert_indices": expert_indices,
    "num_tokens": num_tokens,
}
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, 6, 5) — shape (2, 6, 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
combine Not yet run
unverified (harvested, no recorded run)
usryokousha/mone-pytorch/mone_pytorch/layers/expert_linear.py
code served (permissive licence) · get_code("a76eb25a07812d98")
How it ran

no invocation recorded.

compute_capacity_distribution Not yet run
unverified (harvested, no recorded run)
usryokousha/mone-pytorch/mone_pytorch/layers/routing.py
code served (permissive licence) · get_code("791ac5ddd6e8c4b3")
How it ran

no invocation recorded.

dispatch Not yet run
unverified (harvested, no recorded run)
usryokousha/mone-pytorch/mone_pytorch/layers/expert_linear.py
code served (permissive licence) · get_code("42df7ba0cf9e47df")
How it ran

no invocation recorded.

gather_experts Not yet run
unverified (harvested, no recorded run)
usryokousha/mone-pytorch/mone_pytorch/layers/experts_choose_linear.py
code served (permissive licence) · get_code("65bb5b2b0e53a855")
How it ran

no invocation recorded.

nested_linear_contract Not yet run
unverified (harvested, no recorded run)
usryokousha/mone-pytorch/mone_pytorch/layers/nested_experts_linear.py
code served (permissive licence) · get_code("65105560b1984ac3")
How it ran

no invocation recorded.

nested_mlp Not yet run
unverified (harvested, no recorded run)
usryokousha/mone-pytorch/mone_pytorch/layers/nested_experts_linear.py
code served (permissive licence) · get_code("665512f1103be8ea")
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, 3 are also present in other papers whose code we hold (3 with at least one paper dated earlier, 2 the same month, 3 later) and 11 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
make_2tuple 20 other papers
6 dated earlier, 3 the same month, 10 later, 1 undated · 1 only as an assembly brick
2010.11929 (2020-10)
An Image is Worth 16x16 Words: Transformers for Image Recognition at Scale
2304.07193 (2023-04)
DINOv2: Learning Robust Visual Features without Supervision
2312.02366 (2023-12)
Evaluating General Purpose Vision Foundation Models for Medical Image Analysis: An Experimental Study of DINOv2 on Radiology Benchmarks
and 17 more not named here
drop_path 18 other papers
6 dated earlier, 3 the same month, 8 later, 1 undated · 2 only as an assembly brick
2010.11929 (2020-10)
An Image is Worth 16x16 Words: Transformers for Image Recognition at Scale
2304.07193 (2023-04)
DINOv2: Learning Robust Visual Features without Supervision
2312.02366 (2023-12)
Evaluating General Purpose Vision Foundation Models for Medical Image Analysis: An Experimental Study of DINOv2 on Radiology Benchmarks
and 15 more not named here
named_apply 3 other papers
1 dated earlier, 2 later
2402.12138 (2024-02)
Perceiving Longer Sequences With Bi-Directional Cross-Attention Transformers
2410.23623 (2024-10)
On Learning Multi-Modal Forgery Representation for Diffusion Generated Video Detection
2412.10569 (2024-12)
Learning to Merge Tokens via Decoupled Embedding for Efficient Vision Transformers

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

The visual medium (images and videos) naturally contains a large amount of information redundancy, thereby providing a great opportunity for leveraging efficiency in processing. While Vision Transformer (ViT) based models scale effectively to large data regimes, they fail to capitalize on this inherent redundancy, leading to higher computational costs. Mixture of Experts (MoE) networks demonstrate scalability while maintaining same inference-time costs, but they come with a larger parameter footprint. We present Mixture of Nested Experts (MoNE), which utilizes a nested structure for experts, wherein individual experts fall on an increasing compute-accuracy curve. Given a compute budget, MoNE learns to dynamically choose tokens in a priority order, and thus redundant tokens are processed through cheaper nested experts. Using this framework, we achieve equivalent performance as the baseline models, while reducing inference time compute by over two-fold. We validate our approach on standard image and video datasets - ImageNet-21K, Kinetics400, and Something-Something-v2. We further highlight MoNE$'$s adaptability by showcasing its ability to maintain strong performance across different inference-time compute budgets on videos, using only a single trained model.

For agents

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

get_harvested_code_for_paper("2407.19985")
get_code_for_paper("2407.19985")
have("2407.19985")

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

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

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

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

Connect an agent — have() is free.