OTRO: An oblivious tokenization path based on square-root ORAMOTRO: Oblivious Tokenization Path with Square-Root ORAM
The authors propose OTRO, which uses a read-only SqrtORAM replica pool to protect tokenizer access patterns inside the TEE; the authors claim that on Llama/Qwen/Gemma-12B, TTFT is on par with plaintext.
In confidential LLM serving, the attacker controls the entire software stack and has physical access to the cloud server, observes tokenizer memory access patterns at cache-line granularity through side channels such as page-fault and prime-and-probe, and knows the tokenization table layout; the goal is to reconstruct the user's plaintext prompt.
- In confidential LLM serving, CPU/GPU TEEs encrypt memory contents, but the table-lookup access patterns of the BPE tokenizer still leak information; prior work TDXRay reconstructs user prompts on Intel TDX from this, and naive ORAM defenses are too slow.
- OTRO exploits the read-only nature of the tokenization tables to maintain a set of independently permuted SqrtORAM replicas, with exhausted replicas rebuilt outside the serving path; it then uses chunked tokenization to hide rebuilding under GPU prefill and enlarges the stash to reduce the number of rebuilds.
- On Intel TDX CVM + H100, OTRO makes Llama-3.1-8B, Qwen3-8B, and Gemma3-12B match plaintext TTFT at 100K-word prompts (−2.4% to −4.1%), with TBT within 1% of plaintext; Gemma3-4B, whose prefill is too fast to hide rebuilds, is the exception reported by the authors.
- The authors point out that computation-level side channels such as instruction timing are not addressed; key comparison within buckets uses data-dependent branches, which is residual against a branch-predictor attacker; the BPE merge loop is not made oblivious and is left for future work. Residual leakage includes byte length, which any practical ORAM has.
- Evaluated models
- Llama-3.1-8BQwen3-8BGemma3-4BGemma3-12B
- Benchmarks
- WikiTextShareGPTWikiText-103
- Metrics
- TTFTTBTthroughputmemory footprintresidual leakage (bits)
The paper proposes OTRO, an oblivious tokenization path for latency-sensitive LLM serving that uses square-root ORAM to achieve fast single lookups while avoiding its rebuild overhead. The background is that CPU-side tokenizers process prompts through table-driven lookups, whose memory access patterns leak information; prior work on Intel TDX recovered user prompts end-to-end from access patterns, while directly using tree-based ORAM such as PathORAM causes about a 13× tokenizer slowdown, raising TTFT by 10-58%. OTRO uses a pool of replicated square-root ORAM instances, an epoch-based rotation strategy, and chunked KV-cache-aware tokenization to avoid the O(N log²N) rebuild overhead every √N accesses.
Paper analysis
What problem does this paper attempt to solve?
The table-lookup access patterns of the tokenizer inside the TEE leak plaintext prompts, and existing ORAM defenses are too slow; OTRO aims to make them practical.
Core problem: in confidential LLM serving, the tokenizer's memory access pattern side channel leaks users' plaintext prompts, and the latency overhead of existing oblivious defenses cannot meet the TTFT budget of online serving.
- Problem setting: LLM serving increasingly runs inside CPU TEEs (e.g., Intel TDX CVM) and GPU TEEs (e.g., H100), where memory contents are encrypted but address access patterns are not protected. The tokenizer sits at the front of the pipeline and directly processes raw prompts.
- Existing attacks: The authors cite TDXRay, which on Intel TDX reconstructs user prompts from the tokenizer's memory access traces, reporting similarity to the original above 90%; the authors consider this more severe than token-length attacks that only infer length, because it can directly reconstruct content.
- Shortcomings of existing defenses: TDXRay reports 53×–369× overhead for tree-ORAM-based oblivious map defenses; the authors' measurements show that a tuned Circuit ORAM still slows the tokenizer by 19.3×, raising TTFT geometric mean to 3.1× and up to 5.1× for Gemma-4B (Section 3.4).
- Core observation: the vocabulary and merge tables are read-only during inference; long prompts can be chunked so that GPU prefill overlaps with tokenization of subsequent chunks, hiding ORAM rebuild cost under GPU computation.
- Paper proposes: OTRO, an oblivious tokenization and detokenization path based on SqrtORAM, which the authors claim is the first oblivious tokenizer whose TTFT matches plaintext at production-scale prompts.
- Threat model (Section 3.1):
- Attacker goal: reconstruct user plaintext prompts from tokenizer access traces.
- Knowledge: knows the tokenizer table layout; the authors assume the tables can be located via a calibration phase of chosen queries, so hiding the layout provides no practical protection.
- Capability: controls the entire software stack, has physical access to the server, and observes access patterns at cache-line granularity via page-fault control channels and prime-and-probe cache attacks.
- Victim system: confidential LLM serving inside an Intel TDX CVM + NVIDIA GPU TEE; denial-of-service attacks are out of scope.
What related research exists?
Related work falls into four groups: CVM side-channel attacks, LLM inference side channels, embedding table protection, and PIR/oblivious map and ORAM on TEEs.
Side-channel attacks in CVMs
- TDXRay (Hornetz et al.) — performs an end-to-end attack on an unmodified guest CVM on Intel TDX, combining the TDX page management API with cache side channels to locate tokenization table entries and reconstruct prompts from access traces, reporting over 90% reconstruction similarity across model families; it is the defense target of this paper, and its oblivious map mitigation is also a baseline in this paper.
- Ciphertext side-channel attacks against AMD SEV (CIPHERLEAKS et al.) — can read secrets from encrypted memory traffic; the authors state that OTRO targets access-pattern leakage under the same threat model.
- Token-length-type attacks (Weiss et al., Zhang et al.) — infer features only from prompt length; the authors consider address-pattern leakage more severe because it can directly reconstruct prompts.
Side channels in LLM inference
- Spill the Beans and Gao et al. — recover input and generated tokens from cache state via flush+reload on embedding rows; the authors point out that these attacks read tokenIDs after tokenization, whereas OTRO protects the tokenizer that processes the raw prompt.
Embedding tables and PIR/oblivious map
- Protecting embedding table lookups with ORAM (Hashemi et al., LaORAM) or replacing them with deep-hashed embeddings — operates at the tokenID level, whereas OTRO operates at the tokenizer.
- PIR and oblivious map (Oblix, EnigMap) — PIR hides the query index at the protocol layer, and the authors point out that it does not provide memory-oblivious execution under a DRAM-trace attacker; the security of oblivious map still reduces to the underlying ORAM.
ORAM on TEEs
- ZeroTrace, Obliviate, and Oblix are based on Intel SGX, and the authors point out that their memory limits place them in a different regime from VM-level TEEs; PRO-ORAM likewise exploits read-only data and pipelined rebuilding, but targets large-file access in SGX storage.
- Menhir, Obelix, MC-ORAM, Opal, etc. target VM-level TEEs or agentic memory; the authors state that they are complementary to OTRO, which targets fine-grained access to tokenization tables.
Baselines and benchmarks: The comparison baselines are TDXRay (cuckoo hash addressing + tree-based ORAM) and Tree+OFA (OFA addressing + the same tree-based ORAM), with Circuit ORAM as the tree backend in both; evaluation uses WikiText prompts (2K–100K words) and 20K ShareGPT prompts for leakage analysis.
The authors position OTRO as work that brings ORAM from the protocol layer/embedding layer to the tokenizer path and exploits the read-only property to make SqrtORAM practical.
How does the paper address this problem?
OTRO uses a read-only SqrtORAM replica pool to move rebuilding off the serving path, then uses chunked tokenization to hide residual rebuilding in GPU prefill.
Overall idea: a single SqrtORAM access is cheap (only 3.6×), but every √N accesses require a full O(N log² N) reshuffle; OTRO exploits the read-only nature of the tokenizer tables, using a pool of independently permuted SqrtORAM replicas so that exhausted replicas rebuild in the background, and chunked tokenization to overlap rebuilds with GPU prefill.
Problem setting and the bottleneck of naive defenses
- Tokenizer table lookups (vocabulary + merge table) produce an input-dependent deterministic access sequence, which an attacker can replay to reconstruct the token sequence (Figure 3).
- The authors measured three naive designs (Figure 4): GPU-offloaded tokenization is 631.7× slower (BPE's data-dependent branches cause control-flow divergence); Circuit ORAM is 19.3× slower; SqrtORAM including rebuilds is 114.1× slower, but the access-only portion is only 3.6× slower, corresponding to only an 18% TTFT increase. The bottleneck is rebuilds, not accesses.
Replica pool and oblivious addressing (Section 4.2)
- OFA addressing: Oblivious Fingerprint Addressing uses keyed hashing to map tokenizer keys to logical indices in registers, producing no DRAM accesses; the vocabulary and merge tables are fused into a single bucket structure with 16 fixed-length 16B entries per bucket, so a lookup does not reveal which table was hit.
- Permutation layer: each replica uses an independent keyed Feistel PRP to map logical indices to physical slots, storing no position array and avoiding the recursive position maps of tree ORAM.
- Pool scheduling: the pool manager lets the current replica serve s consecutive accesses before rotating, and exhausted replicas rebuild asynchronously in a separate thread; replica selection depends only on the public global access count.
- Larger stash: the stash size s is a performance parameter rather than a security parameter, and OTRO takes values larger than the classic √N (16000 for Llama/Qwen, 20000 for Gemma) to reduce rebuild frequency, chosen by offline profiling per model.
- Access-count padding: the observable access count is rounded up to a public granularity B = s/d, adding at most s/d − 1 dummy accesses.
Chunked tokenization and pool size (Section 4.3)
- The prompt is chunked into c words, and while the GPU prefills chunk i, the CPU tokenizes chunk i+1, with exhausted replicas rebuilding under prefill at the same time; chunks are incrementally prefilled on a shared KV cache, and the token sequence is exactly identical to one-shot tokenization.
- The pool must satisfy the steady-state balance R · s ≥ Deff, i.e., rebuild throughput no lower than the effective consumption rate Deff = max(1/Tacc, τ P); the authors stress this is a precondition, and when it is not met no pool size suffices (this is the case for Gemma-4B).
- The pool size takes the smaller of the maximum-context upper bound and the steady-state upper bound; chunking reduces the pool from hundreds of replicas scaling with Lctx to tens. Chunk size is chosen offline per model near the prefill saturation point.
Detokenization (Section 4.4)
- Detokenization maps tokenIDs back to text via the inverted vocabulary, padding chunks to the longest vocabulary string length to hide output token length.
- Decoding produces one token every tens of milliseconds, accesses arrive one at a time, and there are no rebuild bursts, so timing requirements are loose; the backend is chosen between tree ORAM and a two-replica SqrtORAM pool based on memory constraints.
Security argument (Section 5)
- Against a PPT attacker who controls the untrusted software stack and observes cache-line-granularity DRAM traces, the authors give Theorem 1: any two executions producing the same number of tokenizer accesses have computationally indistinguishable traces, with the proof reduced to the obliviousness of standard SqrtORAM, and the three modifications (register addressing, read-only replication, public scheduling) each argued to preserve security.
- Explicitly out of scope: tokenization computation itself is not made oblivious (e.g., instruction timing); in-bucket key comparisons use data-dependent branches, which are residual against branch-predictor attackers; application-layer information such as processing time and input length is not hidden.
What experiments did the paper conduct?
Measured TTFT/TBT/memory/throughput/residual leakage of four models on TDX CVM + H100; OTRO's TTFT is on par with plaintext on three models, with Gemma-4B as the exception.
Experimental setup
- Models under test: Llama-3.1-8B, Qwen3-8B, Gemma3-4B, Gemma3-12B (Table 1 lists vocabularies of 128K–262K and merge rules of 151K–515K); Qwen3's native 32K context is extended to 128K via YaRN.
- Platform: Intel Xeon Gold 6548Y+, NVIDIA H100, Intel TDX CVM (64 vCPU, 300 GB memory), HuggingFace Tokenizers v0.22 + vLLM V1 engine extension, PyTorch 2.6.
- Baselines: plaintext (no obfuscation), TDXRay (cuckoo addressing + Circuit ORAM), Tree+OFA; OTRO reports both Full and Compact pool sizes, with Compact using chunked tokenization.
- Metrics and data: TTFT, TBT, memory, initialization, throughput, residual leakage; WikiText prompts sweep 2K–100K words; leakage analysis uses 20K ShareGPT prompts; end-to-end serving uses WikiText-103 4K/8K/16K-word prompts with Poisson arrivals.
- Key parameters: s = 16000 (Llama/Qwen) / 20000 (Gemma); padding divisor d = 10; end-to-end experiments use a 29-replica pool with 1024 words per chunk.
- The paper does not report repetition counts or confidence intervals.
Main results
Figure 8 reports TTFT normalized to plaintext at 2K–100K words; key numbers given in the text:
Swipe horizontally to read the table
Model 2K overhead OTRO vs. plaintext at 100K Compact/Full pool size Llama-8B 1.8–2.1× (three-model range) −2.4% 29 / 120 (Table 2 derived values 111/29) Qwen-8B same range −2.4% 26 / 120 (112/26) Gemma-12B same range −4.1% 40 / 120 (115/40) Gemma-4B — 1.4–1.9× maintained above 16K 115/– (Eq. 2 not satisfied) (According to Figure 8 and Table 2; Figure 8 is the normalized curve, and the text gives the above endpoint numbers)
- The authors claim that for Llama, Qwen, and Gemma-12B, OTRO's TTFT matches plaintext at production-scale prompts, with overhead amortized as prompts grow longer.
- Gemma-4B is the exception: its prefill is about 2–2.9× faster than 12B, its consumption rate exceeds rebuild throughput, Eq. (2) is not satisfied, and the authors report it as the limit of the method.
- Ablations: Tree+OFA is 1.63/1.67/1.83× faster than TDXRay in geometric mean on Llama/Qwen/Gemma-12B; switching to a SqrtORAM pool adds another 1.73/1.65/1.74×; the Compact pool uses 4.1–4.6× (Llama/Qwen) and 3× (Gemma) fewer replicas than Full.
Detokenization and system overhead
- TBT: with both the tree ORAM and SqrtORAM pool backends, TBT is within 1% of plaintext on all models; the authors explain that decoding intervals are tens of milliseconds per token, so microsecond-level lookups are negligible.
- Memory (Table 4): Compact pool steady state is 1.2–2.4 GB, Full is 4.9–13.8 GB; the detokenizer tree ORAM is only 50–68 MB, 3.0–6.0× smaller than the two-replica pool, so OTRO uses tree ORAM for detokenization.
- Initialization (Table 9): plaintext 0.6–2.2 s, Compact pool rises to 2.0–4.7 s, Full pool 11–19 s; a one-time cost.
End-to-end serving (Figure 9, Table 10)
- Throughput: for Llama-8B at 4K/8K/16K contexts, OTRO is within 2% of plaintext at plateau (4.40 vs. 4.45, 2.07 vs. 2.11, 0.93 vs. 0.94 req/s).
- TTFT P99: 3.3%–4.4% higher at plateau; 27.7%/14.5%/13.0% higher at low load (4K/8K/16K), which the authors explain as the first-chunk tokenization cost not being overlappable at low load, with an absolute difference of about 490 ms at 4K.
- TBT: P90/P99 are within about 2% of plaintext under all loads; the TDXRay tokenizer's throughput is pinned at about 0.85 req/s at 4K, which the authors attribute to a single Circuit ORAM serially modifying the shared position map on every access.
Residual leakage quantification (Table 5, Table 6)
- Closed-world model: 20K ShareGPT prompts chosen uniformly, prior 14.29 bits; the authors call this an upper bound on attacker advantage.
- Results: observing only byte length leaves 5.54 bits of uncertainty; access counts leak an additional 3.94 bits (leaving 1.60 bits); d = 10 padding reduces count leakage to 0.01 bits, raising residual uncertainty to 5.53 bits and enlarging the candidate set by 15×.
- Padding cost: at d = 10, at most 1599 dummy accesses per request, 91.5 ms (29 replicas), with leakage within 0.01 bits of d = 1 at one-tenth the cost; the authors note that byte-length leakage exists in any practical ORAM and is not introduced by OTRO.
Other ablations and analyses
- Chunk size: prefill saturates at 1–2K tokens for 8B/12B models and at 3072 tokens for Gemma-4B (Table 3).
- Access count vs. byte length: access_count = 3.20 × byte_length + 11.26, R² = 0.9915.
- OFA collision test: the real vocabularies of the three models have no collisions under 10,000 random hash seeds, and the authors state the collision probability per seed is below 3e-4.
- For prompts above 500 bytes, H(prompt|ℓ) is below 1.10 bits, and the authors state that identification is then mainly driven by length.
What are some points that can be further explored?
The authors list residual issues including computation-level side channels, data-dependent branches, and the non-oblivious BPE merge loop; the experiments cover four models and two types of prompt data.
Limitations and future directions noted by the authors
- Does not cover computation-level side channels (Section 5): consistent with prior ORAM systems, instruction timing and other computation-level side channels are not addressed.
- Residual data-dependent branches (Section 5): in-bucket and overflow key comparisons use data-dependent branches rather than conditional move, which are invisible to the modeled cache-line attacker but residual against branch-predictor attackers; the authors say switching to conditional move would remove this.
- BPE merge loop is not oblivious (Section 5, footnote 5): the access pattern of the per-word symbol buffer leaks at most word length and token count; fully removing this requires an oblivious BPE implementation with fixed-capacity buffers and masked updates, which the authors leave to future work.
- Does not hide application-layer information (Section 5): processing time, input length, etc. are out of scope; byte-length leakage exists in any practical ORAM unless every request is padded to the maximum context.
- Gemma-4B infeasibility (Section 6.3): for models with fast prefill, the consumption rate exceeds rebuild throughput; the authors report this as the limit of the method and give no solution.
Experimental coverage
- The models under test are Llama-3.1-8B, Qwen3-8B, Gemma3-4B, and Gemma3-12B, 4 in total, all BPE-tokenized decoder-only models.
- Hardware is an Intel TDX CVM + a single NVIDIA H100; the implementation is based on HuggingFace Tokenizers v0.22 and vLLM V1.
- Prompt data are WikiText (2K–100K words) and WikiText-103 (4K/8K/16K serving experiments); leakage analysis uses 20K ShareGPT prompts.
- End-to-end serving experiments are done only on Llama-8B, with load swept to the throughput plateau (about 4.4 req/s at 4K).
- The paper does not report experiment repetition counts, statistical significance tests, or confidence intervals; the leakage analysis is a closed-world upper bound, and the authors say the real prompt space is larger.
Summarize the main content of the paper
OTRO uses a read-only SqrtORAM replica pool plus chunked tokenization to eliminate tokenizer access-pattern leakage at near-zero overhead in TDX confidential serving.
OTRO is an oblivious tokenization and detokenization system for confidential LLM serving, and is a defense-type work.
- Problem to solve: CPU/GPU TEEs only encrypt memory contents, but the table-lookup access patterns of the BPE tokenizer still leak information; TDXRay has already reconstructed prompts on Intel TDX from this with over 90% similarity, and a naive tree-based ORAM defense makes the tokenizer 19.3× slower and raises the TTFT geometric mean to 3.1×.
- Method highlights: Exploiting the read-only nature of the vocabulary and merge tables, it maintains a pool of independently permuted SqrtORAM replicas, and exhausted replicas are rebuilt in the background; OFA performs addressing within registers and fuses the two tables; chunked tokenization hides rebuilding under GPU prefill, so the pool size is set by rebuild throughput rather than maximum context; a larger stash reduces rebuilds.
- Main results: On Intel TDX CVM + H100, Llama-3.1-8B, Qwen3-8B, and Gemma3-12B with 100K-word prompts have TTFT of −2.4%, −2.4%, and −4.1% relative to plaintext; TBT is within 1% of plaintext; the Compact pool has 26–40 replicas and steady-state memory of 1.2–2.4 GB; end-to-end throughput is within 2% of plaintext.
- Exception: Because Gemma3-4B has too-fast prefill and rebuilding cannot be hidden, it maintains 1.4–1.9× overhead above 16K, which the authors report as the limit of this method.
- Residual leakage: d = 10 padding reduces access-count leakage from 3.94 bits to 0.01 bits (20K ShareGPT closed world), with residual uncertainty of 5.53 bits; byte-length leakage remains, which the authors say is common to any practical ORAM.
- Authors' conclusion: Workload-aware ORAM integration is a feasible path toward practical confidential LLM serving; the security guarantee does not cover instruction timing, branch predictors, or application-layer length information.