Opacus is a production-grade PyTorch library for training deep learning models with differential privacy (DP). It implements the DP-SGD algorithm with per-sample gradient computation, gradient clipping, and noise addition. The library provides a clean API via `PrivacyEngine.make_private()` that wraps any PyTorch model, optimizer, and data loader with differential privacy components. It supports multiple per-sample gradient backends (hooks, functorch, ExpandedWeights, ghost clipping), distributed training (DDP, FSDP, tensor parallelism), and several privacy accounting mechanisms (RDP, Gaussian DP, PRV). Opacus also includes a module validator that automatically detects and replaces incompatible layers (e.g., BatchNorm → GroupNorm, LSTM → DPLSTM), a batch memory manager for virtual batching, and comprehensive scheduling utilities. The codebase is well-tested, actively maintained with recent commits, and includes extensive documentation and tutorials. Although it carries some complexity from multiple backends and experimental features (research folder), the core abstractions are clean, modular, and reusable.
This repository is a massive, multi-disciplinary research codebase from Google Research, primarily focused on machine learning, optimization, and computer science experiments. While it contains a few application-like components (e.g., a Next.js frontend for model exploration, a Rust-based 3D splatting renderer), the dominant character is data_research, hosting thousands of independent experimental projects. The codebase serves as a central hub for publishing reproducible research in domains including Reinforcement Learning, Computer Vision (NeRF, 3D), NLP (Transformers, LLMs), and Privacy. It relies heavily on shell scripts for environment setup and experiment orchestration, with a mix of Python, C++, Rust, and Java implementations. The infrastructure is robust for research (e.g., `scann` for search, `lila` for experiment management) but exhibits significant fragmentation and technical debt due to the rapid pace of research and mixed framework usage.
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.