SYNTOLOGY HomeExplorerAtlasCodeMethodologyAboutDevelopersFeedPricing
Paper · 2107.01154 · 2021

Gradient-Leakage Resilient Federated Learning

arXiv · PDF · Open in the Atlas

Code that ran

11 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; 1 honoured the contract we drafted, 0 violated it and 3 have no contract verdict; 7 failures of our instrument; 1 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/2107.01154.json · badge: /api/ran/2107.01154.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
KaiyuanZh/censor community (classifier label)
classifier basis not recorded on the link
11 ran · 1 no recorded run
FunctionStatusWhere it lives
activation_errors Ran
ran; our contract draft was wrong, not the code
KaiyuanZh/censor/inversefed/metrics.py
code served (permissive licence) · get_code("e551d62ffffcfda9")
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 defaultdict. 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
from collections import defaultdict

torch.manual_seed(0)

# Build a small model with named modules
class SimpleModel(nn.Module):
    def __init__(self):
        super().__init__()
        self.linear1 = nn.Linear(4, 3)
        self.relu = nn.ReLU()
        self.linear2 = nn.Linear(3, 2)
    
    def forward(self, x):
        x = self.linear1(x)
        x = self.relu(x)
        x = self.linear2(x)
        return x

model = SimpleModel()
model.eval()

# Create two small input tensors with batch size 2 and feature dimension 4
x1 = torch.randn(2, 4)
x2 = torch.randn(2, 4)

ARGS = {
    "model": model,
    "x1": x1,
    "x2": x2,
}
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 defaultdict — a defaultdict output has no array shape of its own; none is stated — the instrument coerces any output to an array; for a defaultdict 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
additive_noise Ran
ran on a synthesized input
KaiyuanZh/censor/defense.py
code served (permissive licence) · get_code("9b5af57ba71916b3")
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 torch.nn as nn

torch.manual_seed(0)

# Build a minimal model - the function doesn't actually use it,
# but we need to provide one
class DummyModel(nn.Module):
    def __init__(self):
        super().__init__()
        self.linear = nn.Linear(4, 3)
    
    def forward(self, x):
        return self.linear(x)

model = DummyModel()

# Create input gradients - a list of tensors with distinct sizes
input_gradient = [
    torch.randn(2, 4),
    torch.randn(3, 5),
    torch.randn(4,)
]

# save_dir - no file I/O needed, just a string
save_dir = "/tmp/model_checkpoint"

# std - standard deviation for the normal distribution
std = 0.1

ARGS = {
    "model": model,
    "input_gradient": input_gradient,
    "save_dir": save_dir,
    "std": std
}
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 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
densenet_cifar Ran
ran; our contract draft was wrong, not the code
KaiyuanZh/censor/inversefed/nn/densenet.py
pointer only (licence: MIT); the stored copy get_code serves, from tasi-lab/unlearning-inversion-attacks, is pointer only (licence: NONE) · get_code("7db01b64f42f28ee")
How it ran

The body of this sample is withheld: this paper's link allows the body inline (MIT), but get_code serves the stored copy, first harvested from tasi-lab/unlearning-inversion-attacks, and GitHub detected no licence in that repository 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.

gradient_clipping Ran
ran; our contract draft was wrong, not the code
KaiyuanZh/censor/defense.py
code served (permissive licence) · get_code("49e3def5d3ba54c9")
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)

# Create a list of gradient tensors (simulating gradients from a model)
# The function expects input_gradient to be a list of tensors
input_gradient = [
    torch.randn(2, 4, requires_grad=False),
    torch.randn(3, 4, requires_grad=False),
]

# Define bound parameter
bound = 4

ARGS = {
    "input_gradient": input_gradient,
    "bound": bound,
}
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
gradient_compression Ran
ran; our contract draft was wrong, not the code
KaiyuanZh/censor/defense.py
code served (permissive licence) · get_code("aae188414ae38f51")
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 numpy as np
import torch

torch.manual_seed(0)

# Create a list of gradient tensors with different shapes
input_gradient = [
    torch.randn(2, 4),
    torch.randn(3, 5),
    torch.randn(2, 3, 4)
]

ARGS = {
    "input_gradient": input_gradient,
    "percentage": 10
}
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
init_logger Ran
ran on a synthesized input
KaiyuanZh/censor/run_rec.py
code served (permissive licence) · get_code("7d2ab6b3bb65b1d1")
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 RootLogger. 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 os
import logging
import tempfile

# Create a temporary directory for logging
temp_dir = tempfile.mkdtemp()

# Define ARGS dictionary with all parameters for init_logger
ARGS = {
    'output_dir': temp_dir,
    'log_level': logging.INFO,
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
none outside the standard library — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type RootLogger — a RootLogger output has no array shape of its own; none is stated — the instrument coerces any output to an array; for a RootLogger 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
load_config Ran
ran; our contract draft was wrong, not the code
KaiyuanZh/censor/run_rec.py
code served (permissive licence) · get_code("21cecdf2721c9a12")
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 dict. 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 yaml
import tempfile
import os

# Create a temporary YAML config file
temp_dir = tempfile.mkdtemp()
config_path = os.path.join(temp_dir, "test_config.yaml")

# Write a valid YAML configuration to the temporary file
config_content = """
model:
  name: test_model
  layers: 3
  hidden_dim: 128
training:
  batch_size: 32
  learning_rate: 0.001
  epochs: 10
data:
  path: /data/dataset
  split: 0.8
"""

with open(config_path, 'w') as f:
    f.write(config_content)

ARGS = {
    'config_path': config_path
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
yaml — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type dict — a dict output has no array shape of its own; none is stated — the instrument coerces any output to an array; for a dict 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
psnr Ran
ran; the contract check could not run (RAISES, DEP_MISSING or TIMEOUT)
KaiyuanZh/censor/inversefed/metrics.py
code served (permissive licence) · get_code("5ef2f520281c0bdf")
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. 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

torch.manual_seed(0)

# Create small test tensors with distinct dimensions
# Shape: [B=2, C=3, m=4, n=5]
img_batch = torch.randn(2, 3, 4, 5)
ref_batch = torch.randn(2, 3, 4, 5)

ARGS = {
    "img_batch": img_batch,
    "ref_batch": ref_batch,
    "batched": False,
    "factor": 1.0,
}
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
reconstruction_costs Ran
ran, honoured the contract we drafted
KaiyuanZh/censor/inversefed/reconstruction_algorithms.py
code served (permissive licence) · get_code("24dd50ff238a3c31")
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 Tensor, 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 torch
import torch.nn as nn

torch.manual_seed(0)

# Create a small set of gradients (list of lists of tensors)
# Each gradient is a list of tensors representing parameter gradients
gradient_1 = [torch.randn(2, 4), torch.randn(3, 5), torch.randn(4)]
gradient_2 = [torch.randn(2, 4), torch.randn(3, 5), torch.randn(4)]
gradient_3 = [torch.randn(2, 4), torch.randn(3, 5), torch.randn(4)]

gradients = [gradient_1, gradient_2, gradient_3]

# Create input_gradient with same structure
input_gradient = [torch.randn(2, 4), torch.randn(3, 5), torch.randn(4)]

ARGS = {
    'gradients': gradients,
    'input_gradient': input_gradient,
    'cost_fn': 'l2',
    'indices': 'def',
    'weights': 'equal'
}
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 Tensor, 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
save_experiment_config Ran
ran on a synthesized input
KaiyuanZh/censor/run_rec.py
code served (permissive licence) · get_code("a4fbdfb704b25d7b")
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 str. 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 os
import yaml
import tempfile
import torch

# Create a temporary directory for save_dir
temp_dir = tempfile.mkdtemp()

# Create a temporary config file with valid YAML content
config_data = {
    'model': 'test_model',
    'learning_rate': 0.001,
    'batch_size': 32,
    'epochs': 10,
    'layers': [64, 128, 256]
}

# Write the config to a temporary file
config_fd, config_path = tempfile.mkstemp(suffix='.yml', text=True)
with os.fdopen(config_fd, 'w') as f:
    yaml.dump(config_data, f)

ARGS = {
    'config_path': config_path,
    'save_dir': temp_dir
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
torch, yaml — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type str — a str output has no array shape of its own; none is stated — the instrument coerces any output to an array; for a str 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
total_variation Ran
ran; the contract check could not run (RAISES, DEP_MISSING or TIMEOUT)
KaiyuanZh/censor/inversefed/metrics.py
code served (permissive licence) · get_code("3d23162c75564e01")
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 Tensor, 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 torch

torch.manual_seed(0)

# The function takes a 4D tensor x and computes anisotropic total variation
# It accesses x[:, :, :, :-1], x[:, :, :, 1:], x[:, :, :-1, :], x[:, :, 1:, :]
# So we need a 4D tensor with shape (batch, channels, height, width)
# Using distinct sizes: batch=2, channels=4, height=3, width=5

x = torch.randn(2, 4, 3, 5)

ARGS = {
    "x": x
}
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 Tensor, 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
get_plugin Not yet run
unverified (harvested, no recorded run)
KaiyuanZh/censor/dnnlib/tflib/custom_ops.py
code served (permissive licence) · get_code("6e1c6773a9fbe6dd")
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, 9 are also present in other papers whose code we hold (0 with at least one paper dated earlier, 0 the same month, 9 later) and 3 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
activation_errors 5 other papers
4 later, 1 same year, order not determinable
Sun_Soteria_Provable_Defense_Against_Privacy_Leakage_in_Federated_Learning_From_CVPR_2021_paper (2021 (year only))
Soteria: Provable Defense against Privacy Leakage in Federated Learning from Representation Perspective
2308.04699 (2023-08)
GIFD: A Generative Gradient Inversion Method with Feature Domain Optimization
2309.13016 (2023-09)
Understanding Deep Gradient Leakage via Inversion Influence Functions
and 2 more not named here
psnr 5 other papers
4 later, 1 same year, order not determinable
Sun_Soteria_Provable_Defense_Against_Privacy_Leakage_in_Federated_Learning_From_CVPR_2021_paper (2021 (year only))
Soteria: Provable Defense against Privacy Leakage in Federated Learning from Representation Perspective
2308.04699 (2023-08)
GIFD: A Generative Gradient Inversion Method with Feature Domain Optimization
2309.13016 (2023-09)
Understanding Deep Gradient Leakage via Inversion Influence Functions
and 2 more not named here
total_variation 5 other papers
4 later, 1 same year, order not determinable
Sun_Soteria_Provable_Defense_Against_Privacy_Leakage_in_Federated_Learning_From_CVPR_2021_paper (2021 (year only))
Soteria: Provable Defense against Privacy Leakage in Federated Learning from Representation Perspective
2308.04699 (2023-08)
GIFD: A Generative Gradient Inversion Method with Feature Domain Optimization
2309.13016 (2023-09)
Understanding Deep Gradient Leakage via Inversion Influence Functions
and 2 more not named here
densenet_cifar 4 other papers
4 later
Zhang_Generative_Gradient_Inversion_via_Over-Parameterized_Networks_in_Federated_Learning_ICCV_2023_paper (2023 (year only))
Generative Gradient Inversion via Over-Parameterized Networks in Federated Learning
2308.04699 (2023-08)
GIFD: A Generative Gradient Inversion Method with Feature Domain Optimization
2309.13016 (2023-09)
Understanding Deep Gradient Leakage via Inversion Influence Functions
and 1 more not named here
get_plugin 1 other paper
1 later
2110.11323 (2021-10)
StyleAlign: Analysis and Applications of Aligned StyleGAN Models
gradient_clipping 1 other paper
1 later
2308.04699 (2023-08)
GIFD: A Generative Gradient Inversion Method with Feature Domain Optimization
gradient_compression 1 other paper
1 later
2308.04699 (2023-08)
GIFD: A Generative Gradient Inversion Method with Feature Domain Optimization
load_config 1 other paper
1 later
2308.04699 (2023-08)
GIFD: A Generative Gradient Inversion Method with Feature Domain Optimization
reconstruction_costs 1 other paper
1 later
2308.04699 (2023-08)
GIFD: A Generative Gradient Inversion Method with Feature Domain 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

Federated learning(FL) is an emerging distributed learning paradigm with default client privacy because clients can keep sensitive data on their devices and only share local training parameter updates with the federated server. However, recent studies reveal that gradient leakages in FL may compromise the privacy of client training data. This paper presents a gradient leakage resilient approach to privacy-preserving federated learning with per training example-based client differential privacy, coined as Fed-CDP. It makes three original contributions. First, we identify three types of client gradient leakage threats in federated learning even with encrypted client-server communications. We articulate when and why the conventional server coordinated differential privacy approach, coined as Fed-SDP, is insufficient to protect the privacy of the training data. Second, we introduce Fed-CDP, the per example-based client differential privacy algorithm, and provide a formal analysis of Fed-CDP with the $(ε, δ)$ differential privacy guarantee, and a formal comparison between Fed-CDP and Fed-SDP in terms of privacy accounting. Third, we formally analyze the privacy-utility trade-off for providing differential privacy guarantee by Fed-CDP and present a dynamic decay noise-injection policy to further improve the accuracy and resiliency of Fed-CDP. We evaluate and compare Fed-CDP and Fed-CDP(decay) with Fed-SDP in terms of differential privacy guarantee and gradient leakage resilience over five benchmark datasets. The results show that the Fed-CDP approach outperforms conventional Fed-SDP in terms of resilience to client gradient leakages while offering competitive accuracy performance in federated learning.

For agents

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

get_harvested_code_for_paper("2107.01154")
get_code_for_paper("2107.01154")
have("2107.01154")

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

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

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

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

Connect an agent — have() is free.