SYNTOLOGY HomeExplorerAtlasCodeMethodologyAboutDevelopersFeedPricing
Paper · 2304.06686 · NeurIPS · 2023

OKRidge: Scalable Optimal k-Sparse Ridge Regression

Chudi Zhong, Cynthia Rudin, Jiachang Liu, Sam Rosen

arXiv · PDF · Open in the Atlas

Code that ran

11 of 13 samples (functions and classes) lifted from this paper's linked repositories executed on a synthesized input in Syntology's jail (3 of them constructed an object rather than computing a result; 5 honoured the contract we drafted, 0 violated it and 6 have no contract verdict; 0 failures of our instrument; 2 no recorded run); 1 of them was also run on the host, not in the jail, by the peer-agreement lane that set its level, measured 2026-11-23; 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/2304.06686.json · badge: /api/ran/2304.06686.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
jiachangliu/okridge canonical (classifier label)
classifier basis: classifier_2025
11 ran · 2 no recorded run
FunctionStatusWhere it lives
total_size Ran
ran, honoured the contract we drafted
jiachangliu/okridge/src/okridge/solvers.py
code served (permissive licence) · get_code("6d403e45178c45cc")
How it ran

Ran in Syntology's jail on this synthesized input (drafted by a language model, Claude Haiku 4.5, prompt python_fixture_v1) and returned int, ndim 0, dtype family int, shape () as a later run recorded it. The image it ran in was not recorded. The comparison behind this sample's level is a different run: the peer-agreement lane ran it again on the host, not in the jail (report dated 2026-09-05T00:19:46Z). 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.

from sys import getsizeof, stderr
from itertools import chain
from collections import deque

# Create test objects for the total_size function
test_list = [1, 2, 3, 4, 5]
test_dict = {"a": 1, "b": 2, "c": [1, 2, 3]}
test_tuple = (1, 2, 3)
test_set = {1, 2, 3}
test_deque = deque([1, 2, 3, 4])
test_frozenset = frozenset([1, 2, 3])

# Create a custom container class for testing handlers
class CustomContainer:
    def __init__(self, items):
        self.items = items
    
    def get_elements(self):
        return iter(self.items)

custom_obj = CustomContainer([1, 2, 3, 4])

# Create handlers dict with a custom handler
custom_handlers = {
    CustomContainer: lambda obj: obj.get_elements()
}

# Test object - a nested structure
test_object = {
    "list": test_list,
    "dict": test_dict,
    "tuple": test_tuple,
    "set": test_set,
    "deque": test_deque,
    "frozenset": test_frozenset,
    "nested": {
        "inner_list": [1, 2, 3],
        "inner_dict": {"x": 10, "y": 20}
    }
}

ARGS = {
    "o": test_object,
    "handlers": custom_handlers,
    "verbose": False
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1
Imports
none outside the standard library — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type int, ndim 0, dtype family int, 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
DataClass Ran
ran on a synthesized input · constructed an object; no result was computed
jiachangliu/okridge/src/okridge/tree.py
code served (permissive licence) · get_code("1be5cb7dc882cee2")
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 an instance of its own class, DataClass: the run constructed the object and did not call it, so no result was computed. 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

np.random.seed(0)

# Create small but distinct-sized data
n = 5  # number of samples
p = 3  # number of features

X = np.random.randn(n, p)
y = np.random.randn(n)
lambda2 = 0.1

ARGS = {
    "X": X,
    "y": y,
    "lambda2": lambda2,
}
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 DataClass — the run constructed an instance of its own class and did not call it; no shape is stated — the instrument coerces any output to an array; for a DataClass 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
Node Ran
ran on a synthesized input · constructed an object; no result was computed
jiachangliu/okridge/src/okridge/tree.py
code served (permissive licence) · get_code("4925be329c6c8ffc")
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 an instance of its own class, Node: the run constructed the object and did not call it, so no result was computed. 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
import gc
import scipy
import psutil
from sklearn.isotonic import IsotonicRegression

class MockData:
    def __init__(self):
        self.p = 5
        self.X = np.random.randn(10, 5)
        self.X_norm_2 = np.linalg.norm(self.X, axis=0)
        self.XTX = self.X.T @ self.X
        self.XTy = self.X.T @ np.random.randn(10)
        self.smallest_eigenval = np.min(np.linalg.eigvals(self.XTX))
        self.XTX_minus_smallest_eigenval = self.XTX - self.smallest_eigenval * np.eye(5)
        self.lambda2 = 0.1
        self.XTX_lambda2 = self.XTX + self.lambda2 * np.eye(5)

class MockParentNode:
    def __init__(self):
        self.data = MockData()
        self.level = 0
        self.lower_bound = 0.0
        self.upper_bound = 1.5
        self.upper_beta = np.random.randn(5)
        self.upper_r = np.random.randn(10)
        self.lower_beta_on_allowed_support = np.random.randn(5)

ARGS = {
    'parent': MockParentNode(),
    'zlb': np.array([False, False, True, False, False]),
    'zub': np.array([True, True, True, True, False]),
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
numpy, psutil, scipy, sklearn — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type Node — the run constructed an instance of its own class and did not call it; no shape is stated — the instrument coerces any output to an array; for a Node 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
calculate_size Ran
ran, honoured the contract we drafted
jiachangliu/okridge/src/okridge/solvers.py
code served (permissive licence) · get_code("c3c9a0804f11f6d3")
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 int, ndim 0, dtype family int, 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 sys
import torch

torch.manual_seed(0)

# The function expects a dictionary where each value is a tuple/list with at least 2 elements
# It calls sys.getsizeof on the first and second elements of each value

tmp_dict = {
    'key1': (torch.randn(2, 4), torch.randn(3, 5)),
    'key2': ([1, 2, 3], {'a': 1, 'b': 2}),
    'key3': ("hello", 42),
}

ARGS = {
    'tmp_dict': tmp_dict
}
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 int, ndim 0, dtype family int, 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
convert_GB_to_bytes Ran
ran, honoured the contract we drafted
jiachangliu/okridge/src/okridge/tree.py
code served (permissive licence) · get_code("2b703299192e52ae")
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
import numpy as np

bytes_per_GB = 1024 ** 3

def convert_GB_to_bytes(x_GB):
    x_bytes = x_GB * bytes_per_GB
    return x_bytes

ARGS = {
    "x_GB": 2.5
}
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 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
convert_bytes_to_GB Ran
ran, honoured the contract we drafted
jiachangliu/okridge/src/okridge/tree.py
code served (permissive licence) · get_code("f6fc85435dbf0406")
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

bytes_per_GB = 1024 ** 3

def convert_bytes_to_GB(x_bytes):
    x_GB = x_bytes / bytes_per_GB
    return x_GB

ARGS = {
    "x_bytes": 2147483648
}
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
get_RAM_available_in_GB Ran
ran on a synthesized input
jiachangliu/okridge/src/okridge/tree.py
code served (permissive licence) · get_code("ffe80097c40a7199")
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; 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 psutil

bytes_per_GB = 1024 ** 3

def convert_bytes_to_GB(x_bytes):
    x_GB = x_bytes / bytes_per_GB
    return x_GB

def get_RAM_available_in_bytes():
    return psutil.virtual_memory()[1]

def get_RAM_available_in_GB():
    return convert_bytes_to_GB(get_RAM_available_in_bytes())

# The function get_RAM_available_in_GB takes no parameters
ARGS = {}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
psutil — 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 — no output shape is stated: observe_signature.py could not observe it (no_inputs)
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_RAM_available_in_bytes Ran
ran on a synthesized input
jiachangliu/okridge/src/okridge/tree.py
code served (permissive licence) · get_code("2360eab65500ca1c")
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 int, ndim 0, dtype family int; 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 psutil

# This function takes no parameters, so ARGS should be an empty dictionary
ARGS = {}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
psutil — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type int, ndim 0, dtype family int — no output shape is stated: observe_signature.py could not observe it (no_inputs)
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_RAM_used_in_GB Ran
ran on a synthesized input
jiachangliu/okridge/src/okridge/tree.py
code served (permissive licence) · get_code("37fd8042734450f6")
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; 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 psutil

# The function get_RAM_used_in_GB() takes no parameters
# It simply calls psutil.virtual_memory()[3] and divides by 1000000000
# No setup is needed as it doesn't accept any arguments

ARGS = {}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
psutil — 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 — no output shape is stated: observe_signature.py could not observe it (no_inputs)
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
linRegModel_unnormalized_big_n Ran
ran on a synthesized input · constructed an object; no result was computed
jiachangliu/okridge/src/okridge/tree.py
code served (permissive licence) · get_code("40b7e97722f1bebb")
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 an instance of its own class, linRegModel_unnormalized_big_n: the run constructed the object and did not call it, so no result was computed. 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

class CustomData:
    def __init__(self):
        # Small dimensions: n=6 samples, p=4 features
        self.n = 6
        self.p = 4
        
        # Create synthetic X matrix (n x p)
        np.random.seed(0)
        self.X = np.random.randn(self.n, self.p)
        
        # Create synthetic y vector (n,)
        self.y = np.random.randn(self.n)
        
        # Lambda2 for L2 regularization
        self.lambda2 = 0.1
        
        # Precompute XTX + lambda2*I
        XTX = self.X.T @ self.X
        self.XTX_lambda2 = XTX + self.lambda2 * np.eye(self.p)
        
        # Precompute XTy
        self.XTy = self.X.T @ self.y
        
        # Lipschitz constant (largest eigenvalue of XTX_lambda2)
        eigvals = np.linalg.eigvals(self.XTX_lambda2)
        self.half_Lipschitz = np.max(eigvals) / 2.0

data = CustomData()

ARGS = {
    "data": data
}
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 linRegModel_unnormalized_big_n — the run constructed an instance of its own class and did not call it; no shape is stated — the instrument coerces any output to an array; for a linRegModel_unnormalized_big_n 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
new_z Ran
ran, honoured the contract we drafted
jiachangliu/okridge/src/okridge/tree.py
code served (permissive licence) · get_code("be5619896ef9cbf7")
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

class CustomClass:
    """Stand-in class with zlb and zub attributes needed by new_z"""
    def __init__(self, zlb, zub):
        self.zlb = zlb
        self.zub = zub

# Create a parent node with zlb and zub arrays
zlb = np.array([0.5, 0.3, 0.7, 0.2])
zub = np.array([0.9, 0.8, 0.95, 0.6])
node = CustomClass(zlb, zub)

# Index to branch on
index = 2

ARGS = {
    "node": node,
    "index": index
}
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
BNBTree Not yet run
unverified (harvested, no recorded run)
jiachangliu/okridge/src/okridge/tree.py
code served (permissive licence) · get_code("480876c73d988263")
How it ran

no invocation recorded.

branch Not yet run
unverified (harvested, no recorded run)
jiachangliu/okridge/src/okridge/tree.py
code served (permissive licence) · get_code("1395c9fcdb4e8258")
How it ran

no invocation recorded.

Also present in other papers' code

Of 13 samples lifted from this paper's linked repositories, 13 carry a function identity and 0 do not. Of the 13 distinct functions with an identity, 1 are also present in other papers whose code we hold (1 with at least one paper dated earlier, 0 the same month, 0 later) and 12 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
total_size 1 other paper
1 dated earlier
2008.07298 (2020-08)
WAFFLE: Watermarking in Federated Learning

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

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 consider an important problem in scientific discovery, namely identifying sparse governing equations for nonlinear dynamical systems. This involves solving sparse ridge regression problems to provable optimality in order to determine which terms drive the underlying dynamics. We propose a fast algorithm, OKRidge, for sparse ridge regression, using a novel lower bound calculation involving, first, a saddle point formulation, and from there, either solving (i) a linear system or (ii) using an ADMM-based approach, where the proximal operators can be efficiently evaluated by solving another linear system and an isotonic regression problem. We also propose a method to warm-start our solver, which leverages a beam search. Experimentally, our methods attain provable optimality with run times that are orders of magnitude faster than those of the existing MIP formulations solved by the commercial solver Gurobi. then we can reformulate Problem (3) as: min β,z max c L Fenchel ridge (β, z, c) s.t. p j=1 z j ≤ k, z j ∈ {0, 1}.

For agents

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

get_harvested_code_for_paper("2304.06686")
get_code_for_paper("2304.06686")
have("2304.06686")

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

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

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

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

Connect an agent — have() is free.