SYNTOLOGY HomeExplorerAtlasCodeMethodologyAboutDevelopersFeedPricing
Paper · 2005.09394 · 2020

Enhancing Monotonic Multihead Attention for Streaming ASR

arXiv · PDF · Open in the Atlas

Code that ran

10 of 15 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 10 have no contract verdict; 0 failures of our instrument; 5 no recorded run), measured 2026-11-22; 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/2005.09394.json · badge: /api/ran/2005.09394.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
hirofumi0810/neural_sp canonical (classifier label)
classifier basis: census
10 ran · 5 no recorded run
FunctionStatusWhere it lives
compute_subsampling_factor Ran
ran on a synthesized input
hirofumi0810/neural_sp/neural_sp/bin/train_utils.py
code served (permissive licence) · get_code("cb16b773271ab2ed")
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 DictConfig. 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.

from omegaconf import DictConfig

ARGS = {
    "args": DictConfig({
        "resume": False,
        "enc_type": "conv",
        "conv_poolings": "(2,2)_(2,2)",
        "subsample": "2_2_2",
        "train_set_sub1": True,
        "train_set_sub2": True,
        "enc_n_layers_sub1": 1,
        "enc_n_layers_sub2": 2,
    })
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
numpy, omegaconf — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type DictConfig — a DictConfig output has no array shape of its own; none is stated — the instrument coerces any output to an array; for a DictConfig output the recorded ndim 1 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
cross_entropy_lsm Ran
ran on a synthesized input
hirofumi0810/neural_sp/neural_sp/models/criterion.py
code served (permissive licence) · get_code("87cb64194a1c4f6a")
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
import numpy as np

torch.manual_seed(0)

# Small tensor dimensions: batch=2, sequence_length=3, vocab=4
batch_size = 2
sequence_length = 3
vocab_size = 4
ignore_index = -100

# Create logits [B, T, vocab] = [2, 3, 4]
logits = torch.randn(batch_size, sequence_length, vocab_size, dtype=torch.float32)

# Create target labels [B, L] = [2, 3]
# Mix of valid indices (0-3) and ignore_index
ys = torch.tensor([
    [0, 1, ignore_index],
    [2, 3, 0]
], dtype=torch.long)

# Label smoothing probability
lsm_prob = 0.1

# Training flag to enable label smoothing
training = True

# normalize_length flag
normalize_length = False

ARGS = {
    'logits': logits,
    'ys': ys,
    'lsm_prob': lsm_prob,
    'ignore_index': ignore_index,
    'training': training,
    'normalize_length': normalize_length
}
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 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
distillation Ran
ran on a synthesized input
hirofumi0810/neural_sp/neural_sp/models/criterion.py
code served (permissive licence) · get_code("8cef8c0370530397")
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 0, dtype family float, 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)

# Construct valid arguments for distillation function
batch_size = 2
max_time = 5
vocab_size = 4

# Create logits for student and teacher
logits_student = torch.randn(batch_size, max_time, vocab_size)
logits_teacher = torch.randn(batch_size, max_time, vocab_size)

# Create sequence lengths
ylens = torch.tensor([3, 4], dtype=torch.long)

# Temperature parameter
temperature = 1.0

ARGS = {
    "logits_student": logits_student,
    "logits_teacher": logits_teacher,
    "ylens": ylens,
    "temperature": temperature,
}
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 0, dtype family float, 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
kldiv_lsm_ctc Ran
ran on a synthesized input
hirofumi0810/neural_sp/neural_sp/models/criterion.py
code served (permissive licence) · get_code("6ec9cbee8edfc3f8")
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 0, dtype family float, 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
import math

torch.manual_seed(0)

# logits: FloatTensor of shape [B, T, vocab]
# B=2 (batch size), T=3 (time steps), vocab=4 (vocabulary size)
logits = torch.randn(2, 3, 4, dtype=torch.float32)

# ylens: IntTensor of shape [B] with sequence lengths
# Each element indicates the valid length for corresponding batch element
ylens = torch.tensor([2, 3], dtype=torch.int64)

ARGS = {
    "logits": logits,
    "ylens": ylens,
}
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 0, dtype family float, 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
load_config Ran
ran on a synthesized input
hirofumi0810/neural_sp/neural_sp/bin/train_utils.py
code served (permissive licence) · get_code("dffc9087259a2b58")
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 DictConfig. 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
from omegaconf import OmegaConf

# Create a temporary YAML config file for testing
temp_dir = tempfile.mkdtemp()
config_file = os.path.join(temp_dir, "config.yaml")

# Write a simple config file
config_content = """
model: test_model
learning_rate: 0.001
batch_size: 32
"""

with open(config_file, 'w') as f:
    f.write(config_content)

ARGS = {
    'config_path': config_file
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
omegaconf — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type DictConfig — a DictConfig output has no array shape of its own; none is stated — the instrument coerces any output to an array; for a DictConfig output the recorded ndim 1 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
measure_time Ran
ran on a synthesized input
hirofumi0810/neural_sp/neural_sp/bin/train_utils.py
code served (permissive licence) · get_code("a6dbc2c0648c0def")
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 functools
import time
import torch
import torch.nn as nn

torch.manual_seed(0)

# Define a simple function to measure
def sample_function(x, y):
    """A simple function that does some computation"""
    result = x + y
    time.sleep(0.01)
    return result

# The measure_time decorator takes one argument: func
# func is a callable that will be decorated
ARGS = {
    'func': sample_function
}
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
register_args_encoder Ran
ran on a synthesized input
hirofumi0810/neural_sp/neural_sp/bin/args_asr.py
code served (permissive licence) · get_code("7250a2e5273dd28a")
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 ArgumentParser. 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 argparse
import torch
import torch.nn as nn

torch.manual_seed(0)

# Create a mock encoder module with add_args method
class MockEncoderModule:
    @staticmethod
    def add_args(parser, args):
        parser.add_argument('--enc_hidden_size', type=int, default=256)
        parser.add_argument('--enc_num_layers', type=int, default=4)
        return parser

# Mock the neural_sp modules by patching sys.modules
import sys
from types import ModuleType

# Create mock modules
mock_neural_sp = ModuleType('neural_sp')
mock_models = ModuleType('neural_sp.models')
mock_seq2seq = ModuleType('neural_sp.models.seq2seq')
mock_encoders = ModuleType('neural_sp.models.seq2seq.encoders')

# Create mock encoder classes
class TDSEncoder:
    @staticmethod
    def add_args(parser, args):
        parser.add_argument('--tds_kernel_size', type=int, default=3)
        return parser

class GatedConvEncoder:
    @staticmethod
    def add_args(parser, args):
        parser.add_argument('--gconv_kernel_size', type=int, default=5)
        return parser

class TransformerEncoder:
    @staticmethod
    def add_args(parser, args):
        parser.add_argument('--transformer_hidden_size', type=int, default=512)
        return parser

class ConformerEncoder:
    @staticmethod
    def add_args(parser, args):
        parser.add_argument('--conformer_hidden_size', type=int, default=512)
        return parser

class RNNEncoder:
    @staticmethod
    def add_args(parser, args):
        parser.add_argument('--rnn_hidden_size', type=int, default=256)
        return parser

# Populate mock modules
mock_encoders.tds = ModuleType('neural_sp.models.seq2seq.encoders.tds')
mock_encoders.tds.TDSEncoder = TDSEncoder

mock_encoders.gated_conv = ModuleType('neural_sp.models.seq2seq.encoders.gated_conv')
mock_encoders.gated_conv.GatedConvEncoder = GatedConvEncoder

mock_encoders.transformer = ModuleType('neural_sp.models.seq2seq.encoders.transformer')
mock_encoders.transformer.TransformerEncoder = TransformerEncoder

mock_encoders.conformer = ModuleType('neural_sp.models.seq2seq.encoders.conformer')
mock_encoders.conformer.ConformerEncoder = ConformerEncoder

mock_encoders.rnn = ModuleType('neural_sp.models.seq2seq.encoders.rnn')
mock_encoders.rnn.RNNEncoder = RNNEncoder

mock_seq2seq.encoders = mock_encoders
mock_models.seq2seq = mock_seq2seq
mock_neural_sp.models = mock_models

sys.modules['neural_sp'] = mock_neural_sp
sys.modules['neural_sp.models'] = mock_models
sys.modules['neural_sp.models.seq2seq'] = mock_seq2seq
sys.modules['neural_sp.models.seq2seq.encoders'] = mock_encoders
sys.modules['neural_sp.models.seq2seq.encoders.tds'] = mock_encoders.tds
sys.modules['neural_sp.models.seq2seq.encoders.gated_conv'] = mock_encoders.gated_conv
sys.modules['neural_sp.models.seq2seq.encoders.transformer'] = mock_encoders.transformer
sys.modules['neural_sp.models.seq2seq.encoders.conformer'] = mock_encoders.conformer
sys.modules['neural_sp.models.seq2seq.encoders.rnn'] = mock_encoders.rnn

# Create parser and args for testing
parser = argparse.ArgumentParser()
args = argparse.Namespace()

ARGS = {
    'parser': parser,
    'args': args,
    'enc_type': 'transformer'
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
neural_sp, torch — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type ArgumentParser — a ArgumentParser output has no array shape of its own; none is stated — the instrument coerces any output to an array; for a ArgumentParser 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
repeat Ran
ran on a synthesized input
hirofumi0810/neural_sp/neural_sp/models/torch_utils.py
code served (permissive licence) · get_code("e5b2027edba3cd80")
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 ModuleList. 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 copy
import torch
import torch.nn as nn

torch.manual_seed(0)

# Create a simple nn.Module to use as the base module
class SimpleModule(nn.Module):
    def __init__(self):
        super().__init__()
        self.linear = nn.Linear(4, 3)
    
    def forward(self, x):
        return self.linear(x)

# Construct arguments
module = SimpleModule()
n_layers = 3

ARGS = {
    "module": module,
    "n_layers": n_layers
}
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 ModuleList — a ModuleList output has no array shape of its own; none is stated — the instrument coerces any output to an array; for a ModuleList output the recorded ndim 1 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
tensor2np Ran
ran on a synthesized input
hirofumi0810/neural_sp/neural_sp/models/torch_utils.py
code served (permissive licence) · get_code("3c1e475e592b7956")
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 (2, 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 torch
import numpy as np

torch.manual_seed(0)

# Create a small tensor for testing
x = torch.randn(2, 4)

ARGS = {
    "x": x
}
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 ndarray, ndim 2, dtype family float, shape (2, 4) — shape (2, 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
tensor2scalar Ran
ran on a synthesized input
hirofumi0810/neural_sp/neural_sp/models/torch_utils.py
code served (permissive licence) · get_code("9a280777fa891d25")
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 float, ndim 0, dtype family float, 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)

# Test case 1: torch.Tensor on CPU
tensor_arg = torch.tensor([42.0])

# Test case 2: float argument (function checks isinstance(x, float))
float_arg = 3.14

# Create ARGS dict - the function only takes one parameter 'x'
# We'll test with a tensor as the primary use case
ARGS = {
    "x": torch.tensor([7.5])
}
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 float, ndim 0, dtype family float, 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
add_args_common Not yet run
unverified (harvested, no recorded run)
hirofumi0810/neural_sp/neural_sp/bin/args_common.py
code served (permissive licence) · get_code("12d5dc4bc4f1e1aa")
How it ran

no invocation recorded.

average_checkpoints Not yet run
unverified (harvested, no recorded run)
hirofumi0810/neural_sp/neural_sp/bin/eval_utils.py
code served (permissive licence) · get_code("6ff5a3b80d5b430d")
How it ran

no invocation recorded.

mkdir_join Not yet run
unverified (harvested, no recorded run)
hirofumi0810/neural_sp/neural_sp/utils.py
code served (permissive licence) · get_code("361835bafa5d4e60")
How it ran

no invocation recorded.

register_args_lm Not yet run
unverified (harvested, no recorded run)
hirofumi0810/neural_sp/neural_sp/bin/args_lm.py
code served (permissive licence) · get_code("a26e873e715d966a")
How it ran

no invocation recorded.

set_lm_name Not yet run
unverified (harvested, no recorded run)
hirofumi0810/neural_sp/neural_sp/bin/model_name.py
code served (permissive licence) · get_code("d62973315f74653e")
How it ran

no invocation recorded.

Also present in other papers' code

Of 15 samples lifted from this paper's linked repositories, 15 carry a function identity and 0 do not. Of the 15 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 15 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-22.

Repositories linked to this paper

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

Abstract

We investigate a monotonic multihead attention (MMA) by extending hard monotonic attention to Transformer-based automatic speech recognition (ASR) for online streaming applications. For streaming inference, all monotonic attention (MA) heads should learn proper alignments because the next token is not generated until all heads detect the corresponding token boundaries. However, we found not all MA heads learn alignments with a naïve implementation. To encourage every head to learn alignments properly, we propose HeadDrop regularization by masking out a part of heads stochastically during training. Furthermore, we propose to prune redundant heads to improve consensus among heads for boundary detection and prevent delayed token generation caused by such heads. Chunkwise attention on each MA head is extended to the multihead counterpart. Finally, we propose head-synchronous beam search decoding to guarantee stable streaming inference.

For agents

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

get_harvested_code_for_paper("2005.09394")
get_code_for_paper("2005.09394")
have("2005.09394")

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

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

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

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

Connect an agent — have() is free.