gaussianzeroorder
Two-point Gaussian zeroth-order stochastic optimization with high-probability last-iterate certificates.
gaussianzeroorder implements the same-sample, two-point Gaussian
zeroth-order stochastic gradient descent method of Ye (2026). It provides
rigorous, finite-sample, high-confidence certificates for the last iterate
under conditional sub-Gaussian noise — not just expectation bounds or guarantees
on averaged iterates.
Features
- High-probability last-iterate guarantee. With probability at least
1 - delta, the final iteratex_Tis within a controlled distance of the optimum. The confidence cost depends only logarithmically / double-logarithmically ondelta, avoiding the polynomial1/deltablow-up of nave union-bound analyses. - Same-sample variance reduction. Both function evaluations within a single finite-difference step use the same stochastic sample (common random numbers), canceling the independent differencing noise that would otherwise dominate.
- Theoretically principled step size. A dimension- and problem-aware schedule
eta_t = 4d / (mu * (t + T0) * ||u_t||^2)withT0 = 32 d L / muis used directly — no learning-rate tuning required. - Explicit dimension & confidence scaling. The theoretical parameters
(
d,T,delta,mu,L,sigma^2) are first-class inputs, so you can compute a priori how many oracle calls are needed for a target precision at a target confidence. - Certification & diagnostics layer. Compute the stitched confidence factor
Gamma_T(delta), estimate complexity, and derive a post-hoc numerical bound onf(x_T) - f(x*)that holds with probability>= 1 - delta. Per-iteration diagnostics (logger, product-weight tracker, weighted scan monitor) are included. - Reproducible & production-friendly. Reproducibility manager, callback hooks, and an async oracle wrapper for batched / concurrent evaluations.
Module overview
| Module | Key components |
|---|---|
optimizer |
TwoPointGaussianOptimizer, StepSizeSchedule, GaussianDirectionSampler |
oracle |
StochasticOracle (protocol), ProblemConfig, NoiseModel |
certification |
ConfidenceFactor, ComplexityEstimator, PostHocBound, DimensionCheck |
diagnostics |
OptimizationLogger, ProductWeightTracker, WeightedScanMonitor |
utils |
SphereGaussianProjection, ReproducibilityManager, CallbackSystem, AsyncOracleWrapper |
Installation
From PyPI:
pip install gaussianzeroorder
From source (editable, with test dependencies):
git clone https://github.com/USER/REPO.git
cd REPO
python -m venv .venv && source .venv/bin/activate # Windows: .venv\Scripts\activate
pip install -e .[test]
Runtime requirement: Python >=3.10 and NumPy >=1.24.
Usage
The optimizer drives a user-supplied StochasticOracle, whose evaluate(x, seed)
method must return a scalar and use seed to enforce common random numbers.
import numpy as np
from gaussianzeroorder.oracle.base import StochasticOracle
from gaussianzeroorder.oracle.config import ProblemConfig
from gaussianzeroorder.optimizer.core import TwoPointGaussianOptimizer
from gaussianzeroorder.optimizer.step_size import StepSizeSchedule
from gaussianzeroorder.optimizer.direction import GaussianDirectionSampler
class QuadraticStochasticOracle(StochasticOracle):
"""Strongly convex quadratic f(x) = (mu/2)||x||^2 with additive linear noise."""
def __init__(self, d: int, mu: float, sigma: float) -> None:
self.d, self.mu, self.sigma = d, mu, sigma
def evaluate(self, x: np.ndarray, seed: int) -> float:
rng = np.random.default_rng(seed)
xi = rng.normal(0.0, self.sigma, size=self.d)
return float(0.5 * self.mu * np.sum(x**2) + np.dot(xi, x))
# Problem parameters
d, mu, L, sigma = 50, 2.0, 2.0, 0.5
T = 2000
delta = 0.05
# Configuration (positional: d, L, mu, sigma^2, Delta_0, delta)
config = ProblemConfig(d, L, mu, (sigma**2) * d, 0.0, delta)
# Components
schedule = StepSizeSchedule(d, L, mu)
sampler = GaussianDirectionSampler(d, seed=42)
oracle = QuadraticStochasticOracle(d, mu, sigma)
optimizer = TwoPointGaussianOptimizer(oracle, config, schedule, sampler)
x0 = np.random.default_rng(0).standard_normal(d)
x_final = optimizer.optimize(x0, total_iteration_horizon_T=T)
print(f"Final iterate norm: {np.linalg.norm(x_final):.6e}")
Certification
After optimization, compute a rigorous bound on suboptimality that holds with
probability at least 1 - delta:
from gaussianzeroorder.certification.confidence import ConfidenceFactor
from gaussianzeroorder.certification.bounds import PostHocBound
T0 = 32.0 * d * L / mu
gamma_T = ConfidenceFactor().compute_gamma_T(T, T0, delta)
trajectory = [None] * (T + 1) # replace with the real recorded trajectory
cert_bound = PostHocBound().compute_bound(trajectory, gamma_T, config)
print(f"Theoretical 1-delta certificate bound: {cert_bound:.6e}")
Theory
The method targets smooth, strongly convex objectives f with sub-Gaussian
stochastic oracle noise. Under the high-dimensional compatibility condition
d >= 16 log(6T/delta) it attains the convergence rate O~(d/T) for the last
iterate with probability >= 1 - delta. The analysis is based on the paper "High-Probability Last-Iterate Guarantees for Two-Point Gaussian Zeroth-Order Stochastic Gradient Descent" by Haishan Ye (arXiv:2606.20446). See that paper for the full analysis and
the definition of the stitched confidence factor Gamma_T(delta).
Development
pip install -e .[test]
pytest
License
Released under the MIT License.
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file gaussianzeroorder-0.1.0.tar.gz.
File metadata
- Download URL: gaussianzeroorder-0.1.0.tar.gz
- Upload date:
- Size: 23.1 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via:
twine/7.0.0 CPython/3.13.14
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
e23a39139993a9ca10ecca955e6c3c20c7a88becc5a8c938635554e42fd63fa4
|
|
| MD5 |
23d9d3823a51ef000203037012bc6c2e
|
|
| BLAKE2b-256 |
f011b7cc4de1f1ed7708292e094d8aa47b0c7d81b925b6735e1257d123b219e7
|
Provenance
The following attestation bundles were made for gaussianzeroorder-0.1.0.tar.gz:
Publisher:
publish.yml on kuslavicek/zeroorder
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
gaussianzeroorder-0.1.0.tar.gz -
Subject digest:
e23a39139993a9ca10ecca955e6c3c20c7a88becc5a8c938635554e42fd63fa4 - Sigstore transparency entry: 2340669090
- Sigstore integration time:
-
Permalink:
kuslavicek/zeroorder@a00008c6e3dfe99228d8567ae2c94d8e564463c1 -
Branch / Tag:
refs/tags/0.1.0 - Owner: https://github.com/kuslavicek
-
Access:
private
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@a00008c6e3dfe99228d8567ae2c94d8e564463c1 -
Trigger Event:
release
-
Statement type:
File details
Details for the file gaussianzeroorder-0.1.0-py3-none-any.whl.
File metadata
- Download URL: gaussianzeroorder-0.1.0-py3-none-any.whl
- Upload date:
- Size: 22.6 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via:
twine/7.0.0 CPython/3.13.14
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
fe95eef9201d7fcd0ad23239d0b4877a87f57f4c615df26c3b2fc7063a8a6140
|
|
| MD5 |
9c604d067d71ca4a53e48a0d2b208002
|
|
| BLAKE2b-256 |
e8d7b5c25d249c3e1117f2eb7e6ac7e364a568e57a1df15db6dc71195bd5cb85
|
Provenance
The following attestation bundles were made for gaussianzeroorder-0.1.0-py3-none-any.whl:
Publisher:
publish.yml on kuslavicek/zeroorder
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
gaussianzeroorder-0.1.0-py3-none-any.whl -
Subject digest:
fe95eef9201d7fcd0ad23239d0b4877a87f57f4c615df26c3b2fc7063a8a6140 - Sigstore transparency entry: 2340669096
- Sigstore integration time:
-
Permalink:
kuslavicek/zeroorder@a00008c6e3dfe99228d8567ae2c94d8e564463c1 -
Branch / Tag:
refs/tags/0.1.0 - Owner: https://github.com/kuslavicek
-
Access:
private
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@a00008c6e3dfe99228d8567ae2c94d8e564463c1 -
Trigger Event:
release
-
Statement type: