SYNTOLOGY HomeExplorerAtlasCodeMethodologyAboutDevelopersFeedPricing
Paper · 2302.08466 · NeurIPS · 2023

Marich: A Query-efficient Distributionally Equivalent Model Extraction Attack using Public Data

Debabrota Basu, Pratik Karmakar

arXiv · PDF · Open in the Atlas

Code that ran

5 of 8 samples (functions and classes) lifted from this paper's linked repositories executed on a synthesized input in Syntology's jail (1 of them constructed an object rather than computing a result; 1 honoured the contract we drafted, 0 violated it and 1 has no contract verdict; 3 failures of our instrument; 3 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/2302.08466.json · badge: /api/ran/2302.08466.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
debabrota-basu/marich canonical (classifier label)
classifier basis: classifier_2025
5 ran · 3 no recorded run
FunctionStatusWhere it lives
conv_dataset Ran
ran; our contract draft was wrong, not the code
debabrota-basu/marich/lr_cnn_res_marich/utils.py
code served (permissive licence) · get_code("74a351501aaa0c29")
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 dataset. 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
from torch.utils.data import Dataset, DataLoader, Subset

torch.manual_seed(0)

class dataset(Dataset):

    def __init__(self, X, Y=None, transform=None):
        self.X = X
        self.Y = Y
        self.transform = transform

    def __len__(self):
        return len(self.X)

    def __getitem__(self, idx):
        if self.transform:
            x = self.transform(self.X[idx].transpose(1, 2, 0))
        else:
            x = self.X[idx]
        if self.Y:
            y = self.Y[idx]
            return (x, y)
        else:
            return x

def conv_dataset(data):
    datas = []
    labels = []
    for d, l in data:
        datas.append(d)
        labels.append(torch.tensor(l))
    mydata = dataset(datas, labels)
    return mydata

# Create sample data: list of (tensor, label) tuples
# Using distinct dimensions: 2 samples, each with shape (3, 4, 5) for height, width, channels
sample_data = [
    (torch.randn(3, 4, 5), 0),
    (torch.randn(3, 4, 5), 1)
]

ARGS = {
    "data": sample_data
}
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 dataset — a dataset 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
dataset Ran
ran on a synthesized input · constructed an object; no result was computed
debabrota-basu/marich/lr_cnn_res_marich/utils.py
code served (permissive licence) · get_code("05a18ee834f7c5ca")
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 an instance of its own class, dataset: the run constructed the object and did not call it, so no result was computed. 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 torch.utils.data import Dataset

torch.manual_seed(0)

# Create small sample data
# X should be a tensor with shape (batch, channels, height, width) based on the transpose(1, 2, 0) call
X = torch.randn(2, 3, 4, 5)  # 2 samples, 3 channels, 4x5 spatial dims
Y = torch.tensor([0, 1])  # 2 labels

# Create a simple transform function that takes input of shape (height, width, channels)
# and returns a tensor
def simple_transform(x):
    # x will be shape (4, 5, 3) after transpose(1, 2, 0)
    return torch.from_numpy(np.array(x)).float()

ARGS = {
    "X": X,
    "Y": Y,
    "transform": simple_transform
}
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 dataset — the run constructed an instance of its own class and did not call it; no shape 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
engrad Ran
ran; the contract check could not run (RAISES, DEP_MISSING or TIMEOUT)
debabrota-basu/marich/lr_cnn_res_marich/utils.py
code served (permissive licence) · get_code("7b5171dd6e96fd3d")
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, ndim 1, dtype family int; no output shape is stated. The image it ran in was not recorded. The code mentions cuda, and the harness aliases cuda to the CPU for every sample; whether this run needed that is 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 torch
import torch.nn as nn
import numpy as np
from torch.utils.data import Dataset, DataLoader

torch.manual_seed(0)
np.random.seed(0)

# Define a simple logistic regression model
class SimpleLogReg(nn.Module):
    def __init__(self, input_dim=784, num_classes=10):
        super().__init__()
        self.linear = nn.Linear(input_dim, num_classes)
    
    def forward(self, x):
        return self.linear(x)

# Define a custom dataset class that matches what the function expects
class CustomDataset(Dataset):
    def __init__(self, X, Y=None):
        self.X = X
        self.Y = Y
    
    def __len__(self):
        return len(self.X)
    
    def __getitem__(self, idx):
        if self.Y is not None:
            return (self.X[idx], self.Y[idx])
        return self.X[idx]
    
    def get_data_label_loader(self, indices, batch_size=2):
        """Returns a dataloader for the given indices"""
        subset = torch.utils.data.Subset(self, indices)
        return DataLoader(subset, batch_size=batch_size, shuffle=False)

# Create small dummy data
X = torch.randn(10, 1, 28, 28)  # 10 samples, 1 channel, 28x28 images
Y = torch.randint(0, 10, (10,))  # 10 class labels

# Create dataset
test_dataset = CustomDataset(X, Y)

# Create model
model = SimpleLogReg(input_dim=784, num_classes=10)

# Define unlabeled indices (indices we want to select from)
unlab_idx = list(range(10))

# Budget for selection
budget = 3

ARGS = {
    'model': model,
    'dataset': test_dataset,
    'unlab_idx': unlab_idx,
    'budget': budget,
    'num_clusters': 3,
    'device': 'cpu',
    'model_type': 'log_reg'
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
numpy, sklearn, torch — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type list, ndim 1, dtype family int — a list 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
entropy_sampling Ran
ran; the contract check could not run (RAISES, DEP_MISSING or TIMEOUT)
debabrota-basu/marich/lr_cnn_res_marich/utils.py
code served (permissive licence) · get_code("f263fc6ff28fed7b")
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, ndim 1, dtype family int; no output shape is stated. The image it ran in was not recorded. The code mentions cuda, and the harness aliases cuda to the CPU for every sample; whether this run needed that is 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 torch
import torch.nn as nn
import torch.nn.functional as F
import numpy as np
from torch.utils.data import Dataset, DataLoader

torch.manual_seed(0)

# Create a minimal custom dataset class that matches what entropy_sampling expects
class CustomDataset(Dataset):
    def __init__(self, X, Y=None):
        self.X = X
        self.Y = Y
    
    def __len__(self):
        return len(self.X)
    
    def __getitem__(self, idx):
        if self.Y is not None:
            return (self.X[idx], self.Y[idx])
        return self.X[idx]
    
    def get_data_label_loader(self, indices):
        """Return a DataLoader for the specified indices"""
        subset = Subset(self, indices)
        return DataLoader(subset, batch_size=2, shuffle=False)

# Create a minimal model that outputs logits
class MinimalModel(nn.Module):
    def __init__(self):
        super().__init__()
        self.fc = nn.Linear(784, 10)
    
    def forward(self, x):
        # For log_reg model_type, expects flattened input of 784 dims
        return self.fc(x)

# Create sample data: 8 samples of 28x28 images (MNIST-like)
X = torch.randn(8, 1, 28, 28)
Y = torch.randint(0, 10, (8,))

# Create the dataset
dataset_obj = CustomDataset(X, Y)

# Create the model
model = MinimalModel()

# Define unlabeled indices (subset of the 8 samples)
unlab_idx = [0, 1, 2, 3, 4]

# Set budget to select
budget = 3

# Import Subset for get_data_label_loader
from torch.utils.data import Subset

ARGS = {
    'model': model,
    'dataset': dataset_obj,
    'unlab_idx': unlab_idx,
    'budget': budget,
    'device': 'cpu',
    'model_type': 'log_reg'
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
numpy, scipy, torch — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type list, ndim 1, dtype family int — a list 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
test Ran
ran, honoured the contract we drafted
debabrota-basu/marich/lr_cnn_res_marich/utils.py
code served (permissive licence) · get_code("2ead12bb8e033cf0")
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 float, ndim 0, dtype family float, shape () as a later run recorded it. The image it ran in was not recorded. The code mentions cuda, and the harness aliases cuda to the CPU for every sample; whether this run needed that is 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
import torch.nn as nn

torch.manual_seed(0)

# Define a simple logistic regression model
class LogRegModel(nn.Module):
    def __init__(self):
        super().__init__()
        self.linear = nn.Linear(784, 10)
    
    def forward(self, x):
        return self.linear(x)

# Define a simple CNN for MNIST
class CNNMnist(nn.Module):
    def __init__(self):
        super().__init__()
        self.conv1 = nn.Conv2d(1, 8, 3)
        self.fc1 = nn.Linear(8 * 26 * 26, 10)
    
    def forward(self, x):
        x = self.conv1(x)
        x = x.view(x.size(0), -1)
        x = self.fc1(x)
        return x

# Define a simple CNN for CIFAR
class CNNCifar(nn.Module):
    def __init__(self):
        super().__init__()
        self.conv1 = nn.Conv2d(3, 8, 3)
        self.fc1 = nn.Linear(8 * 30 * 30, 10)
    
    def forward(self, x):
        x = self.conv1(x)
        x = x.view(x.size(0), -1)
        x = self.fc1(x)
        return x

# Create a model
model = LogRegModel()

# Create a simple test dataloader with 2 batches
# Each batch has 2 samples
# For log_reg, images are flattened to 784 dims
testloader = [
    (torch.randn(2, 1, 28, 28), torch.randint(0, 10, (2,))),
    (torch.randn(2, 1, 28, 28), torch.randint(0, 10, (2,)))
]

ARGS = {
    'model': model,
    'testloader': testloader,
    'device': 'cpu',
    'model_type': 'log_reg'
}
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 float, 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
loss_dep Not yet run
unverified (harvested, no recorded run)
debabrota-basu/marich/lr_cnn_res_marich/utils.py
code served (permissive licence) · get_code("4fa1b49ac225e2f0")
How it ran

no invocation recorded.

marich Not yet run
unverified (harvested, no recorded run)
debabrota-basu/marich/lr_cnn_res_marich/utils.py
code served (permissive licence) · get_code("201a46cb9bc3f82b")
How it ran

no invocation recorded.

train Not yet run
unverified (harvested, no recorded run)
debabrota-basu/marich/lr_cnn_res_marich/utils.py
code served (permissive licence) · get_code("9454ce73b63ebd3e")
How it ran

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 8 distinct functions with an identity, 0 are also present in other papers whose code we hold (0 with at least one paper dated earlier, 0 the same month, 0 later) and 8 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.

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

We study design of black-box model extraction attacks that can send minimal number of queries from a publicly available dataset to a target ML model through a predictive API with an aim to create an informative and distributionally equivalent replica of the target. First, we define distributionally equivalent and Max-Information model extraction attacks, and reduce them into a variational optimisation problem. The attacker sequentially solves this optimisation problem to select the most informative queries that simultaneously maximise the entropy and reduce the mismatch between the target and the stolen models. This leads to an active sampling-based query selection algorithm, MARICH, which is model-oblivious. Then, we evaluate MARICH on different text and image data sets, and different models, including CNNs and BERT. MARICH extracts models that achieve ∼ 60 -95% of true model's accuracy and uses ∼ 1, 000 -8, 500 queries from the publicly available datasets, which are different from the private training datasets. Models extracted by MARICH yield prediction distributions, which are ∼ 2 -4× closer to the target's distribution in comparison to the existing active sampling-based attacks. The extracted models also lead to 84-96% accuracy under membership inference attacks. Experimental results validate that MARICH is query-efficient, and capable of performing task-accurate, high-fidelity, and informative model extraction. * A significant portion of the work has been done as a part of P. Karmakar's masters in Ramakrishna Mission

For agents

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

get_harvested_code_for_paper("2302.08466")
get_code_for_paper("2302.08466")
have("2302.08466")

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

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

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

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

Connect an agent — have() is free.