SYNTOLOGY HomeExplorerAtlasCodeMethodologyAboutDevelopersFeedPricing
Paper · 1805.10367 · 2018

Zeroth-Order Stochastic Variance Reduction for Nonconvex Optimization

arXiv · PDF · Open in the Atlas

Code that ran

4 of 5 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 2 have no contract verdict; 0 failures 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/1805.10367.json · badge: /api/ran/1805.10367.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
IBM/ZOSVRG-BlackBox-Adv community (classifier label)
classifier basis not recorded on the link
4 ran · 1 no recorded run
FunctionStatusWhere it lives
ZOSGD Ran
ran on a synthesized input
IBM/ZOSVRG-BlackBox-Adv/optimization_methods/ZO_SGD.py
code served (permissive licence) · get_code("94687ce94dc084fd")
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 ndarray, ndim 2, dtype family float, shape (4, 3) 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 numpy as np

class MockLogHandler:
    def write(self, text):
        pass

class MockObjFunc:
    def __init__(self):
        self.Loss_Attack = 1e-25
        self.Loss_Overall = 100.0
        self.Loss_L2 = 50.0
        self.query_count = 0
    
    def gradient_estimation(self, delImgAT, mu, q, randBatchIdx):
        return np.random.randn(*delImgAT.shape) * 0.01
    
    def evaluate(self, delImgAT, arr, flag):
        self.query_count += 1
        self.Loss_Overall = np.random.uniform(50, 150)
        self.Loss_L2 = np.random.uniform(20, 80)
        self.Loss_Attack = np.random.uniform(1e-26, 1e-24)
    
    def print_current_loss(self):
        pass

class MockMGR:
    def __init__(self):
        self.parSet = {
            'nStage': 2,
            'M': 3,
            'nFunc': 10,
            'batch_size': 4,
            'mu': 0.1,
            'q': 2,
            'eta': 0.01
        }
        self.logHandler = MockLogHandler()

delImgAT_Init = np.random.randn(4, 3)
MGR = MockMGR()
objfunc = MockObjFunc()

ARGS = {
    'delImgAT_Init': delImgAT_Init,
    'MGR': MGR,
    'objfunc': objfunc
}
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 ndarray, ndim 2, dtype family float, shape (4, 3) — shape (4, 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
ZOSVRG Ran
ran on a synthesized input
IBM/ZOSVRG-BlackBox-Adv/optimization_methods/ZO_SVRG.py
code served (permissive licence) · get_code("32aecf5a6cd9ad3f")
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 ndarray, ndim 4, dtype family float, shape (2, 3, 4, 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 numpy as np
import torch
import torch.nn as nn


class MockLogHandler:
    """Mock log handler that captures writes without file I/O"""
    def __init__(self):
        self.logs = []
    
    def write(self, msg):
        self.logs.append(msg)


class MockObjFunc:
    """Mock objective function with required attributes and methods"""
    def __init__(self, nFunc=10):
        self.nFunc = nFunc
        self.query_count = 0
        self.Loss_Attack = 1.0
        self.Loss_Overall = 2.5
        self.Loss_L2 = 0.5
        self.call_count = 0
    
    def gradient_estimation(self, delImgAT, mu, q, batch_idx=None):
        """Return mock gradient estimation"""
        self.query_count += 1
        self.call_count += 1
        # Simulate gradient as small perturbation
        return np.random.randn(*delImgAT.shape) * 0.01
    
    def evaluate(self, delImgAT, empty_array, flag):
        """Evaluate and update loss values"""
        self.Loss_Attack = max(1e-21, self.Loss_Attack * 0.95)
        self.Loss_Overall = self.Loss_Attack + self.Loss_L2
        self.Loss_L2 *= 0.99
    
    def print_current_loss(self):
        """Print current loss values"""
        print(f"Loss_Overall: {self.Loss_Overall}, Loss_Attack: {self.Loss_Attack}")


class MockMGR:
    """Mock manager with parameter set and log handler"""
    def __init__(self):
        self.parSet = {
            'nStage': 2,
            'M': 3,
            'nFunc': 10,
            'batch_size': 5,
            'mu': 0.01,
            'q': 4,
            'eta': 0.1
        }
        self.logHandler = MockLogHandler()


# Create initial image perturbation
delImgAT_Init = np.random.randn(2, 3, 4, 4) * 0.01

# Create manager
MGR = MockMGR()

# Create objective function
objfunc = MockObjFunc(nFunc=MGR.parSet['nFunc'])

# Define argument dictionary
ARGS = {
    'delImgAT_Init': delImgAT_Init,
    'MGR': MGR,
    'objfunc': objfunc
}
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 ndarray, ndim 4, dtype family float, shape (2, 3, 4, 4) — shape (2, 3, 4, 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
extract_data Ran
ran, honoured the contract we drafted
IBM/ZOSVRG-BlackBox-Adv/setup_mnist.py
code served (permissive licence) · get_code("86c9fa246614e9a9")
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 ndarray, ndim 4, dtype family float, shape (2, 28, 28, 1) 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 numpy as np
import gzip
import io

# Create a minimal gzip file containing MNIST-like data
def create_test_gzip_file():
    # MNIST format: 16-byte header + image data
    # Header: magic number (4 bytes) + num images (4 bytes) + rows (4 bytes) + cols (4 bytes)
    header = np.array([2051, 2, 28, 28], dtype='>i4').tobytes()
    
    # Create image data: 2 images of 28x28 pixels
    num_images = 2
    image_data = np.random.randint(0, 256, size=(num_images * 28 * 28), dtype=np.uint8).tobytes()
    
    # Combine header and image data
    full_data = header + image_data
    
    # Compress with gzip and write to BytesIO
    buffer = io.BytesIO()
    with gzip.GzipFile(fileobj=buffer, mode='wb') as gz:
        gz.write(full_data)
    
    buffer.seek(0)
    return buffer

# Create the test gzip file
test_gzip_buffer = create_test_gzip_file()
test_filename = io.BytesIO(test_gzip_buffer.getvalue())

# Monkey-patch gzip.open to return our test file
import gzip as gzip_module
original_open = gzip_module.open

def mock_gzip_open(filename, *args, **kwargs):
    return gzip.GzipFile(fileobj=io.BytesIO(test_gzip_buffer.getvalue()), mode='rb')

gzip_module.open = mock_gzip_open

ARGS = {
    "filename": "test_mnist.gz",
    "num_images": 2
}
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 ndarray, ndim 4, dtype family float, shape (2, 28, 28, 1) — shape (2, 28, 28, 1) 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
extract_labels Ran
ran, honoured the contract we drafted
IBM/ZOSVRG-BlackBox-Adv/setup_mnist.py
code served (permissive licence) · get_code("a0cf6bb81ff7819e")
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 ndarray, ndim 2, dtype family float, shape (5, 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 numpy as np
import gzip
import io
import tempfile
import os

# Create a temporary gzip file with mock label data
# MNIST label format: 8-byte magic header + 1 byte per label
temp_dir = tempfile.mkdtemp()
temp_file = os.path.join(temp_dir, "labels.gz")

num_images = 5
magic_number = np.array([0, 0, 0, 8], dtype=np.uint8)  # MNIST magic number
num_images_bytes = np.array([0, 0, 0, num_images], dtype=np.uint8)
labels_data = np.array([0, 1, 2, 3, 4], dtype=np.uint8)

with gzip.open(temp_file, 'wb') as f:
    f.write(magic_number.tobytes())
    f.write(num_images_bytes.tobytes())
    f.write(labels_data.tobytes())

ARGS = {
    'filename': temp_file,
    'num_images': num_images
}
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 ndarray, ndim 2, dtype family float, shape (5, 10) — shape (5, 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
generate_attack_data_set Not yet run
unverified (harvested, no recorded run)
IBM/ZOSVRG-BlackBox-Adv/Utils.py
code served (permissive licence) · get_code("5d0019ea9005f127")
How it ran

no invocation recorded.

Also present in other papers' code

Of 5 samples lifted from this paper's linked repositories, 5 carry a function identity and 0 do not. Of the 5 distinct functions with an identity, 2 are also present in other papers whose code we hold (2 with at least one paper dated earlier, 2 the same month, 2 later) and 3 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
extract_data 8 other papers
1 dated earlier, 2 the same month, 5 later
1802.07623 (2018-02)
Explanations based on the Missing: Towards Contrastive Explanations with Pertinent Negatives
1805.11090 (2018-05)
GenAttack: Practical Black-box Attacks with Gradient-Free Optimization
1805.11770 (2018-05)
AutoZOOM: Autoencoder-based Zeroth Order Optimization Method for Attacking Black-box Neural Networks
and 5 more not named here
extract_labels 8 other papers
1 dated earlier, 2 the same month, 5 later
1802.07623 (2018-02)
Explanations based on the Missing: Towards Contrastive Explanations with Pertinent Negatives
1805.11090 (2018-05)
GenAttack: Practical Black-box Attacks with Gradient-Free Optimization
1805.11770 (2018-05)
AutoZOOM: Autoencoder-based Zeroth Order Optimization Method for Attacking Black-box Neural Networks
and 5 more not named here

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

As application demands for zeroth-order (gradient-free) optimization accelerate, the need for variance reduced and faster converging approaches is also intensifying. This paper addresses these challenges by presenting: a) a comprehensive theoretical analysis of variance reduced zeroth-order (ZO) optimization, b) a novel variance reduced ZO algorithm, called ZO-SVRG, and c) an experimental evaluation of our approach in the context of two compelling applications, black-box chemical material classification and generation of adversarial examples from black-box deep neural network models. Our theoretical analysis uncovers an essential difficulty in the analysis of ZO-SVRG: the unbiased assumption on gradient estimates no longer holds. We prove that compared to its first-order counterpart, ZO-SVRG with a two-point random gradient estimator could suffer an additional error of order $O(1/b)$, where $b$ is the mini-batch size. To mitigate this error, we propose two accelerated versions of ZO-SVRG utilizing variance reduced gradient estimators, which achieve the best rate known for ZO stochastic optimization (in terms of iterations). Our extensive experimental results show that our approaches outperform other state-of-the-art ZO algorithms, and strike a balance between the convergence rate and the function query complexity.

For agents

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

get_harvested_code_for_paper("1805.10367")
get_code_for_paper("1805.10367")
have("1805.10367")

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

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

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

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

Connect an agent — have() is free.