端到端动态稀疏性用于资源自适应的大语言模型推理
End-to-End Dynamic Sparsity for Resource-Adaptive LLM Inference
AI总结:
提出L2A框架,通过预算条件和输入感知的门控网络,实现层跳过、头剪枝和推理令牌减少的资源自适应推理,在Llama-3-8B和Qwen-3-4B上达到34%层稀疏性且性能损失小于0.6%。
摘要:
大语言模型(LLM)推理通常在静态资源假设下部署,即模型执行固定的计算图,而不考虑运行时环境。然而,现实世界的云基础设施本质上是动态的,其特点是可用性波动(例如,竞价实例抢占)和分层服务质量要求。在这种易变的环境中,静态模型缺乏灵活性:它们要么在资源约束下崩溃,要么在冗余操作上浪费计算。为弥合这一差距,我们提出学习分配(L2A),一个用于资源自适应推理的端到端框架。与仅基于输入难度的先前方法不同,我们将推理建模为一个受输入和运行时资源预算本身约束的分配问题。我们引入了轻量级的、受预算条件和输入感知的门控网络,并将其集成到LLM中。这些门控通过一个统一的目标进行训练,该目标联合优化任务性能、逻辑一致性和资源成本,沿三个维度匹配现实世界动态的表现形式:层跳过(针对内存和深度压力)、头剪枝(针对吞吐量争用)和推理令牌减少(针对延迟收紧)。这使得模型能够学习超越输入难度的预算感知策略:它根据实时资源动态自适应地配置其计算足迹,在资源允许时最大化推理深度,在预算紧张时强制执行严格的节俭。单个L2A模型在Llama-3-8B和Qwen-3-4B上描绘了整个计算-准确率帕累托前沿:在高达34%的实际层稀疏度下,它在GSM8K上保持与密集基线相差0.6%以内,且在分布外任务上零样本时保持相同差距,而每个静态或启发式基线都需要单独调整的模型,并且在可比的推理时间下仍下降5-10%。
英文摘要:
Large Language Models (LLMs) inference is typically deployed under a static resource assumption, where models execute a fixed computational graph regardless of the runtime environment. However, real-world cloud infrastructure is inherently dynamic, characterized by fluctuating availability (e.g., spot instance preemption) and tiered Quality-of-Service requirements. In such volatile settings, static models are inflexible: they either crash under resource constraints or waste compute on redundant operations. To bridge this gap, we propose Learning to Allocate (L2A), an end-to-end framework for resource-adaptive inference. Unlike prior methods that condition only on input difficulty, we formulate inference as a constrained allocation problem conditioned on both the input and the runtime resource budget itself. We introduce lightweight, budget-conditioned and input-aware gating networks integrated into the LLM. These gates are trained via a unified objective that jointly optimizes task performance, logical consistency, and resource costs along three axes matching how real-world dynamics manifest: layer skipping for memory and depth pressure, head pruning for throughput contention, and reasoning-token reduction for latency tightening. This lets the model learn a budget-aware policy beyond input difficulty alone: it adaptively configures its computational footprint with respect to real-time resource dynamics, maximizing reasoning depth when resources permit while enforcing strict frugality when budgets tighten. A single L2A model traces the entire compute-accuracy Pareto frontier on Llama-3-8B and Qwen-3-4B: at up to 34% realized layer sparsity, it stays within 0.6% of the dense baseline on GSM8K, with the same gap holding zero-shot on out-of-distribution tasks, while every static or heuristic baseline requires a separately tuned model and still drops by 5-10% at comparable inference time.
机构、总结、中文摘要均由AI分析而来,可能存在错误,请以论文正文为准。