SYNTOLOGY HomeExplorerAtlasCodeMethodologyAboutDevelopersFeedPricing
Paper · 2403.02991 · CVPR · 2024

MADTP: Multimodal Alignment-Guided Dynamic Token Pruning for Accelerating Vision-Language Transformer

Jiwen Lu, Tao Chen, Yansong Tang, Peng Ye, Chong Yu, Jianjian Cao, Shengze Li

arXiv · PDF · Open in the Atlas

Code that ran

3 of 7 samples (functions and classes) lifted from this paper's linked repositories executed on a synthesized input in Syntology's jail (2 of them constructed an object rather than computing a result; 0 honoured the contract we drafted, 0 violated it and 2 have no contract verdict; 1 failure 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/2403.02991.json · badge: /api/ran/2403.02991.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
double125/madtp canonical (classifier label)
classifier basis: census
1 ran · 4 no recorded run
double125/MADTP community
Papers with Code archive
2 ran · 0 no recorded run
FunctionStatusWhere it lives
Query_model Ran
ran on a synthesized input · constructed an object; no result was computed
double125/MADTP/models/utils.py
code served (permissive licence) · get_code("4452c423028ca1a4")
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, Query_model: the run constructed the object and did not call it, so no result was computed. 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 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 torch import nn
import math

torch.manual_seed(0)

# Define ARGS dict with all parameters for Query_model
ARGS = {
    'ft_dim': 4,
    'sd_dim': 3,
    'temperature': 1.0,
    'att_func_type': 'softmax',
    'pool_type': 'sum',
    'map_func': 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 Query_model — 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 Query_model 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
Sparsemax Ran
ran on a synthesized input · constructed an object; no result was computed
double125/MADTP/models/utils.py
code served (permissive licence) · get_code("84a5f885901512fc")
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, Sparsemax: the run constructed the object and did not call it, so no result was computed. 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 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 torch import nn

torch.manual_seed(0)

# The Sparsemax class takes one parameter: dim
# dim is an optional integer that defaults to None
# We'll test with a specific dimension value

ARGS = {
    'dim': -1
}
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 Sparsemax — 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 Sparsemax 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
itm_eval Ran
ran; the contract check could not run (RAISES, DEP_MISSING or TIMEOUT)
double125/madtp/compress_retrieval_clip_dtp.py
code served (permissive licence) · get_code("c7f85279d772ea19")
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 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 numpy as np
import torch

torch.manual_seed(0)

# scores_i2t: shape (num_images, num_texts) - similarity scores from images to texts
# Each row is scores for one image against all texts
scores_i2t = np.random.rand(2, 4).astype(np.float32)

# scores_t2i: shape (num_texts, num_images) - similarity scores from texts to images
# Each row is scores for one text against all images
scores_t2i = np.random.rand(4, 2).astype(np.float32)

# txt2img: dict mapping text index to image index
# For each text, which image is the correct match
txt2img = {
    0: 0,
    1: 1,
    2: 0,
    3: 1
}

# img2txt: dict mapping image index to list of text indices
# For each image, which texts are valid matches
img2txt = {
    0: [0, 2],
    1: [1, 3]
}

ARGS = {
    'scores_i2t': scores_i2t,
    'scores_t2i': scores_t2i,
    'txt2img': txt2img,
    'img2txt': img2txt
}
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 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
all_gather_with_grad Not yet run
unverified (harvested, no recorded run)
double125/madtp/models/blip_retrieval.py
code served (permissive licence) · get_code("0ec9fc2025c16f65")
How it ran

no invocation recorded.

build_model Not yet run
unverified (harvested, no recorded run)
double125/madtp/clip/model.py
code served (permissive licence) · get_code("d1807c35f4bb06d9")
How it ran

no invocation recorded.

concat_all_gather Not yet run
unverified (harvested, no recorded run)
double125/madtp/clip/model.py
code served (permissive licence) · get_code("73cecca9f3575f09")
How it ran

no invocation recorded.

rsetattr Not yet run
unverified (harvested, no recorded run)
double125/madtp/models/blip_nlvr.py
pointer only (licence: Apache-2.0); the stored copy get_code serves, from DBO-DKFZ/uncertainty-benchmark, is pointer only (licence: NONE) · get_code("f9de4cdd8a624801")
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 DBO-DKFZ/uncertainty-benchmark, 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. 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, 5 are also present in other papers whose code we hold (5 with at least one paper dated earlier, 2 the same month, 4 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
concat_all_gather 138 other papers
104 dated earlier, 2 the same month, 29 later, 3 same year, order not determinable · 33 only as an assembly brick
1710.09412 (2017-10)
mixup: BEYOND EMPIRICAL RISK MINIMIZATION
1905.04899 (2019-05)
CutMix: Regularization Strategy to Train Strong Classifiers with Localizable Features
1905.12794 (2019-05)
Fashion IQ: A New Dataset Towards Retrieving Images by Natural Language Feedback
and 135 more not named here
all_gather_with_grad 91 other papers
48 dated earlier, 4 the same month, 35 later, 4 same year, order not determinable · 2 only as an assembly brick
2206.02967 (2022-06)
Masked Unsupervised Self-training for Label-free Image Classification
2210.08773 (2022-10)
Plug-and-Play VQA: Zero-shot VQA by Conjoining Large Pretrained Models with Zero Training
2302.06605 (2023-02)
UniAdapter: Unified Parameter-Efficient Transfer Learning for Cross-modal Modeling
and 88 more not named here
itm_eval 13 other papers
11 dated earlier, 2 later
2107.07651 (2021-07)
Align before Fuse: Vision and Language Representation Learning with Momentum Distillation
2202.10401 (2022-02)
Vision-Language Pre-Training with Triple Contrastive Learning
2206.00621 (2022-06)
Cross-View Language Modeling: Towards Unified Cross-Lingual Cross-Modal Pre-training
and 10 more not named here
rsetattr 8 other papers
5 dated earlier, 3 later
2203.04036 (2022-03)
StyleHEAT: One-Shot High-Resolution Editable Talking Face Generation via Pre-trained StyleGAN
2212.04501 (2022-12)
Learning Video Representations from Large Language Models
2305.13417 (2023-05)
VISIT: Visualizing and Interpreting the Semantic Information Flow of Transformers
and 5 more not named here
Sparsemax
brick of this paper's assembly: helper
1 other paper
1 dated earlier · 1 only as an assembly brick
2303.14865 (2023-03)
Revisiting Multimodal Representation in Contrastive Learning: From Patch and Token Embeddings to Finite Discrete Tokens

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

Vision-Language Transformers (VLTs) have shown great success recently, but are meanwhile accompanied by heavy computation costs, where a major reason can be attributed to the large number of visual and language tokens. Existing token pruning research for compressing VLTs mainly follows a single-modality-based scheme yet ignores the critical role of aligning different modalities for guiding the token pruning process, causing the important tokens for one modality to be falsely pruned in another modality branch. Meanwhile, existing VLT pruning works also lack the flexibility to dynamically compress each layer based on different input samples. To this end, we propose a novel framework named Multimodal Alignment-Guided Dynamic Token Pruning (MADTP) for accelerating various VLTs. Specifically, we first introduce a well-designed Multi-modality Alignment Guidance (MAG) module that can align features of the same semantic concept from different modalities, to ensure the pruned tokens are less important for all modalities. We further design a novel Dynamic Token Pruning (DTP) module, which can adaptively adjust the token compression ratio in each layer based on different input instances. Extensive experiments on various benchmarks demonstrate that MADTP significantly reduces the computational complexity of kinds of multimodal models while preserving competitive performance. Notably, when applied to the BLIP model in the NLVR2 dataset, MADTP can reduce the GFLOPs by 80% with less than 4% performance degradation. The code is available at https://github.com/double125/MADTP.

For agents

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

get_harvested_code_for_paper("2403.02991")
get_code_for_paper("2403.02991")
have("2403.02991")

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

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

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

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

Connect an agent — have() is free.