arXiv:2608.05872cs.CLcs.AI2026-08

让大模型分层执行路径自动优化,不改参数也能提速提效。

MACRO: Markov Chain Routing of Transformer Layers

论文配图:MACRO: Markov Chain Routing of Transformer Layers
图 1 · 摘自论文原文
  • 用马尔可夫链建模分层路由,根据上下文动态决定跳过、重复或加残差。
  • 在多个小模型上平均准确率提升5.0%,最大提升达7.2%超过现有方法。
  • 无需训练时更新权重或标签,搜索时间减少9.4倍,适合部署优化场景。

标准大语言模型按顺序执行各层。动态分层路由(即通过层重复、跳过等操作寻找不同执行路径)可提升性能。但现有方法常需修改模型权重、对每个测试实例运行昂贵搜索循环,或依赖推理时的真值标签。本文提出马尔可夫链分层路由框架(MACRO),在不改变底层参数的前提下学习任务相关的执行路径。MACRO 将分层路由建模为依赖上下文的马尔可夫策略,条件包括层索引、计算预算阶段、方向偏移和操作上下文,支持跳过、重复及残差隐藏状态添加操作。马尔可夫路由分布通过训练数据反馈更新,并使用 top-k Viterbi 算法解码以提取高概率候选路径。我们在多个开源 LLM 上的多种推理与知识基准上评估 MACRO,结果表明其相比未路由基线平均准确率提升 5.0%,小模型上增益最显著。相较最优动态路由方法 Dr. LLM,MACRO 提升 7.2%,同时将路径搜索时间从 14.8 小时降至 1.6 小时(降低 9.4 倍)。代码已公开于 https://github.com/Batorskq/MACRO。

原文摘要 · Abstract (English)

Standard Large Language Models (LLMs) execute layers sequentially. Dynamic layer routing, i.e. search for a different execution path through layers involving layer repetitions, skips and other moves, can improve performance. Existing routing approaches often require updating model weights, running expensive search loops per test instance, or demand ground-truth labels during inference. In this work, we propose Markov Chain Routing of Transformer Layers (MACRO), a framework that learns task-specific routes over LLM architectures without modifying underlying parameters. MACRO models layer routing as a context-dependent Markov policy conditioned on layer indices, computation budget phases, directional displacements, and operator context, supporting skip, repeat, and residual hidden-state addition operations. The Markov route distribution is updated via feedback on training data and decoded using a top-k Viterbi algorithm to isolate high-probability candidate programs. We evaluate MACRO across diverse reasoning and knowledge benchmarks on multiple open-weight LLMs. MACRO achieves a +5.0% average accuracy improvement over the unrouted baselines, with largest gains on small models. We outperform the best dynamic routing approach Dr. LLM by +7.2%, while reducing route-search time 9.4x (from 14.8 to 1.6 hours). Our code is publicly available at https://github.com/Batorskq/MACRO.

动态路由大模型优化马尔可夫链Transformer

Thank you to arXiv for use of its open access interoperability. PaperDance 不是 arXiv 官方产品;中文卡片由大模型生成,请以原文为准。