SYNTOLOGY HomeExplorerAtlasCodeMethodologyAboutDevelopersFeedPricing
Paper · 2605.13672 · 2026

SpurAudio: A Benchmark for Studying Shortcut Learning in Few-Shot Audio Classification

Loay Mualem, Abu Giries, Ayoub, Morad Tukan

arXiv · PDF · Open in the Atlas

Code that ran

5 of 13 samples (functions and classes) lifted from this paper's linked repositories executed on a synthesized input in Syntology's jail (2 of them constructed an object rather than computing a result; 0 honoured the contract we drafted, 0 violated it and 4 have no contract verdict; 1 failure of our instrument; 8 no recorded run), 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/2605.13672.json · badge: /api/ran/2605.13672.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
Jerryaa98/SpurAudio community
Papers with Code archive
5 ran · 8 no recorded run
FunctionStatusWhere it lives
MetricModel Ran
ran on a synthesized input · constructed an object; no result was computed
Jerryaa98/SpurAudio/libfewshot_core/model/metric/feat.py
code served (permissive licence) · get_code("6d18f065c859bcf6")
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 an instance of its own class, MetricModel: the run constructed the object and did not call it, so no result was computed. 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
from torch import nn

torch.manual_seed(0)

# Create a minimal concrete implementation of AbstractModel for testing
class ConcreteModel(nn.Module):
    def __init__(self, init_type='normal', model_type=None, way_num=3, shot_num=2, query_num=1):
        super(ConcreteModel, self).__init__()
        self.init_type = init_type
        self.model_type = model_type
        self.way_num = way_num
        self.shot_num = shot_num
        self.query_num = query_num
        self.linear = nn.Linear(4, 8)
    
    def set_forward(self, x):
        return self.linear(x)
    
    def set_forward_loss(self, x):
        return self.linear(x)
    
    def get_uncertainty_threshold(self, policy='mean'):
        return 0.5

# Create test data for hierarchical_cumsum_with_carry
test_array = np.arange(80)  # 80 elements = 4 * 5 * 4

ARGS = {
    'arr': test_array,
    'num_first': 4,
    'num_second': 5
}
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 MetricModel — the run constructed an instance of its own class and did not call it; no shape is stated — the instrument coerces any output to an array; for a MetricModel 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
MultiHeadAttention Ran
ran on a synthesized input
Jerryaa98/SpurAudio/libfewshot_core/model/metric/feat.py
code served (permissive licence) · get_code("abb0132a11948e66")
How it ran

Ran in Syntology's sandbox on this synthesized input (drafted by a language model, class construct-then-call prompt, model not recorded) and returned Tensor, ndim 3, dtype family float, shape (2, 5, 8) 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
import numpy as np

# Import the classes
import torch.nn.functional as F

class ScaledDotProductAttention(nn.Module):
    """Scaled Dot-Product Attention"""

    def __init__(self, temperature, attn_dropout=0.1):
        super().__init__()
        self.temperature = temperature
        self.dropout = nn.Dropout(attn_dropout)
        self.softmax = nn.Softmax(dim=2)

    def forward(self, q, k, v):
        attn = torch.bmm(q, k.transpose(1, 2))
        attn = attn / self.temperature
        log_attn = F.log_softmax(attn, 2)
        attn = self.softmax(attn)
        attn = self.dropout(attn)
        output = torch.bmm(attn, v)
        return (output, attn, log_attn)

class MultiHeadAttention(nn.Module):
    """Multi-Head Attention module"""

    def __init__(self, n_head, d_model, d_k, d_v, dropout=0.1):
        super().__init__()
        self.n_head = n_head
        self.d_k = d_k
        self.d_v = d_v
        self.w_qs = nn.Linear(d_model, n_head * d_k, bias=False)
        self.w_ks = nn.Linear(d_model, n_head * d_k, bias=False)
        self.w_vs = nn.Linear(d_model, n_head * d_v, bias=False)
        nn.init.normal_(self.w_qs.weight, mean=0, std=np.sqrt(2.0 / (d_model + d_k)))
        nn.init.normal_(self.w_ks.weight, mean=0, std=np.sqrt(2.0 / (d_model + d_k)))
        nn.init.normal_(self.w_vs.weight, mean=0, std=np.sqrt(2.0 / (d_model + d_v)))
        self.attention = ScaledDotProductAttention(temperature=np.power(d_k, 0.5))
        self.layer_norm = nn.LayerNorm(d_model)
        self.fc = nn.Linear(n_head * d_v, d_model)
        nn.init.xavier_normal_(self.fc.weight)
        self.dropout = nn.Dropout(dropout)

    def forward(self, q, k, v):
        d_k, d_v, n_head = (self.d_k, self.d_v, self.n_head)
        sz_b, len_q, _ = q.size()
        sz_b, len_k, _ = k.size()
        sz_b, len_v, _ = v.size()
        residual = q
        q = self.w_qs(q).reshape(sz_b, len_q, n_head, d_k)
        k = self.w_ks(k).reshape(sz_b, len_k, n_head, d_k)
        v = self.w_vs(v).reshape(sz_b, len_v, n_head, d_v)
        q = q.permute(2, 0, 1, 3).contiguous().reshape(-1, len_q, d_k)
        k = k.permute(2, 0, 1, 3).contiguous().reshape(-1, len_k, d_k)
        v = v.permute(2, 0, 1, 3).contiguous().reshape(-1, len_v, d_v)
        output, attn, log_attn = self.attention(q, k, v)
        output = output.reshape(n_head, sz_b, len_q, d_v)
        output = output.permute(1, 2, 0, 3).contiguous().reshape(sz_b, len_q, -1)
        output = self.dropout(self.fc(output))
        output = self.layer_norm(output + residual)
        return output

INIT_ARGS = {
    'n_head': 2,
    'd_model': 8,
    'd_k': 4,
    'd_v': 3,
    'dropout': 0.1,
}

ARGS = {
    'q': torch.randn(2, 5, 8),
    'k': torch.randn(2, 5, 8),
    'v': torch.randn(2, 5, 8),
}

if __name__ == '__main__':
    model = MultiHeadAttention(**INIT_ARGS)
    output = model(**ARGS)
    print("Output shape:", output.shape)
    print("Test passed!")
Setup block drafted by
a language model, class construct-then-call prompt, model not recorded
Imports
numpy, torch — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type Tensor, ndim 3, dtype family float, shape (2, 5, 8) — shape (2, 5, 8) 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: torch and numpy seeded to 0 by the harness immediately before the class was constructed from INIT_ARGS (fixture_check.py)
ProtoLayer Ran
ran on a synthesized input · constructed an object; no result was computed
Jerryaa98/SpurAudio/libfewshot_core/model/metric/feat.py
code served (permissive licence) · get_code("c4d86e0b4f211908")
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 an instance of its own class, ProtoLayer: the run constructed the object and did not call it, so no result was computed. 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.functional as F
from torch import nn

torch.manual_seed(0)

class ProtoLayer(nn.Module):
    """
    This Proto Layer is different from Proto_layer @ ProtoNet
    """

    def __init__(self, way_num, shot_num, query_num):
        super(ProtoLayer, self).__init__()
        self.way_num = way_num
        self.shot_num = shot_num
        self.query_num = query_num

    def forward(self, query, proto, mode='euclidean', temperature=1.0):
        return {'euclidean': lambda x, y: -torch.sum(torch.pow(x.unsqueeze(2) - y.unsqueeze(1), 2), dim=3) / temperature, 'cos_sim': lambda x, y: torch.mm(F.normalize(x, p=2, dim=-1), torch.transpose(F.normalize(y, p=2, dim=-1), -1, -2)) / temperature}[mode](query, proto)

# Create instances for the forward call
way_num = 5
shot_num = 1
query_num = 15

proto_layer = ProtoLayer(way_num, shot_num, query_num)

# query tensor: shape (query_num, feature_dim) = (15, 4)
query = torch.randn(query_num, 4)

# proto tensor: shape (way_num, feature_dim) = (5, 4)
proto = torch.randn(way_num, 4)

ARGS = {
    'way_num': way_num,
    'shot_num': shot_num,
    'query_num': query_num
}
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 ProtoLayer — the run constructed an instance of its own class and did not call it; no shape is stated — the instrument coerces any output to an array; for a ProtoLayer 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
ScaledDotProductAttention Ran
ran on a synthesized input
Jerryaa98/SpurAudio/libfewshot_core/model/metric/feat.py
code served (permissive licence) · get_code("db7336a23c3c2b29")
How it ran

Ran in Syntology's sandbox on this synthesized input (drafted by a language model, class construct-then-call prompt, model not recorded) 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 torch.nn.functional as F
from torch import nn

class ScaledDotProductAttention(nn.Module):
    """Scaled Dot-Product Attention"""

    def __init__(self, temperature, attn_dropout=0.1):
        super().__init__()
        self.temperature = temperature
        self.dropout = nn.Dropout(attn_dropout)
        self.softmax = nn.Softmax(dim=2)

    def forward(self, q, k, v):
        attn = torch.bmm(q, k.transpose(1, 2))
        attn = attn / self.temperature
        log_attn = F.log_softmax(attn, 2)
        attn = self.softmax(attn)
        attn = self.dropout(attn)
        output = torch.bmm(attn, v)
        return (output, attn, log_attn)


INIT_ARGS = {
    'temperature': 8.0,
    'attn_dropout': 0.1,
}

ARGS = {
    'q': torch.randn(2, 3, 4),
    'k': torch.randn(2, 5, 4),
    'v': torch.randn(2, 5, 6),
}

if __name__ == '__main__':
    model = ScaledDotProductAttention(**INIT_ARGS)
    output, attn, log_attn = model(**ARGS)
    print("Output shape:", output.shape)
    print("Attention shape:", attn.shape)
    print("Log attention shape:", log_attn.shape)
Setup block drafted by
a language model, class construct-then-call prompt, model not recorded
Imports
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: torch and numpy seeded to 0 by the harness immediately before the class was constructed from INIT_ARGS (fixture_check.py)
hierarchical_cumsum_with_carry Ran
ran; the contract check could not run (RAISES, DEP_MISSING or TIMEOUT)
Jerryaa98/SpurAudio/libfewshot_core/model/metric/feat.py
code served (permissive licence) · get_code("c3fb8f120d94b1cc")
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 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 numpy as np

# The function takes:
# - arr: 1D numpy array that will be reshaped
# - num_first: number of first-level chunks (default 4)
# - num_second: number of second-level chunks per first-level chunk (default 5)

# The total size must be divisible by num_first * num_second
# Let's use num_first=4, num_second=5, so total size = 4*5*2 = 40

num_first = 4
num_second = 5
level2_size = 2  # arbitrary choice for the innermost dimension

total_size = num_first * num_second * level2_size

# Create a simple 1D array with the required size
arr = np.arange(total_size, dtype=np.float32)

ARGS = {
    'arr': arr,
    'num_first': num_first,
    'num_second': num_second,
}
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 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
AbstractModel Not yet run
unverified (harvested, no recorded run)
Jerryaa98/SpurAudio/libfewshot_core/model/metric/feat.py
code served (permissive licence) · get_code("56696393367f0720")
How it ran

no invocation recorded.

FEAT Not yet run
unverified (harvested, no recorded run)
Jerryaa98/SpurAudio/libfewshot_core/model/metric/feat.py
code served (permissive licence) · get_code("5036e89f93ad4f3d")
How it ran

no invocation recorded.

ModelType Not yet run
unverified (harvested, no recorded run)
Jerryaa98/SpurAudio/libfewshot_core/model/metric/feat.py
code served (permissive licence) · get_code("e436a7281b8d1c16")
How it ran

no invocation recorded.

init_weights Not yet run
unverified (harvested, no recorded run)
Jerryaa98/SpurAudio/libfewshot_core/model/metric/feat.py
code served (permissive licence) · get_code("5dcb2aabb03bacc7")
How it ran

no invocation recorded.

weights_init_kaiming Not yet run
unverified (harvested, no recorded run)
Jerryaa98/SpurAudio/libfewshot_core/model/metric/feat.py
code served (permissive licence) · get_code("1034ff8dbf0df0dd")
How it ran

no invocation recorded.

weights_init_normal Not yet run
unverified (harvested, no recorded run)
Jerryaa98/SpurAudio/libfewshot_core/model/metric/feat.py
code served (permissive licence) · get_code("61f3589a88624ab8")
How it ran

no invocation recorded.

weights_init_orthogonal Not yet run
unverified (harvested, no recorded run)
Jerryaa98/SpurAudio/libfewshot_core/model/metric/feat.py
code served (permissive licence) · get_code("bfbe5620c30c7148")
How it ran

no invocation recorded.

weights_init_xavier Not yet run
unverified (harvested, no recorded run)
Jerryaa98/SpurAudio/libfewshot_core/model/metric/feat.py
code served (permissive licence) · get_code("9a3307300f261044")
How it ran

no invocation recorded.

Also present in other papers' code

Of 13 samples lifted from this paper's linked repositories, 13 carry a function identity and 0 do not. Of the 13 distinct functions with an identity, 1 are also present in other papers whose code we hold (1 with at least one paper dated earlier, 0 the same month, 0 later) and 12 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
ScaledDotProductAttention
brick of this paper's assembly: model
3 other papers
3 dated earlier
2207.06580 (2022-07)
Proposal-Free Temporal Action Detection via Global Segmentation Mask Learning
2207.07059 (2022-07)
Semi-Supervised Temporal Action Detection with Proposal-Free Masking
2304.11855 (2023-04)
Glocal Energy-based Learning for Few-Shot Open-Set Recognition

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

Few-shot classification (FSC) is widely used for learning from limited labeled data, yet most evaluations implicitly assume that target concepts are independent of contextual cues. In real-world settings, however, examples often appear within rich contexts, allowing models to exploit spurious correlations between foreground content and background signals. While such effects have been studied in few-shot image classification, their role in few-shot audio classification remains largely unexplored, and existing audio benchmarks offer limited control over contextual structure. We introduce SpurAudio, a benchmark that leverages the natural separability of foreground events and background environments in audio to enable controlled, multi-level evaluation of contextual shifts across support and query sets. Using this benchmark, we show that many state-of-the-art few-shot methods suffer severe performance degradation when background correlations are disrupted, despite achieving similar accuracy under standard evaluation protocols. Crucially, this vulnerability persists even in large pretrained audio foundation models, ruling out limited backbone capacity as an explanation. Moreover, methods that appear comparable under conventional benchmarks can exhibit markedly different sensitivity to spurious correlations, revealing systematic algorithmic strengths and vulnerabilities tied to how feature representations interact with classifier heads at inference time. These findings provide new insight into the behavior of few-shot methods in audio and highlight the need for benchmarks that explicitly probe context dependence when evaluating FSC models. https://github.com/Jerryaa98/SpurAudio

For agents

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

get_harvested_code_for_paper("2605.13672")
get_code_for_paper("2605.13672")
have("2605.13672")

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

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

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

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

Connect an agent — have() is free.