Logistic regression over encrypted data from fully homomorphic encryption

Hao Chen, Ran Gilad-Bachrach, Kyoohyung Han, Zhicong Huang, Amir Jalali, Kim Laine, Kristin E. Lauter

Introduction

In modern data science, a persistent tension exists between the requirement for massive datasets and the imperative of data privacy. Training machine learning models on sensitive information—such as genomic records or financial histories—traditionally requires decrypting the data, creating a significant security vulnerability. This paper, originally presented at the 2017 iDASH Privacy and Security Workshop, explores a potential solution: Fully Homomorphic Encryption (FHE). The authors demonstrate that it is possible to train a logistic regression model while the data remains encrypted from start to finish.

The Challenges of FHE in Machine Learning

Fully Homomorphic Encryption allows mathematical operations to be performed on ciphertexts, producing an encrypted result that matches the result of operations performed on plaintext. However, FHE is notoriously difficult to apply to machine learning for three primary reasons:

  1. Limited Operations: FHE natively supports only addition and multiplication (polynomials). Non-linear functions essential to ML, such as the sigmoid function ($\sigma$), are not natively supported.
  2. Noise Growth: Every operation adds "noise" to the ciphertext. If this noise exceeds a certain threshold, the data becomes undecryptable.
  3. Data Types: FHE schemes typically operate on integers, whereas machine learning requires high-precision floating-point arithmetic.

Proposed Methodology

The authors developed their solution using the SEAL library and the Fan-Vercauteren (FV) encryption scheme. Their approach utilizes several novel techniques to overcome the inherent limitations of FHE.

Polynomial Approximation of the Sigmoid Function

Because the standard sigmoid function cannot be computed directly in FHE, the authors used the Remez algorithm to find the best-fitting low-degree polynomials to approximate it. They evaluated both linear and cubic approximations to balance accuracy against computational depth.

Linear minimax approximation of the sigmoid function: f(x) = 0.5 + 0.125x.

As shown in Figure 1, a linear approximation provides a basic fit, but a higher-degree polynomial is often required for model convergence and accuracy. Figure 2 illustrates the third-degree approximation, which more closely tracks the non-linear curve of the sigmoid function.

Degree 3 minimax approximation providing a closer fit: f(x) = 0.5 + 0.197x - 0.004x³.

1-Bit Gradient Descent (1-Bit GD)

To prevent the numerical values and associated noise from exploding during the training process, the authors adopted 1-Bit GD. Instead of updating model weights by the full gradient, the system only utilizes the sign of the gradient. This strategic choice keeps the plaintext values small and manageable, preserving the "noise budget" of the ciphertext.

Optimized Bootstrapping and Batching

"Bootstrapping" is the process of refreshing a noisy ciphertext to allow for further computation, but it is computationally expensive. The authors developed a modified bootstrapping operation that simultaneously performs fixed-point scaling, effectively combining two necessary operations. Additionally, they utilized vertical batching (SIMD) to pack 64 patient records into a single ciphertext, allowing for parallel processing of data slots.

Experimental Results

The system was evaluated on two distinct datasets: the iDASH 2017 genomic dataset (1,579 records) and a subset of the MNIST handwritten digit dataset (1,500 images).

  • Accuracy: The results indicate that approximation is sufficient for high-quality predictive modeling. On the iDASH dataset, the encrypted model achieved an AUC of 0.690, matching the unencrypted baseline exactly. On MNIST, the encrypted model achieved an AUC of 0.974, compared to 0.977 for the unencrypted version.
  • Computational Cost: While accuracy was preserved, the computational "tax" was significant. For the iDASH dataset, standard Gradient Descent required 115.33 hours for 36 iterations. The optimized 1-Bit GD reduced this to 14.9 hours. Depending on the specific configuration, a single iteration of gradient descent took between 0.4 and 3.2 hours.

Conclusion and Future Work

This research proves the feasibility of training logistic regression models over encrypted data without sacrificing predictive power. However, the primary bottleneck remains computational overhead. Future work will focus on parallelization across multi-core CPUs or GPUs and further algorithmic optimizations for "Big Data" applications. The techniques established here—polynomial approximation and noise-aware gradient descent—provide a foundational roadmap for applying FHE to more complex architectures, such as neural networks.

Summary updated

BibTeX
@article{chen2018logistic,
  author = {Hao Chen and Ran Gilad-Bachrach and Kyoohyung Han and Zhicong Huang and Amir Jalali and Kim Laine and Kristin E. Lauter},
  title = {{Logistic regression over encrypted data from fully homomorphic encryption}},
  journal = {IACR Cryptol. ePrint Arch.},
  year = {2018},
  url = {https://openreview.net/forum?id=BfOGXWX2z9U},
}
Figure