用大模型自动找剪枝策略,精准控制计算量
AgenticPruner: MAC-Constrained Neural Network Compression via LLM-Driven Strategy Search
- 用三个智能体协作,通过迭代学习优化剪枝策略
- 在保持精度前提下,剪枝后计算量误差仅±5%以内
- 适合需要严格计算预算的边缘设备部署场景
神经网络剪枝对资源受限设备部署至关重要,但现有方法多关注参数量减少,未直接控制计算成本。本文提出AgenticPruner框架,利用大语言模型实现基于乘加(MAC)操作预算的优化。该框架包含三个专用智能体:分析模型结构与MAC分布的探测智能体、协调流程并监控分歧的主控智能体,以及由Claude 3.5 Sonnet驱动的分析智能体,可从历史尝试中学习最优策略。通过上下文学习,分析智能体使收敛成功率从48%提升至71%。在同构剪枝的图结构分组基础上,引入跨迭代模式分析,实现对目标MAC预算的自适应逼近,误差控制在用户定义容差范围内。我们在ImageNet-1K上验证了ResNet、ConvNeXt和DeiT等架构的有效性。对于CNN,剪枝后精度不降反升:ResNet-50达1.77G MACs时准确率为77.04%(+0.91%),ResNet-101达4.22G MACs时准确率为78.94%(+1.56%)。ConvNeXt-Small剪至8.17G MACs,参数减少45%,获得1.41倍GPU和1.07倍CPU加速。对于视觉变换器,计算量控制在用户容忍区间内(通常超限+1%~+5%,欠限-5%~-15%),证明其在需严格计算保障场景下的可行性。
原文摘要 · Abstract (English)
Neural network pruning remains essential for deploying deep learning models on resource-constrained devices, yet existing approaches primarily target parameter reduction without directly controlling computational cost. This yields unpredictable inference latency in deployment scenarios where strict Multiply-Accumulate (MAC) operation budgets must be met. We propose AgenticPruner, a framework utilizing large language models to achieve MAC-constrained optimization through iterative strategy learning. Our approach coordinates three specialized agents: a Profiling Agent that analyzes model architecture and MAC distributions, a Master Agent that orchestrates the workflow with divergence monitoring, and an Analysis Agent powered by Claude 3.5 Sonnet that learns optimal strategies from historical attempts. Through in-context learning, the Analysis Agent improves convergence success rate from 48% to 71% compared to grid search. Building upon isomorphic pruning's graph-based structural grouping, our method adds context-aware adaptation by analyzing patterns across pruning iterations, enabling automatic convergence to target MAC budgets within user-defined tolerance bands. We validate our framework on ImageNet-1K across ResNet, ConvNeXt, and DeiT architectures. On CNNs, our approach achieves MAC targeting while maintaining or improving accuracy: ResNet-50 reaches 1.77G MACs with 77.04% accuracy (+0.91% vs baseline); ResNet-101 achieves 4.22G MACs with 78.94% accuracy (+1.56% vs baseline). For ConvNeXt-Small, pruning to 8.17G MACs yields 1.41x GPU and 1.07x CPU speedup with 45% parameter reduction. On Vision Transformers, we demonstrate MAC-budget compliance within user-defined tolerance bands (typically +1% to +5% overshoot, -5% to -15% undershoot), establishing feasibility for deployment scenarios requiring strict computational guarantees.
Thank you to arXiv for use of its open access interoperability. PaperDance 不是 arXiv 官方产品;中文卡片由大模型生成,请以原文为准。