arXiv:2505.17138cs.LGcs.AI2025-05被引 6

动态调整大模型推理压缩策略,实时适应内存变化。

RAP: Runtime Adaptive Pruning for LLM Inference

  • 用强化学习动态决定保留哪些模型组件以节省内存。
  • 在真实运行中同时优化模型参数与缓存占用,提升效率。
  • 适合需要低延迟、高吞吐的部署场景,如在线服务。

大型语言模型(LLMs)在语言理解与生成方面表现优异,但其巨大的计算与内存开销阻碍了实际部署。压缩技术可缓解此问题,但现有方法多依赖固定启发式规则,无法适应运行时内存波动或用户请求带来的异构键值缓存(KV-cache)需求。为此,我们提出RAP——一种基于强化学习的弹性剪枝框架,可动态调整压缩策略,实现运行时感知。具体而言,RAP实时跟踪模型参数与KV-cache之间的动态比例关系。鉴于前馈网络(FFNs)占据多数参数,而注意力层虽参数少却主导KV-cache生成,该强化学习代理会根据当前内存预算、工作负载和设备状态,仅保留最具价值的组件。大量实验表明,RAP显著优于现有最优基线,首次实现了在运行时联合优化模型权重与KV-cache。

原文摘要 · Abstract (English)

Large language models (LLMs) excel at language understanding and generation, but their enormous computational and memory requirements hinder deployment. Compression offers a potential solution to mitigate these constraints. However, most existing methods rely on fixed heuristics and thus fail to adapt to runtime memory variations or heterogeneous KV-cache demands arising from diverse user requests. To address these limitations, we propose RAP, an elastic pruning framework driven by reinforcement learning (RL) that dynamically adjusts compression strategies in a runtime-aware manner. Specifically, RAP dynamically tracks the evolving ratio between model parameters and KV-cache across practical execution. Recognizing that FFNs house most parameters, whereas parameter -light attention layers dominate KV-cache formation, the RL agent retains only those components that maximize utility within the current memory budget, conditioned on instantaneous workload and device state. Extensive experiments results demonstrate that RAP outperforms state-of-the-art baselines, marking the first time to jointly consider model weights and KV-cache on the fly.

大模型推理动态剪枝内存优化

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