SYNTOLOGY HomeExplorerAtlasCodeMethodologyAboutDevelopersFeedPricing
Paper · 2204.13001 · 2022

Relevance-based Margin for Contrastively-trained Video Retrieval Models

arXiv · PDF · Open in the Atlas

Code that ran

4 of 5 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, 0 violated it and 0 have no contract verdict; 1 failure of our instrument; 1 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/2204.13001.json · badge: /api/ran/2204.13001.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
aranciokov/relevancemargin-icmr22 canonical (classifier label)
classifier basis: classifier_2025
4 ran · 1 no recorded run
FunctionStatusWhere it lives
calculate_mAP Ran
ran, honoured the contract we drafted
aranciokov/relevancemargin-icmr22/src/evaluation/mAP.py
code served (permissive licence) · get_code("9ae403a06155097d")
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 float64, 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 numpy as np

# Create small similarity matrix (NxM where N=2, M=3)
sim_mat = np.array([
    [0.9, 0.7, 0.3],
    [0.8, 0.5, 0.6]
], dtype=np.float32)

# Create relevancy matrix (NxM, same shape as sim_mat)
# Binary matrix indicating which items are relevant
relevancy_matrix = np.array([
    [1, 0, 1],
    [1, 1, 0]
], dtype=np.int32)

ARGS = {
    'sim_mat': sim_mat,
    'relevancy_matrix': relevancy_matrix
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
numpy — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type float64, 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_relevance_verb Ran
ran, honoured the contract we drafted
aranciokov/relevancemargin-icmr22/src/train/train_jpose_tripletRelBased.py
code served (permissive licence) · get_code("6c009f73fd0d3f9e")
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 1, dtype family float, shape (2,) 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)

# Analyzing the function:
# get_relevance_verb takes x_verbs and y_verbs
# It zips them together and calls relevance on pairs
# relevance expects either lists or single values (handles both with isinstance check)
# The function returns a tensor of relevance scores

# x_verbs and y_verbs should be iterables of the same length
# Each element can be either a list or a single value (verb identifier)

x_verbs = [
    [1, 2, 3],      # list of verbs
    5                # single verb
]

y_verbs = [
    [1, 2, 4],      # list of verbs with some overlap
    5                # single verb (same as x)
]

ARGS = {
    "x_verbs": x_verbs,
    "y_verbs": y_verbs
}
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 1, dtype family float, shape (2,) — shape (2,) 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_relevances Ran
ran, honoured the contract we drafted
aranciokov/relevancemargin-icmr22/src/train/train_jpose_tripletRelBased.py
code served (permissive licence) · get_code("7173bd40cab0c090")
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 1, dtype family float, shape (2,) 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 as th

th.manual_seed(0)

# The function expects two parameters:
# - x_classes: a list of tuples/lists where each element is (verbs, nouns)
# - y_classes: a list of tuples/lists where each element is (verbs, nouns)
# 
# Each verb and noun can be either a single item or a list of items.
# The function computes IoU between verb sets and noun sets.

# Create sample class data with distinct sizes
# Using lists to represent verbs and nouns (could be strings, ints, etc.)

x_classes = [
    ([1, 2], [10, 11]),           # First sample: verbs=[1,2], nouns=[10,11]
    ([2, 3], [11, 12])            # Second sample: verbs=[2,3], nouns=[11,12]
]

y_classes = [
    ([1, 2, 4], [10, 11, 13]),    # First sample: verbs=[1,2,4], nouns=[10,11,13]
    ([2, 3, 5], [11, 12, 14])     # Second sample: verbs=[2,3,5], nouns=[11,12,14]
]

ARGS = {
    "x_classes": x_classes,
    "y_classes": y_classes
}
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 1, dtype family float, shape (2,) — shape (2,) 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
relevance Ran
ran; our contract draft was wrong, not the code
aranciokov/relevancemargin-icmr22/src/train/train_jpose_tripletRelBased.py
code served (permissive licence) · get_code("5c8ddea96a126303")
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. 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 numpy as np

torch.manual_seed(0)

# Analyzing the function:
# - v_i, v_j: used with set(), len(), intersection(), union()
#   These should be iterables (lists/sets) of verbs
# - N_i, N_j: used with set(), len(), intersection(), union()
#   These should be iterables (lists/sets) of nouns

# Create small lists of verb and noun identifiers
v_i = [1, 2, 3]
v_j = [2, 3, 4]

N_i = ['a', 'b', 'c']
N_j = ['b', 'c', 'd']

ARGS = {
    'v_i': v_i,
    'v_j': v_j,
    'N_i': N_i,
    'N_j': N_j
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
numpy, 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
train_epoch Not yet run
unverified (harvested, no recorded run)
aranciokov/relevancemargin-icmr22/src/train/train_mmen_tripletRelBased.py
code served (permissive licence) · get_code("3ae2bb378626017d")
How it ran

no invocation recorded.

Also present in other papers' code

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

Video retrieval using natural language queries has attracted increasing interest due to its relevance in real-world applications, from intelligent access in private media galleries to web-scale video search. Learning the cross-similarity of video and text in a joint embedding space is the dominant approach. To do so, a contrastive loss is usually employed because it organizes the embedding space by putting similar items close and dissimilar items far. This framework leads to competitive recall rates, as they solely focus on the rank of the groundtruth items. Yet, assessing the quality of the ranking list is of utmost importance when considering intelligent retrieval systems, since multiple items may share similar semantics, hence a high relevance. Moreover, the aforementioned framework uses a fixed margin to separate similar and dissimilar items, treating all non-groundtruth items as equally irrelevant. In this paper we propose to use a variable margin: we argue that varying the margin used during training based on how much relevant an item is to a given query, i.e. a relevance-based margin, easily improves the quality of the ranking lists measured through nDCG and mAP. We demonstrate the advantages of our technique using different models on EPIC-Kitchens-100 and YouCook2. We show that even if we carefully tuned the fixed margin, our technique (which does not have the margin as a hyper-parameter) would still achieve better performance. Finally, extensive ablation studies and qualitative analysis support the robustness of our approach. Code will be released at \url{https://github.com/aranciokov/RelevanceMargin-ICMR22}.

For agents

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

get_harvested_code_for_paper("2204.13001")
get_code_for_paper("2204.13001")
have("2204.13001")

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

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

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

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

Connect an agent — have() is free.