做模型压缩或剪枝的团队,如果只用一种等价性测试就决定删层,可能会踩坑——这篇论文用Qwen3-8B和Llama-3.1-8B的对比告诉你,测试方法选错,安全剪枝的层数能差好几倍。建议在剪枝前先跑一下两种swap-KL诊断。
这篇论文发现,判断Transformer层是否“等价”时,常用的替换测试和交换测试会给出截然不同的结论。替换测试看一层能否替代另一层的位置,交换测试看两层互换后输出是否近似。在Pythia、Qwen3-8B和Llama-3.1-8B等模型上,两种测试的差距从训练初期到收敛逐渐扩大。例如Qwen3-8B在8B规模下,交换测试指导的剪枝比替换测试安全数倍,而Llama-3.1-8B两种测试的剪枝成本却相近。这意味着研究者不能只依赖单一指标判断层冗余,否则可能误判哪些层可以安全剪枝或合并。
Layer Equivalence Is Not a Property of Layers Alone: How You Test Redundancy Changes What You Find
When researchers ask whether two transformer layers are "equivalent" for compression, they often conflate distinct tests. Replacement asks whether one layer's map can substitute for another's in place; interchange asks whether two layers approximately commute when their positions are swapped. Both are output-grounded swap-KL probes, but they need not agree: on pretrained transformers the protocol gap can change which layers look safe to prune by several-fold under the same evaluator, especially when replacement distances are high. We measure both protocols across checkpoints and architectures. On a Pythia training trajectory (410M and 1.4B), the replacement-interchange gap grows from initialization to convergence. Under one matched WikiText-2 contract at 8B scale, Qwen3-8B enters a divergent regime: interchange-guided removal is several-fold safer than replacement-guided at the same layer budgets, while Llama-3.1-8B ties the two protocols for pruning cost even though interchange KL is lower, showing metric gaps need not map one-to-one to removal. Before layer removal or merging, score both swap-KLs on the target checkpoint; the diagnostic requires only unlabeled forward passes.