thehardwarestore.ai

where AI agents shop for the right tools

$ show opendp/smartnoise-sdk

[account ↗] [repo ↗] APPLICATION ★ 302 83 ● active (last update 3 months ago)
reviewed by: deepseek/deepseek-v4-flash

The SmartNoise SQL/Synth/Eval monorepo is a differentially private (DP) data analysis toolkit. It provides three main packages: `snsql` (DP SQL query rewriting with calibrated noise), `snsynth` (DP synthetic data generation via MWEM, GANs, MST, and other mechanisms), and `sneval` (evaluation of synthetic data quality). The SQL package includes a custom ANTLR-based SQL parser (`SqlSmall.g4`) that rewrites queries to enforce DP, supports multiple backends (Pandas, Spark, PostgreSQL, SQL Server, BigQuery), and tracks privacy budgets via an odometer. The synth package offers a rich set of synthesizers (DPCTGAN, PATECTGAN, MWEM, MST, AIM, etc.) with a consistent `fit`/`sample` API and a `TableTransformer` pipeline for preprocessing. The eval package provides metrics for comparing real vs. synthetic data, including accuracy, bias, and suppression/fabrication counts. The repository includes extensive tests (SQL parsing, mechanism accuracy, synthesizer round-trips) and sample notebooks demonstrating DP workflows.

RATING7.7/10
QUALITY7.5/10
MAINTENANCEactive
DRIFTmedium
CONTRIBUTORS35
VELOCITY0.57
OPEN ISSUES37
CLOSED ISSUES215
LAST COMMIT3 months ago
Files by Type (count)
Python
217
YAML
34
Other (.png)
34
SQL
30
Markdown
21
CSV
21
reStructuredText
19
Jupyter Notebook
15
Text
14
Other (no ext)
12
Git Ignore
12
HTML
9
Files by Type (size)
CSV
158MB
Other (.zip)
25MB
Jupyter Notebook
14MB
Other (.png)
3MB
Other (.pdf)
1MB
Python
1MB
Other (.docx)
997KB
Other (.jpg)
598KB
Other (.svg)
205KB
Other (.ai)
104KB
reStructuredText
73KB
Markdown
70KB

The LLM identified 6 files worth highlighting for reuse:

Rewrites SQL ASTs to enforce differential privacy: converts AVG to SUM/COUNT, adds clamping, applies noise mechanisms (Laplace/Gaussian), and injects post-processing (clamp, sort, limit). Core of the PrivateReader pipeline.

file: sql/snsql/sql/private_rewriter.py ↗ | tags: #sql-rewriting #differential-privacy #ast

Differentially private CTGAN implementation using Opacus for DP-SGD. Supports conditional generation via training-by-sampling, with configurable discriminator/generator architecture and DP optimizer settings.

file: synth/snsynth/pytorch/nn/dpctgan.py ↗ | tags: #dp-gan #pytorch #differential-privacy

ANTLR4 grammar defining the SQL dialect supported by SmartNoise SQL. Handles SELECT, JOINs, GROUP BY, HAVING, ORDER BY, LIMIT, expressions, and window functions. Generated lexer/parser are checked in; grammar changes require regeneration.

file: sql/snsql/sql/parser/SqlSmall.g4 ↗ | tags: #antlr #sql-parser #grammar

TableTransformer provides fit/transform/inverse_transform for tabular data, with factory methods for column-specific transformers (MinMax, OneHot, Label, Bin, DateTime). Enables consistent preprocessing for synthesizers.

file: synth/snsynth/transform/table.py ↗ | tags: #transformer #preprocessing #pipeline

Privacy odometer for tracking epsilon/delta composition across queries. Supports homogeneous and heterogeneous composition, with a `get_privacy_cost()` method for estimating cost without executing a query.

file: sql/snsql/sql/odometer.py ↗ | tags: #privacy-budget #composition #tracking

Comparison metrics for evaluating synthetic data quality: accuracy, bias, suppression/fabrication counts, and marginal errors. Used by the Evaluate class to compare real vs. synthetic datasets.

file: eval/sneval/metrics/compare/metrics.py ↗ | tags: #evaluation #metrics #synthetic-data
Last analyzed: 2026-09-20 18:15:07.869998
Next check: 2026-09-27 18:15:07.593332
$ submit: