Do Dynamic Routers Need Memory? HeRo: History-Aware Routing for Efficient LLM Inference

📄 arXiv: 2609.08189v1 📥 PDF

作者: Hongjin Lin, Wentao Wan, Keze Wang

分类: cs.AI, cs.CL

发布日期: 2026-09-08

备注: 9 pages, 2 figures


💡 一句话要点

提出HeRo以解决动态路由中的记忆缺失问题

🎯 匹配领域: 支柱二:RL算法与架构 (RL & Architecture) 支柱九:具身大模型 (Embodied Foundation Models)

关键词: 动态路由 大型语言模型 路由记忆 推理效率 深度学习优化

📋 核心要点

  1. 现有动态路由方法忽视了路由决策的顺序依赖性,导致性能下降。
  2. HeRo通过引入路由记忆机制,维护跨层的显式路由状态,从而改善动态路由的准确性。
  3. 在多个大型语言模型上,HeRo在保持高性能的同时显著减少了模型参数的使用。

📝 摘要(中文)

动态层路由通过学习为个别标记跳过层来降低大型语言模型(LLMs)的推理成本。然而,现有方法将每个路由决策视为仅依赖当前隐藏状态的局部操作,忽视了跨层深度的顺序和路径依赖性。为此,本文提出了历史感知路由(HeRo),引入路由记忆机制以维护跨模型深度的显式路由状态。该记忆通过线性注意力构建,逐步聚合先前的路由分数及其引发的残差更新,形成紧凑的历史表示。在每个路由层,路由器联合当前隐藏表示和累积状态选择执行的分支。HeRo在多个基准测试中表现优异,尤其是在Llama 3.1-8B模型上,成功绕过26.87%的模型参数,同时实现100.24%的密集模型性能。

🔬 方法详解

问题定义:本文旨在解决现有动态路由方法中忽视路由决策的顺序和路径依赖性的问题。这种局限性导致了模型性能的下降,尤其是在多步推理和代码生成任务中。

核心思路:论文提出的HeRo框架通过引入路由记忆机制,维护一个跨层的显式路由状态,使得每个路由决策不仅依赖当前的隐藏状态,还考虑到之前的决策,从而提高动态路由的准确性和适应性。

技术框架:HeRo的整体架构包括一个路由器和一个记忆模块。路由器根据当前的隐藏表示和累积的历史状态选择执行的分支,而记忆模块通过线性注意力机制聚合先前的路由分数和残差更新。

关键创新:HeRo的主要创新在于引入了显式的路由记忆机制,使得动态路由不仅依赖于当前状态,还能利用历史信息。这一设计显著区别于传统方法,后者仅基于当前隐藏状态进行决策。

关键设计:在实现上,HeRo仅训练轻量级的路由器和适配器,且不需要修改预训练参数。通过这种设计,HeRo在多个基准测试中表现出色,尤其是在Llama 3.1-8B模型上,能够在不牺牲性能的情况下减少模型参数的使用。

🖼️ 关键图片

fig_0
fig_1

📊 实验亮点

在Llama 3.1-8B模型上,HeRo成功绕过26.87%的模型参数,同时实现了100.24%的密集模型性能。在更紧凑的计算预算下,HeRo仍能保持97.01%的性能,同时绕过38.82%的模型参数,显示出其在动态路由中的优势。

🎯 应用场景

HeRo的研究成果在大型语言模型的推理效率提升方面具有重要应用价值。通过减少模型参数的使用,HeRo能够在资源受限的环境中实现高效推理,适用于智能助手、自动化内容生成等多个领域。未来,HeRo的设计理念也可能被应用于其他深度学习模型的优化中。

📄 摘要(原文)

Dynamic layer routing reduces the inference cost of Large Language Models (LLMs) by learning to skip layers for individual tokens. Existing methods, however, treat each routing decision as a local operation conditioned solely on the current hidden state which is a formulation that overlooks the sequential, path-dependent nature of routing across depth: earlier decisions shape the representations seen by downstream routers, and the layer-usage objective couples all decisions jointly. We propose History-Aware Routing (HeRo), a dynamic routing framework that resolves this mismatch by introducing a router memory mechanism to maintain an explicit routing state across model depth. The memory is constructed via linear attention, incrementally aggregating preceding routing scores and their induced residual updates into a compact history representation. At each routed layer, the router conditions jointly on this accumulated state and the current hidden representation to select the executed branch. Instantiated for token-wise FFN routing, HeRo trains only lightweight routers and adapters on a frozen backbone, requiring no modification to pretrained parameters. Across Llama 3.1-8B, Llama 2-7B, and Llama 2-13B, HeRo consistently achieves the highest aggregate performance retention among ten baselines. On Llama 3.1-8B, it bypasses 26.87% of model parameters while achieving 100.24% of dense model performance across seven benchmarks, and retains 97.01% while bypassing 38.82% of model parameters under a tighter computation budget. Ablation studies confirm that removing routing history consistently degrades performance, most notably on multistep reasoning and code generation, validating that explicit routing memory enables more accurate and adaptive dynamic routing than solely conditioning on hidden state.