Five key challenges for encrypted transformers
Running a transformer under encryption raises five key challenges, listed in the table below. Figure 7 marks the parts of the model each one affects, using the same numbers.
| Challenge | Why it is hard under encryption |
|---|---|
| 1Non-polynomial functions (softmax, SwiGLU, RMSNorm, argmax) | These functions are not additions or multiplications, so they need polynomial approximations that stay accurate across the full range of values a real model produces. |
| 2Depth and bootstrapping | 32 layers of chained multiplications exhaust the multiplicative depth many times over, requiring repeated bootstrapping. Each bootstrapping adds latency. |
| 3Encrypted × plaintext matrix multiplications | Multiplying an encrypted vector by a large plaintext weight matrix requires rearranging packed values. This is realized using rotations that dominate runtime. |
| 4Encrypted × encrypted matrix multiplications | In attention, all operands are encrypted: queries, keys, and values. Multiplying two ciphertexts costs far more than multiplication with a plaintext. |
| 5Memory and bandwidth on GPUs | Ciphertexts are many times larger than plaintext, so the bottleneck is moving data through GPU memory rather than computing on it. The encrypted KV cache grows with every token generated. |
How Bel-0 overcomes each challenge
Bel-0's performance comes from engineering the whole stack together: the application, the algorithms and the GPU implementation.
- Non-polynomial functions. Bel-0 fits each approximation to the range of values that Llama 3.1 8B actually produces at that point in the model, layer by layer. This covers softmax, SwiGLU, RMSNorm and token selection. Bel-0 runs Llama 3.1 8B with its original weights: no retraining, fine-tuning or architectural changes. It selects a different next token from the plaintext model in only 0.028% of cases.
- Depth and bootstrapping. Bootstrapping dominates the cost of encrypted computation. Bel-0 plans the bootstraps of each layer together with the computation around them, so that each layer needs only a handful. This applies to all 32 layers. Each bootstrap also refreshes only the data that needs it, rather than every ciphertext in the layer.
- Encrypted × plaintext matrix multiplications. Bel-0 packs each token's values so that the matrix multiplications in a layer need far fewer rotations than standard approaches. This applies to the attention projections and the feed-forward network. It also splits each of these multiplications, and the output embedding, across the GPUs.
- Encrypted × encrypted matrix multiplications. In prefill, Bel-0 computes attention for all tokens of the prompt at once, as a single batched multiplication of ciphertexts. In decode, each new token is compared with all earlier tokens using a few ciphertext multiplications instead of a full matrix multiplication.
- Memory and bandwidth on GPUs. Bel-0 uses 32-bit arithmetic throughout, which keeps ciphertexts and evaluation keys small while maintaining 128-bit security. Each GPU holds only the evaluation keys, the weights and the part of the KV cache that its own computation needs. All GPU kernels are optimized for Blackwell-generation GPUs and for running across several GPUs at once. The computation for a single token is distributed across the GPUs to minimize the data transfers between them.
Beyond these five, token selection is where Bel-0 departs significantly from prior works. Bel-0 performs both the output embedding and token selection under encryption, and feeds the encrypted token directly back into the model. Earlier academic prototypes instead returned the encrypted scores to the client, which decrypted them, selected the next token and re-encrypted it. Bel-0 avoids this round trip for every token: the client sends the encrypted prompt once, and the server generates the whole answer on its own. This removes a large communication overhead, since every round trip would send megabytes of ciphertext to the client and back. The client also never sees the model's scores, only the answer, which keeps the model itself better protected.