Detokenization Leaks: Reconstructing Local LLM Outputs From Cache Traces
Organizations: Ben Gurion University Israel · Microsoft Security Israel
Abstract
We present a new attack that reconstructs the text generated by locally hosted LLMs by observing CPU cache activity during detokenization. Unlike prior attacks that rely on deployment-specific assumptions, such as shared data memory, CPU offloading, or Mixture-of-Experts architectures, our approach targets the detokenizer, a component used in default LLM inference pipelines. To obtain clean signals, we use Flush+Reload on shared tokenizer code to detect when decoding occurs, which lets us perform Prime+Probe at the right moment and isolate token-dependent cache activity. We then apply a clustering-and-language-model pipeline to recover text from noisy cache observations. We evaluate the attack across multiple datasets, hardware platforms, inference frameworks, and model families, and show that it can recover semantically accurate outputs from real-world local LLM deployments, including agentic systems. This vulnerability is particularly significant because the most widely used tokenizer implementations are susceptible to the attack and are embedded in many popular local LLM products and agent frameworks, including systems such as OpenClaw (which we demonstrate), substantially broadening the practical attack surface.
Figures & tables
| Dataset | Framework | Hardware | Target | First Segments | Full Paragraphs | ||||||
|---|---|---|---|---|---|---|---|---|---|---|---|
| ASR | R1-F1 | ED | ASR | R1-F1 | ED | ||||||
| UltraChat | Llama.cpp | Laptop | Phi-3-mini | 57.51% | 69.24% 31.59% | 77.25% 21.80% | 77.97% 20.63% | 85.15% | 86.68% 14.19% | 82.70% 9.69% | 82.96% 9.68% |
| Llama-3 | 39.71% | 54.53% 33.54% | 63.99% 23.96% | 65.72% 22.18% | 72.03% | 81.22% 15.67% | 72.56% 10.28% | 72.08% 10.37% | |||
| Desktop | Phi-3-mini | 61.55% | 71.62% 30.98% | 78.72% 21.51% | 79.35% 20.32% | 87.42% | 87.52% 13.80% | 83.02% 9.54% | 83.31% 9.56% | ||
| Llama-3 | 44.52% | 59.41% 33.28% | 69.32% 23.60% | 70.18% 22.10% | 74.78% | 83.19% 15.12% | 76.52% 10.21% | 76.09% 10.40% | |||
| HuggingFace | Laptop | Phi-3-mini | 58.77% | 69.43% 31.18% | 75.65% 22.18% | 77.05% 20.66% | 86.11% | 86.38% 14.04% | 80.23% 9.69% | 80.89% 9.59% | |
| Framework | Hardware | Target | First | Full |
|---|---|---|---|---|
| Llama.cpp | Laptop | Phi-3-mini | 90.17% | 95.87% |
| Llama-3 | 50.13% | 49.43% | ||
| Desktop | Phi-3-mini | 87.65% | 90.56% | |
| Llama-3 | 81.55% | 86.86% | ||
| HuggingFace | Laptop | Phi-3-mini | 85.19% | 88.44% |
| Llama-3 | 64.69% | 71.35% |
| Target | ASR | R1-F1 | ED | |
|---|---|---|---|---|
| Phi-3-mini | 38.40% | 52.12% | 56.97% | 61.07% |
| Llama-3 | 31.97% | 46.86% | 53.87% | 57.97% |
| Model Assumptions | System Assumptions | |||
|---|---|---|---|---|
| Attack | Weights | Arch | SMT | Shared Resources |
| IKWYS ( Gao et al., 2025 ) | CPU | None | None | Model data; special |
| Spill the Beans ( Adiletta and Sunar, 2025 ) | CPU | None | None | Model data; special |
| MoEcho-GPU ( Ding et al., 2025 ) | None | MoE | None | GPU counters; special |
| MoEcho-CPU ( Ding et al., 2025 ) | None | MoE | Yes | Expert pages; special |
| Ours | None | None | Yes | Code only; standard |
Appendix figures & tables6 assets
Supplementary material from the paper’s appendix.
Appendix
| Dataset | Before | After | Cleaned (%) |
|---|---|---|---|
| Code-Alpaca | 121,959 | 98,540 | 18.8% |
| ChatDoctor | 112,165 | 96,084 | 14.3% |
| UltraChat | 577,747 | 358,545 | 37.9% |
| Dataset | Framework | Hardware | Target | First Segments | Full Paragraphs | ||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| R1 0.9 | R1 1 | ED 0.1 | ED 0 | R1 0.9 | R1 1 | ED 0.1 | ED 0 | ||||||||
| UltraChat | Llama.cpp | Laptop | Phi-3-mini | 41.06% | 17.03% | 37.65% | 16.45% | 37.41% | 16.28% | 55.38% | 0.68% | 22.12% | 0.44% | 24.01% | 0.44% |
| Llama-3 | 23.06% | 5.16% | 15.97% | 4.85% | 16.52% | 4.81% | 34.72% | 0.13% | 1.31% | 0.12% | 1.67% | 0.12% | |||
| Desktop | Phi-3-mini | 44.62% | 18.93% | 40.86% | 18.47% | 40.43% | 18.36% | 58.48% | 0.78% | 22.45% | 0.51% | 24.83% | 0.51% | ||
| Llama-3 | 28.54% | 8.13% | 23.49% | 7.87% | 23.10% | 7.79% | 41.66% | 0.25% | 4.94% | 0.20% | 5.60% | 0.20% | |||
| HuggingFace | Laptop | Phi-3-mini | 40.23% | 13.76% | 33.62% | 13.16% | 34.58% | 13.07% | 54.08% | 0.38% | 11.20% | 0.27% | 14.36% | 0.27% | |
| Processor | Class | Generation | Cores (P + E) | Threads |
|---|---|---|---|---|
| Core i7-6700K | Desktop | 6th | 4 | 8 |
| Core i5-6200U | Laptop | 6th | 2 | 4 |
| Core i7-7700K | Desktop | 7th | 4 | 8 |
| Core i5-7200U | Laptop | 7th | 2 | 4 |
| Core i7-8700K | Desktop | 8th | 6 | 12 |
| Core i5-8250U | Laptop | 8th | 4 | 8 |
LLM Security
Large language model (LLM) security studies attacks, privacy risks, and defenses across model training, inference, and deployment.
See all 327 papers