CoolFace
Apppublic

vamshi257/fhe-bio-age-estimator

sourceHugging Faceapache-2.0updated 1y agoView on Hugging Face
0likes
App README

FHE-Based Biological Age and Aging Pace Estimator

This repository implements a privacy-preserving biological age and aging pace estimator using Zama's Concrete ML Fully Homomorphic Encryption (FHE) library.

  • —All computations on sensitive data are performed encrypted (FHE).
  • —Model is demonstrated on real methylation data (GSE40279).
  • —Client/server demo is ready for local use and Hugging Face Spaces deployment.

How It Works

  1. 1.Model: A LinearRegression model is trained on real methylation data (5 CpGs) to predict biological age.
  2. 2.FHE: The model is compiled for FHE inference using Concrete ML.
  3. 3.Client/Server: Client encrypts input, server predicts on encrypted data, client decrypts result.
  4. 4.Demo: Deployable to Hugging Face Spaces or can be run locally.

Usage

🚀 Try the Demo

  • —Enter 5 methylation values (between 0 and 1) in the input fields.
  • —Click Submit to get your encrypted biological age prediction.
  • —All data is processed using Fully Homomorphic Encryption (FHE) – your inputs remain private!

<details> <summary><b>Advanced: Local Training & Development</b></summary>

  1. 1.Install dependencies:
bash
 pip install -r requirements.txt

Install ZAMA Concrete ML Library

Concrete ML can be installed via pip on Linux and macOS (Intel or Apple Silicon). Note: Windows users should use WSL or Docker (see Zama docs).

bash
pip install concrete-ml

If you encounter installation issues (e.g., unsupported CPU or AVX2 limitations), refer to:

Docker Alternative

If you prefer Docker or are on Windows, you can use the official Docker image:

bash
docker pull zamafhe/concrete-ml:latest

See official Docker instructions for more details.

For more help, see the Concrete ML documentation or Zama’s GitHub.```
  1. 1.Train model:
bash
 python src/train.py
  1. 1.Run client/server demo:
bash
python src/app/server.py
python src/app/client.py

Try sample input from data/bio_age_demo_data.csv(5 methylation values, 0–1 scale)

FHE Biological Age Estimation Report

1. Data Pipeline

  • —Source: GSE40279 (656 blood samples)
  • —CpGs: ELOVL2 (cg16867657), KLF14, TRIM59, FHL2, CCDC102B
  • —Age range: 62-89 years

2. Model Architecture

  • —Type: LinearRegression (FHE-compatible)
  • —Quantization: 8-bit weights/activations
  • —FHE Params: perror=0.03, globalp_error=0.01

3. Performance

All metrics measured on local machine (Intel CPU with AVX2 support) using Concrete-ML 1.9.0.

🚦 Performance Benchmarks

MetricCleartext ValueFHE Value
MAE (years)5.025.02
R²0.830.83
Inference time/sample0.33–0.57 ms0.02–0.05 s
Model typeLinearRegressionLinearRegression
DataGSE40279GSE40279

4. Security

  • —Key size: 128-bit
  • —Cryptographic parameters: TFHE shortint

5. Deployment

  • —Local demo: See Usage above.
  • —Hugging Face Spaces: [Instructions for it are "Coming soon"]

6. References