SYNTOLOGY HomeExplorerAtlasCodeMethodologyAboutDevelopersFeedPricing
Paper · 2206.09843 · NeurIPS · 2022

Contextual Squeeze-and-Excitation for Efficient Few-Shot Image Classification

Sebastian Nowozin, Katja Hofmann, Massimiliano Patacchiola, Richard Turner, John Bronskill, Aliaksandra Shysheya

arXiv · PDF · Open in the Atlas

Code that ran

3 of 3 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, 0 violated it and 0 have no contract verdict; 2 failures of our instrument; 0 no recorded run); 1 of them was also run on the host, not in the jail, by the peer-agreement lane that set its level, 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/2206.09843.json · badge: /api/ran/2206.09843.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
mpatacchiola/contextual-squeeze-and-excitation canonical (classifier label)
classifier basis: classifier_2025
3 ran · 0 no recorded run
FunctionStatusWhere it lives
shuffle Ran
ran, honoured the contract we drafted
mpatacchiola/contextual-squeeze-and-excitation/run_metadataset.py
code served (permissive licence) · get_code("180ce251fbb5b1ad")
How it ran

Ran in Syntology's jail on this synthesized input (drafted by a language model, Claude Haiku 4.5, prompt python_fixture_v1) and returned tuple. The image it ran in was not recorded. The comparison behind this sample's level is a different run: the peer-agreement lane ran it again on the host, not in the jail (report dated 2026-09-04T22:42:36Z). 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

# Create small sample data
np.random.seed(0)
images = np.random.randn(2, 4)  # batch_size=2, features=4
labels = np.array([0, 1])  # 2 labels

ARGS = {
    "images": images,
    "labels": labels,
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1
Imports
numpy — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type tuple — a tuple output has no array shape of its own; none is 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
prepare_task Ran
ran; our contract draft was wrong, not the code
mpatacchiola/contextual-squeeze-and-excitation/run_metadataset.py
code served (permissive licence) · get_code("44dc42dfd8570862")
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 tuple. 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 a task_dict with the required structure
# The function expects:
# - context_images: numpy array with shape (batch, height, width, channels)
# - context_labels: numpy array with shape (batch,)
# - target_images: numpy array with shape (batch, height, width, channels)
# - target_labels: numpy array with shape (batch,)

batch_size = 2
height = 4
width = 3
channels = 3

context_images = np.random.randint(0, 256, size=(batch_size, height, width, channels), dtype=np.uint8)
context_labels = np.array([0, 1], dtype=np.int64)

target_images = np.random.randint(0, 256, size=(batch_size, height, width, channels), dtype=np.uint8)
target_labels = np.array([1, 0], dtype=np.int64)

task_dict = {
    'context_images': context_images,
    'context_labels': context_labels,
    'target_images': target_images,
    'target_labels': target_labels
}

ARGS = {
    'task_dict': task_dict
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1
Imports
numpy, torch — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type tuple — a tuple output has no array shape of its own; none is 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
topk Ran
ran; our contract draft was wrong, not the code
mpatacchiola/contextual-squeeze-and-excitation/run_metadataset.py
code served (permissive licence) · get_code("c45c8d2bc5ca679d")
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 list, ndim 2, 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 torch

torch.manual_seed(0)

# Create output tensor: shape (batch_size, num_classes)
# batch_size=2, num_classes=4
output = torch.randn(2, 4)

# Create target tensor: shape (batch_size,)
# Values should be valid class indices (0-3)
target = torch.tensor([1, 2])

# Define ks parameter
ks = (1, 2)

ARGS = {
    "output": output,
    "target": target,
    "ks": ks,
}
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 list, ndim 2, dtype family float — a list 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 3 samples lifted from this paper's linked repositories, 3 carry a function identity and 0 do not. Of the 3 distinct functions with an identity, 2 are also present in other papers whose code we hold (2 with at least one paper dated earlier, 0 the same month, 1 later) and 1 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
topk 2 other papers
1 dated earlier, 1 later
2204.08491 (2022-04)
Active Learning Helps Pretrained Models Learn the Intended Task
2212.10556 (2022-12)
Unleashing the Power of Visual Prompting At the Pixel Level
shuffle 1 other paper
1 dated earlier
2107.01105 (2021-07)
Memory Efficient Meta-Learning with Large Images

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

Recent years have seen a growth in user-centric applications that require effective knowledge transfer across tasks in the low-data regime. An example is personalization, where a pretrained system is adapted by learning on small amounts of labeled data belonging to a specific user. This setting requires high accuracy under low computational complexity, therefore the Pareto frontier of accuracy vs. adaptation cost plays a crucial role. In this paper we push this Pareto frontier in the few-shot image classification setting with a key contribution: a new adaptive block called Contextual Squeeze-and-Excitation (CaSE) that adjusts a pretrained neural network on a new task to significantly improve performance with a single forward pass of the user data (context). We use meta-trained CaSE blocks to conditionally adapt the body of a network and a fine-tuning routine to adapt a linear head, defining a method called UpperCaSE. UpperCaSE achieves a new state-of-the-art accuracy relative to meta-learners on the 26 datasets of VTAB+MD and on a challenging real-world personalization benchmark (ORBIT), narrowing the gap with leading fine-tuning methods with the benefit of orders of magnitude lower adaptation cost.

For agents

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

get_harvested_code_for_paper("2206.09843")
get_code_for_paper("2206.09843")
have("2206.09843")

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

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

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

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

Connect an agent — have() is free.