SYNTOLOGY HomeExplorerAtlasCodeMethodologyAboutDevelopersFeedPricing
Paper · 2405.15586 · 2024

DAGER: Exact Gradient Inversion for Large Language Models

arXiv · PDF · Open in the Atlas

Code that ran

7 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; 2 honoured the contract we drafted, 0 violated it and 0 have no contract verdict; 5 failures of our instrument; 5 no recorded run), measured 2026-11-23; 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/2405.15586.json · badge: /api/ran/2405.15586.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
insait-institute/dager-gradient-inversion canonical (classifier label)
classifier basis: census
7 ran · 5 no recorded run
FunctionStatusWhere it lives
check_if_in_span Ran
ran; our contract draft was wrong, not the code
insait-institute/dager-gradient-inversion/token_filtering.py
code served (permissive licence) · get_code("e7f735177bdb9824")
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 1, dtype family float, shape (2,) 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)

# Analyzing the function:
# - R_K_norm: used with einsum 'ik,ij,...j->...k', so needs shape (i, k) where i and k are dimensions
# - v: used with einsum as (..., j), normalized by pow(2).sum(-1, keepdim=True).sqrt()
#      so v needs shape (..., j) where j matches the last dimension used in einsum
# - The einsum suggests R_K_norm has shape (i, k), and v has shape (..., j)
#   where j should match between R_K_norm's second dimension and v's last dimension

# Let's construct:
# R_K_norm: shape (5, 4) - represents some kind of basis or projection matrix
# v: shape (2, 4) - batch of 2 vectors in 4-dimensional space

R_K_norm = torch.randn(5, 4)
v = torch.randn(2, 4)

ARGS = {
    "R_K_norm": R_K_norm,
    "v": v,
}
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 1, dtype family float, shape (2,) — shape (2,) 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
filter_in_span Ran
ran; our contract draft was wrong, not the code
insait-institute/dager-gradient-inversion/attack_new.py
code served (permissive licence) · get_code("14424832926f4643")
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 int; 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 torch

torch.manual_seed(0)

# R_K_norm: used in einsum 'ik,ij,...j->...k' - needs to be a 2D tensor
# Shape: (K, K) where K is the span dimension
R_K_norm = torch.randn(4, 4)
R_K_norm = R_K_norm / R_K_norm.pow(2).sum(-1, keepdim=True).sqrt()

# v: used in einsum and normalized - needs compatible shape
# Shape: (batch, K) or (..., K) where batch=2, K=4
v = torch.randn(2, 4)

# thresh: scalar threshold for comparison
thresh = 0.5

ARGS = {
    'R_K_norm': R_K_norm,
    'v': v,
    'thresh': thresh
}
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 tuple, ndim 2, dtype family int — 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
get_args Ran
ran; the contract check could not run (RAISES, DEP_MISSING or TIMEOUT)
insait-institute/dager-gradient-inversion/args_factory.py
code served (permissive licence) · get_code("e9b16d51d51a6e25")
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 Namespace. 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 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 argparse
import sys

ARGS = {
    'argv': [
        '--dataset', 'cola',
        '--task', 'seq_class',
        '--split', 'val',
        '--n_inputs', '10',
        '--l1_filter', 'maxB',
        '--l2_filter', 'overlap',
    ]
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
neptune — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type Namespace — a Namespace output has no array shape of its own; none is stated — the instrument coerces any output to an array; for a Namespace 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
get_param Ran
ran, honoured the contract we drafted
insait-institute/dager-gradient-inversion/analyze_neptune.py
code served (permissive licence) · get_code("68917fefa350c8e4")
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 1, dtype family float, shape (3,) 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

class MockProject:
    def __init__(self):
        self.data = {
            "param1": MockFetchable(np.array([1.0, 2.0, 3.0])),
            "param2": MockFetchable(np.array([[1, 2], [3, 4]])),
        }
    
    def exists(self, param):
        return param in self.data
    
    def __getitem__(self, param):
        return self.data[param]

class MockFetchable:
    def __init__(self, value):
        self.value = value
    
    def fetch(self):
        return self.value

project = [MockProject()]

ARGS = {
    "project": project,
    "param": "param1"
}
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 1, dtype family float, shape (3,) — shape (3,) 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_stat_mean_std Ran
ran, honoured the contract we drafted
insait-institute/dager-gradient-inversion/analyze_neptune.py
code served (permissive licence) · get_code("c82d36eb12a25ac4")
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 1, 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
from unittest.mock import Mock

# Create mock project objects that behave like dictionaries
# Each project needs to support project[stat].fetch_values()
class MockProjectStat:
    def __init__(self, values):
        self.values = values
    
    def fetch_values(self):
        mock_result = Mock()
        mock_result.__getitem__ = lambda self, key: pd.Series(self.values) if key == 'value' else None
        return {'value': pd.Series(self.values)}

import pandas as pd

class MockProjectStat:
    def __init__(self, values):
        self.values = values
    
    def fetch_values(self):
        return {'value': pd.Series(self.values)}

class MockProject:
    def __init__(self, stat_data):
        self.stat_data = stat_data
    
    def __getitem__(self, key):
        return self.stat_data[key]

# Create sample projects with stat data
stat_values_1 = np.array([1.0, 2.0, 3.0, 4.0, 5.0])
stat_values_2 = np.array([2.0, 3.0, 4.0])
stat_values_3 = np.array([1.0, 2.0])

project_1 = MockProject({'metric_a': MockProjectStat(stat_values_1)})
project_2 = MockProject({'metric_a': MockProjectStat(stat_values_2)})
project_3 = MockProject({'metric_a': MockProjectStat(stat_values_3)})

projects = [project_1, project_2, project_3]

# stat parameter - the key to access in each project
stat = 'metric_a'

# starts parameter - boundaries for slicing the data
# starts[i+1] - starts[i] gives the number of elements to take from project i
# starts should have length len(projects) + 1
starts = [0, 5, 8, 10]  # project 0: 5 elements, project 1: 3 elements, project 2: 2 elements

ARGS = {
    'projects': projects,
    'stat': stat,
    'starts': starts
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
numpy, pandas — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type tuple, ndim 1, 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
get_top_B_in_span Ran
ran; our contract draft was wrong, not the code
insait-institute/dager-gradient-inversion/attack_new.py
code served (permissive licence) · get_code("85d5abb9ab3a86b5")
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 int; 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 torch

torch.manual_seed(0)

# R_K_norm: used in einsum as 'ik,ij,...j->...k', so shape should be (K, K) or similar
# It's a normalized matrix that projects onto a span
R_K_norm = torch.randn(4, 4)
R_K_norm = R_K_norm / R_K_norm.norm(dim=-1, keepdim=True)

# v: used in einsum as 'ik,ij,...j->...k', has shape (..., j) where j matches last dim of R_K_norm
# This will be normalized in the function, shape (..., 4)
v = torch.randn(2, 4)

# B: used as a parameter but not actually used in the function body
B = 5

# thresh: used in comparison (size < thresh), should be a scalar float
thresh = 0.5

# norm: used in if/elif checks for 'l2' or 'l1'
norm = 'l2'

ARGS = {
    'R_K_norm': R_K_norm,
    'v': v,
    'B': B,
    'thresh': thresh,
    'norm': norm
}
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 tuple, ndim 2, dtype family int — 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
get_top_B_in_span Ran
ran; our contract draft was wrong, not the code
insait-institute/dager-gradient-inversion/token_filtering.py
code served (permissive licence) · get_code("0fc3bbcdae92794f")
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 int; 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 torch

torch.manual_seed(0)

# R_K_norm: used in einsum 'ik,ij,...j->...k', so needs shape (i, k)
# where i is some dimension and k is another
# v: used in einsum as '...j' and operations like v.pow(2).sum(-1), so needs shape (..., j)
# B: used in function but only for sorting/filtering, so just an int
# thresh: used in comparison size < thresh, so just a float

# Let's construct:
# R_K_norm shape: (5, 4) - 5 basis vectors of dimension 4
R_K_norm = torch.randn(5, 4)

# v shape: (2, 4) - batch of 2 vectors of dimension 4
# The einsum suggests v has trailing dimension matching R_K_norm's last dim
v = torch.randn(2, 4)

# B: number of top elements (int)
B = 3

# thresh: threshold for filtering (float)
thresh = 0.5

ARGS = {
    "R_K_norm": R_K_norm,
    "v": v,
    "B": B,
    "thresh": thresh
}
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 tuple, ndim 2, dtype family int — 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
add_partial_forward_bert Not yet run
unverified (harvested, no recorded run)
insait-institute/dager-gradient-inversion/utils/partial_models.py
code served (permissive licence) · get_code("0eb45ed221f977d8")
How it ran

no invocation recorded.

add_partial_forward_gpt2 Not yet run
unverified (harvested, no recorded run)
insait-institute/dager-gradient-inversion/utils/partial_models.py
code served (permissive licence) · get_code("0a2c13e5eac7ed1c")
How it ran

no invocation recorded.

add_partial_forward_llama Not yet run
unverified (harvested, no recorded run)
insait-institute/dager-gradient-inversion/utils/partial_models.py
code served (permissive licence) · get_code("d75aa69345393336")
How it ran

no invocation recorded.

check_if_in_span Not yet run
unverified (harvested, no recorded run)
insait-institute/dager-gradient-inversion/attack_new.py
code served (permissive licence) · get_code("a91a45021f881ade")
How it ran

no invocation recorded.

filter_in_span Not yet run
unverified (harvested, no recorded run)
insait-institute/dager-gradient-inversion/token_filtering.py
code served (permissive licence) · get_code("62d1cc29fda7d4f9")
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 11 distinct functions with an identity, 1 are also present in other papers whose code we hold (0 with at least one paper dated earlier, 0 the same month, 1 later) and 10 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_param 1 other paper
1 later
2503.01838 (2025-03)
GRAIN: Exact Graph Reconstruction from Gradients

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-23.

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 works by aggregating locally computed gradients from multiple clients, thus enabling collaborative training without sharing private client data. However, prior work has shown that the data can actually be recovered by the server using so-called gradient inversion attacks. While these attacks perform well when applied on images, they are limited in the text domain and only permit approximate reconstruction of small batches and short input sequences. In this work, we propose DAGER, the first algorithm to recover whole batches of input text exactly. DAGER leverages the low-rank structure of self-attention layer gradients and the discrete nature of token embeddings to efficiently check if a given token sequence is part of the client data. We use this check to exactly recover full batches in the honest-but-curious setting without any prior on the data for both encoder- and decoder-based architectures using exhaustive heuristic search and a greedy approach, respectively. We provide an efficient GPU implementation of DAGER and show experimentally that it recovers full batches of size up to 128 on large language models (LLMs), beating prior attacks in speed (20x at same batch size), scalability (10x larger batches), and reconstruction quality (ROUGE-1/2 &gt; 0.99).

For agents

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

get_harvested_code_for_paper("2405.15586")
get_code_for_paper("2405.15586")
have("2405.15586")

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

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

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

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

Connect an agent — have() is free.