Skip to content

Phase 2: analytic Renyi divergence certification - #3

Open
jameshoweee wants to merge 1 commit into
jh/phase1-engineeringfrom
jh/phase2-certification
Open

Phase 2: analytic Renyi divergence certification#3
jameshoweee wants to merge 1 commit into
jh/phase1-engineeringfrom
jh/phase2-certification

Conversation

@jameshoweee

Copy link
Copy Markdown
Owner

Adds certification.py — analytic Renyi divergence computation for the base sampler and full sampler chain. This is the missing piece between statistical testing (which tops out at ~1/sqrt(N) sensitivity) and the proof-level guarantees (R_128 - 1 < 2^{-75}).

Key results at default params:

  • Full sampler R_128 - 1 ~ 1.3e-29 (target 2.65e-23) — passes comfortably
  • sigma=1.8 (boundary) marginally fails: 3.94e-23 vs 2.65e-23. Genuine BerExp quantization effect

Uses mpmath for arbitrary-precision arithmetic. Tests verify the computation at 6 (mu, sigma) pairs against known bounds.

Also updates the README with scope/install instructions.

Certification layer (certification.py):
- Computes R_a(P_spec || P_ideal) exactly from the RCDT table and
  BerExp quantization, without sampling
- Base sampler: R_128-1 ~ 9.1e-23 (informational; CDT quantization)
- Full sampler: R_128-1 ~ 1.3e-29 at typical (mu,sigma), 6 orders
  of magnitude below the 2^{-75} target — BerExp rejection tightens
  the distribution dramatically
- Tested at hostile fractional mu (0.0, 0.25, 0.5) and across sigma
  range; all pass with large margin
- Finding: sigma=1.8 (near sigma0=1.8205 boundary) marginally fails
  at R_128-1 = 3.94e-23 vs 2.65e-23 target — genuine BerExp
  quantization effect at extreme sigma values

Effect-size diagnostics (saga.py):
- effect_sizes() method on UnivariateSamples: TV distance with
  null-expected bias floor, R_2 divergence (= log(1 + chi2/n)),
  resolution floor 1/sqrt(N)
- Framed as diagnostics, not security certification

Seeded determinism (test_sampler_determinism.py):
- Same seed produces identical output stream
- Different seeds produce different streams

README scope paragraph:
- Statistical layer detects bugs at delta ~ 1/sqrt(N)
- Certification layer certifies proof-level RD bounds
- Neither detects trace-level side-channel leakage

Test suite: 104 passed, 12 skipped (known blind spots), 0 failed
@jameshoweee

Copy link
Copy Markdown
Owner Author

consolidating into a single PR

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant