SYNTOLOGY HomeExplorerAtlasCodeMethodologyAboutDevelopersFeedPricing
Paper · 1902.05509 · 2019

MultiGrain: a unified image embedding for classes and instances

arXiv · PDF · Open in the Atlas

Code that ran

4 of 4 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 2 have no contract verdict; 2 failures of our instrument; 0 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/1902.05509.json · badge: /api/ran/1902.05509.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
2023-MindSpore-1/ms-code-62 community (classifier label)
classifier basis not recorded on the link
4 ran · 0 no recorded run
FunctionStatusWhere it lives
get_instance_features Ran
ran on a synthesized input
2023-MindSpore-1/ms-code-62/src/create_data.py
code served (permissive licence) · get_code("1e7dce39d953aaa5")
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, 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 collections
import numpy as np

class MockTokenizer:
    def __init__(self, vocab_size=100):
        self.vocab_size = vocab_size
    
    def convert_tokens_to_ids(self, tokens):
        # Simple mock: convert token strings to ids based on hash
        return [hash(token) % self.vocab_size for token in tokens]

class SampleInstance:
    def __init__(self, source_tokens, target_tokens):
        self.source_tokens = source_tokens
        self.target_tokens = target_tokens

# Create tokenizers
tokenizer_src = MockTokenizer(vocab_size=100)
tokenizer_trg = MockTokenizer(vocab_size=100)

# Create a sample instance with source and target tokens
instance = SampleInstance(
    source_tokens=["hello", "world"],
    target_tokens=["bonjour", "monde", "comment"]
)

# Define parameters
max_seq_length = 50
bucket = [8, 16, 32, 64]

ARGS = {
    "instance": instance,
    "tokenizer_src": tokenizer_src,
    "tokenizer_trg": tokenizer_trg,
    "max_seq_length": max_seq_length,
    "bucket": bucket
}
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 tuple, ndim 1, dtype family float — a tuple 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
merge Ran
ran; our contract draft was wrong, not the code
2023-MindSpore-1/ms-code-62/model_utils/config.py
code served (permissive licence) · get_code("b9e24c3e3e0e88a7")
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 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 argparse

torch.manual_seed(0)

# Create a mock args object with some attributes
args = argparse.Namespace(
    learning_rate=0.001,
    batch_size=32,
    epochs=10,
    model_name="test_model",
    debug=True,
    seed=42
)

# Create a base configuration dictionary
cfg = {
    "default_lr": 0.0001,
    "default_batch": 16,
    "dataset": "cifar10"
}

ARGS = {
    "args": args,
    "cfg": cfg
}
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 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_cli_to_yaml Ran
ran; our contract draft was wrong, not the code
2023-MindSpore-1/ms-code-62/model_utils/config.py
code served (permissive licence) · get_code("738456e1b7388e7e")
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 Namespace. 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 argparse
import ast

# Create minimal parent parser
parent_parser = argparse.ArgumentParser(add_help=False)

# Create base configuration dict with various types
cfg = {
    'learning_rate': 0.001,
    'batch_size': 32,
    'epochs': 10,
    'use_cuda': False,
    'model_name': 'resnet50',
    'dropout': 0.5,
    'debug': True,
    'nested_list': [1, 2, 3],  # This will be skipped since it's a list
    'nested_dict': {'a': 1},   # This will be skipped since it's a dict
}

# Create helper descriptions
helper = {
    'learning_rate': 'Learning rate for optimizer',
    'batch_size': 'Batch size for training',
    'epochs': 'Number of training epochs',
    'use_cuda': 'Whether to use CUDA',
    'model_name': 'Name of the model architecture',
    'dropout': 'Dropout rate',
    'debug': 'Enable debug mode',
}

# Create choices for specific parameters
choices = {
    'model_name': ['resnet50', 'vgg16', 'mobilenet'],
}

# Set config path
cfg_path = 'default_config.yaml'

ARGS = {
    'parser': parent_parser,
    'cfg': cfg,
    'helper': helper,
    'choices': choices,
    'cfg_path': cfg_path,
}
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 Namespace — a Namespace output has no array shape of its own; none is stated — the instrument coerces any output to an array; for a Namespace 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_yaml Ran
ran on a synthesized input
2023-MindSpore-1/ms-code-62/model_utils/config.py
code served (permissive licence) · get_code("96a9939953d5992d")
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, 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 tempfile
import os
import yaml

# Create a temporary YAML file with valid config structure
temp_dir = tempfile.mkdtemp()
yaml_path = os.path.join(temp_dir, "config.yaml")

# Write a valid YAML file with 3 documents: config, helper, and choices
yaml_content = """
model: resnet50
learning_rate: 0.001
batch_size: 32
---
model: "Model architecture to use"
learning_rate: "Learning rate for optimization"
batch_size: "Batch size for training"
---
model: [resnet50, resnet101, vgg16]
learning_rate: [0.0001, 0.001, 0.01]
batch_size: [16, 32, 64]
"""

with open(yaml_path, 'w') as f:
    f.write(yaml_content)

ARGS = {
    "yaml_path": yaml_path
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
yaml — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type tuple, ndim 1, dtype family float — a tuple 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

Also present in other papers' code

Of 4 samples lifted from this paper's linked repositories, 4 carry a function identity and 0 do not. Of the 4 distinct functions with an identity, 4 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 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
merge 28 other papers
11 dated earlier, 17 later
1406.1078 (2014-06)
Learning Phrase Representations using RNN Encoder-Decoder for Statistical Machine Translation
1409.3215 (2014-09)
Sequence to Sequence Learning with Neural Networks
1512.00567 (2015-12)
Rethinking the Inception Architecture for Computer Vision
and 25 more not named here
parse_cli_to_yaml 20 other papers
9 dated earlier, 11 later
1406.1078 (2014-06)
Learning Phrase Representations using RNN Encoder-Decoder for Statistical Machine Translation
1409.3215 (2014-09)
Sequence to Sequence Learning with Neural Networks
1512.00567 (2015-12)
Rethinking the Inception Architecture for Computer Vision
and 17 more not named here
parse_yaml 15 other papers
8 dated earlier, 7 later
1406.1078 (2014-06)
Learning Phrase Representations using RNN Encoder-Decoder for Statistical Machine Translation
1409.3215 (2014-09)
Sequence to Sequence Learning with Neural Networks
1512.00567 (2015-12)
Rethinking the Inception Architecture for Computer Vision
and 12 more not named here
get_instance_features 2 other papers
2 dated earlier
1406.1078 (2014-06)
Learning Phrase Representations using RNN Encoder-Decoder for Statistical Machine Translation
1409.3215 (2014-09)
Sequence to Sequence Learning with Neural Networks

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

MultiGrain is a network architecture producing compact vector representations that are suited both for image classification and particular object retrieval. It builds on a standard classification trunk. The top of the network produces an embedding containing coarse and fine-grained information, so that images can be recognized based on the object class, particular object, or if they are distorted copies. Our joint training is simple: we minimize a cross-entropy loss for classification and a ranking loss that determines if two images are identical up to data augmentation, with no need for additional labels. A key component of MultiGrain is a pooling layer that takes advantage of high-resolution images with a network trained at a lower resolution. When fed to a linear classifier, the learned embeddings provide state-of-the-art classification accuracy. For instance, we obtain 79.4% top-1 accuracy with a ResNet-50 learned on Imagenet, which is a +1.8% absolute improvement over the AutoAugment method. When compared with the cosine similarity, the same embeddings perform on par with the state-of-the-art for image retrieval at moderate resolutions.

For agents

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

get_harvested_code_for_paper("1902.05509")
get_code_for_paper("1902.05509")
have("1902.05509")

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

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

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

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

Connect an agent — have() is free.