SYNTOLOGY HomeExplorerAtlasCodeMethodologyAboutDevelopersFeedPricing
Paper · 2107.02575 · ICCV · 2021

Contrastive Multimodal Fusion with TupleInfoNCE

Shanghang Zhang, Qingnan Fan, Hao Dong, Thomas Funkhouser, Li Yi, Yunze Liu

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 (0 of them constructed an object rather than computing a result; 0 honoured the contract we drafted, 0 violated it and 3 have no contract verdict; 0 failures of our instrument; 4 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/2107.02575.json · badge: /api/ran/2107.02575.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
hoi4d/TupleInfoNCE canonical (classifier label)
classifier basis: census
3 ran · 4 no recorded run
FunctionStatusWhere it lives
get_best_checkpoint Ran
ran on a synthesized input
hoi4d/TupleInfoNCE/src/utils.py
code served (permissive licence) · get_code("dfa3a56c484da6ab")
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
import tempfile
import pandas as pd

# Create a temporary directory for the checkpoint
temp_dir = tempfile.mkdtemp()

# Create a logs.csv file with sample data
logs_data = {
    'epoch': [1, 2, 3, 4, 5],
    'mIoU_test': [0.45, 0.52, 0.58, 0.61, 0.59],
    'loss': [1.2, 0.9, 0.7, 0.6, 0.65]
}
df = pd.DataFrame(logs_data)
log_file = os.path.join(temp_dir, 'logs.csv')
df.to_csv(log_file, index=False)

# Create a dummy checkpoint file at the best epoch (epoch 4 has max mIoU_test of 0.61)
best_epoch = 4
ckpt_path = os.path.join(temp_dir, f'ckpt_epoch_{best_epoch}.pth')
with open(ckpt_path, 'w') as f:
    f.write('dummy checkpoint')

ARGS = {
    'ckpt_dir': temp_dir,
    'key': 'mIoU_test'
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
pandas — 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
get_optimizer Ran
ran on a synthesized input
hoi4d/TupleInfoNCE/pretrain.py
code served (permissive licence) · get_code("5f64bc843defdf1d")
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 SGD. 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
import torch.optim

torch.manual_seed(0)

# Create a simple model
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()

# Create args object with required attributes
class Args:
    def __init__(self, optimizer, lr, weight_decay, momentum):
        self.optimizer = optimizer
        self.lr = lr
        self.weight_decay = weight_decay
        self.momentum = momentum

ARGS = {
    'args': Args(optimizer='SGD', lr=0.01, weight_decay=1e-4, momentum=0.9),
    'model': model
}
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 SGD — a SGD output has no array shape of its own; none is stated — the instrument coerces any output to an array; for a SGD 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
validate_sampling Ran
ran on a synthesized input
hoi4d/TupleInfoNCE/search_para.py
code served (permissive licence) · get_code("0e04eede81ffcfae")
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 float, ndim 0, dtype family float, shape () as a later run recorded it. 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, 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
import random

torch.manual_seed(0)

# Create a simple model that takes 3 inputs and returns logits and features
class SimpleModel(nn.Module):
    def __init__(self, feat_dim=8):
        super().__init__()
        self.feat_dim = feat_dim
        self.conv1 = nn.Conv2d(3, 16, kernel_size=1)
        self.conv2 = nn.Conv2d(1, 16, kernel_size=1)
        self.conv3 = nn.Conv2d(1, 16, kernel_size=1)
        self.fc = nn.Linear(16 * 4 * 4, feat_dim)
    
    def forward(self, image, depth, new):
        # Process image
        x_img = self.conv1(image) if image.abs().sum() > 0 else torch.zeros(image.shape[0], 16, 4, 4)
        # Process depth
        x_depth = self.conv2(depth) if depth.abs().sum() > 0 else torch.zeros(depth.shape[0], 16, 4, 4)
        # Process new
        x_new = self.conv3(new) if new.abs().sum() > 0 else torch.zeros(new.shape[0], 16, 4, 4)
        
        # Combine
        x = x_img + x_depth + x_new
        x = x.view(x.shape[0], -1)
        feat = self.fc(x)
        logits = feat
        return logits, feat

# Create dataset and loader
class SimpleDataset:
    def __init__(self, split='val'):
        self.split = split
    
    def __len__(self):
        return 2
    
    def __getitem__(self, idx):
        return {
            'image': torch.randn(3, 4, 4),
            'depth': torch.randn(1, 4, 4),
            'new': torch.randn(1, 4, 4)
        }

class SimpleDataLoader:
    def __init__(self, dataset):
        self.dataset = dataset
    
    def __iter__(self):
        for i in range(len(self.dataset)):
            batch = self.dataset[i]
            yield {
                'image': batch['image'].unsqueeze(0),
                'depth': batch['depth'].unsqueeze(0),
                'new': batch['new'].unsqueeze(0)
            }

# Instantiate models
model = SimpleModel(feat_dim=8)
modelk = SimpleModel(feat_dim=8)

# Create dataset and loader
dataset = SimpleDataset(split='val')
valid_loader = SimpleDataLoader(dataset)

device = 'cpu'

ARGS = {
    'model': model,
    'modelk': modelk,
    'valid_loader': valid_loader,
    'device': device
}
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 float, 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
get_preprocessor Not yet run
unverified (harvested, no recorded run)
hoi4d/TupleInfoNCE/src/preprocessing.py
code served (permissive licence) · get_code("353ebc0e90de147f")
How it ran

no invocation recorded.

load_ckpt Not yet run
unverified (harvested, no recorded run)
hoi4d/TupleInfoNCE/src/utils.py
code served (permissive licence) · get_code("ecf4aca51d0a4cf5")
How it ran

no invocation recorded.

train_one_epoch Not yet run
unverified (harvested, no recorded run)
hoi4d/TupleInfoNCE/search_para.py
code served (permissive licence) · get_code("dc73f8421e04655c")
How it ran

no invocation recorded.

validate Not yet run
unverified (harvested, no recorded run)
hoi4d/TupleInfoNCE/search_para.py
code served (permissive licence) · get_code("ab8055f9e891a387")
How it ran

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, 1 are also present in other papers whose code we hold (0 with at least one paper dated earlier, 0 the same month, 1 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.

FunctionAlso present inEarliest-datedOthers named
get_optimizer 1 other paper
1 later
2304.08028 (2023-04)
MMANet: Margin-aware Distillation and Modality-aware Regularization for Incomplete Multimodal Learning

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

This paper proposes a method for representation learning of multimodal data using contrastive losses. A traditional approach is to contrast different modalities to learn the information shared among them. However, that approach could fail to learn the complementary synergies between modalities that might be useful for downstream tasks. Another approach is to concatenate all the modalities into a tuple and then contrast positive and negative tuple correspondences. However, that approach could consider only the stronger modalities while ignoring the weaker ones. To address these issues, we propose a novel contrastive learning objective, TupleInfoNCE. It contrasts tuples based not only on positive and negative correspondences, but also by composing new negative tuples using modalities describing different scenes. Training with these additional negatives encourages the learning model to examine the correspondences among modalities in the same tuple, ensuring that weak modalities are not ignored. We provide a theoretical justification based on mutual-information for why this approach works, and we propose a sample optimization algorithm to generate positive and negative samples to maximize training efficacy. We find that TupleInfoNCE significantly outperforms previous state of the arts on three different downstream tasks.

For agents

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

get_harvested_code_for_paper("2107.02575")
get_code_for_paper("2107.02575")
have("2107.02575")

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

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

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

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

Connect an agent — have() is free.