Inference Acceleration for Large Language Models on CPUs

LLM MQIA AI Systems and Hardware OLPP EDIO
2024年03月04日
近年来,大型语言模型在各种自然语言处理任务中表现出了显著的性能。然而,将这些模型部署到实际应用中通常需要高效的推理解决方案来处理计算需求。本文探讨了利用CPU加速大型语言模型推理的方法。具体而言,我们引入了一种并行化方法,通过利用现代CPU架构的并行处理能力和批处理推理请求来提高吞吐量。我们的评估显示,加速推理引擎在每秒生成的标记方面提高了18-22倍。对于更长的序列和更大的模型,改进更为明显。此外,我们还可以在同一台机器上运行多个工作进程,通过NUMA节点隔离进一步提高标记/秒。在表2中,我们使用4个工作进程获得了额外的4倍改进。这也将使基于Gen-AI的产品和公司更加环保,我们的估计显示,推理的CPU使用量可以将LLMs的功耗降低48.9%,同时提供生产就绪的吞吐量和延迟。
In recent years, large language models have demonstrated remarkable performance across various natural language processing (NLP) tasks. However, deploying these models for real-world applications often requires efficient inference solutions to handle the computational demands. In this paper, we explore the utilization of CPUs for accelerating the inference of large language models. Specifically, we introduce a parallelized approach to enhance throughput by 1) Exploiting the parallel processing capabilities of modern CPU architectures, 2) Batching the inference request. Our evaluation shows the accelerated inference engine gives an 18-22x improvement in the generated token per sec. The improvement is more with longer sequence and larger models. In addition to this, we can also run multiple workers in the same machine with NUMA node isolation to further improvement in tokens/s. Table 2, we have received 4x additional improvement with 4 workers. This would also make Gen-AI based products and companies environment friendly, our estimates shows that CPU usage for Inference could reduce the power consumption of LLMs by 48.9% while providing production ready throughput and latency.
许愿