Skip to content

Add end-to-end Streamlit privacy auditor UI (MVP)#386

Closed
fazelehh wants to merge 9 commits into
mainfrom
ui/streamlit-auditor
Closed

Add end-to-end Streamlit privacy auditor UI (MVP)#386
fazelehh wants to merge 9 commits into
mainfrom
ui/streamlit-auditor

Conversation

@fazelehh
Copy link
Copy Markdown
Collaborator

@fazelehh fazelehh commented Mar 3, 2026

Streamlit Privacy Auditor UI — MVP + UX Improvements

Summary

  • Adds an end-to-end Streamlit wizard UI (leakpro/ui/) for running MIA privacy audits without touching any code
  • Fixes a correctness bug in the logit cache indexing that caused RMIA to fail with out-of-bounds errors
  • Improves the audit workflow with re-audit support and configurable per-attack parameters

What's included

New UI (leakpro/ui/)

A 4-stage wizard launched via streamlit run leakpro/ui/dashboard.py:

Stage What it does
0 — Overview Landing page with Start / Re-audit / Resume options
1 — Configure Training hyperparameters, attack selection, DP-SGD toggle
2 — Train Dataset download, model training with live log stream
3 — Audit Attack execution with live progress
4 — Results ROC curves, signal histograms, sensitive records export

Bug fix — logit cache indexing

prepare_data() previously assigned random population-space indices to train/test splits.
RMIA and BASE attacks assume logits_cache[i] corresponds to population point i,
causing IndexError: index N is out of bounds at audit time.

Fix: the population is now shuffled once and sequential 0-based indices are assigned
(train = [0…n-1], test = [n…n+m-1]), so position always equals population index.
The population pickle is always regenerated to stay consistent.

UX improvements

  • Re-audit mode — reuse a trained model with different attacks/parameters, skips straight to Stage 3
  • Per-attack parameter expanders in Stage 1 — shadow model count, data fraction, online mode, augmentation settings per attack
  • Re-prepare Data button in Stage 2 — prevents stale session indices from carrying over between runs

Test plan

  • Fresh audit: configure → download data → train → run RMIA/BASE/LiRA → view results
  • Re-audit: after a completed audit, click "Re-audit same model", change attack params, run again without retraining
  • Verify logit cache shape matches population size (60 000 × num_classes for CIFAR-10)
  • DP-SGD training completes and epsilon is reported in results
  • SSH port forwarding (ssh -L 8501:localhost:8501 user@host) required to access from a remote machine

Introduces leakpro/ui/ — a wizard-style Streamlit dashboard that guides
users through the full LeakPro audit journey in a browser:

Stage 0 – Overview: landing page with pipeline diagram and resume support
Stage 1 – Configure: YAML editors, attack checklist, DP-SGD toggle (ε/δ sliders)
Stage 2 – Train: target model training with live progress; supports both
           standard and DP-SGD (Opacus) modes using existing handlers
Stage 3 – Audit: runs MIA attacks with live log streaming per attack
Stage 4 – Explore Results: four interactive tabs
  • Summary — risk cards, traffic-light indicator, plain-English verdict,
               DP-SGD privacy impact panel
  • ROC Analysis — interactive Plotly ROC curves (log-log, all attacks overlaid)
  • Signal Histograms — member vs non-member distributions + threshold slider
  • Sensitive Records — top-N riskiest training images (CIFAR grid) or
                        tabular rows + CSV export for all data types

Reuses CifarInputHandler, CifarInputHandlerDPsgd, LeakPro, and MIAResult
from existing code. No changes to attack pipeline."
@henrikfo henrikfo mentioned this pull request Mar 4, 2026
@fazelehh
Copy link
Copy Markdown
Collaborator Author

taking care of in PR #393

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

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant