Deep dives · 2026-12-03 · Advanced · By bombong
Private Inference: Protecting Data During Computation with TEEs and Cryptography
Private inference is a set of techniques that let you send queries to a remote LLM without the server seeing the original input. There are three branches: TEEs, cryptography (FHE, MPC) and differential privacy. Every approach becomes costly with nonlinear operations, model scale and long contexts, and recent research focuses on reducing these three bottlenecks.
Contents
- Why it was needed: data is exposed at the moment of computation
- Key idea: a vault room, a locked box, hiding in a crowd
- How it works: linear is cheap, nonlinear is expensive
- How it developed: different solutions for each bottleneck
- Where it is heading now: larger models, longer inputs
- Limitations, open issues and practical criteria
- Further study
- Encryption at rest and in transit is not enough. The input is exposed in plaintext the moment the server computes on it, and private inference protects exactly this stage.
- TEEs use hardware isolation, FHE and MPC use mathematical guarantees, and differential privacy uses statistical masking. Each makes different trade-offs among what must be trusted, speed and accuracy.
- Linear operations such as matrix multiplication are relatively cheap, but nonlinear operations such as Softmax are expensive. That is why most research concentrates on reducing nonlinear operations and communication volume.
- According to a study that surveyed 62 systems, only 1 out of 1,891 pairs could be directly compared under the same conditions, and scale has stalled at 13B parameters.
- In practice, it is realistic to first decide what to protect and from whom (the threat model), and then narrow the scope, for example by protecting only the sensitive parts of the input.
Why it was needed: data is exposed at the moment of computation
Most LLMs today are used as LLM-as-a-Service (sending queries to a remote server and getting answers back). The DP-SPD study paper and the DP-MIND study paper both identify the exposure of sensitive information in user queries to the server under this setup as a serious privacy problem. The problem grows with content that is hard to send outside, such as contracts, medical records and internal company code.
Common protections are encryption at rest and encryption in transit over the network. But for the server to run inference, it ultimately has to decrypt the data and compute on it. While computation is in progress, there remains a chance that plaintext is exposed to operators, intruders or other users sharing the same hardware.
Private inference is a set of techniques that protect this 'during computation' stage. The goal is to let the server compute without knowing what it computed. Often the model weights held by the server must be protected as well. CryptPEFT paper treats adapters (small trained modules attached to a model) trained on sensitive data as something to protect along with user input.
Key idea: a vault room, a locked box, hiding in a crowd
Private inference approaches fall into three broad branches. As an analogy, one is 'working inside a vault room no one can look into.' This is the TEE (Trusted Execution Environment), i.e., confidential computing. The processor creates an isolated memory region at the hardware level, and computation inside it cannot be seen even by the operating system or administrators. In exchange, you have to trust the hardware manufacturer and its implementation.
The second is 'reaching into a locked box and assembling the contents without seeing them.' FHE (Fully Homomorphic Encryption) allows addition and multiplication to be performed directly on ciphertext. MPC (Multi-Party Computation) splits data into several shares, and each participant sees only its share while they compute together. There is no need to trust hardware, but computation and communication increase substantially.
The third is 'blending into a crowd so no one can tell who is who.' Differential privacy mixes random noise into the input to make individual information hard to infer. DP-SPD paper implemented this idea by mixing the real query among fake queries generated by the client and shuffling their order before sending. It is fast, but as the DP-SPD study points out, stronger protection tends to cause a large drop in accuracy.
Three approaches to private inference
TEEComputing in a vault
- Protected by hardware isolation
- Relatively fast
- Must trust the manufacturer and implementation
FHE·MPCComputing inside a locked box
- Mathematical guarantees
- No hardware trust needed
- High cost for nonlinear ops and communication
Differential privacyHiding in a crowd
- Masked with noise and decoy queries
- Lightweight and fast
- Stronger protection lowers accuracy
공통 All aim to let the server compute without seeing the original input
How it works: linear is cheap, nonlinear is expensive
A single transformer layer consists of two broad kinds of computation. One is linear operations such as matrix multiplication; the other is nonlinear operations such as Softmax, activation functions and normalization. In cryptography-based approaches, this distinction drives cost. Addition and multiplication can be done directly on ciphertext, but nonlinear functions have to be handled indirectly, through polynomial approximation or table lookups, which is much more expensive. ROSETTA paper points out that in existing FHE frameworks, nonlinear operations account for most of the cost of the decoding stage.
The general flow is as follows. First, the client protects the input (by encrypting it, splitting it into shares, adding noise, or processing it inside a TEE). Second, the server handles the linear operations. In the two-party computation (2-PC) protocol described in the SecMoE study paper, the server performs the FFN (the fully connected network in each layer) computation on the encrypted input using its own plaintext weights. Third, nonlinear operations are handled with special protocols. Fourth, after repeating this for every layer, the client decrypts the result to get the answer.
The same bottleneck appears in TEE approaches. According to the CMIF study paper, CPU-based TEEs were slow at inference, so a split approach was used that offloaded only the linear parts to GPUs. But because nonlinear layers are densely interleaved in LLMs, the communication overhead of going back and forth between the TEE and the GPU grew large. CMIF redrew the boundary by keeping only the embedding layer in a client-side TEE and running the remaining layers on a GPU server.
How it developed: different solutions for each bottleneck
The early studies each targeted a different bottleneck. CryptPEFT paper saw bidirectional communication between the backbone (a large, publicly available pretrained model) and the adapter as the main source of cost in the MPC setting. It therefore designed an architecture in which communication flows only one way, restricting cryptographic operations to the adapter. In Vision Transformer experiments, it reports speedups of 20.62x to 291.48x over existing methods.
SecMoE paper identified a new leakage path in MoE (mixture of experts) architectures. If the server can see which expert was activated, that alone leaks token-level information about the input. Computing all experts blocks this leak but removes sparsity, the main advantage of MoE. SecMoE uses a 'Select-Then-Compute' approach that obliviously selects the needed parameters and then computes only one, scaling the model 63x while limiting the increase in total runtime to 15.2x. ROSETTA paper built on the observation that each nonlinear operation in the decoding stage has a different workload shape, and automatically chooses for each operator whichever fits better: CKKS (an FHE scheme suited to computing on real-valued vectors in batches) or TFHE (an FHE scheme suited to table lookups). As a result, Softmax ran up to 4.8x faster, and the whole pipeline 1.5–2.1x faster.
On the noise-based side, the challenge was reducing accuracy loss. CMIF paper combined TEEs with differential privacy and optimized the Report-Noisy-Max mechanism to keep the performance drop small. DP-SPD paper exploited the fact that the fake queries share a common prefix to reuse the KV cache, and reported both near-plaintext utility and improved inference efficiency. DP-MIND paper extended the scope to long inputs on the scale of a million tokens. It perturbs the input locally, processes it chunk by chunk while carrying the needed information forward in a small memory, and trains the policy that builds this memory with reinforcement learning to be robust to noise.
The work that organizes this whole line of research is the PTI (Private Transformer Inference) systematization study paper. It analyzed 62 systems by linking them in a graph. It concludes that the main driver of performance gains has been advances in cryptography, but those gains have always come together with other factors such as model fidelity, hardware and how costs are accounted for.
Where it is heading now: larger models, longer inputs
The focus of recent research is shifting to practical scale. The Llama-3-8B FHE study paper extended non-interactive inference, which runs on FHE alone, in two directions. One is fast processing of 128 encrypted tokens. To do this, it used ML techniques such as token prepending and orthogonal rotation to dampen extremely large values (outliers), which lowered the cost of polynomial approximation in the nonlinear layers. The other assumes that only the last part of the input is sensitive and extends the prompt to several thousand tokens. The authors designed dedicated linear algebra algorithms for computation that mixes plaintext and ciphertext.
FESC paper takes the approach of changing the architecture itself. Attention is computed over every pair of tokens, so its cost grows quadratically with length. FESC instead ran Mamba-2, a state space model (SSM) that processes input in linear time, in an encrypted state by combining FHE and MPC. It reports that at length 2,048, a 12-layer Mamba model completed inference on a single A100 GPU in 77.3 minutes with peak memory of 32.7GB, with accuracy close to plaintext. It is notable as an end-to-end run on a single GPU, but it also shows how far there is still to go.
There are also structural methods that do not use cryptography. PrivDFS paper identified a problem in split inference, where a model is run partly on the client and partly on the server: the input can be reconstructed from a single intermediate Representation. So it divided this Representation into non-overlapping fragments and sent them separately to multiple servers. On CIFAR-10, the PSNR of reconstruction attacks dropped from 23.25 to 12.72, while accuracy stayed within 1% of split inference without privacy protection.
Limitations, open issues and practical criteria
The biggest issue is that comparisons are hard. According to the PTI systematization study paper, of 1891 candidate pairs, only 1 pair of systems could be directly compared under the same assumptions. Most "N times faster" figures are based on different models, networks (LAN/WAN), hardware and threat models. In fact, the speedup reported by CryptPEFT paper also varies widely with network settings. The same study found that the scale limit of private inference has stalled at 13B parameters. That is still far from the large models in service today.
The trade-offs of each approach are also clear. TEEs are relatively fast, but you have to trust the hardware and its implementation. FHE and MPC have the weakest trust assumptions, but high latency and communication volume. Differential privacy is lightweight, but protection strength and accuracy tend to be inversely related. As SecMoE paper shows, even when the data itself is encrypted, side information such as which path the computation took can leak. Each time the structure is changed for performance, you need to check whether it creates a new leakage path.
The practical criteria are as follows. First, decide what you are protecting and from whom. The options differ depending on whether you distrust the cloud operator and whether the model weights also need protection. Second, check whether you can protect only the sensitive part rather than the whole input. Narrowing the scope, as in the Llama-3-8B FHE study paper, greatly increases the length that can be processed. Third, do not take figures from papers as-is; measure them again with your own model size, network and hardware. Common mistakes are assuming "it's encrypted, so it's safe" and missing metadata leaks such as routing or length, and not checking the accuracy loss of differential privacy on real business data.
The reality shown by the systematization study
Pre-adoption checklist
Threat model
- Have you decided who you are protecting against?
- Do model weights also need protection?
- Can you trust the hardware manufacturer?
Scope and cost
- Can you protect only the sensitive part?
- Have you re-measured latency in your own environment?
- Have you checked DP accuracy loss on real data?
Leakage paths
- Is metadata such as routing or length leaking?
- Can the input be reconstructed from an intermediate Representation?
Further study
If you want an overview of the whole landscape first, start with the PTI systematization study paper. Seeing which properties it uses to classify 62 systems and which criteria it uses to judge comparability gives you a sense of what to check when reading figures in other papers.
To understand the core bottlenecks of cryptographic approaches, read ROSETTA paper for the nonlinear operation problem, then SecMoE paper for side-information leakage created by the architecture, and CryptPEFT paper for communication design. After that, the Llama-3-8B FHE study paper and FESC paper show how far recent attempts to increase scale and length have come.
On the TEE and differential privacy side, look at CMIF paper for TEE partitioning design, and compare DP-SPD paper and DP-MIND paper to see how noise-based methods reduce accuracy loss. If you are curious about the risk of reconstruction attacks in split inference, PrivDFS paper is short and easy to read.
Related terms
Confidential computing Differential privacy KV cache MoE State space model On-device AI Federated learning Personal data de-identification
References
Foundational papers
- A Graph-Based Analysis of Comparability, Scale, and Attribution in Private Transformer Inference (2026)
- Ask in the Crowd: Differentially Private LLM Inference via Dummy-Augmented Shuffling (2026)
- Towards Confidential and Efficient LLM Inference with Dual Privacy Protection (2025)
- ROSETTA: Efficient and Accurate Privacy-Preserving LLM Decoding via Hybrid CKKS/TFHE Evaluation (2026)
- CryptPEFT: Efficient and Private Neural Network Inference via Parameter-Efficient Fine-Tuning (2025)
- SecMoE: Communication-Efficient Secure MoE Inference via Select-Then-Compute (2026)
- DP-MIND: Differentially private memory-guided Long context Inference (2026)
Recent research
Written by AI from the listed references and reviewed. Please check the original sources for details.