Advanced Security Training and Inference with CrypTen
Advanced Security Training and Inference with CrypTen
Conducted preprocessing, training, and inference of a model on sensitive financial data using CrypTen for enhanced security
July 20, 2024
5 minutes read
SUMMARY
The client is a leading financial institution with a strong focus on precision and security in data handling. They possess a deep understanding of financial market trends, statistical analysis, and advanced forecasting techniques.
The client sought to develop a time series forecasting model for financial data with a critical requirement that the data remain encrypted throughout the entire process. This encryption needed to preserve the statistical significance of the data during both training and inference, ensuring that the model could provide accurate predictions without compromising data security.
Additionally, the client wanted the flexibility to use this model with both encrypted and unencrypted data. This required us to develop a model that could seamlessly convert to a secure version using CrypTen for handling encrypted data and then revert back to a standard model for use with unencrypted data.
To meet these stringent requirements, our team utilized CrypTen, a secure computing framework designed for privacy-preserving machine learning. This approach allowed us to preprocess, train, and perform inference on encrypted financial data, while also enabling easy conversion between secure and standard versions of the model.
The client's goal was to leverage this versatile and secure model to improve financial forecasting accuracy while adhering to the highest standards of data protection, demonstrating their commitment to both innovation and security in financial analytics.
TECH STACK
PyTorch
CrypTen
DELIVERY TIMELINE
1 Week
Solution Architecture Design
4 Weeks
Creating Transformer Model with CrypTen
1 Week
Statistical Validation of the Model's Performance On Encrypted Data
1 Week
Deployment & Testing
TECH CHALLENGE
One of the primary challenges was that CrypTen does not support all types of neural network layers due to its privacy-preserving features. Given the requirement to develop a complex transformer-based model, we had to custom-build some layers from scratch to meet CrypTen's standards. This effort ensured the model could securely handle encrypted data while maintaining the necessary complexity and functionality for accurate financial forecasting.
SOLUTION
The team developed an Encoder block of the transformer model using PyTorch. Key layers such as multihead attention, layer normalization, and certain activation layers were custom-built from scratch. This approach allowed the standard PyTorch model to be seamlessly converted into a CrypTen-compatible model, enabling secure training and inference on encrypted data.
Additionally, the team conducted thorough testing and statistically compared the inference accuracy on real and encrypted data. The difference between the predictions was only 0.0001%, proving that the model can make forecasts on encrypted data with minimal deviation.