COAST: Accurate and Efficient Homomorphic Softmax via Anchor Error Cancellation
Abstract
Softmax is expensive under homomorphic encryption because accurate approximation of its exponential and reciprocal operations over wide dynamic ranges requires high multiplicative depth and costly bootstrapping. We propose COAST, an accurate and efficient homomorphic softmax method that reconstructs probabilities from the original logits using a low-cost, coarse log-partition anchor. Cancellation of the shared anchor error during normalization relaxes intermediate precision requirements and reduces bootstrapping overhead. We establish an output-error bound over specified approximation domains. Furthermore, for fixed polynomial degrees, COAST has time complexity and multiplicative depth for logits. Zero-shot plaintext evaluation on five benchmarks with Llama-3.1-8B, Qwen3.8-27B, and Gemma-4-31B shows that COAST largely preserves model accuracy. In 128-key encrypted experiments, compared with THOR (CCS '25) and Cho et al.'s Algorithm 2 (CCS '24), COAST reduces maximum absolute error by factors of up to and and achieves speedups of up to and , respectively.