SYNTOLOGY HomeExplorerAtlasCodeMethodologyAboutDevelopersFeedPricing
Paper · 2112.03570 · 2021

Membership Inference Attacks From First Principles

arXiv · PDF · Open in the Atlas

Code that ran

6 of 8 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 1 has no contract verdict; 5 failures of our instrument; 2 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/2112.03570.json · badge: /api/ran/2112.03570.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
nicomanzonelli/topic_model_attacks reimplementation (classifier label)
classifier basis: classifier_2025
3 ran · 0 no recorded run
vlgiitr/confidence-is-all-you-need extension (classifier label)
classifier basis: classifier_2025
2 ran · 1 no recorded run
orientino/lira-pytorch community (classifier label)
classifier basis not recorded on the link
1 ran · 1 no recorded run
FunctionStatusWhere it lives
fltn Ran
ran; our contract draft was wrong, not the code
nicomanzonelli/topic_model_attacks/topic_mia.py
code served (permissive licence) · get_code("2831112d87704fe9")
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 list. 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

torch.manual_seed(0)

# The function fltn takes a single parameter 'lst' which should be a list
# that may contain both regular items and nested lists (at most one level deep).
# It flattens this structure into a single list.

# Create test data with mixed types - some plain items, some nested lists
test_list = [
    1,
    [2, 3],
    "hello",
    [4, 5, 6],
    torch.tensor([7, 8]),
    [torch.tensor([9, 10]), np.array([11, 12])],
    np.array([13, 14]),
]

ARGS = {
    "lst": test_list
}
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 list — a list 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
generate_ours Ran
ran; the contract check could not run (RAISES, DEP_MISSING or TIMEOUT)
vlgiitr/confidence-is-all-you-need/plot.py
pointer only (licence: NONE) · get_code("485b4287a66c1520")
How it ran

The body of this sample is withheld: GitHub detected no licence in this paper's repository, vlgiitr/confidence-is-all-you-need when it was checked. The setup block that called it is withheld with it, because it is written against that body. source_path and origin say where the code lives, to read under the repository's own terms. A run is recorded.

generate_ours Ran
ran on a synthesized input
orientino/lira-pytorch/plot.py
code served (permissive licence) · get_code("f84881dc40325e67")
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, ndim 2, 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 scipy.stats

# Set random seed for reproducibility
np.random.seed(0)

# Create synthetic data matching the function's expected structure
# keep: boolean array of shape (n_samples, n_models)
# scores: array of shape (n_samples, n_models, n_features)

n_samples = 50
n_models = 3
n_features = 4

# Create keep as a boolean array indicating which examples are "kept"
keep = np.random.rand(n_samples, n_models) > 0.5

# Create scores with shape (n_samples, n_models, n_features)
scores = np.random.randn(n_samples, n_models, n_features)

# Create check_keep: boolean array for checking set, shape (check_n_samples, n_models)
check_n_samples = 10
check_keep = np.random.rand(check_n_samples, n_models) > 0.5

# Create check_scores: array for checking set, shape (check_n_samples, n_models, n_features)
check_scores = np.random.randn(check_n_samples, n_models, n_features)

ARGS = {
    "keep": keep,
    "scores": scores,
    "check_keep": check_keep,
    "check_scores": check_scores,
    "in_size": 100000,
    "out_size": 100000,
    "fix_variance": False,
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
numpy, scipy — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type tuple, ndim 2, dtype family float — a tuple output has no array shape of its own; none is stated
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
load_data Ran
ran; our contract draft was wrong, not the code
vlgiitr/confidence-is-all-you-need/plot.py
pointer only (licence: NONE) · get_code("8ec11ed7f1947e36")
How it ran

The body of this sample is withheld: GitHub detected no licence in this paper's repository, vlgiitr/confidence-is-all-you-need when it was checked. The setup block that called it is withheld with it, because it is written against that body. source_path and origin say where the code lives, to read under the repository's own terms. A run is recorded.

map_calculate_stats Ran
ran; the contract check could not run (RAISES, DEP_MISSING or TIMEOUT)
nicomanzonelli/topic_model_attacks/topic_mia.py
code served (permissive licence) · get_code("05b194730e79b0f1")
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

torch.manual_seed(0)

def fltn(lst):
    """Helper function which flattens a list (at most-one level deep)"""
    out = []
    for item in lst:
        if isinstance(item, list):
            out.extend(item)
        else:
            out.append(item)
    return out

# Create small stat functions that take shadow_phis/target_phi and doc
def stat_func_1(phi, doc):
    """Example stat function - returns a list of scalars"""
    return [phi.sum().item(), phi.mean().item()]

def stat_func_2(phi, doc):
    """Example stat function - returns a list of scalars"""
    return [phi.max().item()]

# Create sample data
# shadow_phis: shape (2, 3, 5) - 2 samples, 3 features, 5 shadow models
shadow_phis = torch.randn(2, 3, 5)

# target_phi: shape (2, 3)
target_phi = torch.randn(2, 3)

# docs_in_shadow: list of 5 sets, each containing document indices
docs_in_shadow = [
    {0, 1},      # shadow model 0 contains docs 0, 1
    {1},         # shadow model 1 contains doc 1
    {0},         # shadow model 2 contains doc 0
    {0, 1},      # shadow model 3 contains docs 0, 1
    set()        # shadow model 4 contains no docs
]

# stat_funcs: list of callable functions
stat_funcs = [stat_func_1, stat_func_2]

# args: tuple of (idx, doc) where doc can be any object
args = (0, {"text": "sample document"})

ARGS = {
    "args": args,
    "shadow_phis": shadow_phis,
    "target_phi": target_phi,
    "docs_in_shadow": docs_in_shadow,
    "stat_funcs": stat_funcs
}
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 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
map_train_shadow_model Ran
ran; the contract check could not run (RAISES, DEP_MISSING or TIMEOUT)
nicomanzonelli/topic_model_attacks/simulation_utils.py
code served (permissive licence) · get_code("a54e9a3450249b65")
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 ShadowModel. 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 torch.nn as nn

torch.manual_seed(0)

# Define a simple training function that takes X and other kwargs
def simple_train_func(X, model=None, epochs=1):
    """Dummy training function that returns a trained model."""
    if model is None:
        model = nn.Linear(4, 2)
    # Simulate training by just returning the model
    return model

# Create a small shadow model class
class ShadowModel(nn.Module):
    def __init__(self):
        super().__init__()
        self.linear = nn.Linear(4, 2)
    
    def forward(self, x):
        return self.linear(x)

# Create training data (small batch)
X_train = torch.randn(2, 4)

# Define train_kwargs with necessary parameters
train_kwargs = {
    'model': ShadowModel(),
    'epochs': 1
}

# Define the arguments dict
ARGS = {
    'args': X_train,
    'train_func': simple_train_func,
    'train_kwargs': train_kwargs
}
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 ShadowModel — a ShadowModel output has no array shape of its own; none is stated — the instrument coerces any output to an array; for a ShadowModel output the recorded ndim 0 and dtype family float describe that coercion, not the output, and are not 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
generate_ours_offline Not yet run
unverified (harvested, no recorded run)
orientino/lira-pytorch/plot.py
code served (permissive licence) · get_code("3e8be43ae654d580")
How it ran

no invocation recorded.

sweep Not yet run
unverified (harvested, no recorded run)
vlgiitr/confidence-is-all-you-need/plot.py
pointer only (licence: NONE) · get_code("18da2122420deb20")
How it ran

The body of this sample is withheld: GitHub detected no licence in this paper's repository, vlgiitr/confidence-is-all-you-need when it was checked. The setup block that called it is withheld with it, because it is written against that body. source_path and origin say where the code lives, to read under the repository's own terms. No invocation recorded.

Also present in other papers' code

Of 8 samples lifted from this paper's linked repositories, 8 carry a function identity and 0 do not. Of the 7 distinct functions with an identity, 3 are also present in other papers whose code we hold (0 with at least one paper dated earlier, 0 the same month, 3 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
sweep 2 other papers
2 later
2402.15159 (2024-02)
Machine Unlearning of Pre-trained Large Language Models
2407.01919 (2024-07)
A Method to Facilitate Membership Inference Attacks in Deep Learning Models
generate_ours 1 other paper
1 later
2407.01919 (2024-07)
A Method to Facilitate Membership Inference Attacks in Deep Learning Models
generate_ours_offline 1 other paper
1 later
2407.01919 (2024-07)
A Method to Facilitate Membership Inference Attacks in Deep Learning Models

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

A membership inference attack allows an adversary to query a trained machine learning model to predict whether or not a particular example was contained in the model's training dataset. These attacks are currently evaluated using average-case "accuracy" metrics that fail to characterize whether the attack can confidently identify any members of the training set. We argue that attacks should instead be evaluated by computing their true-positive rate at low (e.g., <0.1%) false-positive rates, and find most prior attacks perform poorly when evaluated in this way. To address this we develop a Likelihood Ratio Attack (LiRA) that carefully combines multiple ideas from the literature. Our attack is 10x more powerful at low false-positive rates, and also strictly dominates prior attacks on existing metrics.

For agents

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

get_harvested_code_for_paper("2112.03570")
get_code_for_paper("2112.03570")
have("2112.03570")

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

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

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

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

Connect an agent — have() is free.