SYNTOLOGY HomeExplorerAtlasCodeMethodologyAboutDevelopersFeedPricing
Paper · 1908.06039 · 2019

Few-shot Text Classification with Distributional Signatures

arXiv · PDF · Open in the Atlas

Code that ran

5 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; 0 honoured the contract we drafted, 0 violated it and 5 have no contract verdict; 0 failures of our instrument; 0 no recorded run), measured 2026-11-21; 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/1908.06039.json · badge: /api/ran/1908.06039.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
YujiaBao/Distributional-Signatures canonical (classifier label)
classifier basis: census
5 ran · 0 no recorded run
FunctionStatusWhere it lives
get_idf Ran
ran on a synthesized input
YujiaBao/Distributional-Signatures/src/dataset/stats.py
code served (permissive licence) · get_code("f4f0b34b2cb223d0")
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 ndarray, ndim 2, dtype family float, shape (7, 1) 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 a minimal data dict for training scenario
train_data = {
    'label': np.array([0, 0, 1, 1, 2]),  # 5 samples with 3 classes
    'text': np.array([
        [1, 2, 3, 0],
        [1, 2, 4, 0],
        [2, 3, 5, 0],
        [3, 4, 5, 0],
        [1, 5, 6, 0]
    ]),  # 5x4 text data with vocab indices
    'vocab_size': 7,
    'is_train': True
}

# Create source classes for the first call to get_idf
source_classes = np.array([0, 1, 2])

# Define ARGS for get_idf function
ARGS = {
    'data': train_data,
    'source_classes': source_classes
}
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 ndarray, ndim 2, dtype family float, shape (7, 1) — shape (7, 1) 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_iwf Ran
ran on a synthesized input
YujiaBao/Distributional-Signatures/src/dataset/stats.py
code served (permissive licence) · get_code("5870b42fb6d019cd")
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 ndarray, ndim 2, dtype family float, shape (5, 1) 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 a small dataset dictionary with required fields
vocab_size = 5
n_samples = 2

# Create text data: 2 samples, each with 4 tokens (indices into vocab)
text_data = np.array([
    [0, 1, 2, 0],
    [1, 3, 4, 1]
], dtype=np.int32)

# Create label data: 2 samples with class labels
label_data = np.array([0, 1], dtype=np.int32)

# Create training data dictionary
train_data = {
    'text': text_data,
    'label': label_data,
    'vocab_size': vocab_size,
    'is_train': True
}

# Create validation/test data dictionary (without is_train flag)
# Pre-compute iwf for it
val_data = {
    'text': text_data,
    'label': label_data,
    'vocab_size': vocab_size,
    'iwf': np.ones((vocab_size, 1), dtype=np.float32) * 0.5
}

# Define source classes
source_classes = np.array([0, 1], dtype=np.int32)

# Test with training data (should compute iwf)
ARGS = {
    'data': train_data,
    'source_classes': source_classes
}
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 ndarray, ndim 2, dtype family float, shape (5, 1) — shape (5, 1) 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_w_target_rr Ran
ran on a synthesized input
YujiaBao/Distributional-Signatures/src/dataset/stats.py
code served (permissive licence) · get_code("fde536e9e2009c66")
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 float, shape (4, 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
import torch.nn as nn

torch.manual_seed(0)

# Create a small embedding model that takes data dict and returns embeddings
class EmbeddingModel(nn.Module):
    def __init__(self, embedding_dim):
        super().__init__()
        self.embedding_dim = embedding_dim
    
    def forward(self, data):
        # Return embeddings of shape (num_samples, embedding_dim)
        # data['text'] is assumed to exist but we'll just return random embeddings
        num_samples = data['label'].shape[0]
        return torch.randn(num_samples, self.embedding_dim)

# Create sample data
num_samples = 2
embedding_dim = 4
num_classes = 3

data = {
    'label': torch.tensor([0, 1]),  # 2 samples with 2 different classes
    'text': torch.tensor([[1, 2], [3, 4]])  # dummy text representation
}

# Create embedding model
ebd_model = EmbeddingModel(embedding_dim)

# Set parameters
vocab_size = 5
w_target_lam = 0.1

ARGS = {
    'data': data,
    'vocab_size': vocab_size,
    'ebd_model': ebd_model,
    'w_target_lam': w_target_lam
}
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 float, shape (4, 2) — shape (4, 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
select_subset Ran
ran on a synthesized input
YujiaBao/Distributional-Signatures/src/dataset/utils.py
code served (permissive licence) · get_code("27a399e461d663d2")
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 numpy as np

torch.manual_seed(0)

# Create sample data dicts with tensor values
old_data = {
    'feature_a': torch.randn(5, 8),  # 5 items, 8 features
    'feature_b': torch.randn(5, 6),  # 5 items, 6 features
    'feature_c': torch.randn(5, 10), # 5 items, 10 features
}

new_data = {
    'feature_a': None,
    'feature_b': None,
    'feature_c': None,
}

keys = ['feature_a', 'feature_b', 'feature_c']

idx = torch.tensor([0, 2, 4])

max_len = 4

ARGS = {
    'old_data': old_data,
    'new_data': new_data,
    'keys': keys,
    'idx': idx,
    'max_len': max_len,
}
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 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
to_tensor Ran
ran on a synthesized input
YujiaBao/Distributional-Signatures/src/dataset/utils.py
code served (permissive licence) · get_code("bb36a147dcd59388")
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. 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 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)

# Create a sample data dictionary with numpy arrays
data = {
    "input": np.random.randn(2, 4).astype(np.float32),
    "target": np.random.randint(0, 2, (2, 3)).astype(np.int64),
    "metadata": np.array([1.0, 2.0]).astype(np.float32),
}

ARGS = {
    "data": data,
    "cuda": -1,
    "exclude_keys": ["metadata"],
}
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 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

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-21.

Repositories linked to this paper

Some links come from the archived Papers with Code dataset (CC BY-SA 4.0): attribution and licence.

Abstract

In this paper, we explore meta-learning for few-shot text classification. Meta-learning has shown strong performance in computer vision, where low-level patterns are transferable across learning tasks. However, directly applying this approach to text is challenging--lexical features highly informative for one task may be insignificant for another. Thus, rather than learning solely from words, our model also leverages their distributional signatures, which encode pertinent word occurrence patterns. Our model is trained within a meta-learning framework to map these signatures into attention scores, which are then used to weight the lexical representations of words. We demonstrate that our model consistently outperforms prototypical networks learned on lexical knowledge (Snell et al., 2017) in both few-shot text classification and relation classification by a significant margin across six benchmark datasets (20.0% on average in 1-shot classification).

For agents

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

get_harvested_code_for_paper("1908.06039")
get_code_for_paper("1908.06039")
have("1908.06039")

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

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

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

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

Connect an agent — have() is free.