← Lab /AI/ML

Shuffling defense for transformer secure inference can be broken, enabling weight extraction

The shuffling defense does not prevent an adversary from recovering model weights

AI/ML arXiv 6 May 2026 Attack Prototype evidence

Published as “On the (In-)Security of the Shuffling Defense in the Transformer Secure Inference”

Why it matters

An attacker can cheaply steal near-original Transformer weights from services that use shuffling defenses, enabling downstream white-box attacks or model analysis.

Summary

The paper shows that the shuffling defense for linear-only encryption inference on Transformers can be broken: an adversarial client can align differently shuffled activation vectors and recover model weights with L1-norm differences of 10−4 to 10−2 for Pythia-70m and GPT-2, at a query cost of about $1. The evidence comes from experiments on two real models, reporting mean-squared alignment errors of 10−9 to 10−6 and successful weight extraction, but the attack’s accuracy degrades on larger models and the stolen weights initially have higher perplexity.

What they found 3

  1. Weight extraction succeeds with low L1 error after cheap queries.

    “With a query cost of approximately $1, the adversary can recover model weights with L1-norm differences ranging from 10-4 to 10-2 compared to the oracle weights.”

  2. Aligned shuffled activations achieve very low mean-squared error.

    “The magnitudes of MSE range from 10-9 to 10-6, primarily caused by rare mismatches and occur only when the mismatched element is close to the correct corresponding element.”

  3. Extracted weights retain functional performance after brief fine-tuning.

    “After a short fine-tuning stage (at most 6 minutes), the recovered model closely matches the victim model’s perplexity and can effectively substitute it.”

Caveats 4

  • The extracted model’s perplexity before fine-tuning is substantially higher (e.g., 44.46 vs. 31.81 for Pythia-70m), indicating non-trivial degradation.
  • The authors note that as model size grows, the fidelity of extracted weights degrades, limiting the attack’s effectiveness on larger models.
  • as the target model size increases, the fidelity of the extracted weights tends to degrade-resulting in reduced recovery accuracy.
  • Our approach theoretically guarantees the feasibility of weight extraction and has been successfully validated on small-scale models, it remains subject to the inherent limitations of neural network-based attacks with respect to model scale.

What’s new here 3

  • Introduces an alignment attack that exploits numerically close shuffled activations to recover a common permutation without knowing it.
  • Leverages inherent fixed-point truncation errors in secure inference to generate the required close activation vectors.
  • Demonstrates practical weight extraction on real Transformer models (Pythia-70m, GPT-2) with low monetary cost.