SYNTOLOGY HomeExplorerAtlasCodeMethodologyAboutDevelopersFeedPricing
Paper · 2004.00010 · 2020

The Discrete Gaussian for Differential Privacy

arXiv · PDF · Open in the Atlas

Code that ran

8 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; 8 honoured the contract we drafted, 0 violated it and 0 have no contract verdict; 0 failures of our instrument; 0 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/2004.00010.json · badge: /api/ran/2004.00010.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
IBM/discrete-gaussian-differential-privacy canonical (classifier label)
classifier basis: classifier_2025
8 ran · 0 no recorded run
FunctionStatusWhere it lives
cdp_delta_standard Ran
ran, honoured the contract we drafted
IBM/discrete-gaussian-differential-privacy/cdp2adp.py
code served (permissive licence) · get_code("6026d9da4638c121")
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) 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 math

def cdp_delta_standard(rho, eps):
    assert rho >= 0
    assert eps >= 0
    if rho == 0:
        return 0
    return math.exp(-(eps - rho) ** 2 / (4 * rho))

ARGS = {
    "rho": 0.5,
    "eps": 1.0,
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1
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 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
cg_ccdf Ran
ran, honoured the contract we drafted
IBM/discrete-gaussian-differential-privacy/plots.py
code served (permissive licence) · get_code("b755ec71bfa2fa0e")
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 math

torch_manual_seed_0 = __import__('torch').manual_seed(0)

ARGS = {
    'sigma2': 0.5,
    't': 1.2
}
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 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
cg_delta Ran
ran, honoured the contract we drafted
IBM/discrete-gaussian-differential-privacy/cdp2adp.py
code served (permissive licence) · get_code("4b6eaa93facb671d")
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 math

# The function cg_delta takes two numeric parameters: sigma2 and eps
# sigma2 is used as: math.sqrt(sigma2) - so it should be a positive number
# eps is used in arithmetic operations with sigma and constants
# Both are used in math.erfc() and math.exp(), so they should be floats

ARGS = {
    "sigma2": 1.0,
    "eps": 0.5,
}
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 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
dg_ccdf Ran
ran, honoured the contract we drafted
IBM/discrete-gaussian-differential-privacy/plots.py
code served (permissive licence) · get_code("eda2952914aa333a")
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 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 math

def dg_ccdf(sigma2, maxk, iters=1000):
    assert maxk >= 1
    ccdf = [0] * maxk
    sum = 0
    for k in range(iters + maxk, 0, -1):
        term = math.exp(-k * k / (2.0 * sigma2))
        sum = sum + term
    sum = 1 + 2 * sum
    above = 0
    for k in range(iters + maxk, -1, -1):
        term = math.exp(-k * k / (2.0 * sigma2))
        if k < maxk:
            ccdf[k] = above / sum
        above = above + term
    return ccdf

# Analyze function usage:
# - sigma2: used in math.exp(-k * k / (2.0 * sigma2)), so should be a positive float
# - maxk: used in range comparisons and list initialization, should be a positive int
# - iters: used in range calculations, should be a non-negative int (has default=1000)

ARGS = {
    "sigma2": 1.5,
    "maxk": 5,
    "iters": 100
}
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 list, ndim 1, dtype family float — 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
dg_var Ran
ran, honoured the contract we drafted
IBM/discrete-gaussian-differential-privacy/plots.py
code served (permissive licence) · get_code("7cabe632e85c1806")
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 math

def dg_var(sigma2, iters=10000):
    assert sigma2 > 0
    assert math.exp(-iters * iters / (2.0 * sigma2)) < 1e-12
    denominator = 0
    numerator = 0
    for i in range(iters):
        x = iters - i
        term = math.exp(-x * x / (2.0 * sigma2))
        denominator = denominator + term
        numerator = numerator + term * x * x
    denominator = 2.0 * denominator + 1.0
    numerator = 2.0 * numerator
    return numerator / denominator


ARGS = {
    "sigma2": 100.0,
    "iters": 10000
}
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 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
sample_bernoulli Ran
ran, honoured the contract we drafted
IBM/discrete-gaussian-differential-privacy/discretegauss.py
code served (permissive licence) · get_code("58c33a7208409998")
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.

from fractions import Fraction
import random

def sample_uniform(m, rng):
    assert isinstance(m, int)
    assert m > 0
    return rng.randrange(m)

def sample_bernoulli(p, rng):
    assert isinstance(p, Fraction)
    assert 0 <= p <= 1
    m = sample_uniform(p.denominator, rng)
    if m < p.numerator:
        return 1
    else:
        return 0

rng = random.Random(42)
p = Fraction(3, 5)

ARGS = {
    'p': p,
    'rng': rng
}
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 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
sample_bernoulli_exp1 Ran
ran, honoured the contract we drafted
IBM/discrete-gaussian-differential-privacy/discretegauss.py
code served (permissive licence) · get_code("ac222cdc8e4d5654")
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 random
from fractions import Fraction

# Create a random number generator
rng = random.Random(42)

# Define arguments for sample_bernoulli_exp1
ARGS = {
    "x": Fraction(1, 2),  # A valid Fraction between 0 and 1
    "rng": rng  # A random.Random instance
}
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 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
sample_uniform Ran
ran, honoured the contract we drafted
IBM/discrete-gaussian-differential-privacy/discretegauss.py
code served (permissive licence) · get_code("67fe3423cb757b9b")
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 random

torch_rng = random.Random(42)

ARGS = {
    "m": 10,
    "rng": torch_rng,
}
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 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

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, 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 7 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
cdp_delta_standard 4 other papers
4 later
2401.17823 (2024-01)
Privacy-preserving data release leveraging optimal transport and particle gradient descent
2402.03985 (2024-02)
A Bias-Variance Decomposition for Ensembles over Multiple Synthetic Datasets
2403.07797 (2024-03)
Joint Selection: Adaptively Incorporating Public Information for Private Synthetic Data
and 1 more not named here

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 key tool for building differentially private systems is adding Gaussian noise to the output of a function evaluated on a sensitive dataset. Unfortunately, using a continuous distribution presents several practical challenges. First and foremost, finite computers cannot exactly represent samples from continuous distributions, and previous work has demonstrated that seemingly innocuous numerical errors can entirely destroy privacy. Moreover, when the underlying data is itself discrete (e.g., population counts), adding continuous noise makes the result less interpretable. With these shortcomings in mind, we introduce and analyze the discrete Gaussian in the context of differential privacy. Specifically, we theoretically and experimentally show that adding discrete Gaussian noise provides essentially the same privacy and accuracy guarantees as the addition of continuous Gaussian noise. We also present an simple and efficient algorithm for exact sampling from this distribution. This demonstrates its applicability for privately answering counting queries, or more generally, low-sensitivity integer-valued queries.

For agents

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

get_harvested_code_for_paper("2004.00010")
get_code_for_paper("2004.00010")
have("2004.00010")

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

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

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

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

Connect an agent — have() is free.