ppflx
Privacy-preserving federated learning on Flower: each privacy mechanism is a plugin, so a run combines homomorphic encryption, zero-knowledge proofs of bounded model updates, and differential-privacy noise without the training code knowing which is in use.
Proofs are produced and checked by gnark-gradient-prover; benchmarks across datasets and modes live in ppflx-bench.
What the modes guarantee
| Mode | Confidentiality | Integrity | DP |
|---|---|---|---|
baseline |
— | — | — |
he_tenseal, he_concrete_tfhe |
server sees only ciphertexts | — | — |
zkp |
— | update bound to the downloaded model, norm bounded | — |
he_elgamal_zkp, he_elgamal_zkp_sampled |
additively homomorphic ciphertexts | proof bound to the aggregated ciphertext | — |
he_*_zkp (CKKS/TFHE composites) |
server sees only ciphertexts | none — the proof is not bound to the ciphertext | — |
dp |
— | — | noise in training; no end-to-end (ε, δ) guarantee |
he_*_zkp_dp |
server sees only ciphertexts | none | as dp |
DP as implemented. During local training each batch's mean gradient is
clipped to norm C and Gaussian noise with standard deviation σ·C/B is added (B is
the batch size), with σ = √(2 ln(1.25/δ))/ε (ppflx/core/engine.py). That is a
single-step calibration with no per-example clipping and no accounting across
steps or rounds, so the recorded ε sets the noise; it is not an (ε, δ) guarantee
for the published model.
docs/ZKP.md documents the protocols, the update bound, the circuits and the
limitations in full. Read SECURITY.md before relying on any of
these properties.
Install
pip install ppflx # core: Flower, TenSEAL, torch
pip install "ppflx[tfhe]" # adds Concrete-ML — see the licence note below
Python 3.12 (Concrete-ML requires < 3.13; Flower 1.36 requires > 3.11). The
tfhe extra builds onnxoptimizer (pinned by Concrete-ML, with no Python 3.12
wheel) from source, which needs CMake and a C++ compiler; with CMake 4 or later,
install with CMAKE_POLICY_VERSION_MINIMUM=3.5 pip install "ppflx[tfhe]".
pip alone does not give working proofs. The zero-knowledge modes (zkp,
zkp_sampled, he_elgamal_zkp, he_elgamal_zkp_sampled and the *_zkp*
composites) prove and verify through a separate Go proof service that pip does
not install. Build it from
gnark-gradient-prover, set
FL_GNARK_BINARY to the binary and make a local key set as in
docs/ZKP.md, section 7.1.
Without it those modes cannot run; the other modes do not use the proof service.
Use
from ppflx import FLConfig, get_privacy_mode
from ppflx.server import make_strategy
from ppflx.client import make_client
config = FLConfig(dataset="healthcare", privacy_mode="zkp", num_rounds=3)
mode = get_privacy_mode(config.privacy_mode)
strategy = make_strategy(config, mode, testloader) # in a Flower ServerApp
client = make_client("0", trainloaders, valloaders, mode, config) # in a ClientApp
ppflx_bench shows a complete ServerApp and ClientApp built on these.
Key generation:
python -m ppflx.keys generate he_tenseal
python -m ppflx.keys generate dp --output keys/dp/dp_params.json
Proof service
ZKP modes talk to the prover and verifier over HTTP:
export FL_ZKP_PROVER_URL=http://127.0.0.1:9000 # clients prove here
export FL_ZKP_VERIFIER_URL=http://127.0.0.1:9001 # the server verifies here
The verifying keys and manifest this library pins ship in
ppflx/core/gnark_keys_data/; a proof made under any other key is rejected.
Point FL_ZKP_KEYS_DIR elsewhere to pin different keys.
Tests
pytest tests
Tests that need proofs run against a built proof service; set
FL_GNARK_BINARY to its binary, or they skip.
Licence
Apache-2.0 — see LICENSE. Copyright 2026 CorpiXo.
Concrete-ML (the tfhe extra) is BSD-3-Clause-Clear, which grants no patent
rights; Zama requires a commercial patent licence for commercial use. See
NOTICE.
Metadata
Release files for ppflx 0.9.1
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| ppflx-0.9.1.tar.gz | 199.4 kB | With provenance | Details for ppflx-0.9.1.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| ppflx-0.9.1-py3-none-any.whl | Python 3 | none | any | Details for ppflx-0.9.1-py3-none-any.whl |
Total release size: 392.3 kB
Release files / ppflx-0.9.1.tar.gz
| Download URL | ppflx-0.9.1.tar.gz |
|---|---|
| Size | 199.4 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
64770f819d2ebdf12d032b7f40ee49f3d2018e9c724f26b963ce7aaa1a0da4da
|
|
BLAKE2b-256 checksum How to use checksums |
aed5986e49131078998c169b432ace2388c2025dff55fef3e12308fc345889b5
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.16
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Nov 17, 2026.
Transparency logRelease files / ppflx-0.9.1-py3-none-any.whl
| Download URL | ppflx-0.9.1-py3-none-any.whl |
|---|---|
| Size | 192.8 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
d4163a32739abf5e11c9b27bdf86e7b5a31952f231040dfafa5e50a828067c2a
|
|
BLAKE2b-256 checksum How to use checksums |
a11bddb7767528d5878d10634c600e914be9fba7a404cfe7abb613e5ba743074
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.16
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Nov 17, 2026.
Transparency logSecurity for ppflx 0.9.1
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
Full provenance
Both files in this release have been uploaded with provenance metadata.
Attestation for ppflx-0.9.1.tar.gz
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Nov 17, 2026.
Transparency logA note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.