FHE-Based Biological Age and Aging Pace Estimator

May 19, 2025 ยท View on GitHub

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

Usage

  1. Install dependencies:
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).

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:

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. Train model:
python src/train.py
  1. Run client/server demo:
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: p_error=0.03, global_p_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
DataGSE40279, n=656GSE40279, n=656

4. Security

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

5. Deployment

6. References