SYNTOLOGY HomeExplorerAtlasCodeMethodologyAboutDevelopersFeedPricing
Paper · 2202.03397 · 2022

Bilevel Optimization with a Lower-level Contraction: Optimal Sample Complexity without Warm-start

arXiv · PDF · Open in the Atlas

Code that ran

8 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; 2 honoured the contract we drafted, 0 violated it and 0 have no contract verdict; 6 failures of our instrument; 0 no recorded run), measured 2026-11-21; 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/2202.03397.json · badge: /api/ran/2202.03397.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
csml-iit-ucl/bioptexps canonical (classifier label)
classifier basis: classifier_2025
8 ran · 0 no recorded run
FunctionStatusWhere it lives
accuracy Ran
ran; our contract draft was wrong, not the code
csml-iit-ucl/bioptexps/source/DEQs.py
code served (permissive licence) · get_code("7817c0966b657e0b")
How it ran

Ran in Syntology's sandbox on this synthesized input (drafted by a language model, Claude Sonnet 4.5, prompt python_fixture_v1) 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)

# Create predictions tensor with shape (batch_size=2, num_classes=4)
# These are logits/scores before argmax
preds = torch.randn(2, 4)

# Create targets tensor with shape (batch_size=2,)
# These are class indices
targets = torch.tensor([1, 3])

ARGS = {
    "preds": preds,
    "targets": targets
}
Setup block drafted by
a language model, Claude Sonnet 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 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
evaluate Ran
ran; our contract draft was wrong, not the code
csml-iit-ucl/bioptexps/source/meta_learning_parallel.py
code served (permissive licence) · get_code("87426479819d1248")
How it ran

Ran in Syntology's sandbox on this synthesized input (drafted by a language model, Claude Sonnet 4.5, prompt python_fixture_v1) 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 torch
import torch.nn as nn
import numpy as np

torch.manual_seed(0)

# Build a simple meta model
class SimpleMetaModel(nn.Module):
    def __init__(self, input_dim=5, hidden_dim=6):
        super().__init__()
        self.fc = nn.Linear(input_dim, hidden_dim)
    
    def forward(self, x):
        return self.fc(x)

meta_model = SimpleMetaModel()

# Build a simple dataloader (list of batches)
# Each batch is a dict with 'train' and 'test' keys
# Each contains (xs, ys) tuples
# xs shape: [n_tasks, n_samples, input_dim]
# ys shape: [n_tasks, n_samples, 1] for classification
n_tasks_per_batch = 3
n_train_samples = 4
n_test_samples = 5
input_dim = 5
n_classes = 7

dataloader = []
for _ in range(2):  # 2 batches
    batch = {
        'train': (
            torch.randn(n_tasks_per_batch, n_train_samples, input_dim),
            torch.randint(0, n_classes, (n_tasks_per_batch, n_train_samples, 1))
        ),
        'test': (
            torch.randn(n_tasks_per_batch, n_test_samples, input_dim),
            torch.randint(0, n_classes, (n_tasks_per_batch, n_test_samples, 1))
        )
    }
    dataloader.append(batch)

# Build get_params_init function
# Returns parameters for the linear head
def get_params_init(bs):
    hidden_dim = 6
    n_classes = 7
    weights = torch.randn(bs, hidden_dim, n_classes, requires_grad=True)
    bias = torch.randn(bs, n_classes, requires_grad=True)
    return [weights, bias]

# Build inner_optim_build function
def inner_optim_build(params):
    opt = torch.optim.SGD(params, lr=0.01)
    return [opt]

# Build criterion
def criterion(input, target, reduction='none'):
    # Simple cross entropy-like loss
    # input: [batch, n_classes]
    # target: [batch, 1]
    target = target.squeeze(-1)
    loss = nn.functional.cross_entropy(input, target, reduction=reduction)
    return loss

# Build post_transform function
def post_transform(data):
    # Just return data as-is
    return data

# Set parameters
n_tasks = 4
T = 2  # Number of inner loop steps
reg_param = 0.01
n_parallel_tasks = 2

ARGS = {
    'n_tasks': n_tasks,
    'dataloader': dataloader,
    'meta_model': meta_model,
    'get_params_init': get_params_init,
    'T': T,
    'reg_param': reg_param,
    'inner_optim_build': inner_optim_build,
    'n_parallel_tasks': n_parallel_tasks,
    'criterion': criterion,
    'post_transform': post_transform
}
Setup block drafted by
a language model, Claude Sonnet 4.5, prompt python_fixture_v1
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 — 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
frnp Ran
ran, honoured the contract we drafted
csml-iit-ucl/bioptexps/source/poisoning.py
code served (permissive licence) · get_code("9a92238c7fc47933")
How it ran

Ran in Syntology's sandbox on this synthesized input (drafted by a language model, Claude Sonnet 4.5, prompt python_fixture_v1) and returned Tensor, ndim 2, dtype family float, shape (2, 4) 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 numpy as np

torch.manual_seed(0)

# Create a small numpy array
x = np.array([[1.0, 2.0, 3.0, 4.0],
              [5.0, 6.0, 7.0, 8.0]])

ARGS = {
    'x': x
}
Setup block drafted by
a language model, Claude Sonnet 4.5, prompt python_fixture_v1
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, 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
from_maybe_sparse Ran
ran, honoured the contract we drafted
csml-iit-ucl/bioptexps/source/poisoning.py
code served (permissive licence) · get_code("76ce9079b895cd6b")
How it ran

Ran in Syntology's sandbox on this synthesized input (drafted by a language model, Claude Sonnet 4.5, prompt python_fixture_v1) and returned Tensor. 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 numpy as np
import scipy.sparse

torch.manual_seed(0)

# Test with a sparse matrix
sparse_matrix = scipy.sparse.csr_matrix(np.array([[1.0, 0.0, 2.0], 
                                                    [0.0, 3.0, 0.0]]))

ARGS = {
    'x': sparse_matrix
}
Setup block drafted by
a language model, Claude Sonnet 4.5, prompt python_fixture_v1
Imports
numpy, scipy, torch — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type Tensor, shape (2, 3) — shape (2, 3) as a later run recorded it
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_cnn_miniimagenet Ran
ran; our contract draft was wrong, not the code
csml-iit-ucl/bioptexps/source/meta_learning_parallel.py
code served (permissive licence) · get_code("46e6c33eb305af98")
How it ran

Ran in Syntology's sandbox on this synthesized input (drafted by a language model, Claude Sonnet 4.5, prompt python_fixture_v1) and returned Sequential. 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

torch.manual_seed(0)

# The function takes three parameters:
# 1. hidden_size: an integer representing the number of hidden units
# 2. n_classes: optional integer for number of classes (default None)
# 3. transductive: boolean flag (default False)

# Looking at the function body:
# - hidden_size is used as the output channels in conv layers
# - n_classes is not actually used in the function body
# - transductive is used in BatchNorm2d's track_running_stats parameter

ARGS = {
    'hidden_size': 64,
    'n_classes': 5,
    'transductive': False
}
Setup block drafted by
a language model, Claude Sonnet 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 Sequential — a Sequential 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
get_cnn_omniglot Ran
ran; our contract draft was wrong, not the code
csml-iit-ucl/bioptexps/source/meta_learning_parallel.py
code served (permissive licence) · get_code("af1f45cf07537d97")
How it ran

Ran in Syntology's sandbox on this synthesized input (drafted by a language model, Claude Sonnet 4.5, prompt python_fixture_v1) and returned Sequential. 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 math
from torch import nn

torch.manual_seed(0)

# The function get_cnn_omniglot takes:
# - hidden_size: an integer for the number of hidden units
# - n_classes: optional, number of classes (not used in the function body)
# - transductive: boolean flag for batch norm behavior

ARGS = {
    'hidden_size': 64,
    'n_classes': 5,
    'transductive': False
}
Setup block drafted by
a language model, Claude Sonnet 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 Sequential — a Sequential 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
to_numpy Ran
ran; our contract draft was wrong, not the code
csml-iit-ucl/bioptexps/source/DEQs.py
code served (permissive licence) · get_code("206093cc91ccd0b8")
How it ran

Ran in Syntology's sandbox on this synthesized input (drafted by a language model, Claude Sonnet 4.5, prompt python_fixture_v1) 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

torch.manual_seed(0)

# Test case 1: single tensor
tensor_single = torch.randn(2, 4)

# Test case 2: list of tensors
tensor_list = [torch.randn(2, 4), torch.randn(3, 5)]

# Test case 3: tuple of tensors
tensor_tuple = (torch.randn(2, 4), torch.randn(3, 5))

# Test case 4: nested structure
tensor_nested = [torch.randn(2, 4), (torch.randn(3, 5), torch.randn(1, 2))]

# We'll use the single tensor as the main test case
ARGS = {
    'tensor': tensor_single
}
Setup block drafted by
a language model, Claude Sonnet 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 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
tonp Ran
ran; the contract check could not run (RAISES, DEP_MISSING or TIMEOUT)
csml-iit-ucl/bioptexps/source/poisoning.py
code served (permissive licence) · get_code("e9907a680034c66c")
How it ran

Ran in Syntology's sandbox on this synthesized input (drafted by a language model, Claude Sonnet 4.5, prompt python_fixture_v1) 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. 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

torch.manual_seed(0)

# Create a small tensor on CPU
x = torch.randn(2, 4)

# The function checks if cuda is available and moves tensor accordingly
# We pass a CPU tensor and let the function handle it
# The cuda parameter has a default value from the module level

ARGS = {
    'x': x,
    'cuda': False  # Set to False since we're in CPU-only environment
}
Setup block drafted by
a language model, Claude Sonnet 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 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

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-21.

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 analyse a general class of bilevel problems, in which the upper-level problem consists in the minimization of a smooth objective function and the lower-level problem is to find the fixed point of a smooth contraction map. This type of problems include instances of meta-learning, equilibrium models, hyperparameter optimization and data poisoning adversarial attacks. Several recent works have proposed algorithms which warm-start the lower-level problem, i.e.~they use the previous lower-level approximate solution as a staring point for the lower-level solver. This warm-start procedure allows one to improve the sample complexity in both the stochastic and deterministic settings, achieving in some cases the order-wise optimal sample complexity. However, there are situations, e.g., meta learning and equilibrium models, in which the warm-start procedure is not well-suited or ineffective. In this work we show that without warm-start, it is still possible to achieve order-wise (near) optimal sample complexity. In particular, we propose a simple method which uses (stochastic) fixed point iterations at the lower-level and projected inexact gradient descent at the upper-level, that reaches an $ε$-stationary point using $O(ε^{-2})$ and $\tilde{O}(ε^{-1})$ samples for the stochastic and the deterministic setting, respectively. Finally, compared to methods using warm-start, our approach yields a simpler analysis that does not need to study the coupled interactions between the upper-level and lower-level iterates.

For agents

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

get_harvested_code_for_paper("2202.03397")
get_code_for_paper("2202.03397")
have("2202.03397")

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

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

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

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

Connect an agent — have() is free.