SYNTOLOGY HomeExplorerAtlasCodeMethodologyAboutDevelopersFeedPricing
Paper · 2202.13100 · 2022

SemSup: Semantic Supervision for Simple and Scalable Zero-shot Generalization

arXiv · PDF · Open in the Atlas

Code that ran

5 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 5 have no contract verdict; 0 failures of our instrument; 2 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/2202.13100.json · badge: /api/ran/2202.13100.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
princeton-nlp/semsup canonical (classifier label)
classifier basis not recorded on the link
5 ran · 2 no recorded run
FunctionStatusWhere it lives
compute_hierarchical_micro_f1 Ran
ran on a synthesized input
princeton-nlp/semsup/run_rcv1/src/metrics.py
code served (permissive licence) · get_code("b76c3202b2f4320e")
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; no output shape is stated. It ran in syntology-harvest-sandbox:v5-deps (sha256:6a292aa1aed1) at 2026-09-26T22:17:51Z. 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
import numpy as np

torch.manual_seed(0)

# Construct arguments for compute_hierarchical_micro_f1

# preds: binary predictions, shape (batch_size=2, num_labels=4)
preds = torch.tensor([
    [1, 0, 1, 0],
    [0, 1, 1, 1]
], dtype=torch.int32)

# label_ids: ground truth binary labels, shape (batch_size=2, num_labels=4)
label_ids = torch.tensor([
    [1, 0, 0, 1],
    [1, 1, 0, 0]
], dtype=torch.int32)

# id2label: mapping from label index to label name
id2label = {
    0: "label_0",
    1: "label_1",
    2: "label_2",
    3: "label_3"
}

# ancestor_dict: mapping from label to its ancestors (including itself)
ancestor_dict = {
    "label_0": ["label_0", "root"],
    "label_1": ["label_1", "root"],
    "label_2": ["label_2", "parent_2", "root"],
    "label_3": ["label_3", "parent_3", "root"]
}

ARGS = {
    "preds": preds,
    "label_ids": label_ids,
    "ancestor_dict": ancestor_dict,
    "id2label": id2label
}
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 — no output shape is stated: no later run recorded an output shape for this sample (observed_output and metamorphic_properties carry none; shape_contract and output_contract record ndim only)
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 syntology-harvest-sandbox:v5-deps (sha256:6a292aa1aed1); 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
margin_loss_formatting Ran
ran on a synthesized input
princeton-nlp/semsup/run_rcv1/src/models.py
code served (permissive licence) · get_code("5d834f72b96ce572")
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 2, dtype family int, shape (2, 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

torch.manual_seed(0)

# Create a small multilabel one-hot encoded labels tensor
# Shape: (batch_size=2, num_classes=4)
# Each row represents which classes are relevant for that sample
labels = torch.tensor([
    [1, 0, 1, 0],  # sample 0: classes 0 and 2 are positive
    [0, 1, 1, 1],  # sample 1: classes 1, 2, and 3 are positive
], dtype=torch.float32)

device = None

ARGS = {
    "labels": labels,
    "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 Tensor, ndim 2, dtype family int, shape (2, 4) — shape (2, 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
multilabel_metrics Ran
ran on a synthesized input
princeton-nlp/semsup/run_rcv1/src/legacy.py
code served (permissive licence) · get_code("19122025463c89d9")
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 function. 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 numpy as np
import torch
from scipy.special import expit
from sklearn.metrics import accuracy_score, f1_score, classification_report

torch.manual_seed(0)

# Create minimal stand-in classes and objects

class DataArgs:
    """Stand-in for data_args parameter"""
    def __init__(self):
        self.dataset_name = "rcv1"
        self.data_dir = "/tmp"

# Create small id2label and label2id mappings
id2label = {
    0: "label_0",
    1: "label_1",
    2: "label_2",
    3: "label_3"
}

label2id = {v: k for k, v in id2label.items()}

# Create fbr dict with global thresholds
fbr = {
    0: 0.5,
    1: 0.5,
    2: 0.5,
    3: 0.5
}

# Create data_args instance
data_args = DataArgs()

# Mock get_ancestors function to make the compute_metrics inner function work
def get_ancestors(data_args, label2id):
    """Mock function that returns ancestor dict for hierarchical metrics"""
    return {i: set() for i in range(len(label2id))}

def compute_hierarchical_micro_f1(preds, label_ids, ancestor_dict, id2label):
    """Mock function for hierarchical F1 computation"""
    return 0.75

# Patch these into the module namespace so compute_metrics can find them
import sys
current_module = sys.modules[__name__]
setattr(current_module, 'get_ancestors', get_ancestors)
setattr(current_module, 'compute_hierarchical_micro_f1', compute_hierarchical_micro_f1)

# Create mock predictions object that will be passed to compute_metrics
class PredictionsObject:
    def __init__(self):
        # Batch size 2, 4 labels per sample
        self.predictions = np.random.randn(2, 4).astype(np.float32)
        self.label_ids = np.array([[1, 0, 1, 0], [0, 1, 1, 0]], dtype=np.int32)

ARGS = {
    "data_args": data_args,
    "id2label": id2label,
    "label2id": label2id,
    "fbr": fbr
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
numpy, scipy, sklearn, torch — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type function — a function output has no array shape of its own; none is stated — the instrument coerces any output to an array; for a function 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
multilabel_metrics Ran
ran on a synthesized input
princeton-nlp/semsup/run_rcv1/src/metrics.py
code served (permissive licence) · get_code("d5dc988d6fb826b0")
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 function. 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 numpy as np
from scipy.special import expit
import copy

class DataArgs:
    def __init__(self):
        self.task_name = 'rcv1'
        self.hierarchy_file = None

class PredictionOutput:
    def __init__(self, predictions, label_ids):
        self.predictions = predictions
        self.label_ids = label_ids

# Create a minimal hierarchy file content in memory
hierarchy_content = """root Root None Root
node1 Root None label1
node2 Root None label2
node3 label1 None label3
"""

# Write to a temporary file-like structure
import tempfile
import os

temp_dir = tempfile.mkdtemp()
hierarchy_file = os.path.join(temp_dir, 'hierarchy.txt')
with open(hierarchy_file, 'w') as f:
    f.write(hierarchy_content)

data_args = DataArgs()
data_args.hierarchy_file = hierarchy_file

# Create label2id and id2label mappings
label2id = {
    'label1': 0,
    'label2': 1,
    'label3': 2,
}

id2label = {v: k for k, v in label2id.items()}

# Create predictions and labels
# Shape: (batch_size=2, num_labels=3)
predictions = np.array([
    [0.8, 0.2, 0.5],
    [0.3, 0.9, 0.6]
], dtype=np.float32)

label_ids = np.array([
    [1, 0, 1],
    [0, 1, 1]
], dtype=np.int64)

# Create a PredictionOutput object
p = PredictionOutput(predictions=predictions, label_ids=label_ids)

# Create fbr (threshold dictionary)
fbr = {}

# Get ancestors
ancestor_dict = {}
ancestor_dict[0] = [0, -1]  # label1's ancestors: [label1, Root]
ancestor_dict[1] = [1, -1]  # label2's ancestors: [label2, Root]
ancestor_dict[2] = [2, 0, -1]  # label3's ancestors: [label3, label1, Root]

ARGS = {
    'data_args': data_args,
    'id2label': id2label,
    'label2id': label2id,
    'fbr': fbr,
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
numpy, scipy, sklearn — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type function — a function output has no array shape of its own; none is stated — the instrument coerces any output to an array; for a function 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_arg_with_default Ran
ran on a synthesized input
princeton-nlp/semsup/run_eval.py
code served (permissive licence) · get_code("d03e617252683bab")
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 argparse

torch.manual_seed(0)

# Create a simple argparse Namespace object to serve as args
args = argparse.Namespace()
args.learning_rate = 0.001
args.batch_size = 32
args.model_name = "test_model"
args.epochs = None  # This will test the default fallback

# Create a default configuration dictionary
default_config = {
    "learning_rate": 0.0001,
    "batch_size": 16,
    "model_name": "default_model",
    "optimizer": "adam"
}

# Construct ARGS dictionary with all parameters
ARGS = {
    "default_config": default_config,
    "args": args,
    "key": "learning_rate",
    "required": 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 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_ancestors Not yet run
unverified (harvested, no recorded run)
princeton-nlp/semsup/run_rcv1/src/metrics.py
code served (permissive licence) · get_code("f4f3a480d491121a")
How it ran

no invocation recorded.

semantic_model_forward_pass Not yet run
unverified (harvested, no recorded run)
princeton-nlp/semsup/run_rcv1/src/models.py
code served (permissive licence) · get_code("94b6ef826d36fa1a")
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, 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 7 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

Zero-shot learning is the problem of predicting instances over classes not seen during training. One approach to zero-shot learning is providing auxiliary class information to the model. Prior work along this vein have largely used expensive per-instance annotation or singular class-level descriptions, but per-instance descriptions are hard to scale and single class descriptions may not be rich enough. Furthermore, these works have used natural-language descriptions exclusively, simple bi-encoders models, and modality or task-specific methods. These approaches have several limitations: text supervision may not always be available or optimal and bi-encoders may only learn coarse relations between inputs and class descriptions. In this work, we present SemSup, a novel approach that uses (1) a scalable multiple description sampling method which improves performance over single descriptions, (2) alternative description formats such as JSON that are easy to generate and outperform text on certain settings, and (3) hybrid lexical-semantic similarity to leverage fine-grained information in class descriptions. We demonstrate the effectiveness of SemSup across four datasets, two modalities, and three generalization settings. For example, across text and image datasets, SemSup increases unseen class generalization accuracy by 15 points on average compared to the closest baseline.

For agents

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

get_harvested_code_for_paper("2202.13100")
get_code_for_paper("2202.13100")
have("2202.13100")

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

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

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

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

Connect an agent — have() is free.