Manuscript Offprint

arXiv:2610.19325

AutoPoly-HE: Autonomous Design of Polynomial Activations for Privacy-Preserving Encrypted Inference

Zeinab Elkhatib, Kamrul Hasan, Ali Sekmen, Imtiaz Ahmed, Tariqul Islam

Open access. PaperVantage converted this article to text, so layout and figures may differ from the original.

Zeinab Elkhatib 1^{1}, Kamrul Hasan 1^{1}, Ali Sekmen 1^{1}, Imtiaz Ahmed 2^{2}, Tariqul Islam 3^{3}

1^{1} Tennessee State University, Nashville, TN, USA

2^{2} Howard University, Washington, DC, USA

3^{3} University of Maryland Baltimore County (UMBC), Baltimore, MD, USA

Email: {zelkhati, mhasan1, asekmen}@tnstate.edu, imtiaz.ahmed@howard.edu, mtislam@umbc.edu

Abstract—Privacy-preserving machine learning has become critical for deploying artificial intelligence in sensitive domains such as healthcare, finance, and infrastructure monitoring. Homomorphic encryption (HE) enables secure inference on encrypted data. Despite its advantages, HE is not compatible with nonlinear activation functions found in machine learning models. Existing methods mitigate this problem by manually designing polynomial approximations for these activation functions. However, these functions do not account for the differences in dataset characteristics or model architecture. Furthermore, these functions are also limited to the accuracies of convolutional neural network (CNN) models. In this work, we propose an autonomous framework that selects polynomial activation functions tailored to each dataset and model. Using this framework, we analyze the interdependence between polynomial activation design and model architecture by evaluating several CNN ResNet and Vision Transformer models across multiple datasets. Experimental results demonstrate that the proposed framework generalizes across multiple architectures, including ResNet-18, ResNet-34, ResNet-50, ViT-S/16, ViT-B/16, and ViT-L/16. Across all datasets, transformer-based models maintain higher accuracy under polynomial approximation, while convolutional models exhibit increased degradation as task complexity grows. In addition, latency analysis reveals that the proposed CLS token based inference pipeline significantly reduces computational overhead by eliminating depth-dependent operations, shifting the primary cost to encryption and decryption. These findings demonstrate that the proposed method not only adapts polynomial activations across architectures, but also enables efficient encrypted inference through both activation design and pipeline optimization.

I. INTRODUCTION

The increasing demand for secure artificial intelligence has driven interest in privacy-preserving machine learning (PPML), particularly in domains such as healthcare, autonomous transportation, and other critical infrastructures, where sensitive data must remain protected [1], [2]. In many cases, machine learning inference is performed on external or cloud-based systems, creating a need for techniques that allow computation without exposing raw data [3].

Homomorphic Encryption (HE) provides a solution by enabling computation directly on encrypted data [4]. However, the application of HE in deep learning is limited by the types of operations it supports. Homomorphic encryption schemes only support linear operations, such as addition and multiplication. This makes it infeasible to directly evaluate nonlinear activation functions, including ReLU and GELU, which are essential for modern neural networks [5], [6]. To address these limitations, these functions are replaced with polynomial approximations that are compatible with HE. While this enables encrypted computation, it introduces approximation errors that can significantly degrade model accuracy.

Furthermore, although polynomial activations make it possible to use encryption with machine learning, achieving high accuracy remains a major challenge. Particularly with more complex datasets, models often experience performance degradation. This suggests that the impact of polynomial approximations extends beyond function design alone and depends on additional factors within the model. Two key challenges contribute to this limitation. First, polynomial activation functions are typically designed by approximating standard nonlinear functions such as ReLU or GELU directly, rather than being tailored to the characteristics of the dataset or the behavior of the trained model. This approach can result in suboptimal approximations that do not generalize well throughout the model. The second challenge limiting the accuracy of encrypted inference is the role of model architecture, specifically how it interacts with polynomial approximation. Most efforts have focused on CNNs, without investigating how alternative architectures, such as ViTs, behave under these constraints. To address these challenges, we introduce an automated framework that learns polynomial activation functions based on the dataset and trained model, and that automates the search for the appropriate polynomial degree. This removes the need for manual design and helps maintain a balance between accuracy and computational efficiency.

Using this framework, we analyze the interaction between polynomial activation design and model architecture by evaluating multiple convolutional and transformer-based models, including ResNet-18, ResNet-34, ResNet-50, ViT-S/16, ViT-B/16, and ViT-L/16 across multiple datasets. To address these challenges, the proposed framework introduces three key improvements: a) it learns polynomial activation functions tailored to the dataset and trained model, reducing approximation error; b) it balances accuracy and homomorphic encryption constraints by selecting polynomial degrees that control multiplicative depth; and c) it evaluates both convolutional and transformer-based architectures, enabling analysis of how model structure impacts performance under polynomial approximations. The rest of this paper is organized as follows. Section II reviews existing work on privacy-preserving machine learning, homomorphic encryption, and polynomial activation functions. Section III describes the proposed methodology, including the automated framework for generating polynomial activations and the experimental setup used for both CNN and the Vision Transformer model. Section IV presents and analyzes the experimental results, highlighting the impact of activation design and model architecture on performance. Finally, Section V concludes the paper and outlines directions for future work.

References (32)

  • Privacy-preserving machine learning: Threats and solutions
  • A review of privacy-preserving techniques for medical data sharing
  • Machine learning in the cloud: Security and privacy challenges
  • Homomorphic encryption for arithmetic of approximate numbers
  • Cryptonets: Applying neural networks to encrypted data with high throughput and accuracy
  • Cryptodl: Deep neural networks over encrypted data (opens arXiv in a new tab)
  • Deep learning enabled semantic communication systems
  • Semantic communications with ai tasks
  • Semantic communications for image recovery and classification via deep joint source and channel coding
  • Privacy-preserving task-oriented semantic communications against model inversion attacks
  • Gazelle: A low latency framework for secure neural network inference
  • Highly accurate cnn inference using approximate activation functions over homomorphic encryption
  • Redsec: Running encrypted deep neural networks in secure enclaves
  • Lola: Low-latency cryptonets for homomorphic inference
  • Autofhe: Automated adaption of cnns for efficient evaluation over homomorphic encryption
  • Ola: Optimal linear approximation for efficient homomorphic evaluation of neural networks
  • Slaf: Secure learning of activation functions in homomorphic encryption
  • Imagenet: A large-scale hierarchical image database
  • An image is worth $16 \times 16$ words: Transformers for image recognition at scale
  • Training data-efficient image transformers & distillation through attention
  • Swin transformer: Hierarchical vision transformer using shifted windows
  • Mpcvit: Privacy-preserving vision transformers via multi-party computation
  • Privit: Vision transformers for privacy-preserving image classification
  • Shaft: Secure and efficient vision transformers via hybrid privacy-preserving techniques
  • Semantic communication: A survey on research landscape, challenges, and future directions
  • MIT Press, 2016
  • Deep sparse rectifier neural networks
  • Generalizations of horner’s rule for polynomial evaluation
  • Resnet-18 model trained on cifar-100
  • Brain tumor classification based on hybrid optimized multi-features analysis using magnetic resonance imaging dataset
  • SGDR: Stochastic Gradient Descent with Warm Restarts
  • Tenseal: A library for encrypted tensor operations using homomorphic encryption