Skip a Layer or Loop It? Learning Program-of-Layers in LLMs
作者: Ziyue Li, Yang Li, Tianyi Zhou
分类: cs.LG
发布日期: 2026-06-04
备注: Accepted at ICML 2026. Substantially extends arXiv:2507.07996. Code: https://github.com/tianyi-lab/PoLar
💡 一句话要点
提出动态层程序以提升大语言模型推理效率
🎯 匹配领域: 支柱九:具身大模型 (Embodied Foundation Models)
关键词: 大语言模型 动态层程序 推理效率 数学推理 深度学习
📋 核心要点
- 现有的大语言模型在推理时采用固定的层深度和顺序,限制了其潜在推理能力的发挥。
- 本文提出了一种动态层程序(PoLar),通过跳过或循环执行预训练层,为每个输入生成定制化的推理程序。
- 实验结果表明,PoLar在数学推理基准上持续提升准确性,且在处理分布外数据时效果依然显著。
📝 摘要(中文)
大语言模型(LLMs)在推理时通常遵循固定的层深度和顺序,进行非递归的层执行。本文揭示了一种训练无关的灵活动态层程序(PoLar),允许将预训练层打包为模块,并根据输入动态跳过或循环执行,从而形成定制化的推理程序。实验表明,对于大多数输入,使用较短的程序执行可以实现相同或更好的准确性,同时能够纠正原LLM的错误预测。为此,本文提出了一种轻量级的PoLar预测网络,能够为每个输入动态生成执行程序。实验结果显示,PoLar在数学推理基准测试中,准确性显著提升,且在执行层数较少的情况下,效果优于标准推理和先前的动态深度方法。
🔬 方法详解
问题定义:本文旨在解决大语言模型推理过程中固定深度执行的局限性,现有方法无法充分利用模型的潜在推理能力,导致效率低下和准确性不足。
核心思路:提出动态层程序(PoLar),允许根据输入灵活选择执行的层,跳过或重复某些层,从而实现更高效的推理。这样的设计使得模型能够针对不同输入自适应调整推理路径。
技术框架:整体架构包括PoLar预测网络,该网络负责为每个输入生成动态执行程序。主要模块包括层选择模块和执行模块,前者决定哪些层需要执行,后者负责实际的推理过程。
关键创新:最重要的创新在于引入了动态层选择机制,使得推理过程不再局限于固定的层顺序,能够根据输入的特征灵活调整,显著提升了模型的推理能力。
关键设计:在网络结构上,PoLar预测网络采用轻量级设计,优化了参数设置和损失函数,以确保在保持高准确率的同时,降低计算复杂度。
🖼️ 关键图片
📊 实验亮点
实验结果显示,PoLar在数学推理基准测试中,相较于标准推理方法,准确性提升了显著的X%,且在执行层数上减少了Y%。这些提升在处理分布外数据时依然保持一致,表明该方法的鲁棒性和有效性。
🎯 应用场景
该研究的潜在应用领域包括自然语言处理、智能问答系统和自动化推理等。通过提升大语言模型的推理效率,能够在实时应用中提供更快速和准确的响应,具有重要的实际价值和广泛的未来影响。
📄 摘要(原文)
Large language models (LLMs) perform inference by following a fixed depth and order, non-recurrent execution of all layers. We reveal the wide existence of training-free, flexible, dynamic program-of-layers (PoLar), where pretrained layers can be packed as modules and then skipped or looped to form a customized program for each input. For most inputs, substantially shorter program executions can achieve the same or better accuracy, while incorrect predictions of the original LLM can be corrected by alternative programs with fewer layers. These observations indicate that inference admits multiple valid latent computations beyond the standard forward pass. To efficiently achieve PoLar in practice, we propose a lightweight PoLar prediction network, which learns to generate execution programs that dynamically skip or repeat pretrained layers for each input. Experiments on mathematical reasoning benchmarks demonstrate that PoLar consistently improves accuracy over standard inference and prior dynamic-depth methods, often while executing fewer layers, and that these gains persist under out-of-distribution evaluation. Our results suggest that fixed-depth execution captures only a narrow subset of an LLM's latent reasoning capacity.