SYNTOLOGY HomeExplorerAtlasCodeMethodologyAboutDevelopersFeedPricing
Paper · 1810.07218 · 2018

Incremental Few-Shot Learning with Attention Attractor Networks

arXiv · PDF · Open in the Atlas

Code that ran

5 of 10 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; 5 no recorded run), measured 2026-11-23; 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/1810.07218.json · badge: /api/ran/1810.07218.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
renmengye/inc-few-shot-attractor-public canonical (classifier label)
classifier basis: census
5 ran · 5 no recorded run
FunctionStatusWhere it lives
RegisterAttractor Ran
ran on a synthesized input
renmengye/inc-few-shot-attractor-public/fewshot/models/attractors/attractor.py
code served (permissive licence) · get_code("db1395e0b1c22f55")
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 torch
import torch.nn as nn

# The RegisterAttractor function takes one parameter: attractor_name
# which is used as a key in the ATTRACTOR_REGISTRY dict.
# The function returns a decorator that registers a class/function.

# Construct a simple attractor class to register
class SimpleAttractor(nn.Module):
    def __init__(self):
        super().__init__()
        self.linear = nn.Linear(4, 4)
    
    def forward(self, x):
        return self.linear(x)

# Define the arguments for RegisterAttractor
ARGS = {
    "attractor_name": "simple_attractor"
}
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 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
assign_cluster Ran
ran on a synthesized input
renmengye/inc-few-shot-attractor-public/fewshot/models/kmeans_utils.py
code served (permissive licence) · get_code("fd146e231aa1f310")
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 EagerTensor, ndim 3, dtype family float, shape (2, 4, 3) 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 tensorflow as tf
import numpy as np

# Set seed for reproducibility
tf.random.set_seed(0)

# Create small tensors with distinct dimensions
batch_size = 2
num_clusters = 3
num_data_points = 4
feature_dim = 5

# cluster_centers: [B, K, D]
cluster_centers = tf.constant(
    np.random.randn(batch_size, num_clusters, feature_dim).astype(np.float32)
)

# data: [B, N, D]
data = tf.constant(
    np.random.randn(batch_size, num_data_points, feature_dim).astype(np.float32)
)

ARGS = {
    "cluster_centers": cluster_centers,
    "data": data,
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
numpy, tensorflow — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type EagerTensor, ndim 3, dtype family float, shape (2, 4, 3) — shape (2, 4, 3) 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
calculate_episode_protos Ran
ran on a synthesized input
renmengye/inc-few-shot-attractor-public/run_proto_exp.py
code served (permissive licence) · get_code("9c0f25b4ea59ecb4")
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 (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 numpy as np
import six

# Create a mock TensorFlow session and model
class MockModel:
    def __init__(self):
        self.h_a = "h_a_tensor"
        self.inputs = "inputs_tensor"

class MockSession:
    def run(self, tensor_name, feed_dict=None):
        # Return mock embeddings: shape (6, 4) for 6 samples, 4-dim embeddings
        return np.random.randn(6, 4).astype(np.float32)

# Create mock episode with training data
class MockEpisode:
    def __init__(self):
        # x_train: 6 samples, 5 features
        self.x_train = np.random.randn(6, 5).astype(np.float32)
        # y_train: class labels for each sample
        # For nway=3, we have 3 classes (0, 1, 2 or 1, 2, 3 depending on old_and_new)
        self.y_train = np.array([0, 0, 1, 1, 2, 2])

ARGS = {
    "sess": MockSession(),
    "model": MockModel(),
    "num_classes_a": 2,
    "nway": 3,
    "episode": MockEpisode(),
    "old_and_new": False,
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
numpy, six — 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 (3, 4) — shape (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
compute_logits Ran
ran on a synthesized input
renmengye/inc-few-shot-attractor-public/fewshot/models/kmeans_utils.py
code served (permissive licence) · get_code("b4b89c2bb9f5f4f1")
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 EagerTensor, ndim 3, dtype family float, shape (2, 5, 3) 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 tensorflow as tf
import numpy as np

# Set seed for reproducibility
tf.random.set_seed(0)
np.random.seed(0)

# Create small test tensors
# cluster_centers: [B, K, D] where B=batch, K=num_clusters, D=dimension
B = 2  # batch size
K = 3  # number of clusters
D = 4  # feature dimension
N = 5  # number of data points

cluster_centers = tf.constant(
    np.random.randn(B, K, D).astype(np.float32)
)

# data: [B, N, D]
data = tf.constant(
    np.random.randn(B, N, D).astype(np.float32)
)

ARGS = {
    "cluster_centers": cluster_centers,
    "data": data,
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
numpy, tensorflow — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type EagerTensor, ndim 3, dtype family float, shape (2, 5, 3) — shape (2, 5, 3) 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
compute_logits_cosine Ran
ran on a synthesized input
renmengye/inc-few-shot-attractor-public/fewshot/models/kmeans_utils.py
code served (permissive licence) · get_code("003314f3ea6c637c")
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 EagerTensor, ndim 3, dtype family float, shape (2, 5, 3) 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 tensorflow as tf
import numpy as np

# Set seed for reproducibility
tf.random.set_seed(0)
np.random.seed(0)

# Create small tensors with distinct dimensions
# B=2 (batch), K=3 (clusters), D=4 (dimension), N=5 (data points)
B = 2
K = 3
D = 4
N = 5

# cluster_centers: [B, K, D]
cluster_centers = tf.constant(
    np.random.randn(B, K, D).astype(np.float32)
)

# data: [B, N, D]
data = tf.constant(
    np.random.randn(B, N, D).astype(np.float32)
)

ARGS = {
    "cluster_centers": cluster_centers,
    "data": data,
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
numpy, tensorflow — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type EagerTensor, ndim 3, dtype family float, shape (2, 5, 3) — shape (2, 5, 3) 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
calculate_protos Not yet run
unverified (harvested, no recorded run)
renmengye/inc-few-shot-attractor-public/run_proto_exp.py
code served (permissive licence) · get_code("03c9fac0501311a0")
How it ran

no invocation recorded.

cosine Not yet run
unverified (harvested, no recorded run)
renmengye/inc-few-shot-attractor-public/run_proto_exp.py
code served (permissive licence) · get_code("4dedc68d854ae87b")
How it ran

no invocation recorded.

get_attractor Not yet run
unverified (harvested, no recorded run)
renmengye/inc-few-shot-attractor-public/fewshot/models/attractors/attractor.py
code served (permissive licence) · get_code("3a411d462f300aee")
How it ran

no invocation recorded.

get_exp_logger Not yet run
unverified (harvested, no recorded run)
renmengye/inc-few-shot-attractor-public/run_exp.py
code served (permissive licence) · get_code("cf5426582b207c79")
How it ran

no invocation recorded.

get_saver Not yet run
unverified (harvested, no recorded run)
renmengye/inc-few-shot-attractor-public/run_exp.py
code served (permissive licence) · get_code("d289bd846920809c")
How it ran

no invocation recorded.

Also present in other papers' code

Of 10 samples lifted from this paper's linked repositories, 10 carry a function identity and 0 do not. Of the 10 distinct functions with an identity, 5 are also present in other papers whose code we hold (0 with at least one paper dated earlier, 0 the same month, 5 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.

FunctionAlso present inEarliest-datedOthers named
calculate_episode_protos 1 other paper
1 later
2003.08561 (2020-03)
XtarNet: Learning to Extract Task-Adaptive Representation for Incremental Few-Shot Learning
calculate_protos 1 other paper
1 later
2003.08561 (2020-03)
XtarNet: Learning to Extract Task-Adaptive Representation for Incremental Few-Shot Learning
cosine 1 other paper
1 later
2003.08561 (2020-03)
XtarNet: Learning to Extract Task-Adaptive Representation for Incremental Few-Shot Learning
get_exp_logger 1 other paper
1 later
2003.08561 (2020-03)
XtarNet: Learning to Extract Task-Adaptive Representation for Incremental Few-Shot Learning
get_saver 1 other paper
1 later
2003.08561 (2020-03)
XtarNet: Learning to Extract Task-Adaptive Representation for Incremental Few-Shot Learning

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

Machine learning classifiers are often trained to recognize a set of pre-defined classes. However, in many applications, it is often desirable to have the flexibility of learning additional concepts, with limited data and without re-training on the full training set. This paper addresses this problem, incremental few-shot learning, where a regular classification network has already been trained to recognize a set of base classes, and several extra novel classes are being considered, each with only a few labeled examples. After learning the novel classes, the model is then evaluated on the overall classification performance on both base and novel classes. To this end, we propose a meta-learning model, the Attention Attractor Network, which regularizes the learning of novel classes. In each episode, we train a set of new weights to recognize novel classes until they converge, and we show that the technique of recurrent back-propagation can back-propagate through the optimization process and facilitate the learning of these parameters. We demonstrate that the learned attractor network can help recognize novel classes while remembering old classes without the need to review the original training set, outperforming various baselines.

For agents

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

get_harvested_code_for_paper("1810.07218")
get_code_for_paper("1810.07218")
have("1810.07218")

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

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

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

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

Connect an agent — have() is free.