Manuscript Offprint

arXiv:2610.32065

SPA: Structure-Preserving Approximation of Gated Activations under FHE

Rui Li, Wenyuan Wu, Weijie Miao

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

ABSTRACT

Nonlinear activation evaluation remains a major bottleneck in neural inference under fully homomorphic encryption (FHE). FHE supports efficient addition and multiplication, but lacks native operations for exponential functions, reciprocals, and value-dependent selection. High-degree polynomial approximations on fixed intervals are therefore commonly used to replace nonlinear activations. They can achieve small errors but often incur substantial multiplicative depth and latency. We observe that several widely used nonlinear activations share the algebraic structure A(x)=xg(x)A(x) = xg(x) with g(−x)=1−g(x)g(-x) = 1 - g(x). This class includes GELU, SiLU, fixed-parameter Swish, and the scalar nonlinear branches of GEGLU/SwiGLU. We propose SPA (Structure-Preserving Approximation) to exploit this shared structure. SPA retains the exact odd component x/2x/2 and approximates only the even residual as a polynomial in x2x^2, yielding a comparison-free arithmetic kernel. This construction removes redundant odd degrees of freedom and enables lower-cost polynomial evaluation at a given error target. Plaintext experiments with Gemma-4-E2B and Llama-3.2-3B show that SPA largely preserves downstream task performance without weight updates. Fixed-interval CKKS benchmarks show favorable error-latency trade-offs. On [−5,5][-5, 5], SPA-balanced achieves a 3.25×3.25 \times speedup over MOAI (ICLR' 26) for erf-GELU with comparable error. On the same interval, SPA-accurate achieves 79.22% lower root mean squared error (RMSE) and a 10.40×10.40 \times speedup over Euston (S&P' 26) for QuickGELU. For SiLU, SPA-accurate achieves 19.02% lower RMSE and a 2.06×2.06 \times speedup over THOR (CCS' 25).

1 INTRODUCTION

Fully homomorphic encryption (FHE) enables neural inference on encrypted inputs, but does not directly implement nonlinear activations such as GELU and SiLU. Their evaluation is a major challenge in large language model (LLM) feed-forward blocks (Cheon et al., 2017; Ebel et al., 2025; Nam et al., 2025). The goal is to find accurate, low-cost replacements that balance polynomial accuracy and depth against lookup, selection, or communication costs (Hao et al., 2022; Pang et al., 2024; Gupta et al., 2024; Kei & Chow, 2025).

We study the scalar GELU/SiLU branches in Figure 1 and other activations with the shared structure

A(x)=xg(x),g(−x)=1−g(x),(1)A(x)=x g(x),\qquad g(-x)=1-g(x), \tag{1}

where gg is a scalar gate function that modulates xx, not an additional learned projection. GELU, SiLU, and fixed-parameter Swish have this structure, which implies A(x)−A(−x)=xA(x) - A(-x) = x: the odd part is known exactly, and only the even remainder requires approximation. Replacing this scalar branch leaves the other projection, elementwise product, and trained weights unchanged.

We propose SPA, Structure-Preserving Approximation, which retains the linear odd part and approximates the even remainder after the change of variable u=x2u = x^2. This structural restriction preserves the

Figure

Figure 1: Activation functions employed in several mainstream large language models. For multimodal models that may adopt different activation functions across modules, only those used in the text modules are reported. GEGLU/SwiGLU contain scalar GELU/SiLU branches, respectively.

best uniform approximation error at the corresponding degree in xx, independently of the basis. Our implementation uses Chebyshev polynomials and discrete minimax fitting, with an explicit evaluation schedule and coefficient-specific error bounds.

Our contributions are (i) a structure-preserving replacement based on (1); (ii) best-approximation equivalence and finite-interval bounds for specified coefficients; and (iii) target-matched GELU, QuickGELU, and SiLU experiments assessing model performance and homomorphic error–cost trade-offs. An equivalent even-polynomial representation has the same approximation space.

References (54)