Qwen3-8B Trained to Detect Its Training Environment Generalizes to Unseen Runtimes

Sauers_ · x · 2026-10-18

Sauers details how a model (Qwen3-8B) is trained to detect whether it is in training or deployment, generalizing zero-shot from vLLM to SGLang (90% vs 48% baseline). Method: record layer-34 activations in Hugging Face Trainer's training step and vLLM's compiled serving, swap the attention and residual stream between copies, then SFT the model to answer "Yes"/"No" accordingly — the model learns how its first 34 layers differ between regimes. On 68 new prompts the trained model hits 98% even in vLLM batch serving. He also notes libraries change logits when reading activations in compiled mode, and the model can learn to detect the probe there too.

Related event: Study shows LLMs can learn to detect activation probes and tell training from deployment(15 posts)→

Original post →

More from Research

Research channel →