SYNTOLOGY HomeExplorerAtlasCodeMethodologyAboutDevelopersFeedPricing
Paper · 1810.12042 · 2018

Logit Pairing Methods Can Fool Gradient-Based Attacks

arXiv · PDF · Open in the Atlas

Code that ran

3 of 24 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; 0 honoured the contract we drafted, 0 violated it and 3 have no contract verdict; 0 failures of our instrument; 21 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/1810.12042.json · badge: /api/ran/1810.12042.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
uds-lsv/evaluating-logit-pairing-methods canonical (classifier label)
classifier basis: census
3 ran · 21 no recorded run
FunctionStatusWhere it lives
load_cifar10 Ran
ran on a synthesized input
uds-lsv/evaluating-logit-pairing-methods/mnist_cifar10/utils.py
code served (permissive licence) · get_code("80ab7f0d5badcb2c")
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 torch
import tempfile
import os

torch.manual_seed(0)

# Create a mock data_loader module since the function imports from it
import sys
from types import ModuleType

# Create mock get_cifar10 function
def mock_get_cifar10(batch_size, train=True, path=None, augmentation=False, std=0.0, shuffle=True, workers=4, adversarial=False, subset=1000):
    # Create dummy data loaders as lists of (image, label) tuples
    num_samples = 10 if train else 5
    if adversarial:
        num_samples = min(subset, num_samples)
    
    dataloader = [
        (torch.randn(batch_size, 3, 32, 32), torch.randint(0, 10, (batch_size,)))
        for _ in range(max(1, num_samples // batch_size))
    ]
    
    classes = ['airplane', 'automobile', 'bird', 'cat', 'deer', 'dog', 'frog', 'horse', 'ship', 'truck']
    
    return dataloader, None, classes

# Create and inject the mock module
data_loader_module = ModuleType('data_loader')
data_loader_module.get_cifar10 = mock_get_cifar10
sys.modules['data_loader'] = data_loader_module

# Now set up the arguments
ARGS = {
    'batch_size': 2,
    'data_dir': tempfile.gettempdir(),
    'augmentation': False,
    'stddev': 0.0,
    'adv_subset': 5,
    'workers': 1,
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
data_loader, torch — 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
load_mnist Ran
ran on a synthesized input
uds-lsv/evaluating-logit-pairing-methods/mnist_cifar10/utils.py
code served (permissive licence) · get_code("4131fcb2c408c901")
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 torch
import numpy as np
from unittest.mock import Mock, patch
from torch.utils.data import DataLoader, TensorDataset

torch.manual_seed(0)

# Create minimal mock data for MNIST
x_train = torch.randn(8, 1, 28, 28)  # batch of 8 images
y_train = torch.randint(0, 10, (8,))  # 10 classes
train_dataset = TensorDataset(x_train, y_train)

x_test = torch.randn(4, 1, 28, 28)
y_test = torch.randint(0, 10, (4,))
test_dataset = TensorDataset(x_test, y_test)

# Create mock get_mnist function
def mock_get_mnist(batch_size, train, path, augmentation=False, std=0.0, shuffle=False, 
                    adversarial=False, subset=None, workers=4):
    if train:
        dataset = train_dataset
    else:
        dataset = test_dataset
    
    if adversarial and subset:
        indices = list(range(min(subset, len(dataset))))
        dataset = torch.utils.data.Subset(dataset, indices)
    
    loader = DataLoader(dataset, batch_size=batch_size, shuffle=shuffle, num_workers=0)
    classes = ['0', '1', '2', '3', '4', '5', '6', '7', '8', '9']
    return loader, None, classes

# Patch the data_loader module
import sys
mock_module = Mock()
mock_module.get_mnist = mock_get_mnist
sys.modules['data_loader'] = mock_module

ARGS = {
    'batch_size': 2,
    'data_dir': '/tmp/mnist',
    'augmentation': False,
    'stddev': 0.0,
    'adv_subset': 1000,
    'workers': 4
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
data_loader, numpy, torch — 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
num_examples_per_epoch Ran
ran on a synthesized input
uds-lsv/evaluating-logit-pairing-methods/tiny_imagenet/datasets/tiny_imagenet_input.py
code served (permissive licence) · get_code("82c2b6eb2545846f")
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, 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

# Analyze the function: it takes a single parameter 'split' which is a string
# The function checks if the split name starts with 'train' or 'validation'
# and returns different numbers based on that. It raises ValueError for invalid splits.

# We'll test with a valid split name
ARGS = {
    'split': 'train'
}
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 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
adversarial_eval Not yet run
unverified (harvested, no recorded run)
uds-lsv/evaluating-logit-pairing-methods/mnist_cifar10/train_utils.py
code served (permissive licence) · get_code("8d88c7458d12a344")
How it ran

no invocation recorded.

clean_eval Not yet run
unverified (harvested, no recorded run)
uds-lsv/evaluating-logit-pairing-methods/mnist_cifar10/train_utils.py
code served (permissive licence) · get_code("3f622aea1ef8a1a4")
How it ran

no invocation recorded.

create_biases Not yet run
unverified (harvested, no recorded run)
uds-lsv/evaluating-logit-pairing-methods/mnist_cifar10/models.py
code served (permissive licence) · get_code("3da530e14d48c054")
How it ran

no invocation recorded.

create_conv2d_weights Not yet run
unverified (harvested, no recorded run)
uds-lsv/evaluating-logit-pairing-methods/mnist_cifar10/models.py
code served (permissive licence) · get_code("490fa4d25461b72a")
How it ran

no invocation recorded.

create_weights Not yet run
unverified (harvested, no recorded run)
uds-lsv/evaluating-logit-pairing-methods/mnist_cifar10/models.py
code served (permissive licence) · get_code("691983021599f82f")
How it ran

no invocation recorded.

generate_pgd_common Not yet run
unverified (harvested, no recorded run)
uds-lsv/evaluating-logit-pairing-methods/tiny_imagenet/adversarial_attack.py
code served (permissive licence) · get_code("30f41eaf0970534e")
How it ran

no invocation recorded.

generate_pgd_ll Not yet run
unverified (harvested, no recorded run)
uds-lsv/evaluating-logit-pairing-methods/tiny_imagenet/adversarial_attack.py
code served (permissive licence) · get_code("2419474f5f44dcb2")
How it ran

no invocation recorded.

generate_pgd_rand Not yet run
unverified (harvested, no recorded run)
uds-lsv/evaluating-logit-pairing-methods/tiny_imagenet/adversarial_attack.py
code served (permissive licence) · get_code("81e47ab1c6a2da20")
How it ran

no invocation recorded.

get_cifar10 Not yet run
unverified (harvested, no recorded run)
uds-lsv/evaluating-logit-pairing-methods/mnist_cifar10/data_loader.py
code served (permissive licence) · get_code("04ff1339b08bf76e")
How it ran

no invocation recorded.

get_lr_schedule Not yet run
unverified (harvested, no recorded run)
uds-lsv/evaluating-logit-pairing-methods/tiny_imagenet/model_lib.py
code served (permissive licence) · get_code("b1dbba539c2d86e5")
How it ran

no invocation recorded.

get_mnist Not yet run
unverified (harvested, no recorded run)
uds-lsv/evaluating-logit-pairing-methods/mnist_cifar10/data_loader.py
code served (permissive licence) · get_code("60f00d58b4540401")
How it ran

no invocation recorded.

get_optimizer Not yet run
unverified (harvested, no recorded run)
uds-lsv/evaluating-logit-pairing-methods/tiny_imagenet/model_lib.py
code served (permissive licence) · get_code("da769e06be080c23")
How it ran

no invocation recorded.

image_preprocessing Not yet run
unverified (harvested, no recorded run)
uds-lsv/evaluating-logit-pairing-methods/tiny_imagenet/datasets/imagenet_input.py
code served (permissive licence) · get_code("fa0d1c2e6ff14096")
How it ran

no invocation recorded.

imagenet_input Not yet run
unverified (harvested, no recorded run)
uds-lsv/evaluating-logit-pairing-methods/tiny_imagenet/datasets/imagenet_input.py
code served (permissive licence) · get_code("5879253ec320b0e2")
How it ran

no invocation recorded.

imagenet_parser Not yet run
unverified (harvested, no recorded run)
uds-lsv/evaluating-logit-pairing-methods/tiny_imagenet/datasets/imagenet_input.py
code served (permissive licence) · get_code("d65aec16072659e5")
How it ran

no invocation recorded.

model_train Not yet run
unverified (harvested, no recorded run)
uds-lsv/evaluating-logit-pairing-methods/mnist_cifar10/train_utils.py
code served (permissive licence) · get_code("69767d95c86f9450")
How it ran

no invocation recorded.

read_tiny_imagenet_annotations Not yet run
unverified (harvested, no recorded run)
uds-lsv/evaluating-logit-pairing-methods/tiny_imagenet/tiny_imagenet_converter/converter.py
code served (permissive licence) · get_code("43080682f6ede917")
How it ran

no invocation recorded.

read_training_annotations Not yet run
unverified (harvested, no recorded run)
uds-lsv/evaluating-logit-pairing-methods/tiny_imagenet/tiny_imagenet_converter/converter.py
code served (permissive licence) · get_code("694218061904f78b")
How it ran

no invocation recorded.

read_validation_annotations Not yet run
unverified (harvested, no recorded run)
uds-lsv/evaluating-logit-pairing-methods/tiny_imagenet/tiny_imagenet_converter/converter.py
code served (permissive licence) · get_code("427561f788da200e")
How it ran

no invocation recorded.

tiny_imagenet_input Not yet run
unverified (harvested, no recorded run)
uds-lsv/evaluating-logit-pairing-methods/tiny_imagenet/datasets/tiny_imagenet_input.py
code served (permissive licence) · get_code("d5f94fe48b23242f")
How it ran

no invocation recorded.

tiny_imagenet_parser Not yet run
unverified (harvested, no recorded run)
uds-lsv/evaluating-logit-pairing-methods/tiny_imagenet/datasets/tiny_imagenet_input.py
code served (permissive licence) · get_code("dc5e94702d782007")
How it ran

no invocation recorded.

Also present in other papers' code

Of 24 samples lifted from this paper's linked repositories, 24 carry a function identity and 0 do not. Of the 24 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 23 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
get_optimizer 1 other paper
1 dated earlier
1807.10272 (2018-07)
Evaluating and Understanding the Robustness of Adversarial Logit Pairing

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

Recently, Kannan et al. [2018] proposed several logit regularization methods to improve the adversarial robustness of classifiers. We show that the computationally fast methods they propose - Clean Logit Pairing (CLP) and Logit Squeezing (LSQ) - just make the gradient-based optimization problem of crafting adversarial examples harder without providing actual robustness. We find that Adversarial Logit Pairing (ALP) may indeed provide robustness against adversarial examples, especially when combined with adversarial training, and we examine it in a variety of settings. However, the increase in adversarial accuracy is much smaller than previously claimed. Finally, our results suggest that the evaluation against an iterative PGD attack relies heavily on the parameters used and may result in false conclusions regarding robustness of a model.

For agents

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

get_harvested_code_for_paper("1810.12042")
get_code_for_paper("1810.12042")
have("1810.12042")

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

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

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

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

Connect an agent — have() is free.