uniml

Private inference on an H100, with no Linux in the guest.

uniml runs Qwen3-4B and Qwen3-0.6B on a passed-through NVIDIA H100 from a Lean 4 unikernel (silo-os) inside an Intel TDX trust domain: no Linux, no C library, no NVIDIA driver, and no CUDA inside the guest. In the card's confidential mode, prompts, multi-turn OS shell sessions, and answers are sealed end-to-end with HPKE to an ephemeral key vouched for by both an Intel TDX quote and the H100's signed SPDM attestation.

Jump to results Launch unimlOS Desktop Try it Source on GitHub Threat model Issue #2
202 tok/s (4B)Qwen3-4B in H100 confidential mode (96.7% of CUDA CC), 128/128 exact fp32 & bf16 IDs
353–398 tok/sQwen3-0.6B in H100 confidential mode, 128/128 exact PyTorch fp32 token IDs
8,192 contextmulti-turn KV cache + HPKE-sealed 'o' neural desktop apps, VFS & shell
2 hardware rootsIntel TDX quote (RTMR1 from EFI image) + NVIDIA Device Identity CA P-384 chain & 64 signed measurements
Results · 2026-12-03

Speed and correctness against Mesa and CUDA

All measurements on the same machine: one host with Intel TDX (two Xeon Gold 6526Y, Linux 7.0, QEMU 10.2.1) and one NVIDIA H100 NVL 94 GB (PCI 10de:2321) passed through whole via vfio-pci, running NVIDIA's GSP firmware 570.144 (and NVIDIA driver 580.196.07 / CUDA 13.0 for the llama.cpp reference rows). Every uniml run checked greedy decoding on the 23-token reference prompt (128 generated tokens, end tokens suppressed): 128 of 128 match PyTorch in 32-bit floats (and the first 66 match the bf16 reference, where PyTorch fp32 also diverges).

Qwen3-4B (run 86 · 8.05 GB bf16 weights · 36 layers · 4K context)

Measured on the same H100 NVL and TDX host with cc-qwen4b-try.sh 86: greedy decoding on the 23-token reference prompt (128 generated tokens) matched 128 of 128 PyTorch fp32 and bf16 token IDs in both ordinary and confidential mode.

Stack (Qwen3-4B) Mode Generated tok/s Prompt tok/s Notes
uniml (Lean unikernel + TDX) Confidential (CC) 202 39 cold Run 86: 8.05 GB via 'W' + CE decrypt at 53 MiB/s, 438 jobs/tok; 3-turn sealed 'o' OS session (pos=155→208→228/4096)
uniml (Lean unikernel + TDX) Ordinary 209 88 cold Run 86: 260 ms cold 23-tok prompt, 606 ms for 127 gen tokens; 59 MiB/s load
Linux + llama.cpp (Vulkan / Mesa) Ordinary VM 100 — Same Mesa Hopper Vulkan stack on Linux
Linux + llama.cpp (CUDA 13, NVIDIA 580) Confidential (TDX) 209 — CUDA CC ceiling; uniml CC reaches 96.7% of CUDA CC
Linux + llama.cpp (CUDA 13, NVIDIA 580) Ordinary VM 213 — Ordinary-mode CUDA reference ceiling

Qwen3-0.6B (runs 71–80 · 1.19 GB bf16 weights · 28 layers)

Stack Mode Generated tok/s Prompt tok/s Notes
uniml (Lean unikernel + TDX) Confidential (CC) 353–398 460–469 warm Runs 75–76: 395 / 353 on 128-tok ref; 398 warm (batch=16); 365–375 ms cold 23-tok prompt; 248 cold gen in run 78
uniml (Lean unikernel + TDX) Ordinary 331–423 500 warm 331–423 across fresh starts (382 run 80, 403 run 74); 457 warm gen on second prompt; 175–181 cold prompt
Linux + Mesa NVK (same 13 shaders) Ordinary VM 259–323 — Same Mesa-compiled shaders driven through Vulkan; 259–269 fresh process, 323 warm
Linux + llama.cpp (Vulkan / Mesa) Ordinary VM 311 7,500–9,250 llama-bench -ngl 99 -p 512 -n 128 -r 3 (prompt batched at 512 tokens)
Linux + llama.cpp (CUDA 13, NVIDIA 580) Confidential (TDX) 560 52,600 Reference ceiling in TDX CC mode (88% of ordinary CUDA); single llama-bench run
Linux + llama.cpp (CUDA 13, NVIDIA 580) Ordinary VM 633 55,600 Ordinary-mode CUDA reference ceiling; uniml CC reaches 63%–71% of CUDA CC

Confidential-mode startup, weight transfer, and proof timings

Numbers from clean confidential-mode runs 71, 75, 76, and 78 with zero runtime firmware asserts and CC mode is off verified afterwards on every run.

Qwen3-4B (run 86 · 8.05 GB bf16 weights · 36 layers · 4K context)

Measured on the same H100 NVL and TDX host with cc-qwen4b-try.sh 86: greedy decoding on the 23-token reference prompt (128 generated tokens) matched 128 of 128 PyTorch fp32 and bf16 token IDs in both ordinary and confidential mode.

Stack (Qwen3-4B) Mode Generated tok/s Prompt tok/s Notes
uniml (Lean unikernel + TDX) Confidential (CC) 202 39 cold Run 86: 8.05 GB via 'W' + CE decrypt at 53 MiB/s, 438 jobs/tok; 3-turn sealed 'o' OS session (pos=155→208→228/4096)
uniml (Lean unikernel + TDX) Ordinary 209 88 cold Run 86: 260 ms cold 23-tok prompt, 606 ms for 127 gen tokens; 59 MiB/s load
Linux + llama.cpp (Vulkan / Mesa) Ordinary VM 100 — Same Mesa Hopper Vulkan stack on Linux
Linux + llama.cpp (CUDA 13, NVIDIA 580) Confidential (TDX) 209 — CUDA CC ceiling; uniml CC reaches 96.7% of CUDA CC
Linux + llama.cpp (CUDA 13, NVIDIA 580) Ordinary VM 213 — Ordinary-mode CUDA reference ceiling

Qwen3-0.6B (runs 71–80 · 1.19 GB bf16 weights · 28 layers)

PhaseMeasuredWhat happens
SPDM 1.1 exchange + GSP 570.144 boot 2,934 ms P-384 ECDH, NVIDIA cert chain check, encrypted RPC queues, 64 signed measurements (~32 ms with AES-NI)
Engine state + compute & CE channels 154 + 73 + 35 ms Throwaway golden-context channel, compute channel, and enciphering 0xc8b5 copy channel (0x20802a0d + 0x20800ae2)
Copy-engine enciphered round-trip (16 KiB) 3.6–3.8 ms Enciphered H2D decrypt (Lce00_h2d_user) and D2H encrypt (Lce00_d2h_user), advancing nonce verified twice
1.19 GB weights encrypted & CE-decrypted 20.0–22.3 s 1,192,431,616 B (SHA-256 dd0a6884…a60e), 2 MiB chunks, 51–56 MiB/s including SHA-256 and AES-256-GCM
Encrypted readback & SHA-256 verify 9.3–10.3 s All 1.19 GB brought back out via CE encrypt (Copier.bring) and hashed again: identical
Qwen3-0.6B setup 28–34 ms 2 MiB zeroed small-array page, 13 shader programs, 342 compute jobs/token baked once into card memory
Qwen3-4B weights (8.05 GB) CE-decrypted + verify 143.1 s + 66.5 s 8,045,436,928 B (SHA-256 b7148744…359f) via 64-bit 'W' at 53 MiB/s; readback verify 66,526 ms; 60 ms model setup
Sealed multi-turn 'o' OS session (run 86) 3 turns + 'k' 4K KV cache (pos=155→208→228/4096); each turn verified via check-answer --require-cc & TDX + NVIDIA P-384 quotes
Sealed Q&A + dual quotes (0.6B, run 78) 2 × 5,243 B quotes 'k' attested sealing key + 'e' HPKE-sealed Q&A; 23 prompt tokens, 60 out; zero plaintext on wire
Architecture

What runs inside the 2.3 MB trust domain

Everything that parses untrusted input — network packets, firmware headers, SPDM messages, X.509 certificates, GSP queue replies, tokenizer files, and HPKE envelopes — is written in Lean 4. Two small C files sit underneath (boot/hw.c, 432 lines; boot/cipher.c, 125 lines), and thirteen Hopper compute shaders are compiled offline by Mesa and embedded as instruction words covered by RTMR1.

Model & serviceLean
GpuBoot.lean, Uniml/Model/Qwen.lean (configurable Qwen.Config for Qwen3-4B 438 jobs/tok and Qwen3-0.6B 342 jobs/tok, 4,096-position KV caches, multi-turn 'o' OS sessions), Uniml/Text/ (hand-written BPE tokenizer matching Hugging Face on 75/76 cases and refusing non-NFC), and Uniml/Proof.lean (UNIMLKEY1, UNIMLANS2).
Sealing & cryptoLean + 125 lines C
silo-os Tls.Hpke (RFC 9180 Base X25519 / HKDF-SHA-256 / ChaCha20-Poly1305, zero new C, constant-time secret.c from mini-print) plus Uniml/Crypto/ (P-384, HMAC/HKDF-SHA-384, AES-256-GCM, RSA-PSS 3072) and boot/cipher.c (AES-NI / PCLMUL inner loops, differential-tested against pure Lean).
H100 GPU driverLean
Uniml/Gpu/: Start.lean, Exchange.lean (SPDM 1.1), Queue.lean (AES-GCM GSP RPC queues), Rm.lean (0x20800afa), Space.lean (6-level Hopper page tables, 4 KiB & 2 MiB pages), Channel.lean, Copy.lean (enciphering 0xc8b5 CE), Compute.lean, and Runner.lean.
Compute shadersMesa NAK → Hopper ISA 90
Uniml/Model/QwenPrograms.lean: 13 compute shaders (plus 3 Qwen3-4B matvec widths) compiled offline from trial/qwen-fast/*.comp by Mesa commit c9fd312 with the two-line fix in trial/mesa-hopper.patch (NAK_DEBUG=nougpr). Embedded as bytes inside the measured image.
Unikernel & gluesilo-os + 432 lines C
silo-os minimal Lean runtime, EFI start-up, virtio-net, IPv4/TCP, TDX report and QGS quoting (Kernel/Quote.lean), plus boot/hw.c claiming a second PCI device with a shared DMA arena (up to 1 GiB; gpu-boot claims 256 MiB) and a direct 1 MiB register opening.
Hardware underneathIntel TDX + NVIDIA H100
Intel Xeon Gold 6526Y TDX trust domain on TDVF firmware; passed-through NVIDIA H100 NVL 94 GB running NVIDIA-signed closed GSP firmware 570.144 (~52 MB compressed) in confidential mode.
Engineering findings

How confidential compute was brought up without NVIDIA's closed user-mode driver

NVIDIA's open kernel modules cover the SPDM handshake and copy-engine key derivation, but leave out compute launches in confidential mode. Six concrete findings closed the gap from first probe to 398 tok/s with dual attestation.

01 · Mesa Hopper & memory layout

Two Mesa bugs and 100 → 423 tok/s

Comparing NVIDIA's Hopper QMD v4 against Mesa c9fd312 turned up two one-line bugs (trial/mesa-hopper.patch): the job-kind field was left zero (queue instead of grid), and ISA 90 branch targets used the wrong encoding. Moving parameters, programs, and job descriptions from shared memory into card memory — plus vec4 loads and fused norm/reduction shaders — took generation from 100 tok/s to 423 tok/s.

02 · SPDM 1.1 & AES-NI

Encrypted GSP queues in ~1 ms per RPC

Exchange.lean speaks SPDM 1.1 over the card's mailbox, verifying the card's 2-cert chain against NVIDIA's built-in GH100 Provisioner ICA, establishing P-384 session keys, encrypting every GSP RPC slot, and pulling 64 signed measurements via 0x20800ad9. Pure-Lean AES took 40 ms per 4 KiB RPC; moving only the two inner loops into 125 lines of AES-NI/PCLMUL (boot/cipher.c) cut that to ~1 ms.

03 · GSP 570.144 disassembly

Unlocking the enciphering copy engine (0x20802a0d)

Allocating an enciphering 0xc86f copy channel failed with status 0x40 and five firmware asserts. Disassembling GSP 570.144 proved bSupportEncryption and CE key slots are only initialized by 0x20802a0d (kceMapPceLceForCC, 156 B) before DERIVE_LCE_KEYS (0x20800ae2), while errorNotifierMem must remain in shared system memory. That replaced the 300 ms stale-read wait with direct CE readout.

04 · GSP 570.144 disassembly

Root-causing 0x20800afa status 0x25

Rewriting previously-touched card pages via 0x20800afa failed with 0x25 (NV_ERR_INVALID_DATA) and halted the firmware. Disassembly showed leaving cpuCacheAttrib = 0 mapped FB through GSP RISC-V's cached window without invalidating L1 D-cache after DMA, so in-place GCM decryption read stale plaintext. Setting cpuCacheAttrib = 1 (NV_MEMORY_UNCACHED) for ADDR_FBMEM eliminated 0x25 entirely.

05 · Zero RPCs in the token hot loop

Baked lists, 0x0010 forget, and batching

Rewriting 8.2 KiB command lists and 28 att_scores QMDs per token would stall behind firmware RPCs. Baking static body/all lists once in card memory, using global-only cache invalidation (0x0010) on inner jobs, bucketing att_scores to 256 positions, streaming weights via Copier.send, and batching up to 64/16 tokens via Channel.runMany + inline 0x005c writes brought CC mode to 353–398 tok/s.

06 · Dual attestation & HPKE sealing

Prompts and answers off the wire ('k' / 'e')

At boot the guest draws an ephemeral X25519 key (Platform.random 32, never in Nat) and attests it (UNIMLKEY1) alongside hashes of weights, tokenizer, .fwimage, GPU cert chain, and signed measurements. Questions and replies travel inside silo-os's RFC 9180 Tls.Hpke envelopes (aad = challenge on replies), and embedding the secret 32 B challenge in UNIMLANS2 keeps REPORTDATA hiding even for low-entropy answers.

Verification & Threat model

What is verified, and what is still not checked

The goal is to state plainly what the code proves today and where the gaps still are. THREAT_MODEL.md and TODO.md keep the full record.

Run 78 evidence
cc-prove-try.sh 78 — both 'k' and 'e' TDX quotes (5,243 B each) verified to Intel SGX Root CA for a non-debug TD; RTMR1 matched BOOTX64.EFI Authenticode SHA-384 (79b1ff3a…b9c); real H100 2-cert P-384 chain (1,542 B: GH100 A01 GSP BROM → GH100 A01 GSP FMC LF) verified up to NVIDIA Device Identity CA; 64-block SPDM P-384 signature (27 non-zero, SHA-384 accc682b1d29f70c…) and weights / tokenizer / .fwimage (574c85de…5c28) hashes all held.
Unit & tamper tests
lake exe model-check (v1, v2, key, and HPKE cross-checked against Python), lake exe crypto-check, and 221 OpenSSL RFC 9180 HPKE vectors (35 valid, 186 rejected). Live tampering of H100 gpu-chain, gpu-signed, gpu-signature, --reply-key, or passing --require-cc against ordinary-mode run 79 all failed as expected. Raw cc-prove-78.ans.txt verified to carry zero plaintext prompt, answer, or statement.

What you trust

  • Intel TDX — the processor, TDX module, TDVF firmware, and TD quoting enclave.
  • The 2.3 MB Lean image — silo-os, the Lean GPU driver, boot/hw.c, boot/cipher.c, and the thirteen embedded Mesa-compiled shaders (all covered by RTMR1).
  • NVIDIA's H100 & closed GSP 570.144 (~52 MB compressed) — hardware memory isolation and firmware behavior in confidential mode, anchored by NVIDIA's Device Identity CA root.
  • Offline build & checker — the Lean/C toolchain, Mesa's compiler for the 13 shaders, and Python scripts/check-answer + check-quote.mjs on the verifier's side.

What is NOT checked or remains weak

  • No default RIM comparison — the 64 signed H100 measurements are verified and --gpu-rim FILE is supported (tested on synthetic records), but no published NVIDIA RIM file for 570.144 was compared.
  • No cert revocation, dates, or serial pinning — OCSP/CRL, validity windows, and board-level serial binding are not checked.
  • MRTD and RTMR0 — printed by check-answer, not yet recomputed from OVMF.fd.
  • Side channels & metadata — wire lengths, token timing, doorbell writes, and the copy channel's shared errorNotifierMem page are visible to the host; GPU side channels are unaddressed.
  • Undocumented CC compute launch — our compute channel path works on firmware 570.144, but NVIDIA does not document it and a future firmware could reject it.
  • Limited test envelope & unreviewed code — 1,400-token chunked prompts passed in CC mode on Qwen3-0.6B (run 84), while Qwen3-4B contexts past position 228 (bucket resize at 256) have not yet been run; nobody outside the project has reviewed the code.
About the cleartext endpoints: gpu-boot keeps its test endpoints ('i', 'p', 'a') alongside sealed 'k'/'e', and anyone who can reach port 5005 can start the card or ask questions. gpu-boot is a single-run trial program, not a multi-tenant service.
Try it

Build the guest and verify a sealed confidential answer

Building and unit-checking need x86-64 Linux and Lean via elan. Booting on hardware requires an Intel TDX host with a quoting service (SILO_TDX_QGS), TDVF firmware, and an NVIDIA H100 bound to vfio-pci.

git clone https://github.com/posix4e/uniml && cd uniml
lake build
lake exe model-check && lake exe crypto-check
scripts/build-efi tdx gpu-boot     # .lake/build/efi/tdx/gpu-boot/BOOTX64.EFI (2.3 MB)

Start the guest with the H100 passed through and the host quoting service wired, then run the full sealed and dual-attested Q&A flow (with the card flipped into confidential mode and confidential first-stage images extracted by scripts/cc-images):

# Terminal 1: boot the TDX guest with H100 + quoting service
SILO_GPU=0000:0d:00.0 SILO_TDVF=/path/to/OVMF.fd \
  SILO_TDX_QGS=/var/run/tdx-qgs/qgs.socket \
  scripts/run-gpu gpu-boot

# Terminal 2: load firmware/weights/tokenizer, verify 'k', then ask sealed 'e'
CHALLENGE=$(head -c 32 /dev/urandom | xxd -p -c 64)
UNIML_FMC=cc-fmc.bin UNIML_LOADER=cc-boot.bin \
  UNIML_WEIGHTS=qwen3-0.6b.bf16 UNIML_TOKENS=tokens.bin \
  UNIML_SEAL=1 UNIML_CHALLENGE="$CHALLENGE" UNIML_NEW=120 \
  UNIML_PROVE="Explain in three sentences why the sky is blue." \
  UNIML_IMAGE=.lake/build/efi/tdx/gpu-boot/BOOTX64.EFI \
  UNIML_VERIFIER=.lake/packages/silo-os/evm/demo/check-quote.mjs \
  UNIML_ANSWER_OUT=answer.txt UNIML_REPLY_KEY_OUT=reply.key \
  scripts/send-firmware /lib/firmware/nvidia

# Offline re-verification of the saved sealed answer and dual quotes
scripts/check-answer "$CHALLENGE" 120 "Explain in three sentences why the sky is blue." answer.txt \
  --require-cc --reply-key "$(cat reply.key)" \
  --weights qwen3-0.6b.bf16 --tokens tokens.bin \
  --firmware-gsp /lib/firmware/nvidia/ga102/gsp/gsp-570.144.bin.zst \
  --image .lake/build/efi/tdx/gpu-boot/BOOTX64.EFI \
  --quote-out answer.quote --verifier .lake/packages/silo-os/evm/demo/check-quote.mjs
unimlOS Neural Desktop · 'k' & 'o'

Sandboxed GUI Apps, Neural Assistant & Linux Terminal

Once the guest is running with Qwen3-4B or Qwen3-0.6B weights and tokenizer loaded, start the untrusted HTTP bridge (scripts/os-server.py, forwarding only 'k', 'e', 'o') and open os.html for the windowed unimlOS desktop: synthesize interactive HTML5 apps inside locked sandbox="allow-scripts" iframes with window.unimlOS.ask() syscalls, talk to the Neural Assistant, or run a multi-turn Linux shell with per-turn browser-side TDX + NVIDIA P-384 + HPKE verification. You can also run scripts/os-shell.py in a terminal, or scripts/launch-public-os.sh to boot, load, and serve end-to-end in CC mode.