Skip to content

RFC: dp accounting should use rust as its backend #397

@amyssnippet

Description

@amyssnippet

I am proposing an optional, high-performance backend for dp-accounting that resolves the computation bottleneck in RDP accounting.

By offloading the exact RDP math (Poisson Subsampled Gaussian) to a vectorized Rust extension, I achieved a 40x-45x speedup on standard workloads while maintaining floating-point accuracy ($10^{-12}$

Proposed Solution

I have developed dp-accelerator, a drop-in Rust replacement that:

  1. Implements the exact _compute_log_a_frac logic from Google's dp_accounting using statrs.
  2. Vectorizes computation across all $\alpha$ orders.
  3. Exposes a safe Python interface via PyO3.

This package is already published on PyPI (pip install dp-accelerator) and uses Apache 2.0.

Benchmarks (Intel Mac i5 8th gen)

Config Steps Python (ms) Rust (ms) Speedup
MNIST 1k 36.5 0.86 42x
ImageNet 90k 30.0 0.69 43x
Batch (10 checks) 1k-60k 333.4 8.8 37x
Image Image

Integration Plan

I have a working branch where this is implemented as a soft dependency:

  • dp-accounting does not need to compile Rust.
  • If dp-accelerator is installed, analysis.py detects it and routes the computation to the fast path.
  • If not installed, it falls back to the existing Python implementation with an alert kind of warning to suggest using the dp-accelarator package for faster

I have prepared a technical report (submitted to techrxiv) detailed in the repo: https://github.com/AxiomaticLabs/dp-accelerator

Would the team be open to a PR integrating this optional backend?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions