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
- Model: A LinearRegression model is trained on real methylation data (5 CpGs) to predict biological age.
- FHE: The model is compiled for FHE inference using Concrete ML.
- Client/Server: Client encrypts input, server predicts on encrypted data, client decrypts result.
- Demo: Deployable to Hugging Face Spaces or can be run locally.
Usage
- 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.```
- Train model:
python src/train.py
- 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
| Metric | Cleartext Value | FHE Value |
|---|---|---|
| MAE (years) | 5.02 | 5.02 |
| Rยฒ | 0.83 | 0.83 |
| Inference time/sample | 0.33โ0.57 ms | 0.02โ0.05 s |
| Model type | LinearRegression | LinearRegression |
| Data | GSE40279, n=656 | GSE40279, n=656 |
4. Security
- Key size: 128-bit
- Cryptographic parameters: TFHE shortint
5. Deployment
- Local demo: See Usage above.
- Hugging Face Spaces: vamshi257/fhe-bio-age-estimator