atlas

Research map / Architectures and efficiency / Attention and transformers

Converting Transformers to Polynomial Form for Secure Inference Over Homomorphic Encryption

ICML 2024 · Architectures and efficiency › Attention and transformers · approach: Transformer expressivity and learnability · 6 citations (OpenAlex)

Read the paperCheck your idea against 108,967 papers

AI-extracted summary. Written by AI from the paper's full text. Numbers and claims can be wrong or missing context, so check the paper before you cite or build on it.

Converts transformers (BERT-like LM and ViT/Swin) into fully polynomial form for CKKS-based homomorphic-encryption inference, using softmax-free scaled sigma-attention and a range-minimization training phase for LayerNorm and activations.

Problem

Transformers contain non-polynomial operations (softmax, LayerNorm, GELU) that cannot be evaluated under CKKS homomorphic encryption, and polynomial networks are unstable, so secure inference with transformers was not previously feasible.

Approach

Replace softmax with pointwise activation attention scaled by a length factor (sigma-scale attention), use BatchNorm in place of LayerNorm for vision (with extra stabilizers), and train with a range-minimization loss that narrows the inputs to non-polynomial layers (including LayerNorm variance) so low-degree polynomial approximations can be substituted.

Key results

Measured effects reported in the paper

What was changedWhereMeasuredEffect
Replace Softmax attention with scaled-σ attention (ablation)6-layer BERT-like transformer · WikiText-103perplexity: 18.98 -> 19.07Hurt
Add range-minimization training (ablation)P 6-layer BERT-like transformer · WikiText-103perplexity: 19.07 -> 19.15Hurt
Replace Softmax attention with scaled-σ attention (ablation)12-layer BERT-like transformer · WikiText-103perplexity: 16.89 -> 16.98Hurt
Add range-minimization training (ablation)P 12-layer BERT-like transformer · WikiText-103perplexity: 16.98 -> 17.15Hurt
Convert the transformer to polynomial form6-layer BERT-like transformer · WikiText-103perplexity: 18.98 -> 19.89Hurt
Convert the transformer to polynomial form12-layer BERT-like transformer · WikiText-103perplexity: 16.89 -> 18.91Hurt
Convert ViT to HE-friendly polynomial formViT · CIFAR-100accuracy: 73.4 -> 70.8Hurt
Convert Swin to HE-friendly polynomial formSwin Transformer · Tiny-ImageNetaccuracy: 59.4 -> 58.9Hurt
Add post-activation length scaling to GELU pointwise attention (ablation)ViT · CIFAR-100accuracy: 68.41% to 70.87% (+2.46%)Helped
Add post-activation length scaling to GELU pointwise attention (ablation)ViT · CIFAR-10accuracy: 81.17% to 92.31% (+11.14%)Helped
Use pointwise attention without length scaling (ablation)NLP transformer · WikiText-103training stabilityHurt
Use pre- and post-scaling with S(L)=1/L (ablation)NLP transformer with σ-attention · WikiText-103training convergenceHurt

Surprising findings

Limitations

Experimental setup

Datasets: WikiText-103 CIFAR-100 CIFAR-10 Tiny-ImageNet

Benchmarks: WikiText-103 CIFAR-100 CIFAR-10 Tiny-ImageNet

Metrics: perplexity test accuracy latency

Baselines: vanilla softmax transformer ResNet-152 over HE

Builds on: CKKS Remez algorithm HElayers range loss for polynomial activations

Closest papers by meaning

Writing a paper in this area? scime draft is a free LaTeX editor with AI included, real-time co-authors and a check of your references and venue rules before you submit. It also imports OpenAI Prism projects.

Open scime draft

Get the next scime Dispatch and a monthly field update

Free. We send a confirmation link first; every email has a one-click unsubscribe. Privacy