How it works
Sealed models on stock engines
kLLM seals a checkpoint under a key and serves it on stock SGLang and vLLM. It is a layer on top of the inference engine, in the way LMCache is for KV caches. It neither replaces nor forks the engine.
Architecture
- 01
Seal the checkpoint
kllm sealrewrites a Hugging Face checkpoint with static transforms derived from the key.orthapplies a random orthogonal basis to the residual stream.permapplies a signed permutation, so the sealed weights are the original values reordered and sign-flipped. Tensor names, shapes and dtype do not change. - 02
Lock the weights
By default
kllm sealthen encrypts every weight in place with AES-256-CTR under a key derived from the model key, within the finite values of its format. The files still load in any engine, but compute nothing useful and cannot be matched to the public base without the key.--no-lockskips this step. - 03
Serve on a stock engine
kllm serve --keyunlocks the weights once into a cache readable only by its owner and starts the engine on them. Because the checkpoint keeps its layout, the stock engine runs its own model classes, kernels, CUDA graphs, batching and tensor parallelism. - 04
Keep the key in a trusted domain
The permuted tokenizer is encrypted under the key. It is decrypted only in a trusted domain, a confidential VM or the user's own machine in client-keyed mode, and it is never sent to the GPU.
Transforms
Two transforms: orth and perm
Both transforms are exact in exact arithmetic. In bf16 serving they change accumulation order only: the mean absolute change in log-probability against plain serving was 0.03 to 0.10, comparable to switching between fp16 and bf16 (0.053).
| orth | perm | |
|---|---|---|
| Operation | Random orthogonal basis for the residual stream | Signed permutation: original values reordered and sign-flipped |
| Exactness | Exact in exact arithmetic; float64 tests agree to 1e-9 on tiny random models | Sealed weights are bit-exact rearrangements of the originals |
| FP8 checkpoints | Not supported | Block-wise and per-tensor FP8 |
| Weights derived from a public model | Recoverable from the unlocked sealed weights for weight changes up to 3% of the weight standard deviation; weights with no public relative have no known attack, and no proof either | Recoverable from the unlocked sealed weights at any fine-tune size |
Locked weights
Locked at rest, unlocked to run
Locking protects the files, not a running model. Unless a model is sealed with --no-lock, its weights stay encrypted until kLLM unlocks them on the machine that runs it.
On disk
Every value is shifted, within the finite values of its format up to the tensor's largest power of two, by an AES-256-CTR key stream derived from the model key and the tensor's name. The files keep their names, shapes and dtypes and load in any engine, but compute nothing useful. Only each tensor's largest binary exponent is stored in the clear.
Served with the key
kllm serve --keyunlocks the weights once into~/.cache/kllm/unlocked(KLLM_UNLOCKED_DIR, mode 0700) and serves the result, which is the sealed model. Unlocking ran at about 0.7 GB/s on a GPU and 0.1 GB/s on CPUs, once per key and file set.Client-keyed
kllm cloud --keyunlocks the weights on the user's side into the keyless copy that the cloud serves withkllm serve --client;kllm seal --clientwrites the same copy when sealing. The key and the tokenizer stay with the user.
Whoever runs the model holds the unlocked weights, and with the public base at hand they can be matched to it. The measured attacks on sealed weights apply to the unlocked weights.
Official models
Official sealed models and model keys
The kLLM team seals selected public models at a pinned revision under perm, locks the weights and publishes them under ANetResearch on Hugging Face with names such as Qwen3-8B-kllm. Each model has its own model key, derived with HKDF-SHA256 from an offline master key. A key issued for one model reveals nothing about the master key or about any other model's key, and raising a model's key version rotates its key.
Approved applicants receive the keys of the models they apply for as ordinary, passphrase-protected kLLM key files. Every holder of one model's key holds the same key. Each published model carries kllm-manifest.json with its base, revision, key fingerprint and version, kLLM version and the SHA-256 digest of every file, and kllm verify rebuilds it from the public base for comparison.
Where the key lives
Three ways to serve a sealed model
The protection a deployment offers depends on where the key and the decrypted tokenizer live, not on the engine.
Client-keyed
Private SealKey and tokenizer on the user's machine
The GPU host receives the sealed weights and configuration only, with no key and no tokenizer, and serves token ids in and out (
Documentationkllm serve --client). The weights are unlocked on the user's side first (kllm cloud --key), because the GPU host computes with them. A local proxy on the user's machine (kllm client proxy) tokenizes requests and exposes an OpenAI-compatible API on 127.0.0.1.Confidential VM
Attested CPU · EnterpriseKey and tokenizer in confidential-VM memory
Documentationkllm serve --key-source cdh --productionreleases the key into a confidential VM after attestation, and users can check that TLS terminates in the attested VM. The GPU is an ordinary passthrough device, so GPU memory is not protected. Not yet validated on TEE hardware.Development mode
No protection from the hostTokenizer decrypted into host /dev/shm
Documentationkllm serve --keyon an ordinary host unlocks the weights into its cache and decrypts the tokenizer into host/dev/shm. It is convenient for development and offers no protection from the host.kllm runon a sealed model uses this mode on the local machine.
Workflow
Pull, unlock with a key, run
The library, the local store and named keys wrap the same sealing and serving commands. kllm run starts SGLang or vLLM in the background on 127.0.0.1, unlocking a sealed model with its key, and opens a chat.
# Pull a plain model from the library and chat with it
$ kllm pull qwen3:8b
$ kllm run qwen3:8b
Architectures
Transformer models across modalities
Sealing requires a validated implementation for each architecture; there is no on-the-fly sealing of unknown architectures. Plain serving runs any model the chosen engine supports.
Language models
Qwen3, Qwen3-MoE, Qwen2 and Qwen2.5, and Llama 3.x, under orth or perm; FP8 block-wise or per-tensor checkpoints of these under perm.
Image diffusion
Z-Image, sealed by its own scheme with a client-keyed mode: the text encoder is sealed and the DiT's latent interface uses a key-derived patch basis. In client-keyed mode the VAE decodes on the user's machine.
Video generation
MiniMax H3 FL2VA, served with SGLang. perm is recommended; orth re-rounds the text encoder's rotated weights, to which the audio stream is most sensitive.