SYNTOLOGY HomeExplorerAtlasCodeMethodologyAboutDevelopersFeedPricing
Paper · 2107.03377 · NeurIPS · 2021

Long Short-Term Transformer for Online Action Detection

Stefano Soatto, Hao Chen, Mingze Xu, Yuanjun Xiong, Xinyu Li, Wei Xia, Zhuowen Tu, Lstr Encoder, Lstr Decoder, Positional Encoding

arXiv · PDF · Open in the Atlas

Code that ran

6 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, 1 violated it and 4 have no contract verdict; 1 failure of our instrument; 4 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/2107.03377.json · badge: /api/ran/2107.03377.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
amazon-science/long-short-term-transformer community (classifier label)
classifier basis not recorded on the link
5 ran · 1 no recorded run
amazon-research/long-short-term-transformer alias (classifier label)
classifier basis: classifier_2025
1 ran · 3 no recorded run
FunctionStatusWhere it lives
Registry Ran
ran on a synthesized input
amazon-research/long-short-term-transformer/src/rekognition_online_action_detection/models/lstr.py
code served (permissive licence) · get_code("5b79db82f7d82ff6")
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 NoneType. 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

# Define the Registry class
def _register_generic(module_dict, module_name, module):
    assert module_name not in module_dict
    module_dict[module_name] = module

class Registry(dict):

    def __init__(self, *args, **kwargs):
        super(Registry, self).__init__(*args, **kwargs)

    def register(self, module_name, module=None):
        if module is not None:
            _register_generic(self, module_name, module)
            return

        def register_fn(fn):
            _register_generic(self, module_name, fn)
            return fn
        return register_fn


# Setup code
INIT_ARGS = {}

ARGS = {
    'module_name': 'test_module',
    'module': lambda x: x * 2
}

METHOD = 'register'

# Construct and call
registry = Registry(**INIT_ARGS)
result = registry.register(**ARGS)

# Verify the registration worked
print("Registry contents:", dict(registry))
print("Registered module callable:", registry['test_module'](5))
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 NoneType — a NoneType output has no array shape of its own; none is stated — the instrument coerces any output to an array; for a NoneType 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: torch and numpy seeded to 0 by the harness immediately before the class was constructed from INIT_ARGS (fixture_check.py)
calibrated_average_precision_score Ran
ran on a synthesized input
amazon-science/long-short-term-transformer/src/rekognition_online_action_detection/evaluation/metrics.py
code served (permissive licence) · get_code("4b0c45865a8c0eee")
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 float64, ndim 0, 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

# Construct test data for calibrated_average_precision_score
# The function expects:
# - y_true: array of binary labels (0 or 1)
# - y_score: array of prediction scores

np.random.seed(0)

# Create sample data
# y_true should be binary (0s and 1s)
y_true = np.array([1, 0, 1, 1, 0, 1, 0, 0])

# y_score should be prediction scores (floats between 0 and 1 typically)
y_score = np.array([0.9, 0.2, 0.8, 0.7, 0.3, 0.6, 0.4, 0.1])

ARGS = {
    "y_true": y_true,
    "y_score": y_score,
}
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 float64, ndim 0, dtype family float — no output shape is stated: observe_signature.py recorded float ndim 0, which disagrees with the fixture run
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
generate_square_subsequent_mask Ran
ran, violated the contract we drafted
amazon-science/long-short-term-transformer/src/rekognition_online_action_detection/models/transformer/utils.py
code served (permissive licence) · get_code("823c049021ac6854")
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 2, dtype family float, shape (5, 5) 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 = {
    "sz": 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 Tensor, ndim 2, dtype family float, shape (5, 5) — shape (5, 5) 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
get_stage_pred_scores Ran
ran on a synthesized input
amazon-science/long-short-term-transformer/src/rekognition_online_action_detection/evaluation/metrics.py
code served (permissive licence) · get_code("2b4cae7268c1b0f8")
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 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

# Construct arguments for get_stage_pred_scores
# The function processes gt_targets (ground truth labels) and pred_scores (prediction scores)
# It segments data based on action boundaries and extracts specific stages

# Create a simple example with some actions (non-zero) and background (zero)
# Pattern: background, action1, background, action2, background
gt_targets = [0, 1, 1, 0, 2, 2, 2, 0]
pred_scores = [0.1, 0.8, 0.9, 0.2, 0.7, 0.85, 0.75, 0.15]

# Percentages for stage start and end within each action
perc_s = 0.3  # Start at 30% through the action
perc_e = 0.8  # End at 80% through the action

ARGS = {
    "gt_targets": gt_targets,
    "pred_scores": pred_scores,
    "perc_s": perc_s,
    "perc_e": perc_e,
}
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 tuple, ndim 2, 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
layer_norm Ran
ran; our contract draft was wrong, not the code
amazon-science/long-short-term-transformer/src/rekognition_online_action_detection/models/transformer/utils.py
code served (permissive licence) · get_code("38e465d98db284f6")
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 LayerNorm. 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

torch.manual_seed(0)

ARGS = {
    "d_model": 64,
    "condition": True
}
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 LayerNorm — a LayerNorm output has no array shape of its own; none is stated — the instrument coerces any output to an array; for a LayerNorm 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
postprocessing Ran
ran on a synthesized input
amazon-science/long-short-term-transformer/src/rekognition_online_action_detection/evaluation/postprocessing.py
code served (permissive licence) · get_code("a1406d77c11f45ee")
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 numpy as np

# The postprocessing function takes data_name as parameter
# and returns a postprocessing function (thumos_postprocessing in this case)
# The returned function takes ground_truth, prediction, smooth, and switch parameters

# Create sample ground_truth and prediction arrays
# ground_truth needs column 21 to check validity
# prediction needs columns 5 and 8 for the switch operation
# Let's create arrays with at least 22 columns for ground_truth and 9 columns for prediction

np.random.seed(0)

# Create ground_truth: shape (10, 22) - 10 frames, 22 columns
# Column 21 contains the validity flag (0 or 1)
ground_truth = np.random.rand(10, 22)
ground_truth[:, 21] = np.array([0, 1, 0, 0, 1, 0, 0, 0, 1, 0])  # Mix of valid (0) and invalid (1)

# Create prediction: shape (10, 9) - 10 frames, 9 columns
# Columns 5 and 8 are used in the switch operation
prediction = np.random.rand(10, 9)

ARGS = {
    "data_name": "THUMOS"
}

# The postprocessing function returns a callable, which we would then call with:
# postprocessing_fn = postprocessing("THUMOS")
# result = postprocessing_fn(ground_truth, prediction, smooth=False, switch=False)
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 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
LSTR Not yet run
unverified (harvested, no recorded run)
amazon-research/long-short-term-transformer/src/rekognition_online_action_detection/models/lstr.py
code served (permissive licence) · get_code("db30394d4d9c124a")
How it ran

no invocation recorded.

_register_generic Not yet run
unverified (harvested, no recorded run)
amazon-research/long-short-term-transformer/src/rekognition_online_action_detection/models/lstr.py
code served (permissive licence) · get_code("9b77a01bbd0a3540")
How it ran

no invocation recorded.

build_feature_head Not yet run
unverified (harvested, no recorded run)
amazon-research/long-short-term-transformer/src/rekognition_online_action_detection/models/lstr.py
code served (permissive licence) · get_code("3ad8b1617b1ca798")
How it ran

no invocation recorded.

perframe_average_precision Not yet run
unverified (harvested, no recorded run)
amazon-science/long-short-term-transformer/src/rekognition_online_action_detection/evaluation/metrics.py
code served (permissive licence) · get_code("d8d010da99929e02")
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, 9 are also present in other papers whose code we hold (4 with at least one paper dated earlier, 0 the same month, 8 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
generate_square_subsequent_mask 8 other papers
2 dated earlier, 6 later · 1 only as an assembly brick
2004.09144 (2020-04)
Transformer Reasoning Network for Image-Text Matching and Retrieval
2008.05231 (2020-08)
Fine-grained Visual Textual Alignment for Cross-Modal Retrieval using Transformer Encoders
2109.10852 (2021-09)
Pix2seq: A Language Modeling Framework for Object Detection
and 5 more not named here
Registry
brick of this paper's assembly: helper
2 other papers
1 dated earlier, 1 later · 1 only as an assembly brick
2103.16047 (2021-03)
Noise-resistant Deep Metric Learning with Ranking-based Instance Selection
2308.07893 (2023-08)
Memory-and-Anticipation Transformer for Online Action Understanding
_register_generic
brick of this paper's assembly: helper
2 other papers
1 dated earlier, 1 later · 2 only as an assembly brick
2103.16047 (2021-03)
Noise-resistant Deep Metric Learning with Ranking-based Instance Selection
2308.07893 (2023-08)
Memory-and-Anticipation Transformer for Online Action Understanding
build_feature_head
brick of this paper's assembly: helper
1 other paper
1 later · 1 only as an assembly brick
2308.07893 (2023-08)
Memory-and-Anticipation Transformer for Online Action Understanding
calibrated_average_precision_score 1 other paper
1 later
2209.09236 (2022-09)
Real-time Online Video Detection with Temporal Smoothing Transformers
get_stage_pred_scores 1 other paper
1 later
2209.09236 (2022-09)
Real-time Online Video Detection with Temporal Smoothing Transformers
layer_norm 1 other paper
1 dated earlier
2104.00969 (2021-04)
TubeR: Tubelet Transformer for Video Action Detection
perframe_average_precision 1 other paper
1 later
2209.09236 (2022-09)
Real-time Online Video Detection with Temporal Smoothing Transformers
postprocessing 1 other paper
1 later
2209.09236 (2022-09)
Real-time Online Video Detection with Temporal Smoothing Transformers

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 present Long Short-term TRansformer (LSTR), a temporal modeling algorithm for online action detection, which employs a long-and short-term memory mechanism to model prolonged sequence data. It consists of an LSTR encoder that dynamically leverages coarse-scale historical information from an extended temporal window (e.g., 2048 frames spanning of up to 8 minutes), together with an LSTR decoder that focuses on a short time window (e.g., 32 frames spanning 8 seconds) to model the fine-scale characteristics of the data. Compared to prior work, LSTR provides an effective and efficient method to model long videos with fewer heuristics, which is validated by extensive empirical analysis. LSTR achieves state-of-the-art performance on three standard online action detection benchmarks, THUMOS'14, TVSeries, and HACS Segment. Code has been made available at: https://xumingze0308.github.io/projects/lstr.

For agents

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

get_harvested_code_for_paper("2107.03377")
get_code_for_paper("2107.03377")
have("2107.03377")

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

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

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

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

Connect an agent — have() is free.