arXivDaily arXiv每日学术速递 周一至周五更新
arXiv 2504.06261cs.LGcs.CL
收藏

Hogwild! 推理:通过并发注意力实现并行LLM生成

Hogwild! Inference: Parallel LLM Generation via Concurrent Attention

Yandex;HSE University(俄罗斯高等经济大学);IST Austria(国际研究所)

Gleb Rodionov, Roman Garipov, Alina Shutova, George Yakushev, Erik Schultheis, Vage Egiazarian, Anton Sinitsin, Denis Kuznedelev, Dan Alistarh

AI总结:

针对LLM长推理时间问题,提出Hogwild!推理引擎,通过并行运行LLM工作者、并发更新注意力缓存让其自主协作,利用RoPE优化硬件利用率,无需额外微调即可实现并行推理,提升任务适用性。

摘要:

大语言模型(LLMs)已展现出通过高级推理、长文本生成和工具使用解决日益复杂任务的能力。解决这些任务通常涉及长推理时间的计算。在人类问题解决中,加快工作的常见策略是协作:将问题划分为子任务、同时探索不同策略等。近期研究表明,LLMs也可通过实现明确的协作框架(如投票机制或明确创建可并行执行的独立子任务)进行并行操作。然而,这些框架中的每一种可能并非适用于所有类型的任务,这会阻碍其适用性。在本研究中,我们提出一种不同的设计方法:并行运行LLM“工作者”,允许它们通过并发更新的注意力缓存同步,并提示这些工作者决定如何最佳协作。我们的方法允许LLM实例针对手头的问题提出自己的协作策略,同时“查看”并发KV缓存中彼此的记忆。我们通过Hogwild!推理实现这一方法:这是一个并行LLM推理引擎,其中同一LLM的多个实例使用相同的注意力缓存并行运行,可“即时”访问彼此的记忆。Hogwild!推理利用旋转位置嵌入(RoPE)避免重新计算,同时提高并行硬件利用率。我们发现,现代具备推理能力的LLMs无需额外微调即可直接使用共享键值缓存进行推理。

英文摘要:

Large Language Models (LLMs) have demonstrated the ability to tackle increasingly complex tasks through advanced reasoning, long-form content generation, and tool use. Solving these tasks often involves long inference-time computations. In human problem solving, a common strategy to expedite work is collaboration: by dividing the problem into sub-tasks, exploring different strategies concurrently, etc. Recent research has shown that LLMs can also operate in parallel by implementing explicit cooperation frameworks, such as voting mechanisms or the explicit creation of independent sub-tasks that can be executed in parallel. However, each of these frameworks may not be suitable for all types of tasks, which can hinder their applicability. In this work, we propose a different design approach: we run LLM "workers" in parallel , allowing them to synchronize via a concurrently-updated attention cache and prompt these workers to decide how best to collaborate. Our approach allows the LLM instances to come up with their own collaboration strategy for the problem at hand, all the while "seeing" each other's memory in the concurrent KV cache. We implement this approach via Hogwild! Inference: a parallel LLM inference engine where multiple instances of the same LLM run in parallel with the same attention cache, with "instant" access to each other's memory. Hogwild! Inference takes advantage of Rotary Position Embeddings (RoPE) to avoid recomputation while improving parallel hardware utilization. We find that modern reasoning-capable LLMs can perform inference with shared Key-Value cache out of the box, without additional fine-tuning.

机构、总结、中文摘要均由AI分析而来,可能存在错误,请以论文正文为准。

↑