-
Notifications
You must be signed in to change notification settings - Fork 229
[2.7] Kaplan Meier updates #3935
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: 2.7
Are you sure you want to change the base?
Conversation
Greptile SummaryThis PR restructures the Kaplan-Meier HE example to support both simulation and production deployment modes using the Recipe API. The changes modernize the example by: Key Changes:
Architecture:
Quality:
Confidence Score: 5/5
Important Files Changed
Sequence DiagramsequenceDiagram
participant Server as Server (KM_HE)
participant Client as Client (client_he.py)
participant HEContext as HE Context (CKKS)
Note over Server,Client: Round 1: Collect Max Index (Cleartext)
Server->>Client: Send empty message (round=1)
Client->>Client: Calculate local max histogram index
Client->>Server: Send max_idx (cleartext)
Note over Server,Client: Round 2: Collect Encrypted Histograms
Server->>Server: Aggregate max indices to get global max
Server->>Client: Send max_idx_global (cleartext, round=2)
Client->>HEContext: Encrypt histograms with CKKS
Client->>Server: Send encrypted histograms (ciphertext)
Note over Server,Client: Round 3: Distribute Aggregated Results
Server->>HEContext: Add encrypted vectors (homomorphic addition)
Server->>Client: Send aggregated encrypted histograms (round=3)
Client->>HEContext: Decrypt histograms with CKKS
Client->>Client: Perform Kaplan-Meier analysis
Client->>Client: Save results (km_curve_fl_he.png, km_global.json)
Client->>Server: Send completion message
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull request overview
This PR applies updates to the Kaplan-Meier with Homomorphic Encryption example for version 2.7, transitioning from BFV to CKKS encryption scheme and adding production deployment support through the Recipe API.
- Switches from BFV to CKKS homomorphic encryption scheme for better compatibility with approximate arithmetic
- Adds production mode support with automatic HE context provisioning via startup kits
- Refactors job submission from JobAPI to Recipe API pattern for improved flexibility
Reviewed changes
Copilot reviewed 10 out of 10 changed files in this pull request and generated no comments.
Show a summary per file
| File | Description |
|---|---|
| utils/prepare_he_context.py | Updates default HE scheme to CKKS with poly_modulus_degree=8192 and adds CKKS-specific configuration (coeff_mod_bit_sizes, global_scale) |
| start_all.sh | New convenience script for starting all NVFlare parties (server + 5 clients) in the background for local production testing |
| server_he.py | Adds persistor_id parameter, implements dual-mode HE context file handling (base64/raw binary), switches from BFV to CKKS vector operations, improves logging clarity |
| server.py | Adds persistor_id parameter and refactors histogram aggregation logic for clarity |
| project.yml | New provisioning configuration with HEBuilder for automatic CKKS context generation in production mode |
| km_job.py | Removed in favor of new Recipe API approach |
| job.py | New file implementing Recipe API pattern with KMRecipe class for unified simulation and production mode job execution |
| client_he.py | Updates HE context file path resolution for both modes, switches from BFV to CKKS encryption, adds CKKS-specific float-to-int conversion for histogram decryption, fixes output file paths |
| client.py | Updates output file paths to use job-specific directories, refactors histogram logic to avoid repeated max() calls |
| README.md | Comprehensive documentation updates covering CKKS scheme details, production mode setup, provisioning steps, and deployment instructions |
Comments suppressed due to low confidence (1)
examples/advanced/kaplan-meier-he/client_he.py:207
- Redundant int() conversions are applied here. At lines 197-198, hist_obs_global and hist_cen_global are already converted to lists of integers using list comprehensions with int(round(x)). The subsequent int() calls at lines 204 and 207 when indexing these lists are unnecessary since the elements are already integers.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Fixes # .
Description
Apply same updates for KM example to 2.7
Types of changes
./runtest.sh.