SYNTOLOGY HomeExplorerAtlasCodeMethodologyAboutDevelopersFeedPricing
Paper · 2409.19212 · NeurIPS · 2024

An Accelerated Algorithm for Stochastic Bilevel Optimization under Unbounded Smoothness

Jie Hao, Mingrui Liu, Xiaochuan Gong

arXiv · PDF · Open in the Atlas

Code that ran

3 of 4 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 2 have no contract verdict; 1 failure of our instrument; 1 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/2409.19212.json · badge: /api/ran/2409.19212.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
mingruiliu-ml-lab/accelerated-bilevel-optimization-unbounded-smoothness canonical (classifier label)
classifier basis: classifier_2025
3 ran · 1 no recorded run
FunctionStatusWhere it lives
AUCMLoss Ran
ran on a synthesized input
mingruiliu-ml-lab/accelerated-bilevel-optimization-unbounded-smoothness/auc_maximization/methods/accbo.py
code served (permissive licence) · get_code("db4ed8cb0d9eab8b")
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 1, dtype family float; no output shape is stated. The image it ran in was not recorded. The code mentions cuda, and the harness aliases cuda to the CPU for every sample; whether this run needed that is 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

# AUCM Loss requires learnable parameters a, b, alpha
# These are typically initialized as tensors with requires_grad=True
a = torch.zeros(1, dtype=torch.float32, requires_grad=True)
b = torch.zeros(1, dtype=torch.float32, requires_grad=True)
alpha = torch.zeros(1, dtype=torch.float32, requires_grad=True)

INIT_ARGS = {
    'a': a,
    'b': b,
    'alpha': alpha,
    'margin': 1.0,
    'imratio': 0.3,
    'device': torch.device('cpu')
}

# For forward: y_pred expects shape (batch, features) where last column is used
# y_true expects shape (batch,) with binary labels
batch_size = 5
num_features = 3

y_pred = torch.randn(batch_size, num_features)
y_true = torch.tensor([1, 0, 1, 0, 1], dtype=torch.float32)

ARGS = {
    'y_pred': y_pred,
    'y_true': y_true
}
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 Tensor, ndim 1, dtype family float — no output shape is stated: observe_signature.py observed this class with its constructor sizes canonicalised where it could, which the node does not record, so its shape is not stated as this setup block's
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)
RNN Ran
ran on a synthesized input
mingruiliu-ml-lab/accelerated-bilevel-optimization-unbounded-smoothness/auc_maximization/methods/accbo.py
code served (permissive licence) · get_code("71942a381042e08c")
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 2, dtype family float; no output shape is stated. The image it ran in was not recorded. The code mentions cuda, and the harness aliases cuda to the CPU for every sample; whether this run needed that is 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 numpy as np
from torch.autograd import Variable

# Reproduce the classes from the problem
from torch import nn
import torch
import numpy as np
from torch.autograd import Variable

class RecurrentEncoder(nn.Module):

    def __init__(self, n_enc_layers, word_embed_dim, encoder_dim, pool_type, dpout_model, bidirectional, rnn=True):
        super(RecurrentEncoder, self).__init__()
        self.n_enc_layers = n_enc_layers
        self.word_embed_dim = word_embed_dim
        self.encoder_dim = encoder_dim
        self.pool_type = pool_type
        self.dpout_model = dpout_model
        self.bidirectional = bidirectional
        self.rnn = rnn
        net_cls = nn.RNN if self.rnn else nn.LSTM
        self.encoder = net_cls(self.word_embed_dim, self.encoder_dim, self.n_enc_layers, bidirectional=bidirectional, dropout=self.dpout_model)

    def is_cuda(self):
        return 'cuda' in str(self.encoder.bias_hh_l0.device)

    def forward(self, sent_tuple):
        sent, sent_len = sent_tuple
        self.encoder.flatten_parameters()
        sent_len, idx_sort = (np.sort(sent_len)[::-1], np.argsort(-sent_len))
        idx_unsort = np.argsort(idx_sort)
        sent_len, idx_sort = (sent_len.copy(), idx_sort.copy())
        idx_sort = torch.from_numpy(idx_sort).cuda() if self.is_cuda() else torch.from_numpy(idx_sort)
        sent = sent.index_select(1, Variable(idx_sort))
        sent_packed = nn.utils.rnn.pack_padded_sequence(sent, sent_len)
        sent_output = self.encoder(sent_packed)[0]
        sent_output = nn.utils.rnn.pad_packed_sequence(sent_output)[0]
        idx_unsort = torch.from_numpy(idx_unsort).cuda() if self.is_cuda() else torch.from_numpy(idx_unsort)
        sent_output = sent_output.index_select(1, Variable(idx_unsort))
        if self.pool_type == 'mean':
            sent_len = Variable(torch.FloatTensor(sent_len)).unsqueeze(1).cuda() if self.is_cuda() else Variable(torch.FloatTensor(sent_len)).unsqueeze(1)
            emb = torch.sum(sent_output, 0).squeeze(0)
            emb = emb / sent_len.expand_as(emb)
        elif self.pool_type == 'max':
            emb = torch.max(sent_output, 0)[0]
            if emb.ndimension() == 3:
                emb = emb.squeeze(0)
                assert emb.ndimension() == 2
        return emb

class RNN(nn.Module):

    def __init__(self, word_embed_dim, encoder_dim, n_enc_layers, dpout_model, dpout_fc, fc_dim, n_classes, pool_type, linear_fc, bidirectional=False):
        super(RNN, self).__init__()
        self.encoder_dim = encoder_dim
        self.n_enc_layers = n_enc_layers
        self.dpout_fc = dpout_fc
        self.fc_dim = fc_dim
        self.n_classes = n_classes
        self.linear_fc = linear_fc
        self.bidirectional = bidirectional
        self.encoder = RecurrentEncoder(n_enc_layers, word_embed_dim, encoder_dim, pool_type, dpout_model, bidirectional)
        self.inputdim = self.encoder_dim
        if self.bidirectional:
            self.inputdim *= 2
        if self.linear_fc:
            self.classifier = nn.Sequential(nn.Linear(self.inputdim, self.fc_dim), nn.Linear(self.fc_dim, self.fc_dim), nn.Linear(self.fc_dim, self.n_classes))
        else:
            self.classifier = nn.Sequential(nn.Dropout(p=self.dpout_fc), nn.Linear(self.inputdim, self.fc_dim), nn.Tanh(), nn.Dropout(p=self.dpout_fc), nn.Linear(self.fc_dim, self.fc_dim), nn.Tanh(), nn.Dropout(p=self.dpout_fc), nn.Linear(self.fc_dim, self.n_classes))

    def forward(self, s1, s2=None):
        if s2 is not None:
            u = self.encoder(s1)
            v = self.encoder(s2)
            features = torch.cat((u, v, torch.abs(u - v), u * v), 1)
        else:
            features = self.encoder(s1)
        output = self.classifier(features)
        return output

INIT_ARGS = {
    'word_embed_dim': 4,
    'encoder_dim': 5,
    'n_enc_layers': 2,
    'dpout_model': 0.0,
    'dpout_fc': 0.0,
    'fc_dim': 6,
    'n_classes': 3,
    'pool_type': 'max',
    'linear_fc': False,
    'bidirectional': False,
}

ARGS = {
    's1': (torch.randn(7, 2, 4), np.array([7, 5])),
    's2': None,
}

if __name__ == '__main__':
    model = RNN(**INIT_ARGS)
    output = model(ARGS['s1'], ARGS['s2'])
    print("Output shape:", output.shape)
    print("Output:", output)
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 2, dtype family float — no output shape is stated: observe_signature.py observed this class with its constructor sizes canonicalised where it could, which the node does not record, so its shape is not stated as this setup block's
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)
predict Ran
ran; the contract check could not run (RAISES, DEP_MISSING or TIMEOUT)
mingruiliu-ml-lab/accelerated-bilevel-optimization-unbounded-smoothness/auc_maximization/methods/accbo.py
code served (permissive licence) · get_code("b5f52970528f0f54")
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 (2, 3) as a later run recorded it. The image it ran in was not recorded. The code mentions cuda, and the harness aliases cuda to the CPU for every sample; whether this run needed that is 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

torch.manual_seed(0)

class SimpleNet(nn.Module):
    def __init__(self):
        super().__init__()
        self.linear = nn.Linear(4, 3)
    
    def forward(self, inputs):
        s_embed, s_lens = inputs
        # Process embeddings and return output
        output = self.linear(s_embed)
        return output

# Create a minimal net that accepts (s_embed, s_lens) tuple
net = SimpleNet()

# Create tiny tensors: batch_size=2, embedding_dim=4
s_embed = torch.randn(2, 4)
s_lens = torch.tensor([3, 2])

inputs = (s_embed, s_lens)

ARGS = {
    "net": net,
    "inputs": inputs
}
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 (2, 3) — shape (2, 3) 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
Learner Not yet run
unverified (harvested, no recorded run)
mingruiliu-ml-lab/accelerated-bilevel-optimization-unbounded-smoothness/auc_maximization/methods/accbo.py
code served (permissive licence) · get_code("2c7767b37ecd4981")
How it ran

no invocation recorded.

Also present in other papers' code

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

This paper investigates a class of stochastic bilevel optimization problems where the upper-level function is nonconvex with potentially unbounded smoothness and the lower-level problem is strongly convex. These problems have significant applications in sequential data learning, such as text classification using recurrent neural networks. The unbounded smoothness is characterized by the smoothness constant of the upper-level function scaling linearly with the gradient norm, lacking a uniform upper bound. Existing state-of-the-art algorithms require O(ϵ -4 ) oracle calls of stochastic gradient or Hessian/Jacobian-vector product to find an ϵ-stationary point. However, it remains unclear if we can further improve the convergence rate when the assumptions for the function in the population level also hold for each random realization almost surely (e.g., Lipschitzness of each realization of the stochastic gradient). To address this issue, we propose a new Accelerated Bilevel Optimization algorithm named AccBO. The algorithm updates the upper-level variable by normalized stochastic gradient descent with recursive momentum and the lower-level variable by the stochastic Nesterov accelerated gradient descent algorithm with averaging. We prove that our algorithm achieves an oracle complexity of O(ϵ -3 ) to find an ϵ-stationary point, when the lower-level stochastic gradient has a small variance O(ϵ). Our proof relies on a novel lemma characterizing the dynamics of stochastic Nesterov accelerated gradient descent algorithm under distribution drift with high probability for the lower-level variable, which is of independent interest and also plays a crucial role in analyzing the hypergradient estimation error over time. Experimental results on various tasks confirm that our proposed algorithm achieves the predicted theoretical acceleration and significantly outperforms baselines in bilevel optimization. The code is available here.

For agents

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

get_harvested_code_for_paper("2409.19212")
get_code_for_paper("2409.19212")
have("2409.19212")

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

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

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

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

Connect an agent — have() is free.