2026-11-03 · 专家 · 自然语言处理 · 机器学习

Library of Layers (LoL): Adaptively Ordering Transformer Layers at Runtime

该论文提出了一种名为Library of Layers (LoL)的架构,通过动态选择Transformer层来提高模型效率和可解释性。

更新于 2026-11-03。作者:Abdellah Rahmani、Sean McLeish、Ang Li、Sanae Lotfi、Pascal Frossard、Micah Goldblum。

中文摘要

计算机程序员将相同的可重用计算原语(例如,条件语句或循环)按不同的顺序链接起来,以实现不同的算法。相比之下,现有的语言模型架构总是以相同的顺序执行其层。我们引入了层库(LoL),这是一种在推理过程中动态排列其层的架构,以解决手头的问题。LoL只有一个超参数,即其全局层库中变换器块的大小,这允许它在参数重用和稀疏性之间无缝过渡,将密集、深度递归和专家混合架构的参数效率和FLOPs效率权衡泛化到一个统一的家族中。我们表明,当在文本数据上预训练时,LoL在所有上述基线中均实现了有竞争力的性能。在合成的数独和迷宫数据上,我们观察到模型采用不同的层排列顺序来实现不同的解决方案策略,并且我们可以干预路由,迫使模型对一个特定的问题实例应用特定的解决方案策略。在多语言自然语言环境中,我们发现LoL根据语言和脚本选择不同的层排列模式。同样,我们在安全数据上训练LoL,并将探测器拟合到其路由输出,发现这些探测器可以以高AUROC区分安全文本和不安全文本。LoL为模型动态构建自己的计算图提供了通往未来的途径,从而实现更高效和可控的推理。

英文摘要

Computer programmers chain together the same reusable computational primitives, for example, conditional statements or loops, but in different orders to implement different algorithms. In contrast, existing language model architectures always execute their layers in the same order. We introduce Library of Layers (LoL), an architecture that dynamically orders its layers during inference to solve the problem at hand. LoL has a single hyperparameter, the size of its global library of transformer blocks, that allows it to transition seamlessly between parameter reuse and sparsity, generalizing the parameter-efficiency and FLOPs-efficiency tradeoffs of dense, depth-recurrent, and mixture of experts architectures in one unified family. We show that LoL achieves competitive performance with all three above baselines when pretrained on text data. On synthetic sudoku and maze data, we observe that the model employs distinct layer orderings to implement different solution strategies, and we can intervene on routing to force a model to apply a specific solution strategy to a problem instance. In a multilingual natural language setting, we find that LoL chooses different layer order patterns based on language and script. Similarly, we train LoL on safety data and fit probes to its router outputs, finding that these probes distinguish safe from unsafe text with high AUROC. LoL provides a path toward a future in which models dynamically compose their own computational graph, enabling more efficient and controllable reasoning.

解读

一句话总结

该论文提出了一种名为Library of Layers (LoL)的架构,通过动态选择Transformer层来提高模型效率和可解释性。

问题1:这篇论文想要解决什么具体问题?

问题2:论文的核心创新点是什么?

问题3:实验结果如何验证了方法的有效性?

问题4:这个研究的实际应用价值是什么?

来源