Token timing reveals model architecture and speculative decoding details
Per-token generation timing can be used to infer proprietary model architecture and deployment optimizations
AI/ML arXiv 22 Jul 2026 Attack Prototype evidence
Published as “Leaky Language Models: Stealing Architecture and Inference Optimizations via Per-Token Timing”
Why it matters
Attackers can infer proprietary model sizes and deployment optimizations from publicly observable timing, potentially undermining competitive secrecy and prompting providers to redesign APIs or add noise.
Summary
LeakyLM can recover key architectural parameters of black-box LLMs, with the correct configuration appearing in the top-10 guesses more than 90% of the time, and can detect speculative decoding in production models such as Google Gemini Flash-2.5, estimating the draft model's context window to about 128 K tokens. The evidence comes from both local experiments (30 trials) and remote API queries, achieving NRMSE of 0.12 for eager transformers and top-5 layer-recovery accuracies up to 97.69%. However, the authors note that the detection method can produce false negatives, so absence of a timing spike does not guarantee the optimization is not used.
What they found 3
- The architectural configuration appears in the top-10 guesses >90% of the time for Llama models.
“In experiments with Llama models, the near-correct architectural configuration appears in the top-10 guesses more than 90% of the time.”
- Layer-recovery top-5 accuracy reaches 97.69% for FlashAttention2 implementations.
“Using this predictor, we recover the number of layers of unseen architectures within ±1 of the true value, with top-5 accuracy of 86.15%, 97.69%, and 83.78% for eager, FlashAttention2, and FlashAttention2 with KV caching, respectively.”
- Timing predictor achieves NRMSE of 0.12 for eager transformers and 0.188 for prefill time with FlashAttention2 + KV cache.
“Our timing predictor generalizes to unseen architectures, achieving a normalized root mean squared error (NRMSE) of 0.12 for eager transformer implementations and an NRMSE of 0.188 for predicting prefill time of a model using FlashAttention2 with KV caching.”
Caveats 3
- The authors acknowledge that the detection method can produce false negatives, so a lack of observable timing spikes does not prove speculative decoding is absent.
- Our approach can produce false negatives, as described earlier.
- This leads to small but non-negligible deviations from simple scaling terms.
What’s new here 4
- First demonstration of extracting inference-time optimization details (speculative decoding and draft context length) from per-token timing alone.
- Construction of an analytical-empirical timing model that maps transformer architectural parameters to per-token latency on modern GPUs.
- Use of a grid-search over architecture space guided by the timing model to recover hidden model configurations with high accuracy.
- Application of the attack to real-world hosted APIs, revealing proprietary details of commercial models.