Latency Prediction for LLM Inference on NPU Systems

LLM MQIA AI Systems and Hardware TPU/NPU
2026年06月16日
部署大语言模型(LLM)需在涵盖并行化策略、批处理技术及调度策略的庞大配置空间中进行探索。在此空间内开展穷举式性能测量既不现实,因此延迟预测成为系统优化的关键环节。尽管神经网络处理器(NPU)已作为专为大语言模型推理设计的加速器崭露头角,但目前尚无针对NPU的标准化延迟预测方法。具体而言,将既有研究成果直接迁移应用于NPU上的大语言模型推理延迟预测时,面临三大挑战:商用NPU微架构细节未公开、编译器优化行为难以预判,以及因动态长度分桶(bucketing)机制所引发的延迟非线性特性。 为此,我们提出LENS——一种无需依赖NPU微架构信息或编译器内部细节、且能准确建模分桶所导致延迟非线性的推理延迟估计算法。LENS对每个分桶仅需执行两次端到端(E2E)实测,即可基于这两组测量结果组合推算出任意输入与输出长度组合下的推理延迟。我们在来自多家厂商的NPU硬件平台、多种大语言模型以及多样化的实际工作负载上对LENS进行了全面验证,平均预测误差仅为2.15%。此外,我们还将LENS与两种方法论相近的基线方案进行了对比实验,进一步证实了其设计思路的有效性与先进性。
Deploying Large Language Models (LLMs) requires exploring a large configuration space spanning parallelization strategies, batching techniques, and scheduling policies. Exhaustive measurement across this space is impractical, making latency prediction essential for system optimization. While NPUs have emerged as accelerators designed for LLM inference, no prediction methodology has been established for them. Specifically, applying prior work to LLM inference latency prediction on NPUs faces three challenges: undisclosed microarchitecture of commercial NPUs, unpredictable compiler optimizations, and latency non-linearity induced by bucketing. We present LENS, a latency estimator that predicts NPU inference latency without information on the microarchitecture or compiler, and captures the non-linear latency induced by bucketing. LENS profiles each bucket with two end-to-end (E2E) measurements and composes the results to predict latency for arbitrary input-output length combinations. We validate LENS across NPUs from multiple vendors, several LLMs, and diverse workloads, achieving a mean prediction error of 2.15\%. We further compare LENS against two methodologically related baselines, confirming the validity of its approach.
许愿