SYNTOLOGY HomeExplorerAtlasCodeMethodologyAboutDevelopersFeedPricing
Paper · 1805.11090 · 2018

GenAttack: Practical Black-box Attacks with Gradient-Free Optimization

arXiv · PDF · Open in the Atlas

Code that ran

5 of 12 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 3 have no contract verdict; 0 failures of our instrument; 7 no recorded run), 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/1805.11090.json · badge: /api/ran/1805.11090.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
nesl/adversarial_genattack canonical (classifier label)
classifier basis: census
5 ran · 4 no recorded run
maremun/GenAttackMCS2018 reimplementation (classifier label)
classifier basis: classifier_2025
0 ran · 3 no recorded run
FunctionStatusWhere it lives
extract_data Ran
ran, honoured the contract we drafted
nesl/adversarial_genattack/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
nesl/adversarial_genattack/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_data Ran
ran on a synthesized input
nesl/adversarial_genattack/utils.py
code served (permissive licence) · get_code("bb5e83c39bdec690")
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. 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 MockData:
    def __init__(self):
        # test_data: list of samples, each sample is an array
        # Shape: (num_samples, feature_dim)
        self.test_data = [np.random.randn(5).astype(np.float32) for _ in range(10)]
        
        # test_labels: one-hot encoded labels
        # Shape: (num_samples, num_labels)
        num_labels = 3
        self.test_labels = np.zeros((10, num_labels), dtype=int)
        for i in range(10):
            self.test_labels[i, np.random.randint(0, num_labels)] = 1

data = MockData()

ARGS = {
    "data": data,
    "size": 5
}
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 — 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
l_2_dist Ran
ran on a synthesized input
nesl/adversarial_genattack/utils.py
code served (permissive licence) · get_code("32ecbd87f915e308")
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 float32, 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 numpy as np

# Create two small numpy arrays representing images
orig_img = np.random.rand(4, 3).astype(np.float32)
new_img = np.random.rand(4, 3).astype(np.float32)

ARGS = {
    "orig_img": orig_img,
    "new_img": new_img
}
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 float32, 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
l_inf_dist Ran
ran on a synthesized input
nesl/adversarial_genattack/utils.py
code served (permissive licence) · get_code("6f056b1dd2976681")
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 float64, 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 numpy as np
import torch

torch.manual_seed(0)

# Create two small image arrays with distinct shapes
orig_img = np.random.randn(2, 4, 3)
new_img = np.random.randn(2, 4, 3)

ARGS = {
    "orig_img": orig_img,
    "new_img": new_img,
}
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 float64, ndim 0, dtype family float — no output shape is stated: observe_signature.py recorded float ndim 0, which disagrees with the fixture run
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
crossover Not yet run
unverified (harvested, no recorded run)
maremun/GenAttackMCS2018/genattack.py
code served (permissive licence) · get_code("d0d8c5d6a3a88cd8")
How it ran

no invocation recorded.

get_mutation Not yet run
unverified (harvested, no recorded run)
maremun/GenAttackMCS2018/genattack.py
code served (permissive licence) · get_code("ec5f90b9679633c5")
How it ran

no invocation recorded.

load_batch Not yet run
unverified (harvested, no recorded run)
nesl/adversarial_genattack/setup_cifar.py
code served (permissive licence) · get_code("ab7faf0047f2c872")
How it ran

no invocation recorded.

load_batch Not yet run
unverified (harvested, no recorded run)
nesl/adversarial_genattack/setup_cifar.py
code served (permissive licence) · get_code("3b4fb87c66244ebf")
How it ran

no invocation recorded.

readimg Not yet run
unverified (harvested, no recorded run)
nesl/adversarial_genattack/setup_inception.py
code served (permissive licence) · get_code("59c8c9a8f20e44a9")
How it ran

no invocation recorded.

train Not yet run
unverified (harvested, no recorded run)
nesl/adversarial_genattack/train_models.py
code served (permissive licence) · get_code("8b389eb9f5726984")
How it ran

no invocation recorded.

where Not yet run
unverified (harvested, no recorded run)
maremun/GenAttackMCS2018/genattack.py
code served (permissive licence) · get_code("23e2e9ee651bbb83")
How it ran

no invocation recorded.

Also present in other papers' code

Of 12 samples lifted from this paper's linked repositories, 12 carry a function identity and 0 do not. Of the 12 distinct functions with an identity, 5 are also present in other papers whose code we hold (2 with at least one paper dated earlier, 4 the same month, 5 later) and 7 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.10367 (2018-05)
Zeroth-Order Stochastic Variance Reduction for Nonconvex 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.10367 (2018-05)
Zeroth-Order Stochastic Variance Reduction for Nonconvex Optimization
1805.11770 (2018-05)
AutoZOOM: Autoencoder-based Zeroth Order Optimization Method for Attacking Black-box Neural Networks
and 5 more not named here
load_batch 5 other papers
1 the same month, 4 later
1805.11770 (2018-05)
AutoZOOM: Autoencoder-based Zeroth Order Optimization Method for Attacking Black-box Neural Networks
1811.00866 (2018-11)
Efficient Neural Network Robustness Certification with General Activation Functions
1902.03229 (2019-02)
Adaptive and Safe Bayesian Optimization in High Dimensions via One-Dimensional Subspaces
and 2 more not named here
load_batch 4 other papers
1 the same month, 3 later
1805.11770 (2018-05)
AutoZOOM: Autoencoder-based Zeroth Order Optimization Method for Attacking Black-box Neural Networks
1811.00866 (2018-11)
Efficient Neural Network Robustness Certification with General Activation Functions
1902.03229 (2019-02)
Adaptive and Safe Bayesian Optimization in High Dimensions via One-Dimensional Subspaces
and 1 more not named here
train 1 other paper
1 later
aaai_20650 (2022 (year only))
Adversarial Examples Can Be Effective Data Augmentation for Unsupervised Machine 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

Deep neural networks are vulnerable to adversarial examples, even in the black-box setting, where the attacker is restricted solely to query access. Existing black-box approaches to generating adversarial examples typically require a significant number of queries, either for training a substitute network or performing gradient estimation. We introduce GenAttack, a gradient-free optimization technique that uses genetic algorithms for synthesizing adversarial examples in the black-box setting. Our experiments on different datasets (MNIST, CIFAR-10, and ImageNet) show that GenAttack can successfully generate visually imperceptible adversarial examples against state-of-the-art image recognition models with orders of magnitude fewer queries than previous approaches. Against MNIST and CIFAR-10 models, GenAttack required roughly 2,126 and 2,568 times fewer queries respectively, than ZOO, the prior state-of-the-art black-box attack. In order to scale up the attack to large-scale high-dimensional ImageNet models, we perform a series of optimizations that further improve the query efficiency of our attack leading to 237 times fewer queries against the Inception-v3 model than ZOO. Furthermore, we show that GenAttack can successfully attack some state-of-the-art ImageNet defenses, including ensemble adversarial training and non-differentiable or randomized input transformations. Our results suggest that evolutionary algorithms open up a promising area of research into effective black-box attacks.

For agents

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

get_harvested_code_for_paper("1805.11090")
get_code_for_paper("1805.11090")
have("1805.11090")

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

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

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

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

Connect an agent — have() is free.