← finnpounds
Privacy-Preserving ML · Applied Cryptography

Encrypted Vitals
FHE for Medical Inference

A model predicts a tumor condition from six patient vitals — while the vitals stay encrypted the entire time. The server computes on ciphertext it can't read, and returns a prediction only the patient can decrypt.

Concrete ML (Zama) Logistic Regression · 7-bit 6 vitals features

Finn Pounds  ·  EAI6400  ·  View the code on GitHub →
1.00
Hold-out accuracy & F1 = 1.00
0.85 ± 0.13
5-fold cross-validated F1
0
Plaintext vitals seen by the model

The question

Clinical models need vitals sharp enough to flag a tumor; privacy rules insist those same vitals stay confidential. Of the privacy-preserving options — differential privacy, federated learning, secure multi-party computation, and homomorphic encryption — Fully Homomorphic Encryption (FHE) is the one that lets a server run ordinary classification math directly on encrypted inputs, with no plaintext ever leaving the client.

How it works

🧠Train LR
in the clear
⚙️Compile to
FHE circuit
🔒Encrypt
vitals (client)
🔑Infer on
ciphertext (server)
🔓Decrypt
label (client)

The server in the middle never holds a decryption key — it computes blind.

The guarantee that makes it real: the encrypted circuit returns ciphertext predictions that decrypt to exactly the labels the plaintext model would have produced — agreement is bit-for-bit, not approximate.

The result

On a stratified 30% hold-out fold, the plaintext and FHE paths agree on every single label. Because that fold is tiny, a 5-fold cross-validation gives the honest performance estimate.

Inference pathAccuracyF1
Plaintext1.001.00
FHE (on ciphertext)1.001.00
5-fold CV (honest estimate)0.85 ± 0.13

What the server actually sees

Each patient's six vitals become a single opaque ciphertext like this (18 of them, one per test patient, in results/EncryptedVitals.csv):

AQAAAC4AAAADAAAAAAAAAAAAAAAAAAMACAAAAAAAAQBUAAAAAQABAGQAAAABAAEAAQAAAA4AAAABAAAAggQAACvigKUkKeA2gFYSCEovAaA/Q/Ewvv5CDRQCL+35J4+HJkllAaKRVcW9u4MjTnHIeWDt5BvMThaanKMGS+AcPFV9LjwaAhTr3rQ7O//LX3N5FySCTt3ZcVbB6MuFYpPp7sxymbCEQXhX9p55t+HFyi8FY69zWJs/4zoBxca0ldeS7lNUYh+GW60jbg3cxmVW30AAAAAAAAAAAAAAAAAAAQABAAAAHAAAAAEAAAAGAAAAAwAAAAAAAAAAAAAAAAAA…

How it was built

ChoiceDetail
FeaturesBP_sys, BP_dia, HR, O2, Smoking, Alcohol
ModelLogistic Regression, balanced class weights
Quantization7-bit (keeps the FHE circuit small)
FHE frameworkConcrete ML 1.9 (Zama), TFHE backend

Blood pressure is split into systolic/diastolic, oxygen and heart rate parsed to numbers, and smoking/alcohol encoded as flags — six interpretable inputs, standardized, then handed to a Concrete ML classifier whose predict(…, fhe="execute") path runs entirely on encrypted data.

Honest caveats