SYNTOLOGY HomeExplorerAtlasCodeMethodologyAboutDevelopersFeedPricing
Paper · 2110.07749 · ICLR · 2021

Attention-Free Keyword Spotting

Mashrur Morshed, Ahmad Ahsan

arXiv · PDF · Open in the Atlas

Code that ran

8 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 6 have no contract verdict; 2 failures of our instrument; 2 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/2110.07749.json · badge: /api/ran/2110.07749.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
AI-Research-BD/Keyword-MLP canonical (classifier label)
classifier basis: plan_row
8 ran · 2 no recorded run
FunctionStatusWhere it lives
calc_step Ran
ran on a synthesized input
AI-Research-BD/Keyword-MLP/utils/misc.py
code served (permissive licence) · get_code("12d715bdf737f38c")
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 int, ndim 0, dtype family int, 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

torch.manual_seed(0)

ARGS = {
    "epoch": 5,
    "n_batches": 32,
    "batch_index": 7
}
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 int, ndim 0, dtype family int, 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
count_params Ran
ran on a synthesized input
AI-Research-BD/Keyword-MLP/utils/misc.py
code served (permissive licence) · get_code("854b6b5cf6315fbc")
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 int, ndim 0, dtype family int, 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
from torch import nn, optim

torch.manual_seed(0)

# Create a small model for testing
class SimpleModel(nn.Module):
    def __init__(self):
        super().__init__()
        self.linear1 = nn.Linear(4, 3)
        self.linear2 = nn.Linear(3, 2)
    
    def forward(self, x):
        x = self.linear1(x)
        x = self.linear2(x)
        return x

model = SimpleModel()

ARGS = {
    "model": model
}
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 int, ndim 0, dtype family int, 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
dropout_layers Ran
ran; our contract draft was wrong, not the code
AI-Research-BD/Keyword-MLP/models/kwmlp.py
code served (permissive licence) · get_code("ce12abe20e1af654")
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 1, 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
import torch.nn as nn
from random import randrange

torch.manual_seed(0)

# Create a list of small nn.Module layers
class SimpleLayer(nn.Module):
    def __init__(self, in_features, out_features):
        super().__init__()
        self.linear = nn.Linear(in_features, out_features)
    
    def forward(self, x):
        return self.linear(x)

layers = [
    SimpleLayer(4, 3),
    SimpleLayer(3, 2),
    SimpleLayer(2, 3),
    SimpleLayer(3, 4),
]

prob_survival = 0.7

ARGS = {
    "layers": layers,
    "prob_survival": prob_survival,
}
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 list, ndim 1, 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
evaluate Ran
ran on a synthesized input
AI-Research-BD/Keyword-MLP/utils/trainer.py
code served (permissive licence) · get_code("40175e67a61190d6")
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 tuple, ndim 1, 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
from torch import nn, optim
from torch.utils.data import DataLoader, TensorDataset
from typing import Callable, Tuple

torch.manual_seed(0)

# Define a minimal nn.Module that takes input and produces logits
class SimpleNet(nn.Module):
    def __init__(self):
        super().__init__()
        self.linear = nn.Linear(4, 3)
    
    def forward(self, x):
        return self.linear(x)

# Create model instance
net = SimpleNet()

# Define a loss function (criterion)
criterion = nn.CrossEntropyLoss()

# Create a small dataset: batch_size=2, input_dim=4, num_classes=3
# We'll create 6 samples total
x_data = torch.randn(6, 4)
y_data = torch.randint(0, 3, (6,))

# Create dataset and dataloader
dataset = TensorDataset(x_data, y_data)
dataloader = DataLoader(dataset, batch_size=2, shuffle=False)

# Device (CPU only)
device = torch.device('cpu')

ARGS = {
    'net': net,
    'criterion': criterion,
    'dataloader': dataloader,
    'device': device
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
torch, tqdm — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type tuple, ndim 1, dtype family float — a tuple 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
get_optimizer Ran
ran on a synthesized input
AI-Research-BD/Keyword-MLP/utils/opt.py
code served (permissive licence) · get_code("d65ca06fe0124125")
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 AdamW. 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
from torch import nn, optim

torch.manual_seed(0)

# Create a simple neural network module
class SimpleNet(nn.Module):
    def __init__(self):
        super().__init__()
        self.linear1 = nn.Linear(4, 8)
        self.linear2 = nn.Linear(8, 2)
    
    def forward(self, x):
        x = torch.relu(self.linear1(x))
        x = self.linear2(x)
        return x

# Instantiate the network
net = SimpleNet()

# Create optimizer config dict
opt_config = {
    'opt_type': 'adamw',
    'opt_kwargs': {
        'lr': 0.001,
        'weight_decay': 0.01
    }
}

ARGS = {
    'net': net,
    'opt_config': opt_config
}
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 AdamW — a AdamW output has no array shape of its own; none is stated — the instrument coerces any output to an array; for a AdamW 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
get_scheduler Ran
ran on a synthesized input
AI-Research-BD/Keyword-MLP/utils/scheduler.py
code served (permissive licence) · get_code("d836a387836b9a38")
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 CosineAnnealingLR. 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
from torch import optim
from torch.optim import lr_scheduler

torch.manual_seed(0)

# Create a simple model
model = nn.Linear(4, 3)

# Create an optimizer
optimizer = optim.SGD(model.parameters(), lr=0.1)

# Define scheduler arguments
ARGS = {
    'optimizer': optimizer,
    'scheduler_type': 'cosine_annealing',
    'T_max': 100
}
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 CosineAnnealingLR — a CosineAnnealingLR output has no array shape of its own; none is stated — the instrument coerces any output to an array; for a CosineAnnealingLR 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
get_train_val_test_split Ran
ran; our contract draft was wrong, not the code
AI-Research-BD/Keyword-MLP/utils/dataset.py
code served (permissive licence) · get_code("1dda7e6316a2f0ba")
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 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 os
import tempfile
import shutil

# Create a temporary directory structure for the dataset
temp_root = tempfile.mkdtemp()

# Create label directories
label_dirs = ['speech', 'music', 'noise']
for label in label_dirs:
    label_path = os.path.join(temp_root, label)
    os.makedirs(label_path, exist_ok=True)
    # Create some dummy .wav files
    for i in range(3):
        wav_file = os.path.join(label_path, f'file_{i}.wav')
        with open(wav_file, 'w') as f:
            f.write(f'dummy wav content {i}')

# Create validation file
val_file = tempfile.NamedTemporaryFile(mode='w', delete=False, suffix='.txt')
val_file.write('speech/file_0.wav\n')
val_file.write('music/file_1.wav')
val_file.close()

# Create test file
test_file = tempfile.NamedTemporaryFile(mode='w', delete=False, suffix='.txt')
test_file.write('speech/file_1.wav\n')
test_file.write('noise/file_0.wav')
test_file.close()

ARGS = {
    'root': temp_root,
    'val_file': val_file.name,
    'test_file': test_file.name,
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
none outside the standard library — 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
train_single_batch Ran
ran on a synthesized input
AI-Research-BD/Keyword-MLP/utils/trainer.py
code served (permissive licence) · get_code("1aa66761878693ca")
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 tuple, ndim 1, 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
from torch import nn, optim

torch.manual_seed(0)

# Define a simple neural network
class SimpleNet(nn.Module):
    def __init__(self, input_dim=4, num_classes=3):
        super().__init__()
        self.fc1 = nn.Linear(input_dim, 8)
        self.fc2 = nn.Linear(8, num_classes)
    
    def forward(self, x):
        x = torch.relu(self.fc1(x))
        x = self.fc2(x)
        return x

# Create model instance
net = SimpleNet(input_dim=4, num_classes=3)

# Create tiny data tensor (batch_size=2, dim=4)
data = torch.randn(2, 4)

# Create targets tensor (batch_size=2) with class labels
targets = torch.tensor([0, 2])

# Create optimizer
optimizer = optim.SGD(net.parameters(), lr=0.01)

# Create loss criterion
criterion = nn.CrossEntropyLoss()

# Create device (CPU only)
device = torch.device('cpu')

ARGS = {
    'net': net,
    'data': data,
    'targets': targets,
    'optimizer': optimizer,
    'criterion': criterion,
    '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 tuple, ndim 1, dtype family float — a tuple 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
get_config Not yet run
unverified (harvested, no recorded run)
AI-Research-BD/Keyword-MLP/config_parser.py
code served (permissive licence) · get_code("d203ddadc113d9d6")
How it ran

no invocation recorded.

get_preds Not yet run
unverified (harvested, no recorded run)
AI-Research-BD/Keyword-MLP/inference.py
code served (permissive licence) · get_code("43893718a859b6fe")
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, 10 are also present in other papers whose code we hold (10 with at least one paper dated earlier, 0 the same month, 2 later) and 0 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
dropout_layers 2 other papers
1 dated earlier, 1 later
2105.08050 (2021-05)
Pay Attention to MLPs
get_config 2 other papers
1 dated earlier, 1 later
2104.00769 (2021-04)
Keyword Transformer: A Self-Attention Model for Keyword Spotting
2202.03555 (2022-02)
data2vec: A General Framework for Self-supervised Learning in Speech, Vision and Language
calc_step 1 other paper
1 dated earlier
2104.00769 (2021-04)
Keyword Transformer: A Self-Attention Model for Keyword Spotting
count_params 1 other paper
1 dated earlier
2104.00769 (2021-04)
Keyword Transformer: A Self-Attention Model for Keyword Spotting
evaluate 1 other paper
1 dated earlier
2104.00769 (2021-04)
Keyword Transformer: A Self-Attention Model for Keyword Spotting
get_optimizer 1 other paper
1 dated earlier
2104.00769 (2021-04)
Keyword Transformer: A Self-Attention Model for Keyword Spotting
get_preds 1 other paper
1 dated earlier
2104.00769 (2021-04)
Keyword Transformer: A Self-Attention Model for Keyword Spotting
get_scheduler 1 other paper
1 dated earlier
2104.00769 (2021-04)
Keyword Transformer: A Self-Attention Model for Keyword Spotting
get_train_val_test_split 1 other paper
1 dated earlier
2104.00769 (2021-04)
Keyword Transformer: A Self-Attention Model for Keyword Spotting
train_single_batch 1 other paper
1 dated earlier
2104.00769 (2021-04)
Keyword Transformer: A Self-Attention Model for Keyword Spotting

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

Till now, attention-based models have been used with great success in the keyword spotting problem domain. However, in light of recent advances in deep learning, the question arises whether self-attention is truly irreplaceable for recognizing speech keywords. We thus explore the usage of gated MLPs-previously shown to be alternatives to transformers in vision tasks-for the keyword spotting task. We provide a family of highly efficient MLP-based models for keyword spotting, with less than 0.5 million parameters. We show that our approach achieves competitive performance on Google Speech Commands V2-12 and V2-35 benchmarks with much fewer parameters than self-attention-based methods. Transformers (Vaswani et al., 2017) have shown remarkable success in Computer Vision tasks with the advent of the Vision Transformer (ViT) (Dosovitskiy et al., 2020). They have lately been studied in the field of keyword spotting (KWS). Several works (Berg et al., 2021;Gong et al., 2021) have obtained exceptional results with ViT-like approaches on KWS.

For agents

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

get_harvested_code_for_paper("2110.07749")
get_code_for_paper("2110.07749")
have("2110.07749")

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

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

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

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

Connect an agent — have() is free.