Layer-Parallel Inference Reduces Encrypted Nonlinear Depth in Transformers

Ligong Han, Kai Xu, Hao Wang, Ruijiang Gao, Han Gao, Akash SrivastavaarXiv 2026

TL;DR

Performing secure Transformer inference on encrypted data using Fully Homomorphic Encryption (FHE) is severely bottlenecked by the sequential stacking of non-linear layers, which triggers expensive cryptographic "bootstrapping" operations. This paper introduces Structured Newton Layer Parallelism (SNLP) to break this sequential dependency chain, allowing multiple layers to be evaluated in parallel. This method achieves up to a 2.65× reduction in cryptographic overhead with virtually no degradation in model accuracy.

What Problem Does This Paper Address?

Fully Homomorphic Encryption (FHE) is the holy grail of privacy-preserving machine learning: it allows a server to perform computations on data while it remains completely encrypted. However, running modern Transformers under FHE is notoriously slow.

FHE natively supports only linear operations like addition and multiplication. Non-linear operations essential to Transformers—such as Softmax, RMSNorm, and activation functions—must be approximated using high-degree polynomials. These approximations introduce small errors that compound exponentially as data flows sequentially through the $L$ layers of a network.

To prevent this accumulated noise from destroying the computation, FHE relies on an incredibly expensive operation called bootstrapping to refresh the encrypted data's noise budget. Bootstrapping is the primary bottleneck in encrypted ML, accounting for 50–86% of total inference latency. This paper tackles the root cause: the strict layer-by-layer sequential dependency graph of modern Transformers.

Methods

Instead of trying to engineer better polynomial approximations for individual operations, the authors alter the macro-level computation graph using Structured Newton Layer Parallelism (SNLP).

SNLP reformulates the Transformer's layers as a coupled system of non-linear equations. Rather than waiting for layer $l$ to finish before starting layer $l+1$, SNLP executes a short sequential "prefix" of layers, and then solves the remaining "suffix" layers in parallel over a small number of solver iterations ($K$).

To pass information accurately across these parallel layers, it applies a structured, Newton-style correction. The authors utilize two specific variants:

  • Identity Newton (IDN): Uses a simplified identity matrix for the correction, turning it into a purely additive prefix-sum propagation that has zero FHE multiplicative depth (requiring no extra bootstraps).
  • HC Newton (HCN): Designed for Hyper-Connection architectures, using a small linear transform over data streams.

Because running full FHE encryption is too computationally heavy for extensive experimentation, the authors developed an HE-Approximation Simulation framework in PyTorch. This framework replaces standard non-linearities with their calibrated Chebyshev polynomial approximations, allowing them to precisely track how errors accumulate across different computational graphs.

Datasets

The models evaluated in the paper were trained from scratch on ClimbMix, a standard dataset mixture used for language model pre-training. The final evaluations tracked language model perplexity (PPL) on a fixed validation split at a sequence length of 2048 tokens.

Key Insights and Ideas

  • Parallelism Dilutes Error Accumulation: Counter-intuitively, evaluating layers in parallel via SNLP results in lower error amplification than traditional sequential inference. Sequential execution repeatedly feeds noisy polynomial outputs directly into the next non-linear block. SNLP's parallel structure breaks this chain, mitigating the compounding noise effect.
  • Softmax is the Ultimate Culprit: Per-operation ablation studies revealed that Softmax polynomial approximation completely dominates the error budget. Approximating RMSNorm or activations introduces negligible noise, but low-degree Softmax approximations quickly degrade model performance.
  • FHE-Optimal $\neq$ Wallclock-Optimal: On standard GPU hardware, increasing the number of solver iterations ($K$) makes inference slower. However, in FHE, the primary cost metric is sequential non-linear depth, not raw operation count. This creates a unique paradigm where configurations with higher solver iterations are highly optimal for FHE because they drastically reduce bootstrapping requirements while maintaining accuracy.

Key Results

  • Cryptographic Speedup: On a 0.5B parameter IDN-trained model, the SNLP configuration (n24-K4) reduced the number of required cryptographic bootstraps from 53 down to 20—a 2.65× reduction.
  • High Fidelity: This massive reduction in overhead was achieved while keeping the encrypted perplexity within 1.2% of the exact sequential baseline.

The trade-off between non-linear depth (NFE) and perplexity is illustrated in the Pareto frontier below, demonstrating how SNLP-aware training unlocks a much lower cryptographic cost regime:

Figure 1: NFE vs. PPL under degree-12 HE approximation. Each point is one (N, K, init) configuration from a full sweep. The IDN-trained model (blue) dominates the baseline (orange) Pareto frontier, reaching NFE = 12 with encrypted PPL within 1.2% of sequential’s. The baseline cannot achieve practical quality below NFE = 20, confirming that SNLP-aware training is essential for accessing the low-NFE regime.

Furthermore, tracking the error layer-by-layer shows that SNLP successfully keeps relative error at or below sequential levels, even when executing blocks simultaneously:

Figure 2: Per-layer relative error ∥hHE −hexact∥/∥hexact∥under degree-12 polynomial ap- proximation (0.5B IDN model, N = 24, K = 1). SNLP uses 3.5× fewer bootstraps (15 vs. 53) yet achieves comparable per-layer error to sequential inference. Prefix layers (0–7) are shared. In the parallel layers (8–31, shaded), SNLP error stays at or below sequential despite evaluating all suffix blocks in parallel with only one Newton iteration.

Limitations and Future Work

  • Simulation vs. Production FHE: The study relies on simulated polynomial approximations rather than full CKKS encryption deployments. In a real FHE deployment, the max-subtraction step required for Softmax numerical stability requires complex comparison circuits, an additional cost not fully captured by the symbolic model.
  • Scale Limitations: The experiments were conducted on "Nanochat" scale models ranging from 0.5B to 3B parameters. Verifying that these parallel convergence properties hold for massive production LLMs (e.g., 7B+ parameters) remains an open question.
  • Softmax Alternatives: Since Softmax is the primary driver of approximation error, the authors note that future work should explore combining SNLP with architectures that eliminate Softmax entirely, such as linear attention or gated attention mechanisms.

Summary updated

BibTeX
@misc{han2026layer,
  author = {Ligong Han and Kai Xu and Hao Wang and Ruijiang Gao and Han Gao and Akash Srivastava},
  title = {{Layer-Parallel Inference Reduces Encrypted Nonlinear Depth in Transformers}},
  year = {2026},
  eprint = {2607.04819},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/2607.04819},
}
Figure