ChatPaper.aiChatPaper

Inferência Hogwild!: Geração Paralela de LLMs por meio de Atenção Concorrente

Hogwild! Inference: Parallel LLM Generation via Concurrent Attention

April 8, 2025
Autores: Gleb Rodionov, Roman Garipov, Alina Shutova, George Yakushev, Vage Egiazarian, Anton Sinitsin, Denis Kuznedelev, Dan Alistarh
cs.AI

Resumo

Modelos de Linguagem de Grande Escala (LLMs) têm demonstrado a capacidade de lidar com tarefas cada vez mais complexas por meio de raciocínio avançado, geração de conteúdo extenso e uso de ferramentas. A resolução dessas tarefas frequentemente envolve longos cálculos durante a inferência. Na resolução de problemas humanos, uma estratégia comum para agilizar o trabalho é a colaboração: dividindo o problema em sub-tarefas, explorando diferentes estratégias simultaneamente, etc. Pesquisas recentes mostraram que LLMs também podem operar em paralelo implementando frameworks explícitos de cooperação, como mecanismos de votação ou a criação explícita de sub-tarefas independentes que podem ser executadas em paralelo. No entanto, cada um desses frameworks pode não ser adequado para todos os tipos de tarefas, o que pode limitar sua aplicabilidade. Neste trabalho, propomos uma abordagem de design diferente: executamos "trabalhadores" LLM em paralelo, permitindo que eles se sincronizem por meio de um cache de atenção atualizado simultaneamente e solicitamos que esses trabalhadores decidam como colaborar da melhor forma. Nossa abordagem permite que as instâncias criem sua própria estratégia de colaboração para o problema em questão, enquanto "veem" o progresso parcial umas das outras no cache concorrente. Implementamos essa abordagem por meio do Hogwild! Inference: um mecanismo de inferência paralela de LLM onde múltiplas instâncias do mesmo LLM são executadas em paralelo com o mesmo cache de atenção, com acesso "instantâneo" aos tokens gerados umas pelas outras. O Hogwild! Inference aproveita os Rotary Position Embeddings (RoPE) para evitar recomputação enquanto melhora a utilização de hardware paralelo. Descobrimos que LLMs modernos com capacidade de raciocínio podem realizar inferência com cache compartilhado de Chave-Valor prontamente, sem necessidade de ajustes adicionais.
English
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 instances to come up with their own collaboration strategy for the problem at hand, all the while "seeing" each other's partial progress in the concurrent 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 generated tokens. 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.

Summary

AI-Generated Summary

PDF1076April 9, 2025