SYNTOLOGY HomeExplorerAtlasCodeMethodologyAboutDevelopersFeedPricing
Paper · 2412.11959 · ICLR · 2025

Gramian Multimodal Representation Learning and Alignment

Giordano Cicchetti, Eleonora Grassucci, Luigi Sigillo, Danilo Comminiello

arXiv · PDF · Open in the Atlas

Code that ran

7 of 12 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; 3 honoured the contract we drafted, 1 violated it and 0 have no contract verdict; 3 failures of our instrument; 5 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/2412.11959.json · badge: /api/ran/2412.11959.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
ispamm/GRAM canonical (classifier label)
classifier basis: census
7 ran · 5 no recorded run
FunctionStatusWhere it lives
compute_max_audio_sample_num_for_position_embeddings Ran
ran, honoured the contract we drafted
ispamm/GRAM/utils/args.py
code served (permissive licence) · get_code("0122d74913461cf9")
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.

class DataConfig:
    def __init__(self):
        self.train = [
            {'audio_sample_num': 2},
            {'audio_sample_num': 3},
        ]
        self.val = [
            {'audio_sample_num': 1},
            {'audio_sample_num': 2},
        ]
        self.concatenated_nums = 4

ARGS = {
    'data_cfg': DataConfig()
}
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
compute_max_vision_sample_num_for_position_embeddings Ran
ran, honoured the contract we drafted
ispamm/GRAM/utils/args.py
code served (permissive licence) · get_code("30fd4a1a3eedb19c")
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

class DataConfig:
    def __init__(self, train, val, concatenated_nums):
        self.train = train
        self.val = val
        self.concatenated_nums = concatenated_nums

ARGS = {
    'data_cfg': DataConfig(
        train=[
            {'vision_sample_num': 2},
            {'vision_sample_num': 3},
        ],
        val=[
            {'vision_sample_num': 1},
        ],
        concatenated_nums=4
    )
}
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
disabled_train Ran
ran, violated the contract we drafted
ispamm/GRAM/model/general_module.py
code served (permissive licence) · get_code("4cb732f513d69dfd")
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 SimpleModel. 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)

class SimpleModel(nn.Module):
    def __init__(self):
        super().__init__()
        self.linear = nn.Linear(4, 3)
    
    def forward(self, x):
        return self.linear(x)

model = SimpleModel()

ARGS = {
    "self": model,
    "mode": 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 SimpleModel — a SimpleModel output has no array shape of its own; none is stated — the instrument coerces any output to an array; for a SimpleModel 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
execCmd Ran
ran; our contract draft was wrong, not the code
ispamm/GRAM/utils/offline_process_data.py
code served (permissive licence) · get_code("77a45c1e515dbe2e")
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 str. 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 os

def execCmd(cmd):
    r = os.popen(cmd)
    text = r.read()
    r.close()
    return text

# The function takes a single parameter 'cmd' which is a string command to execute
# We'll provide a simple, safe command that doesn't require file I/O or network access

ARGS = {
    "cmd": "echo 'Hello World'"
}
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 str — a str output has no array shape of its own; none is stated — the instrument coerces any output to an array; for a str 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
gelu Ran
ran, honoured the contract we drafted
ispamm/GRAM/model/general_module.py
pointer only (licence: MIT); the stored copy get_code serves, from tanmay1618/text_to_sql_bert, is pointer only (licence: NONE) · get_code("fdc64f4c72036ae4")
How it ran

The body of this sample is withheld: this paper's link allows the body inline (MIT), but get_code serves the stored copy, first harvested from tanmay1618/text_to_sql_bert, 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. A run is recorded.

load_from_pretrained_dir Ran
ran; our contract draft was wrong, not the code
ispamm/GRAM/utils/build_model.py
code served (permissive licence) · get_code("7d297bdebd282cba")
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 os
import torch
import tempfile
import shutil

torch.manual_seed(0)

# Create a temporary directory structure with checkpoint files
temp_dir = tempfile.mkdtemp()
checkpoint_dir = os.path.join(temp_dir, 'pretrain')
os.makedirs(checkpoint_dir)

# Create checkpoint-5 directory with pytorch_model.bin
checkpoint_5_dir = os.path.join(checkpoint_dir, 'checkpoint-5')
os.makedirs(checkpoint_5_dir)

# Create a dummy checkpoint dictionary
dummy_checkpoint = {
    'model_state_dict': torch.randn(2, 4),
    'optimizer_state_dict': torch.randn(3, 5),
}

# Save the checkpoint
pytorch_model_path = os.path.join(checkpoint_5_dir, 'pytorch_model.bin')
torch.save(dummy_checkpoint, pytorch_model_path)

# Create another checkpoint for testing fallback
checkpoint_3_dir = os.path.join(checkpoint_dir, 'checkpoint-3')
os.makedirs(checkpoint_3_dir)
torch.save(dummy_checkpoint, os.path.join(checkpoint_3_dir, 'pytorch_model.bin'))

# Create a stand-in class for run_cfg
class RunConfig:
    def __init__(self, pretrain_dir):
        self.pretrain_dir = pretrain_dir

# Create a stand-in class for args
class Args:
    def __init__(self, run_cfg):
        self.run_cfg = run_cfg

# Create the args object
run_cfg = RunConfig(pretrain_dir=checkpoint_dir)
args_obj = Args(run_cfg=run_cfg)

# Define a mock LOGGER to avoid errors
class MockLogger:
    def info(self, msg):
        pass

import sys
class LoggerModule:
    pass

logger_module = LoggerModule()
logger_module.info = lambda msg: None

# Inject LOGGER into the module namespace where load_from_pretrained_dir will be called
import builtins
if not hasattr(builtins, 'LOGGER'):
    class SimpleLogger:
        def info(self, msg):
            pass
    builtins.LOGGER = SimpleLogger()

ARGS = {
    'args': args_obj
}
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
parse_with_config Ran
ran; our contract draft was wrong, not the code
ispamm/GRAM/utils/args.py
code served (permissive licence) · get_code("15b65a6a6e8fd954")
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 EasyDict. 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 os
import sys
import json
import tempfile
from easydict import EasyDict as edict
import argparse

# Create temporary directory for config files
temp_dir = tempfile.mkdtemp()

# Create mock config files
run_cfg_default = {
    "use_ddp": True,
    "bf16": False,
    "fp16": False,
    "batch_size": 32
}

model_cfg_default = {
    "vision_encoder_type": "vit",
    "pool_video": True,
    "inherit_keys": ["vision_encoder_type", "pool_video"],
    "checkpointing": False,
    "concatenated_nums": 2
}

# Write default config files
run_cfg_path = os.path.join(temp_dir, "run_cfg_default.json")
model_cfg_path = os.path.join(temp_dir, "model_cfg_default.json")

with open(run_cfg_path, 'w') as f:
    json.dump(run_cfg_default, f)

with open(model_cfg_path, 'w') as f:
    json.dump(model_cfg_default, f)

# Create main config file
file_cfg = {
    "run_cfg": {"default": run_cfg_path},
    "model_cfg": {"default": model_cfg_path},
    "data_cfg": {
        "train": [
            {
                "vision_sample_num": 4,
                "audio_sample_num": 2,
                "batch_size": 16,
                "epoch": 10,
                "steps": None,
                "task": "multimodal"
            }
        ],
        "val": [
            {
                "vision_sample_num": 2,
                "audio_sample_num": 1,
                "batch_size": 8,
                "task": "multimodal"
            }
        ],
        "concatenated_nums": 2
    }
}

config_path = os.path.join(temp_dir, "config.json")
with open(config_path, 'w') as f:
    json.dump(file_cfg, f)

# Create a mock parser
parser = argparse.ArgumentParser()
parser.add_argument('--config', type=str, default=config_path)
parser.add_argument('--pretrain_dir', type=str, default=None)
parser.add_argument('--local_rank', type=int, default=0)
parser.add_argument('--train_epoch', type=int, default=None)
parser.add_argument('--train_steps', type=int, default=None)
parser.add_argument('--train_vision_sample_num', type=int, default=None)
parser.add_argument('--train_batch_size', type=int, default=None)
parser.add_argument('--train_task', type=str, default=None)
parser.add_argument('--test_batch_size', type=int, default=None)
parser.add_argument('--test_vision_sample_num', type=int, default=None)
parser.add_argument('--test_task', type=str, default=None)
parser.add_argument('--vision_transforms', type=str, default=None)

ARGS = {
    'parser': parser
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
easydict — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type EasyDict — a EasyDict output has no array shape of its own; none is stated — the instrument coerces any output to an array; for a EasyDict 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_list Not yet run
unverified (harvested, no recorded run)
ispamm/GRAM/utils/distributed.py
code served (permissive licence) · get_code("eee800bfe0a47a9f")
How it ran

no invocation recorded.

all_gather_with_grad Not yet run
unverified (harvested, no recorded run)
ispamm/GRAM/utils/distributed.py
code served (permissive licence) · get_code("0ec9fc2025c16f65")
How it ran

no invocation recorded.

build_optimizer Not yet run
unverified (harvested, no recorded run)
ispamm/GRAM/utils/build_optimizer.py
code served (permissive licence) · get_code("cc4ffe92873b4ee6")
How it ran

no invocation recorded.

concat_all_gather Not yet run
unverified (harvested, no recorded run)
ispamm/GRAM/utils/distributed.py
code served (permissive licence) · get_code("73cecca9f3575f09")
How it ran

no invocation recorded.

load_from_resume Not yet run
unverified (harvested, no recorded run)
ispamm/GRAM/utils/build_model.py
code served (permissive licence) · get_code("647f671c01bde501")
How it ran

no invocation recorded.

Also present in other papers' code

Of 12 samples lifted from this paper's linked repositories, 12 carry a function identity and 0 do not. Of the 12 distinct functions with an identity, 12 are also present in other papers whose code we hold (12 with at least one paper dated earlier, 3 the same month, 4 later) and 0 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
gelu 198 other papers
178 dated earlier, 17 later, 3 same year, order not determinable · 32 only as an assembly brick
1408.5882 (2014-08)
Convolutional Neural Networks for Sentence Classification
1810.04805 (2018-10)
BERT: Pre-training of Deep Bidirectional Transformers for Language Understanding
1901.10125 (2019-01)
Glyce: Glyph-vectors for Chinese Character Representations
and 195 more not named here
disabled_train 173 other papers
146 dated earlier, 2 the same month, 17 later, 8 same year, order not determinable · 5 only as an assembly brick
2012.09841 (2020-12)
Taming Transformers for High-Resolution Image Synthesis
2102.05379 (2021-02)
Argmax Flows and Multinomial Diffusion: Learning Categorical Distributions
2104.07652 (2021-04)
Geometry-Free View Synthesis: Transformers and no 3D Priors
and 170 more not named here
concat_all_gather 138 other papers
120 dated earlier, 1 the same month, 14 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
74 dated earlier, 1 the same month, 12 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
all_gather_list 1 other paper
1 dated earlier
2305.18500 (2023-05)
VAST: A Vision-Audio-Subtitle-Text Omni-Modality Foundation Model and Dataset
build_optimizer 1 other paper
1 dated earlier
2305.18500 (2023-05)
VAST: A Vision-Audio-Subtitle-Text Omni-Modality Foundation Model and Dataset
compute_max_audio_sample_num_for_position_embeddings 1 other paper
1 dated earlier
2305.18500 (2023-05)
VAST: A Vision-Audio-Subtitle-Text Omni-Modality Foundation Model and Dataset
compute_max_vision_sample_num_for_position_embeddings 1 other paper
1 dated earlier
2305.18500 (2023-05)
VAST: A Vision-Audio-Subtitle-Text Omni-Modality Foundation Model and Dataset
execCmd 1 other paper
1 dated earlier
2305.18500 (2023-05)
VAST: A Vision-Audio-Subtitle-Text Omni-Modality Foundation Model and Dataset
load_from_pretrained_dir 1 other paper
1 dated earlier
2305.18500 (2023-05)
VAST: A Vision-Audio-Subtitle-Text Omni-Modality Foundation Model and Dataset
load_from_resume 1 other paper
1 dated earlier
2305.18500 (2023-05)
VAST: A Vision-Audio-Subtitle-Text Omni-Modality Foundation Model and Dataset
parse_with_config 1 other paper
1 dated earlier
2305.18500 (2023-05)
VAST: A Vision-Audio-Subtitle-Text Omni-Modality Foundation Model and Dataset

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

Human perception integrates multiple modalities-such as vision, hearing, and language-into a unified understanding of the surrounding reality. While recent multimodal models have achieved significant progress by aligning pairs of modalities via contrastive learning, their solutions are unsuitable when scaling to multiple modalities. These models typically align each modality to a designated anchor without ensuring the alignment of all modalities with each other, leading to suboptimal performance in tasks requiring a joint understanding of multiple modalities. In this paper, we structurally rethink the pairwise conventional approach to multimodal learning and we present the novel Gramian Representation Alignment Measure (GRAM), which overcomes the above-mentioned limitations. GRAM learns and then aligns n modalities directly in the higher-dimensional space in which modality embeddings lie by minimizing the Gramian volume of the k-dimensional parallelotope spanned by the modality vectors, ensuring the geometric alignment of all modalities simultaneously. GRAM can replace cosine similarity in any downstream method, holding for 2 to n modalities and providing more meaningful alignment with respect to previous similarity measures. The novel GRAM-based contrastive loss function enhances the alignment of multimodal models in the higher-dimensional embedding space, leading to new stateof-the-art performance in downstream tasks such as video-audio-text retrieval and audio-video classification. The project page, the code and the pretrained models are available at https://ispamm.github.io/GRAM/.

For agents

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

get_harvested_code_for_paper("2412.11959")
get_code_for_paper("2412.11959")
have("2412.11959")

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

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

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

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

Connect an agent — have() is free.