SYNTOLOGY HomeExplorerAtlasCodeMethodologyAboutDevelopersFeedPricing
Paper · 2501.18059 · ICLR · 2025

Learning the Optimal Stopping for Early Classification within Finite Horizons via Sequential Probability Ratio Test

Akinori Ebihara, Taiki Miyagawa, Kazuyuki Sakurai, Hitoshi Imaoka

arXiv · PDF · Open in the Atlas

Code that ran

5 of 8 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 0 have no contract verdict; 4 failures of our instrument; 3 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/2501.18059.json · badge: /api/ran/2501.18059.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
akinori-f-ebihara/firmbound canonical (classifier label)
classifier basis: classifier_2025
5 ran · 3 no recorded run
FunctionStatusWhere it lives
G_st Ran
ran; our contract draft was wrong, not the code
akinori-f-ebihara/firmbound/models/backward_induction_utils.py
code served (permissive licence) · get_code("61d33dbc0647c14f")
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, ndim 3, 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 a small posteriors tensor
# Shape: (batch_size=2, time_steps=3, num_classes=4)
posteriors = torch.rand(2, 3, 4)

# Ensure posteriors are valid probabilities (sum to 1 along class dimension)
posteriors = posteriors / posteriors.sum(dim=-1, keepdim=True)

# penalty is a scalar float
penalty = 1.0

ARGS = {
    "posteriors": posteriors,
    "penalty": penalty,
}
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 tuple, ndim 3, 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
conditional_expectation_G_given_lmbda Ran
ran; our contract draft was wrong, not the code
akinori-f-ebihara/firmbound/models/backward_induction_utils.py
code served (permissive licence) · get_code("bc9c95cd0ae7e727")
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 torch
import torch.nn as nn
import gpytorch
from gpytorch.models import ExactGP
from gpytorch.means import ConstantMean
from gpytorch.kernels import ScaleKernel, RBFKernel
from gpytorch.distributions import MultivariateNormal
from gpytorch.likelihoods import GaussianLikelihood

torch.manual_seed(0)

# Create a minimal GPyTorch model
class SimpleGP(ExactGP):
    def __init__(self, train_x, train_y, likelihood):
        super().__init__(train_x, train_y, likelihood)
        self.mean_module = ConstantMean()
        self.covar_module = ScaleKernel(RBFKernel())
    
    def forward(self, x):
        mean_x = self.mean_module(x)
        covar_x = self.covar_module(x)
        return MultivariateNormal(mean_x, covar_x)

# Create minimal training data
train_x = torch.randn(2, 4)
train_y = torch.randn(2)

# Create likelihood
likelihood = GaussianLikelihood()

# Create model
model = SimpleGP(train_x, train_y, likelihood)

# Create test input (stat parameter)
stat = torch.randn(2, 4)

ARGS = {
    'model': model,
    'likelihood': likelihood,
    'stat': stat
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
gpytorch, torch — 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
get_upper_triangle Ran
ran, violated the contract we drafted
akinori-f-ebihara/firmbound/models/backward_induction_utils.py
code served (permissive licence) · get_code("e1acdf086039d22b")
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 Tensor, ndim 4, dtype family float, shape (2, 3, 4, 10) 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)

# Create a small scores_full tensor
# The function expects shape: (batch_size (optional), num_thresholds (optional), time_steps (optional), num_classes, num_classes)
# Let's create a tensor with all dimensions: (batch_size=2, num_thresholds=3, time_steps=4, num_classes=5, num_classes=5)
scores_full = torch.randn(2, 3, 4, 5, 5)

ARGS = {
    "scores_full": scores_full
}
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 Tensor, ndim 4, dtype family float, shape (2, 3, 4, 10) — shape (2, 3, 4, 10) 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
initialize_Gaussian_process_model Ran
ran; our contract draft was wrong, not the code
akinori-f-ebihara/firmbound/models/backward_induction_utils.py
code served (permissive licence) · get_code("db081f74285f8953")
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, 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 gpytorch
import numpy as np
import torch
from gpytorch.models import ApproximateGP
from gpytorch.variational import CholeskyVariationalDistribution, VariationalStrategy

class GPModel(ApproximateGP):
    def __init__(self, inducing_points):
        variational_distribution = CholeskyVariationalDistribution(inducing_points.size(0))
        variational_strategy = VariationalStrategy(self, inducing_points, variational_distribution, learn_inducing_locations=True)
        super(GPModel, self).__init__(variational_strategy)
        self.mean_module = gpytorch.means.ConstantMean()
        self.covar_module = gpytorch.kernels.ScaleKernel(gpytorch.kernels.RBFKernel())

    def forward(self, x):
        mean_x = self.mean_module(x)
        covar_x = self.covar_module(x)
        return gpytorch.distributions.MultivariateNormal(mean_x, covar_x)

torch.manual_seed(0)
stat = torch.randn(10, 4)

ARGS = {
    'stat': stat,
    'num_inducing_points': 5
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1
Imports
gpytorch, 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
retrieve_posteriors_from_llrm Ran
ran; our contract draft was wrong, not the code
akinori-f-ebihara/firmbound/models/backward_induction_utils.py
code served (permissive licence) · get_code("96b1d9ff0aeefc1c")
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 Tensor, ndim 3, dtype family float, shape (2, 3, 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

torch.manual_seed(0)

# Create a strictly antisymmetric log-likelihood ratio matrix
# Shape: (batch_size=2, time_steps=3, num_classes=4, num_classes=4)
batch_size = 2
time_steps = 3
num_classes = 4

# Create antisymmetric matrix: llrm[i,j] = -llrm[j,i], diagonal = 0
llrm_base = torch.randn(num_classes, num_classes)
llrm_base = (llrm_base - llrm_base.T) / 2  # Make antisymmetric
llrm_base.fill_diagonal_(0)  # Ensure diagonal is zero

# Expand to full shape
llrm = llrm_base.unsqueeze(0).unsqueeze(0).expand(batch_size, time_steps, num_classes, num_classes).clone()

# Create a strictly antisymmetric prior ratio matrix
# Shape: (num_classes=4, num_classes=4)
# Diagonal should be all-one (log(p(k)/p(k)) = log(1) = 0, but the function expects chi_kl = p(label_k) / p(label_l))
# So diagonal should be 1.0 in the ratio space
prior_ratio_base = torch.randn(num_classes, num_classes)
prior_ratio_base = (prior_ratio_base - prior_ratio_base.T) / 2  # Make antisymmetric
prior_ratio_base.fill_diagonal_(1.0)  # Diagonal is 1 (ratio of identical priors)

prior_ratio_matrix = prior_ratio_base

ARGS = {
    "llrm": llrm,
    "prior_ratio_matrix": prior_ratio_matrix,
}
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 Tensor, ndim 3, dtype family float, shape (2, 3, 4) — shape (2, 3, 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
GPModel Not yet run
unverified (harvested, no recorded run)
akinori-f-ebihara/firmbound/models/backward_induction_utils.py
code served (permissive licence) · get_code("7bd697acf5186bd8")
How it ran

no invocation recorded.

backward_induction Not yet run
unverified (harvested, no recorded run)
akinori-f-ebihara/firmbound/models/backward_induction_utils.py
code served (permissive licence) · get_code("4b98560231473fe6")
How it ran

no invocation recorded.

stochastic_variational_ELBO_maximization Not yet run
unverified (harvested, no recorded run)
akinori-f-ebihara/firmbound/models/backward_induction_utils.py
code served (permissive licence) · get_code("e76952a6c06e3205")
How it ran

no invocation recorded.

Also present in other papers' code

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

Time-sensitive machine learning benefits from Sequential Probability Ratio Test (SPRT), which provides an optimal stopping time for early classification of time series. However, in finite horizon scenarios, where input lengths are finite, determining the optimal stopping rule becomes computationally intensive due to the need for backward induction, limiting practical applicability. We thus introduce FIRMBOUND, an SPRT-based framework that efficiently estimates the solution to backward induction from training data, bridging the gap between optimal stopping theory and real-world deployment. It employs density ratio estimation and convex function learning to provide statistically consistent estimators for sufficient statistic and conditional expectation, both essential for solving backward induction; consequently, FIRMBOUND minimizes Bayes risk to reach optimality. Additionally, we present a faster alternative using Gaussian process regression, which significantly reduces training time while retaining low deployment overhead, albeit with potential compromise in statistical consistency. Experiments across independent and identically distributed (i.i.d.), non-i.i.d., binary, multiclass, synthetic, and real-world datasets show that FIRMBOUND achieves optimalities in the sense of Bayes risk and speed-accuracy tradeoff. Furthermore, it advances the tradeoff boundary toward optimality when possible and reduces decisiontime variance, ensuring reliable decision-making. Code is publicly available at https://github.com/Akinori-F-Ebihara/FIRMBOUND.

For agents

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

get_harvested_code_for_paper("2501.18059")
get_code_for_paper("2501.18059")
have("2501.18059")

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

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

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

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

Connect an agent — have() is free.