SYNTOLOGY HomeExplorerAtlasCodeMethodologyAboutDevelopersFeedPricing
Paper · 2503.01980 · CVPR · 2025

Recurrence-Enhanced Vision-and-Language Transformers for Robust Multimodal Document Retrieval

Rita Cucchiara, Marcella Cornia, Lorenzo Baraldi, Davide Caffagni, Sara Sarto

arXiv · PDF · Open in the Atlas

Code that ran

4 of 6 samples (functions and classes) lifted from this paper's linked repositories executed on a synthesized input in Syntology's jail (3 of them constructed an object rather than computing a result; 1 honoured the contract we drafted, 0 violated it and 3 have no contract verdict; 0 failures of our instrument; 2 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/2503.01980.json · badge: /api/ran/2503.01980.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
aimagelab/ReT community
Papers with Code archive
4 ran · 2 no recorded run
FunctionStatusWhere it lives
RetCell Ran
ran on a synthesized input · constructed an object; no result was computed
aimagelab/ReT/src/models/ret/modeling_ret.py
code served (permissive licence) · get_code("77b0dfaabd33bb62")
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 an instance of its own class, RetCell: the run constructed the object and did not call it, so no result was computed. 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 transformers import PretrainedConfig

torch.manual_seed(0)

class RetConfig(PretrainedConfig):
    model_type = 'ret'
    is_composition = False

    def __init__(self, text_config=None, vision_config=None, is_text_frozen=True, is_vision_frozen=True, late_proj_output_size=128, layer_strategy='clip_vit_b', use_pooler_features=False, num_queries=32, hidden_size=1024, dropout_p=0.05, attention_dropout=0.05, activation_fn='gelu', input_gate_bias_prior=0.0, forget_gate_bias_prior=0.0, use_tanh=False, **kwargs):
        super().__init__(**kwargs)
        self.text_config = text_config
        self.vision_config = vision_config
        self.is_text_frozen = is_text_frozen
        self.is_vision_frozen = is_vision_frozen
        self.late_proj_output_size = late_proj_output_size
        self.layer_strategy = layer_strategy
        self.use_pooler_features = use_pooler_features
        self.num_queries = num_queries
        self.hidden_size = hidden_size
        self.intermediate_size = hidden_size * 4
        self.num_attention_heads = hidden_size // 64
        self.dropout_p = dropout_p
        self.attention_dropout = attention_dropout
        self.activation_fn = activation_fn
        self.input_gate_bias_prior = input_gate_bias_prior
        self.forget_gate_bias_prior = forget_gate_bias_prior
        self.use_tanh = use_tanh

config = RetConfig(
    text_config=None,
    vision_config=None,
    is_text_frozen=True,
    is_vision_frozen=True,
    late_proj_output_size=128,
    layer_strategy='clip_vit_b',
    use_pooler_features=False,
    num_queries=4,
    hidden_size=64,
    dropout_p=0.05,
    attention_dropout=0.05,
    activation_fn='gelu',
    input_gate_bias_prior=0.0,
    forget_gate_bias_prior=0.0,
    use_tanh=False
)

ARGS = {
    'config': config
}
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 RetCell — the run constructed an instance of its own class and did not call it; no shape is stated — the instrument coerces any output to an array; for a RetCell 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
RetConfig Ran
ran on a synthesized input · constructed an object; no result was computed
aimagelab/ReT/src/models/ret/modeling_ret.py
code served (permissive licence) · get_code("efd2c64c80d9da04")
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 an instance of its own class, RetConfig: the run constructed the object and did not call it, so no result was computed. 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 transformers import PretrainedConfig

torch.manual_seed(0)

class MockTextConfig(PretrainedConfig):
    model_type = "bert"
    
    def __init__(self, **kwargs):
        super().__init__(**kwargs)
        self.hidden_size = 768
        self.vocab_size = 30522
        self.num_hidden_layers = 12
        self.num_attention_heads = 12
        self.intermediate_size = 3072

class MockVisionConfig(PretrainedConfig):
    model_type = "vit"
    
    def __init__(self, **kwargs):
        super().__init__(**kwargs)
        self.hidden_size = 768
        self.num_hidden_layers = 12
        self.num_attention_heads = 12
        self.intermediate_size = 3072
        self.image_size = 224
        self.patch_size = 16

text_config = MockTextConfig()
vision_config = MockVisionConfig()

ARGS = {
    'text_config': text_config,
    'vision_config': vision_config,
    'is_text_frozen': True,
    'is_vision_frozen': True,
    'late_proj_output_size': 128,
    'layer_strategy': 'clip_vit_b',
    'use_pooler_features': False,
    'num_queries': 32,
    'hidden_size': 1024,
    'dropout_p': 0.05,
    'attention_dropout': 0.05,
    'activation_fn': 'gelu',
    'input_gate_bias_prior': 0.0,
    'forget_gate_bias_prior': 0.0,
    'use_tanh': False,
}
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 RetConfig — the run constructed an instance of its own class and did not call it; no shape is stated — the instrument coerces any output to an array; for a RetConfig 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
RetModelOutput Ran
ran on a synthesized input · constructed an object; no result was computed
aimagelab/ReT/src/models/ret/modeling_ret.py
code served (permissive licence) · get_code("42f58d719a525dfd")
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 an instance of its own class, RetModelOutput: the run constructed the object and did not call it, so no result was computed. 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 dataclasses import dataclass
from typing import List, Sequence, Optional, Tuple
from transformers.modeling_outputs import ModelOutput

torch.manual_seed(0)

@dataclass
class RetModelOutput(ModelOutput):
    text_last_hidden_state: Optional[torch.Tensor] = None
    text_pooler_output: Optional[torch.Tensor] = None
    vision_last_hidden_state: Optional[torch.Tensor] = None
    vision_pooler_output: Optional[torch.Tensor] = None
    ret_features: Optional[torch.Tensor] = None

ARGS = {
    "text_last_hidden_state": torch.randn(2, 4),
    "text_pooler_output": torch.randn(2, 3),
    "vision_last_hidden_state": torch.randn(2, 5),
    "vision_pooler_output": torch.randn(2, 6),
    "ret_features": torch.randn(2, 7),
}
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 RetModelOutput — the run constructed an instance of its own class and did not call it; no shape is stated — the instrument coerces any output to an array; for a RetModelOutput 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
get_additive_attn_mask Ran
ran, honoured the contract we drafted
aimagelab/ReT/src/models/ret/modeling_ret.py
code served (permissive licence) · get_code("6f2879b3a1509c9a")
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 binary attention mask tensor
# Shape: (2, 4) - batch size 2, sequence length 4
binary_attn_mask = torch.tensor([
    [True, True, False, False],
    [True, False, False, True]
], dtype=torch.bool)

# Use float32 as the dtype parameter
dtype = torch.float32

ARGS = {
    "binary_attn_mask": binary_attn_mask,
    "dtype": dtype
}
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
RetLayerStrategy Not yet run
unverified (harvested, no recorded run)
aimagelab/ReT/src/models/ret/modeling_ret.py
code served (permissive licence) · get_code("f12e1adead40d190")
How it ran

no invocation recorded.

RetModel Not yet run
unverified (harvested, no recorded run)
aimagelab/ReT/src/models/ret/modeling_ret.py
code served (permissive licence) · get_code("a61ac2ba2a2004ff")
How it ran

no invocation recorded.

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

Cross-modal retrieval is gaining increasing efficacy and interest from the research community, thanks to large-scale training, novel architectural and learning designs, and its application in LLMs and multimodal LLMs. In this paper, we move a step forward and design an approach that allows for multimodal queries -composed of both an image and a text -and can search within collections of multimodal documents, where images and text are interleaved. Our model, ReT, employs multi-level representations extracted from different layers of both visual and textual backbones, both at the query and document side. To allow for multi-level and cross-modal understanding and feature extraction, ReT employs a novel Transformer-based recurrent cell that integrates both textual and visual features at different layers, and leverages sigmoidal gates inspired by the classical design of LSTMs. Extensive experiments on M2KR and M-BEIR benchmarks show that ReT achieves state-of-the-art performance across diverse settings. Our source code and trained models are publicly available at: https://github.com/aimagelab/ReT.

For agents

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

get_harvested_code_for_paper("2503.01980")
get_code_for_paper("2503.01980")
have("2503.01980")

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

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

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

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

Connect an agent — have() is free.