2025-10-15 · 进阶 · 自然语言处理 · 机器学习

Dr.LLM: Dynamic Layer Routing in LLMs

Dr.LLM通过动态层路由技术,在不改变预训练模型权重的情况下,提高了大型语言模型在推理任务中的准确性和效率。

更新于 2025-10-16。作者:Ahmed Heakl、Martin Gubri、Salman Khan、Sangdoo Yun、Seong Joon Oh。

中文摘要

大型语言模型(LLMs)会处理每个标记,遍历整个Transformer层的所有层,这导致在简单查询上浪费计算,对于需要更深层推理的复杂查询则灵活性不足。自适应深度方法可以提高效率,但之前的方法依赖于昂贵的推理时搜索、架构更改或大规模重新训练,并且在实践中,尽管效率有所提高,但往往降低了准确性。我们引入了Dr.LLM,即针对LLMs的动态层路由,这是一个可后装的框架,它为预训练模型配备了轻量级的逐层路由器,这些路由器决定跳过、执行或重复一个块。路由器通过显式监督进行训练:使用蒙特卡洛树搜索(MCTS),我们推导出高质量的层配置,在计算预算下保持或提高准确性。我们的设计,包括用于稳定路由的窗口池化、具有类别平衡的焦点损失以及瓶颈MLP路由器,确保了在类别不平衡和长序列下的鲁棒性。在ARC(逻辑)和DART(数学)数据集上,Dr.LLM将准确性提高了高达+3.4%,同时平均每个例子节省了5层。路由器在域外任务(MMLU、GSM8k、AIME、TruthfulQA、SQuADv2、GPQA、PIQA、AGIEval)中推广,只降低了0.85%的准确性,同时保持了效率,并且比之前的路由方法提高了高达+7.7%的准确性。总的来说,Dr.LLM表明,通过显式监督的路由器可以改造冻结的LLMs,实现预算感知、以准确性为导向的推理,而无需更改基础权重。

英文摘要

Large Language Models (LLMs) process every token through all layers of a transformer stack, causing wasted computation on simple queries and insufficient flexibility for harder ones that need deeper reasoning. Adaptive-depth methods can improve efficiency, but prior approaches rely on costly inference-time search, architectural changes, or large-scale retraining, and in practice often degrade accuracy despite efficiency gains. We introduce Dr.LLM, Dynamic routing of Layers for LLMs, a retrofittable framework that equips pretrained models with lightweight per-layer routers deciding to skip, execute, or repeat a block. Routers are trained with explicit supervision: using Monte Carlo Tree Search (MCTS), we derive high-quality layer configurations that preserve or improve accuracy under a compute budget. Our design, windowed pooling for stable routing, focal loss with class balancing, and bottleneck MLP routers, ensures robustness under class imbalance and long sequences. On ARC (logic) and DART (math), Dr.LLM improves accuracy by up to +3.4%p while saving 5 layers per example on average. Routers generalize to out-of-domain tasks (MMLU, GSM8k, AIME, TruthfulQA, SQuADv2, GPQA, PIQA, AGIEval) with only 0.85% accuracy drop while retaining efficiency, and outperform prior routing methods by up to +7.7%p. Overall, Dr.LLM shows that explicitly supervised routers retrofit frozen LLMs for budget-aware, accuracy-driven inference without altering base weights.

解读

一句话总结

Dr.LLM通过动态层路由技术,在不改变预训练模型权重的情况下,提高了大型语言模型在推理任务中的准确性和效率。

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

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

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

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

来源

机器可读索引:llms.txt