SYNTOLOGY HomeExplorerAtlasCodeMethodologyAboutDevelopersFeedPricing
Paper · 2212.04542 · 2022

VASR: Visual Analogies of Situation Recognition

arXiv · PDF · Open in the Atlas

Code that ran

7 of 8 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 7 have no contract verdict; 0 failures of our instrument; 1 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/2212.04542.json · badge: /api/ran/2212.04542.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
vasr-dataset/vasr canonical (classifier label)
classifier basis not recorded on the link
7 ran · 1 no recorded run
FunctionStatusWhere it lives
calculate_accuracy Ran
ran on a synthesized input
vasr-dataset/vasr/experiments/utils.py
code served (permissive licence) · get_code("a9c309927ba2e283")
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 tuple. 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 numpy as np

torch.manual_seed(0)

# Construct arguments for calculate_accuracy
# The function takes:
# - out_prob: a tensor that will be passed through softmax (dim=1)
# - y: a tensor of labels that will be compared with argmax predictions

# Create a small batch of logits (2 samples, 4 classes)
out_prob = torch.randn(2, 4)

# Create corresponding labels (2 samples with class indices 0-3)
y = torch.tensor([0, 3])

ARGS = {
    "out_prob": out_prob,
    "y": y
}
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 tuple — a tuple output has no array shape of its own; none is 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
calculate_size_proportions Ran
ran on a synthesized input
vasr-dataset/vasr/dataset/pipeline/C_filter_visual.py
code served (permissive licence) · get_code("a09718f9096a1801")
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)

# Analyze the function:
# - bbox: needs to be a sequence/tuple with 4 elements (x1, y1, x2, y2)
# - img_size: a numeric value representing total image size
# The function unpacks bbox into 4 coordinates and calculates object area / img_size

# Create a valid bbox (x1, y1, x2, y2)
bbox = (10, 20, 50, 80)

# Create img_size (total pixel count or similar)
img_size = 10000

ARGS = {
    "bbox": bbox,
    "img_size": img_size,
}
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
count_intersecting_diff_key_AB Ran
ran on a synthesized input
vasr-dataset/vasr/dataset/pipeline/A_find_AB_pairs.py
code served (permissive licence) · get_code("8da4ede1807a6c92")
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 numpy as np

torch.manual_seed(0)

# Construct A_frames: a list of dicts, each containing the 'different_key'
A_frames = [
    {'different_key': 'value_a', 'other_field': 1},
    {'different_key': 'value_b', 'other_field': 2},
    {'different_key': 'value_c', 'other_field': 3},
]

# Construct B_frames: a list of dicts, each containing the 'different_key'
# Some values overlap with A_frames to test intersection
B_frames = [
    {'different_key': 'value_b', 'other_field': 4},
    {'different_key': 'value_c', 'other_field': 5},
    {'different_key': 'value_d', 'other_field': 6},
]

# The key name to extract and compare
different_key = 'different_key'

ARGS = {
    'A_frames': A_frames,
    'B_frames': B_frames,
    'different_key': different_key,
}
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 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
dump_train_info Ran
ran on a synthesized input
vasr-dataset/vasr/experiments/utils.py
code served (permissive licence) · get_code("5b8a29188c340a69")
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 list, ndim 1, dtype family float; no output shape is stated. The image it ran in was not recorded. If your copy returns the same type and ndim 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 tempfile
import os

# Create a temporary directory for model outputs
temp_dir = tempfile.mkdtemp()

# Construct all_losses dict with 'train' and 'dev' keys
# Each key maps to a dict where keys are indices and values are lists of losses
all_losses = {
    'train': {
        0: [0.5, 0.45, 0.4],
        1: [0.3, 0.28, 0.26],
        2: [0.2, 0.19, 0.18]
    },
    'dev': {
        0: [0.55, 0.48, 0.42],
        1: [0.35, 0.31, 0.27],
        2: [0.25, 0.22, 0.20]
    }
}

# Construct all_dev_accuracy as a dict where keys are indices and values are lists of accuracies
all_dev_accuracy = {
    0: [0.75, 0.78, 0.80],
    1: [0.82, 0.84, 0.86],
    2: [0.88, 0.89, 0.90]
}

# Define ARGS dictionary with all required parameters
ARGS = {
    'model_dir_path': temp_dir,
    'all_losses': all_losses,
    'all_dev_accuracy': all_dev_accuracy,
    'epoch': 5
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
numpy, pandas — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type list, ndim 1, dtype family float — a list output has no array shape of its own; none is stated
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
filter_by_legit_pairs_and_sample Ran
ran on a synthesized input
vasr-dataset/vasr/dataset/pipeline/B_filter_textual.py
code served (permissive licence) · get_code("40605229814712da")
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 DataFrame. 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 pandas as pd
import numpy as np

# Create a minimal DataFrame that satisfies the function's requirements
df = pd.DataFrame({
    'different_key': ['key_A', 'key_A', 'key_B', 'key_B', 'key_C'],
    'diff_item_A_str_first': ['item_1', 'item_2', 'item_3', 'item_4', 'item_5'],
    'diff_item_B_str_first': ['item_x', 'item_y', 'item_z', 'item_w', 'item_v']
})

# Create pairs_for_key_dict with matching triplets
pairs_for_key_dict = {
    'key_A': [('item_1', 'item_x'), ('item_2', 'item_y')],
    'key_B': [('item_3', 'item_z')],
    'key_C': [('item_5', 'item_v')]
}

ARGS = {
    'df': df,
    'pairs_for_key_dict': pairs_for_key_dict
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
numpy, pandas — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type DataFrame — a DataFrame output has no array shape of its own; none is stated — the instrument coerces any output to an array; for a DataFrame output the recorded ndim 2 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_bbox_of_diff_item Ran
ran on a synthesized input
vasr-dataset/vasr/dataset/pipeline/C_filter_visual.py
code served (permissive licence) · get_code("daadf88214823ae9")
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 list, ndim 1, dtype family int; no output shape is stated. The image it ran in was not recorded. If your copy returns the same type and ndim 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)

# Construct valid arguments for get_bbox_of_diff_item
bbox_dict = {
    "key1": [10, 20, 30, 40],
    "key2": [-1, -1, -1, -1],
    "key3": [5, 15, 25, 35]
}

diff_item = "some_diff_item"
different_key = "key1"

ARGS = {
    "bbox_dict": bbox_dict,
    "diff_item": diff_item,
    "different_key": different_key
}
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 list, ndim 1, dtype family int — a list output has no array shape of its own; none is stated
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
run_trained_scores Ran
ran on a synthesized input
vasr-dataset/vasr/experiments/run_zero_shot.py
code served (permissive licence) · get_code("8753077ca7bddb4c")
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 torch
import torch.nn as nn
import pandas as pd

torch.manual_seed(0)

class ZeroShotModel(nn.Module):
    def __init__(self):
        super().__init__()
        self.linear = nn.Linear(3, 4)
    
    def preprocess(self, img):
        """Convert image to feature tensor"""
        if isinstance(img, torch.Tensor):
            return img
        return torch.randn(1, 3)
    
    def get_analogies_scores(self, all_image_features, candidates):
        """
        Compute cosine similarity scores for analogies.
        Returns dict mapping candidate names to scores.
        """
        A_feat = all_image_features['A']
        B_feat = all_image_features['B']
        C_feat = all_image_features['C']
        candidate_feats = all_image_features['candidates']
        
        # Compute C + (B - A)
        analogy_vec = C_feat + (B_feat - A_feat)
        
        scores = {}
        for i, candidate_name in enumerate(candidates):
            candidate_feat = candidate_feats[i]
            # Cosine similarity
            cos_sim = torch.nn.functional.cosine_similarity(
                analogy_vec, candidate_feat, dim=1
            )
            scores[candidate_name] = cos_sim.item()
        
        return scores

# Create a mock ZeroShot model
model = ZeroShotModel()

# Create a mock pandas DataFrame row
row_data = {
    'A_img': torch.randn(1, 3),
    'B_img': torch.randn(1, 3),
    'C_img': torch.randn(1, 3),
    'D_img': torch.randn(1, 3),
    'candidates': ['cand1', 'cand2']
}
row = pd.Series(row_data)

ARGS = {
    'model': model,
    'row': row
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
pandas, 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
train_epoch Not yet run
unverified (harvested, no recorded run)
vasr-dataset/vasr/experiments/run_trainable.py
code served (permissive licence) · get_code("f93a5d6a3488c688")
How it ran

no invocation recorded.

Also present in other papers' code

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

A core process in human cognition is analogical mapping: the ability to identify a similar relational structure between different situations. We introduce a novel task, Visual Analogies of Situation Recognition, adapting the classical word-analogy task into the visual domain. Given a triplet of images, the task is to select an image candidate B' that completes the analogy (A to A' is like B to what?). Unlike previous work on visual analogy that focused on simple image transformations, we tackle complex analogies requiring understanding of scenes. We leverage situation recognition annotations and the CLIP model to generate a large set of 500k candidate analogies. Crowdsourced annotations for a sample of the data indicate that humans agree with the dataset label ~80% of the time (chance level 25%). Furthermore, we use human annotations to create a gold-standard dataset of 3,820 validated analogies. Our experiments demonstrate that state-of-the-art models do well when distractors are chosen randomly (~86%), but struggle with carefully chosen distractors (~53%, compared to 90% human accuracy). We hope our dataset will encourage the development of new analogy-making models. Website: https://vasr-dataset.github.io/

For agents

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

get_harvested_code_for_paper("2212.04542")
get_code_for_paper("2212.04542")
have("2212.04542")

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

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

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

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

Connect an agent — have() is free.