Training Predictive Models on Encrypted Data using Fully Homomorphic Encryption
The transformative power of data across sectors like healthcare, finance, advertising, and genomics cannot be overstated. Yet, as valuable as this data can be, it is often laden with sensitive information that can include personally identifiable details, making its security paramount. Herein lies the potential of Fully Homomorphic Encryption (FHE) – a groundbreaking technology that secures data while preserving its utility, allowing data owners to process it even in its encrypted state.
The implications of FHE stretch far into the future of machine learning, offering a path to unlock use-cases where data privacy isn't just a requirement but a cornerstone. By enabling the training of machine learning models on encrypted data, FHE introduces a new era of privacy protections in collaborative environments. Imagine a scenario where entities can enrich their models by leveraging the data of others, without ever compromising the integrity and confidentiality of the information shared. This not only safeguards privacy but also fosters a culture of trust and cooperation.
Moreover, in such collaborative settings, the ability to train interpretable models on encrypted data can be revolutionary. It offers clear insights into how external data enhances model performance, thereby validating the value of collaboration. This transparency and understanding are crucial, creating a solid foundation of confidence among parties that their partnership is not only secure but also mutually beneficial.
In essence, Fully Homomorphic Encryption is not just a tool for data security; it is a catalyst for innovation, enabling safer, more productive collaborations across industries where privacy concerns have traditionally hindered progress. Its application in training machine learning models on encrypted data promises a future where privacy and utility go hand in hand, unlocking unprecedented potential for growth and advancement.
Training encrypted data with Concrete ML
With its most recent release, v1.4, Concrete ML supports training of Logistic Regression models on encrypted data. This class of models are well known for their simplicity, robustness and interpretability. The implementation uses stochastic gradient descent to train the model, so the data sets are split into batches during training.
The current encrypted training approach in Concrete ML performs encryption, training and decryption jointly. This is useful for development purposes for data scientists that want to explore the accuracy of models trained on encrypted data. In a real client-server application one expects that these steps will be separate so that the server only receives and sends encrypted data.
First, instantiate the Logistic Regression training class, [.c-inline-code]SGDClassifier[.c-inline-code].
Next, simply call the fit function while specifying that the training should use FHE. This function quantizes and encrypts the training data and labels and, after training, decrypts the resulting model.
The model parameters, stored in the clear in the model object can now be used to predict on new clear or encrypted data.
You can easily use the above code to learn a classifier on the well known breast-cancer dataset. The following code shows how to train batch by batch in order to monitor the model accuracy throughout the training process.
First, download, split and scale the dataset.
Now, train the classifier by encrypting each batch of data individually and running it through the training algorithm. The model is decrypted after each batch so that it can be evaluated.
Plotting the above accuracy after each batch was processed gives the following graph:
The training time for this model is around 11 seconds per batch on a large AWS server. For the entire breast-cancer dataset the time to train the model is 13 minutes. For more results, check out this research paper that will be presented at FHE.org 2024.
Future work
While currently only the single user experimentation use-case is explored, the natural use-case for training is the client-server setting. In future versions of Concrete ML this deployment setting will be added, following the API for deploying encrypted inference.
Collaboration between multiple parties is where training on encrypted data really shines. Using threshold protocols it is possible for multiple parties to generate keys that keep their individual data secure, while allowing joint training. Furthermore, in future versions of Concrete ML, more complex models such as neural networks will be enabled for encrypted training.
Additional links
- Star the Concrete ML Github repository to endorse our work.
- Review the Concrete ML documentation.
- Join the Zama Bounty and Grant Program.
- Get support on our community channels.