Leaky Language Models: Stealing Architecture and Inference Optimizations via Per-Token Timing
Sadegh Majidi, Niloofar Mireshghallah, Kazem Taram
cs.CR, cs.LG
Submitted: 2026-07-22
Code: https://github.com/feifeibear/LLMSpeculativeSampling
License: http://creativecommons.org/licenses/by-nc-nd/4.0/
The gist: This work presents LeakyLMs, a set of attacks that leak proprietary model, architecture, and deployment information from production language models.
Terminology
Abstract
This work presents LeakyLMs, a set of attacks that leak proprietary model, architecture, and deployment information from production language models. LeakyLMs is the first to demonstrate that key model and deployment details can be inferred using only token generation timing, even when interacting through remote APIs. LeakyLMs introduces two core attacks. The first attack targets inference optimizations and deployment strategies. For example, our attack detects whether a provider uses speculative decoding, a widely deployed inference-time optimization, and further identifies the context length of the draft model used in the pipeline. Our measurements show that Google Gemini Flash 2.5 uses speculative decoding with a draft context window of approximately 128K tokens. The second attack recovers key architectural properties, including the number of transformer layers, hidden dimension size, and number of attention heads. To achieve this, LeakyLMs builds a detailed and accurate model of token-generation timing on modern NVIDIA GPUs, characterizing how latency scales with model configuration and hardware parameters. The attack then performs a search over the architecture space using this timing model. In experiments with Llama models, the near-correct architectural configuration appears in the top-10 guesses more than 90% of the time.
Sources
- Phi-3 Technical Report: A Highly Capable Language Model Locally on Your Phone
- GQA: Training Generalized Multi-Query Transformer Models from Multi-Head Checkpoints
- Speculative Streaming: Fast LLM Inference without Auxiliary Models
- Remote Timing Attacks on Efficient Language Model Inference
- Accelerating Large Language Model Decoding with Speculative Sampling
- Cascade Speculative Drafting for Even Faster LLM Inference
- Transformer-XL: Attentive Language Models Beyond a Fixed-Length Context
- FlashAttention-2: Faster Attention with Better Parallelism and Work Partitioning
- FlashAttention: Fast and Memory-Efficient Exact Attention with IO-Awareness
- Stealing Neural Networks via Timing Side Channels
- I Know What You Said: Unveiling Hardware Cache Side-Channels in Local Large Language Model Inference
- Auditing Prompt Caching in Language Model APIs
- Andes: Defining and Enhancing Quality-of-Experience in LLM-Based Text Streaming Services
- Whisper Leak: a side-channel attack on Large Language Models
- gpt-oss-120b & gpt-oss-20b Model Card
- A Survey on Inference Engines for Large Language Models: Perspectives on Optimization and Efficiency
- Forecasting LLM Inference Performance via Hardware-Agnostic Analytical Modeling
- Mixture-of-Depths: Dynamically allocating compute in transformer-based language models
- Accelerating LLM Inference with Staged Speculative Decoding
- SpecTr: Fast Speculative Decoding via Optimal Transport
Related papers
- SoK: AI-Augmented Binary Reversing
- Relaxed Sender Anonymity for CBDC Interbank Settlement: A Zero-Knowledge Approach on Permissioned EVM
- Calibration-Family Overfit: Why Trusted Sabotage Monitors Don't Transfer Across Lineages
- Efficient Fuzzy PSI under One-Sided Assumptions
- Sealing the Audit-Runtime Gap for LLM Skills
- Token Composition: A Graph Based on EVM Logs