SYNTOLOGY HomeExplorerAtlasCodeMethodologyAboutDevelopersFeedPricing
Paper · aaai_28324 · AAAI · 2024

Context-I2W: Mapping Images to Context-Dependent Words for Accurate Zero-Shot Composed Image Retrieval

Yue Hu, Qi Wu, Jing Yu, Gang Xiong, Yuanmin Tang, Keke Gai, Jiamin Zhuang

Open in the Atlas

Code that ran

8 of 13 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; 1 honoured the contract we drafted, 2 violated it and 1 has no contract verdict; 4 failures of our instrument; 5 no recorded run), measured 2026-11-23; 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/aaai_28324.json · badge: /api/ran/aaai_28324.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
Pter61/context-i2w canonical (classifier label)
classifier basis: census
8 ran · 5 no recorded run
FunctionStatusWhere it lives
FeedForward Ran
ran; our contract draft was wrong, not the code
Pter61/context-i2w/model/model.py
code served (permissive licence) · get_code("4d75570b4e91d0b4")
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 Sequential. 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)

ARGS = {
    "dim": 64,
    "mult": 4
}
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 Sequential — a Sequential output has no array shape of its own; none is stated — the instrument coerces any output to an array; for a Sequential output the recorded ndim 1 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
exists Ran
ran, violated the contract we drafted
Pter61/context-i2w/model/model.py
pointer only (licence: Apache-2.0); the stored copy get_code serves, from ThomasMrY/VCT, is pointer only (licence: NONE) · get_code("aa5486a3650902d8")
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 ThomasMrY/VCT, 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.

get_default_params Ran
ran; our contract draft was wrong, not the code
Pter61/context-i2w/src/params.py
code served (permissive licence) · get_code("0ad517bf07a3dc06")
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

torch.manual_seed(0)

# The function only takes model_name as a parameter
# It checks the model_name against predefined lists and returns appropriate parameter dicts
# No complex objects needed - just a string

ARGS = {
    'model_name': 'RN50'
}
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
get_loss Ran
ran; the contract check could not run (RAISES, DEP_MISSING or TIMEOUT)
Pter61/context-i2w/src/trainer.py
code served (permissive licence) · get_code("4aefc9c8f821ec23")
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 Tensor, 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

torch.manual_seed(0)

# Build a minimal model that returns image_features, text_features, logit_scale
class DummyModel(nn.Module):
    def __init__(self):
        super().__init__()
        self.proj = nn.Linear(4, 3)
    
    def forward(self, images, texts, extra=False):
        # images: [batch, 4], texts: [batch, 4]
        image_features = self.proj(images)  # [batch, 3]
        text_features = self.proj(texts)    # [batch, 3]
        logit_scale = torch.tensor([0.07])  # scalar wrapped in tensor
        
        if extra:
            return image_features, text_features, logit_scale
        else:
            return image_features, text_features, logit_scale

model = DummyModel()

# Create small batch of image and text features
batch_size = 2
images = torch.randn(batch_size, 4)
texts = torch.randn(batch_size, 4)

# Loss functions (CrossEntropyLoss expects logits and class indices)
loss_img = nn.CrossEntropyLoss()
loss_txt = nn.CrossEntropyLoss()

# Args configuration
class Args:
    def __init__(self):
        self.distributed = False
        self.aggregate = False
        self.gpu = None

args = Args()

ARGS = {
    "model": model,
    "images": images,
    "texts": texts,
    "loss_img": loss_img,
    "loss_txt": loss_txt,
    "args": args,
    "data_identifier": -1
}
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 Tensor, 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_sample_save_path Ran
ran on a synthesized input
Pter61/context-i2w/src/eval_utils.py
code served (permissive licence) · get_code("fbfe7c18149e5efe")
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

# Create a temporary directory for testing
temp_root = tempfile.mkdtemp()

ARGS = {
    "root": temp_root,
    "eval_name": "evaluation_001",
    "model_name": "model_v1"
}
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
is_master Ran
ran, violated the contract we drafted
Pter61/context-i2w/src/utils.py
code served (permissive licence) · get_code("c97b5d8516c10994")
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 bool, 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

class Args:
    def __init__(self, distributed=False, gpu=0, dp=False):
        self.distributed = distributed
        self.gpu = gpu
        self.dp = dp

# Test case 1: non-distributed setup (should return True)
args_1 = Args(distributed=False, gpu=0, dp=False)

# Test case 2: distributed with gpu=0 (should return True)
args_2 = Args(distributed=True, gpu=0, dp=False)

# Test case 3: distributed with gpu=1 and no dp (should return False)
args_3 = Args(distributed=True, gpu=1, dp=False)

# Test case 4: distributed with gpu=1 but dp=True (should return True)
args_4 = Args(distributed=True, gpu=1, dp=True)

# Primary ARGS dict for execution
ARGS = {
    'args': Args(distributed=False, gpu=0, dp=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 bool, 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
prepare_img Ran
ran, honoured the contract we drafted
Pter61/context-i2w/src/eval_utils.py
code served (permissive licence) · get_code("c97029a509c1d772")
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 3, dtype family float, shape (3, 3, 4) 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 torchvision.transforms as transforms
from PIL import Image
import io

torch.manual_seed(0)

# Create a small dummy image in memory
img_data = Image.new('RGB', (4, 3), color='red')
img_bytes = io.BytesIO()
img_data.save(img_bytes, format='PNG')
img_bytes.seek(0)

# Create a temporary file-like object
class FakeFile:
    def __init__(self, img_bytes):
        self.img_bytes = img_bytes
    
    def __enter__(self):
        return self
    
    def __exit__(self, *args):
        pass
    
    def read(self):
        return self.img_bytes.getvalue()

# Create transform that converts PIL image to tensor
transform = transforms.Compose([
    transforms.ToTensor(),
])

# Create a file-like object that Image.open can read from
img_file = io.BytesIO()
img_data.save(img_file, format='PNG')
img_file.seek(0)

ARGS = {
    'img_file': img_file,
    'transform': transform,
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
PIL, torch, torchvision — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type Tensor, ndim 3, dtype family float, shape (3, 3, 4) — shape (3, 3, 4) 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
setup_primary_logging Ran
ran; our contract draft was wrong, not the code
Pter61/context-i2w/src/logger.py
code served (permissive licence) · get_code("050a8682c03e5b7a")
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 Queue. 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 logging
import tempfile
import os
from torch.multiprocessing import Queue

# Create a temporary log file for testing
temp_dir = tempfile.gettempdir()
log_file = os.path.join(temp_dir, "test_log.txt")

# Define arguments for setup_primary_logging
ARGS = {
    "log_file": log_file,
    "level": logging.INFO
}
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 Queue — a Queue output has no array shape of its own; none is stated — the instrument coerces any output to an array; for a Queue 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
concat_all_gather Not yet run
unverified (harvested, no recorded run)
Pter61/context-i2w/model/model.py
code served (permissive licence) · get_code("73cecca9f3575f09")
How it ran

no invocation recorded.

download_pretrained_from_hf Not yet run
unverified (harvested, no recorded run)
Pter61/context-i2w/model/clip.py
code served (permissive licence) · get_code("16a61f88e426e60e")
How it ran

no invocation recorded.

get_imagenet Not yet run
unverified (harvested, no recorded run)
Pter61/context-i2w/src/data.py
code served (permissive licence) · get_code("1b48169f44bfc0c2")
How it ran

no invocation recorded.

has_hf_hub Not yet run
unverified (harvested, no recorded run)
Pter61/context-i2w/model/clip.py
code served (permissive licence) · get_code("576e20dbc1f9c66e")
How it ran

no invocation recorded.

make_html Not yet run
unverified (harvested, no recorded run)
Pter61/context-i2w/src/eval_utils.py
code served (permissive licence) · get_code("d3d7d2da76d463c9")
How it ran

no invocation recorded.

Also present in other papers' code

Of 13 samples lifted from this paper's linked repositories, 13 carry a function identity and 0 do not. Of the 13 distinct functions with an identity, 10 are also present in other papers whose code we hold (4 with at least one paper dated earlier, 0 the same month, 3 later) and 3 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
exists 486 other papers
283 dated earlier, 53 later, 148 same year, order not determinable, 2 undated · 78 only as an assembly brick
1603.08155 (2016-03)
Perceptual Losses for Real-Time Style Transfer and Super-Resolution
1611.07004 (2016-11)
Image-to-Image Translation with Conditional Adversarial Networks
1804.04637 (2018-04)
EMBER: An Open Dataset for Training Static PE Malware Machine Learning Models
and 483 more not named here
concat_all_gather 138 other papers
102 dated earlier, 14 later, 22 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
FeedForward 47 other papers
7 dated earlier, 13 later, 27 same year, order not determinable · 4 only as an assembly brick
2204.14198 (2022-04)
Flamingo: a Visual Language Model for Few-Shot Learning
2308.02463 (2023-08)
Towards Generalist Foundation Model for Radiology by Leveraging Web-scale 2D&3D Medical Data
2308.06721 (2023-08)
IP-Adapter: Text Compatible Image Prompt Adapter for Text-to-Image Diffusion Models
and 44 more not named here
download_pretrained_from_hf 1 other paper
1 same year, order not determinable
2403.16005 (2024-03)
Knowledge-Enhanced Dual-stream Zero-shot Composed Image Retrieval
get_default_params 1 other paper
1 same year, order not determinable
2403.16005 (2024-03)
Knowledge-Enhanced Dual-stream Zero-shot Composed Image Retrieval
get_loss 1 other paper
1 dated earlier
2309.16137 (2023-09)
Context-I2W: Mapping Images to Context-dependent Words for Accurate Zero-Shot Composed Image Retrieval
has_hf_hub 1 other paper
1 same year, order not determinable
2403.16005 (2024-03)
Knowledge-Enhanced Dual-stream Zero-shot Composed Image Retrieval
is_master 1 other paper
1 same year, order not determinable
2403.16005 (2024-03)
Knowledge-Enhanced Dual-stream Zero-shot Composed Image Retrieval
prepare_img 1 other paper
1 same year, order not determinable
2403.16005 (2024-03)
Knowledge-Enhanced Dual-stream Zero-shot Composed Image Retrieval
setup_primary_logging 1 other paper
1 same year, order not determinable
2403.16005 (2024-03)
Knowledge-Enhanced Dual-stream Zero-shot Composed Image Retrieval

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

Different from Composed Image Retrieval task that requires expensive labels for training task-specific models, Zero-Shot Composed Image Retrieval (ZS-CIR) involves diverse tasks with a broad range of visual content manipulation intent that could be related to domain, scene, object, and attribute. The key challenge for ZS-CIR tasks is to learn a more accurate image representation that has adaptive attention to the reference image for various manipulation descriptions. In this paper, we propose a novel context-dependent mapping network, named Context-I2W, for adaptively converting descriptionrelevant Image information into a pseudo-word token composed of the description for accurate ZS-CIR. Specifically, an Intent View Selector first dynamically learns a rotation rule to map the identical image to a task-specific manipulation view. Then a Visual Target Extractor further captures local information covering the main targets in ZS-CIR tasks under the guidance of multiple learnable queries. The two complementary modules work together to map an image to a context-dependent pseudo-word token without extra supervision. Our model shows strong generalization ability on four ZS-CIR tasks, including domain conversion, object composition, object manipulation, and attribute manipulation. It obtains consistent and significant performance boosts ranging from 1.88% to 3.60% over the best methods and achieves new state-of-the-art results on ZS-CIR. Our code is available at https://github.com/Pter61/context-i2w.

For agents

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

get_harvested_code_for_paper("aaai_28324")
get_code_for_paper("aaai_28324")
have("aaai_28324")

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

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

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

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

Connect an agent — have() is free.