SYNTOLOGY HomeExplorerAtlasCodeMethodologyAboutDevelopersFeedPricing
Paper · aaai_20650 · AAAI · 2022

Adversarial Examples Can Be Effective Data Augmentation for Unsupervised Machine Learning

Pin-Yu Chen, Sijia Liu, Chia-Yi Hsu, Chia-Mu Yu, Songtao Lu

Open in the Atlas

Code that ran

4 of 9 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; 5 no recorded run), measured 2026-11-22; 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/aaai_20650.json · badge: /api/ran/aaai_20650.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/UAE canonical (classifier label)
classifier basis: census
4 ran · 5 no recorded run
FunctionStatusWhere it lives
extract_data Ran
ran, honoured the contract we drafted
IBM/UAE/Supervised/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_data Ran
ran on a synthesized input
IBM/UAE/Unsupversied/setup_fmmnist.py
code served (permissive licence) · get_code("f7f6483f1420d26b")
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 with MNIST-like data
def create_test_gzip_file():
    # MNIST file format: 16-byte header followed by 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 pixel data: 2 images * 28 * 28 pixels = 1568 bytes
    # Using random uint8 values for pixel data
    num_images = 2
    pixel_data = np.random.randint(0, 256, size=(num_images * 28 * 28), dtype=np.uint8).tobytes()
    
    # Combine header and pixel data
    data = header + pixel_data
    
    # Compress with gzip
    compressed = io.BytesIO()
    with gzip.GzipFile(fileobj=compressed, mode='wb') as f:
        f.write(data)
    
    return compressed.getvalue()

# Create the gzip data in memory
gzip_data = create_test_gzip_file()

# Write to a temporary file-like object for testing
import tempfile
import os

# Create a temporary file
temp_fd, temp_path = tempfile.mkstemp(suffix='.gz')
try:
    os.write(temp_fd, gzip_data)
    os.close(temp_fd)
    
    ARGS = {
        'filename': temp_path,
        'num_images': 2
    }
finally:
    # Clean up will happen after ARGS is defined
    pass
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/UAE/Supervised/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
standardized Ran
ran on a synthesized input
IBM/UAE/Supervised/MINE_binary_search.py
code served (permissive licence) · get_code("26aa638c5239d2a6")
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 EagerTensor, 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 tensorflow as tf
import numpy as np

# Create a small test image tensor
# Shape: [batch_size, width] = [2, 4]
# The function computes moments over axis [1], so we need at least 2 dimensions
img_data = np.random.randn(2, 4).astype(np.float32)
img = tf.constant(img_data)

ARGS = {
    "img": img
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
numpy, tensorflow — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type EagerTensor, 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
MiNetwork Not yet run
unverified (harvested, no recorded run)
IBM/UAE/Supervised/MINE_binary_search.py
code served (permissive licence) · get_code("eb1cde3a4e9c756f")
How it ran

no invocation recorded.

get_train_steps Not yet run
unverified (harvested, no recorded run)
IBM/UAE/Unsupversied/simCLR/model_util.py
code served (permissive licence) · get_code("14ec8ff095316493")
How it ran

no invocation recorded.

learning_rate_schedule Not yet run
unverified (harvested, no recorded run)
IBM/UAE/Unsupversied/simCLR/model_util.py
code served (permissive licence) · get_code("ea360af54446b02b")
How it ran

no invocation recorded.

load_batch Not yet run
unverified (harvested, no recorded run)
IBM/UAE/Supervised/setup_cifar.py
code served (permissive licence) · get_code("b60dcd06b47c331c")
How it ran

no invocation recorded.

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

no invocation recorded.

Also present in other papers' code

Of 9 samples lifted from this paper's linked repositories, 9 carry a function identity and 0 do not. Of the 9 distinct functions with an identity, 5 are also present in other papers whose code we hold (5 with at least one paper dated earlier, 0 the same month, 0 later) and 4 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
7 dated earlier, 1 same year, order not determinable
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.11090 (2018-05)
GenAttack: Practical Black-box Attacks with Gradient-Free Optimization
and 5 more not named here
extract_labels 8 other papers
7 dated earlier, 1 same year, order not determinable
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.11090 (2018-05)
GenAttack: Practical Black-box Attacks with Gradient-Free Optimization
and 5 more not named here
get_train_steps 4 other papers
3 dated earlier, 1 same year, order not determinable
2006.05576 (2020-06)
Self-supervised Learning from a Multi-view Perspective
2006.10029 (2020-06)
Big Self-Supervised Models are Strong Semi-Supervised Learners
2109.12909 (2021-09)
Compressive Visual Representations
and 1 more not named here
learning_rate_schedule 1 other paper
1 dated earlier
2006.10029 (2020-06)
Big Self-Supervised Models are Strong Semi-Supervised Learners
train 1 other paper
1 dated earlier
1805.11090 (2018-05)
GenAttack: Practical Black-box Attacks with Gradient-Free Optimization

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

Adversarial examples causing evasive predictions are widely used to evaluate and improve the robustness of machine learning models. However, current studies focus on supervised learning tasks, relying on the ground-truth data label, a targeted objective, or supervision from a trained classifier. In this paper, we propose a framework of generating adversarial examples for unsupervised models and demonstrate novel applications to data augmentation. Our framework exploits a mutual information neural estimator as an information-theoretic similarity measure to generate adversarial examples without supervision. We propose a new MinMax algorithm with provable convergence guarantees for efficient generation of unsupervised adversarial examples. Our framework can also be extended to supervised adversarial examples. When using unsupervised adversarial examples as a simple plug-in data augmentation tool for model retraining, significant improvements are consistently observed across different unsupervised tasks and datasets, including data reconstruction, representation learning, and contrastive learning. Our results show novel methods and considerable advantages in studying and improving unsupervised machine learning via adversarial examples.

For agents

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

get_harvested_code_for_paper("aaai_20650")
get_code_for_paper("aaai_20650")
have("aaai_20650")

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

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

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

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

Connect an agent — have() is free.