SYNTOLOGY HomeExplorerAtlasCodeMethodologyAboutDevelopersFeedPricing
Paper · 2409.05395 · EMNLP · 2024

Shaking Up VLMs: Comparing Transformers and Structured State Space Models for Vision & Language Modeling

Alessandro Suglia, Arash Eshghi, Oliver Lemon, Malvina Nikandrou, Georgios Pantazopoulos

arXiv · PDF · Open in the Atlas

Code that ran

6 of 6 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, 1 violated it and 0 have no contract verdict; 4 failures of our instrument; 0 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/2409.05395.json · badge: /api/ran/2409.05395.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
gpantaz/vl_mamba canonical (classifier label)
classifier basis: census
6 ran · 0 no recorded run
FunctionStatusWhere it lives
ai2d_score Ran
ran, honoured the contract we drafted
gpantaz/vl_mamba/src/vl_mamba/evaluation/evaluate_ai2d.py
code served (permissive licence) · get_code("82940dc88a089dff")
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 string

# The function takes a prediction string and an answer integer
# The answer is used as an index into string.ascii_uppercase
# The prediction is compared to the character at that index

ARGS = {
    "prediction": "A",
    "answer": 0
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
none outside the standard library — 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
build_tokenizer Ran
ran; our contract draft was wrong, not the code
gpantaz/vl_mamba/src/vl_mamba/train_hf.py
code served (permissive licence) · get_code("b6f70d524bb042b8")
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 MockTokenizer. 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 transformers
from dataclasses import dataclass, field
from typing import Literal, Union

@dataclass
class ModelArguments:
    """Model arguments."""
    model_name: str = field(default='state-spaces/mamba-790m')
    vision_encoder_name: Literal['openai/clip-vit-large-patch14-336', 'timm/eva02_large_patch14_clip_224', 'timm/eva02_large_patch14_clip_336'] = field(default='timm/eva02_large_patch14_clip_336')
    select_layer: int = field(default=-2)
    select_feature: str = field(default='patch')
    train_only_visual_embeddings: bool = field(default=True)
    image_size: int = field(default=224)
    patch_size: int = field(default=16)
    num_channels: int = field(default=3)
    tokenizer_name: str = field(default='EleutherAI/gpt-neox-20b')
    tokenizer_truncation_side: Literal['right', 'left'] = field(default='right')
    tokenizer_padding_side: Literal['right', 'left'] = field(default='right')
    tokenizer_add_special_tokens: bool = field(default=True)
    model_max_length: int = field(default=100)
    pixel_based: bool = field(default=True)
    extrapolate_image_size: int | None = field(default=None)

class MockTokenizer:
    """Mock tokenizer that mimics transformers.AutoTokenizer interface."""
    def __init__(self):
        self.eos_token = None
        self.pad_token = None
        self.model_max_length = None
        self.truncation_side = None
        self.padding_side = None

def mock_auto_tokenizer_from_pretrained(model_name: str):
    """Mock AutoTokenizer.from_pretrained to avoid network calls."""
    return MockTokenizer()

# Monkey patch to avoid actual model downloads
transformers.AutoTokenizer.from_pretrained = staticmethod(mock_auto_tokenizer_from_pretrained)

# Create ModelArguments instance
model_args = ModelArguments(
    model_name='state-spaces/mamba-790m',
    vision_encoder_name='timm/eva02_large_patch14_clip_336',
    select_layer=-2,
    select_feature='patch',
    train_only_visual_embeddings=True,
    image_size=224,
    patch_size=16,
    num_channels=3,
    tokenizer_name='EleutherAI/gpt-neox-20b',
    tokenizer_truncation_side='right',
    tokenizer_padding_side='right',
    tokenizer_add_special_tokens=True,
    model_max_length=100,
    pixel_based=True,
    extrapolate_image_size=None
)

ARGS = {
    'model_args': model_args
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
torch, transformers — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type MockTokenizer — a MockTokenizer output has no array shape of its own; none is stated — the instrument coerces any output to an array; for a MockTokenizer 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
build_tokenizer Ran
ran; our contract draft was wrong, not the code
gpantaz/vl_mamba/src/vl_mamba/evaluation/base_evaluator.py
code served (permissive licence) · get_code("6f151d425fafa70f")
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 MockTokenizer. 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 dataclasses import dataclass, field
from typing import Any, Literal
import transformers

torch.manual_seed(0)

@dataclass
class BaseModelArguments:
    """Base Model arguments."""
    model_name: str = field(default='state-spaces/mamba-790m')
    cross_attention_config: str = field(default='configs/model/mamba-790m_layer_interval4.json')
    vision_encoder_name: Literal['openai/clip-vit-large-patch14-336', 'timm/eva02_large_patch14_clip_224', 'timm/eva02_large_patch14_clip_336'] = field(default='timm/eva02_large_patch14_clip_336')
    select_layer: int = field(default=-2)
    select_feature: str = field(default='patch')
    train_only_visual_embeddings: bool = field(default=True)
    image_size: int = field(default=336)
    extrapolate_image_size: int | None = field(default=None)
    patch_size: int = field(default=14)
    num_channels: int = field(default=3)
    tokenizer_name: str = field(default='EleutherAI/gpt-neox-20b')
    tokenizer_truncation_side: Literal['right', 'left'] = field(default='right')
    tokenizer_padding_side: Literal['right', 'left'] = field(default='right')
    tokenizer_add_special_tokens: bool = field(default=True)
    model_max_length: int = field(default=100)
    pixel_based: bool = field(default=False)

class MockTokenizer:
    """Minimal mock tokenizer for testing."""
    def __init__(self):
        self.eos_token = None
        self.pad_token = None
        self.model_max_length = 512
        self.truncation_side = 'right'
        self.padding_side = 'right'

# Create mock AutoTokenizer.from_pretrained
original_from_pretrained = transformers.AutoTokenizer.from_pretrained

def mock_from_pretrained(model_name):
    return MockTokenizer()

transformers.AutoTokenizer.from_pretrained = staticmethod(mock_from_pretrained)

# Build the BaseModelArguments instance
model_args = BaseModelArguments(
    model_name='state-spaces/mamba-790m',
    cross_attention_config='configs/model/mamba-790m_layer_interval4.json',
    vision_encoder_name='timm/eva02_large_patch14_clip_336',
    select_layer=-2,
    select_feature='patch',
    train_only_visual_embeddings=True,
    image_size=336,
    extrapolate_image_size=None,
    patch_size=14,
    num_channels=3,
    tokenizer_name='EleutherAI/gpt-neox-20b',
    tokenizer_truncation_side='right',
    tokenizer_padding_side='right',
    tokenizer_add_special_tokens=True,
    model_max_length=100,
    pixel_based=False
)

ARGS = {
    'model_args': model_args
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
torch, transformers — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type MockTokenizer — a MockTokenizer output has no array shape of its own; none is stated — the instrument coerces any output to an array; for a MockTokenizer 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
compute_metrics Ran
ran; our contract draft was wrong, not the code
gpantaz/vl_mamba/src/vl_mamba/evaluation/evaluate_ai2d.py
code served (permissive licence) · get_code("b67b817d3b006d55")
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 string
from typing import Any, Literal

# Construct test data for compute_metrics
# The function expects:
# - pred_list: list[str] - predictions (single characters)
# - label_list: list[str] - labels (indices as strings or single characters)

# Looking at ai2d_score, it expects:
# - prediction: str (a single character like 'A', 'B', etc.)
# - answer: str (an index or character that maps to ascii_uppercase)

# The function uses:
# - zip(pred_list, label_list, strict=False)
# - ai2d_score(prediction, answer) for each pair
# - len(pred_list)

# ai2d_score maps answer (assumed to be an int as string or direct index) to a character
# Then compares with prediction

# Create sample predictions and labels
pred_list = ['A', 'B', 'C', 'A']
label_list = [0, 1, 2, 0]  # These will be converted to 'A', 'B', 'C', 'A' by index_map

ARGS = {
    'pred_list': pred_list,
    'label_list': label_list,
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
loguru — 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
compute_metrics Ran
ran; our contract draft was wrong, not the code
gpantaz/vl_mamba/src/vl_mamba/evaluation/evaluate_gqa.py
code served (permissive licence) · get_code("ee5eb0333993e5fa")
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 numpy as np

# Set random seed for reproducibility
torch.manual_seed(0)

# Construct valid arguments for compute_metrics function
pred_list = [
    "paris",
    "london",
    "berlin",
    "tokyo"
]

label_list = [
    "PARIS",
    "LONDON",
    "Berlin",
    "TOKYO"
]

ARGS = {
    "pred_list": pred_list,
    "label_list": label_list
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
loguru, numpy, 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
gqa_score Ran
ran, violated the contract we drafted
gpantaz/vl_mamba/src/vl_mamba/evaluation/evaluate_gqa.py
code served (permissive licence) · get_code("01e4d5c3706acc57")
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 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)

ARGS = {
    "prediction": "The capital of France is Paris",
    "answer": "the capital of france is paris",
}
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 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

Also present in other papers' code

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

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

This study explores replacing Transformers in Visual Language Models (VLMs) with Mamba, a recent structured state space model (SSM) that demonstrates promising performance in sequence modeling. We test models up to 3B parameters under controlled conditions, showing that Mamba-based VLMs outperforms Transformers-based VLMs in captioning, question answering, and reading comprehension. However, we find that Transformers achieve greater performance in visual grounding and the performance gap widens with scale. We explore two hypotheses to explain this phenomenon: 1) the effect of task-agnostic visual encoding on the updates of the hidden states, and 2) the difficulty in performing visual grounding from the perspective of in-context multimodal retrieval. Our results indicate that a task-aware encoding yields minimal performance gains on grounding, however, Transformers significantly outperform Mamba at incontext multimodal retrieval. Overall, Mamba shows promising performance on tasks where the correct output relies on a summary of the image but struggles when retrieval of explicit information from the context is required 1 . Visual Question Answering What color is the toy the dog is holding? Yellow. Which clock is a heart? A.

For agents

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

get_harvested_code_for_paper("2409.05395")
get_code_for_paper("2409.05395")
have("2409.05395")

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

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

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

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

Connect an agent — have() is free.