Hogwild! Inference: Parallel LLM Generation via Concurrent Attention

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

Abstract

Hogwild! Inference is a novel parallel generation engine that enables multiple instances of a Large Language Model (LLM) to collaborate on a single task in real-time. By sharing a concurrent Key-Value (KV) cache, workers can observe and react to each other's tokens as they are generated. This approach utilizes a mathematical optimization involving Rotary Position Embeddings (RoPE) to eliminate the computational overhead typically associated with dynamic context re-encoding. Our evaluation across complex reasoning benchmarks shows that Hogwild! Inference achieves up to 3.6x speedups and significant accuracy improvements without specialized fine-tuning.

Introduction

Standard LLM inference is fundamentally sequential, generating text token-by-token. While parallelization strategies like "Skeleton-of-Thought" exist, they typically rely on rigid, pre-defined plans that lack the dynamic flexibility of human collaboration. Humans often pivot, correct mistakes, or divide labor on the fly—capabilities that are missing in current inference frameworks. Hogwild! Inference addresses this gap by allowing "telepathic" real-time interaction between multiple model workers through a shared attention mechanism.

Methodology: Concurrent Attention and the RoPE Trick

The core of Hogwild! Inference is a shared KV cache architecture that organizes data into three distinct blocks: a Common Cache for system prompts and finalized steps, a block for Other Workers' live tokens, and a block for the Current Worker's active generation.

Conceptual overview of Hogwild! Inference showing collaborative worker views.

To enable this real-time visibility without massive computational overhead, the authors introduce a "RoPE Trick." In standard models using Rotary Position Embeddings, incorporating tokens from another worker would normally require re-rotating all keys in the cache to maintain relative positions, a process with $O(n^3)$ complexity. Hogwild! Inference instead rotates the current query multiple times to match the relative positions of different cache blocks. This allows for "instant" visibility of peer tokens with minimal overhead.

Implementation of the RoPE trick for efficient concurrent attention.

Coordination is further enhanced through Zero-Shot Collaboration prompts. Workers are instructed to monitor the shared cache for redundancy and pivot if a sub-problem has already been addressed by a peer, effectively allowing the models to "reason to coordinate."

Experimental Setup

The system was evaluated on several high-difficulty reasoning and coding benchmarks, including:

  • LIMO: Complex math problems requiring extensive reasoning chains.
  • LiveCodeBench: Competitive programming tasks.
  • OlympiadBench & AIME’25: Advanced math and physics problems.
  • GSM8k×5: A synthetic test for simultaneous problem-solving.

Tests were conducted using various model families, including QwQ-32B, DeepSeek-R1, and Phi-4, primarily on NVIDIA L40S GPUs.

Key Results

Speed and Efficiency

Hogwild! Inference demonstrates near-linear scaling in generation speed. On a 32B parameter model, the system achieved nearly 2x speedup with 2 workers and 3.2–3.6x speedup with 4 workers compared to standard sequential inference.

Accuracy Gains

The collaborative approach consistently outperformed single-agent baselines and rigid parallel methods. On the LIMO dataset, Hogwild! workers converged to correct solutions significantly faster than baselines. The authors found that "instant" token-wise synchronization is far more effective than step-wise synchronization, as it allows for tighter coordination and faster error correction.

Model Scalability

While larger reasoning models (e.g., QwQ, DeepSeek-R1) showed strong emergent collaborative behavior, smaller models (below 4B parameters) occasionally struggled with "distraction" from the shared cache, leading to less coherent reasoning paths.

Discussion and Limitations

Despite its advantages, Hogwild! Inference faces challenges regarding context limits. Simultaneous generation by multiple workers causes the total context length to grow rapidly, potentially exceeding the model's trained sequence length. Additionally, the current evaluation of "collaborativeness" relies on proprietary metrics (GPT-4o as a judge). Future work may involve fine-tuning models specifically for concurrent environments or integrating speculative decoding to further enhance performance.

Conclusion

Hogwild! Inference represents a significant step toward truly collaborative AI. By enabling real-time, low-overhead communication between LLM instances, the framework unlocks new levels of efficiency and reasoning capability, proving that models can learn to work together effectively without explicit training for collaboration.

Summary updated

BibTeX
@inproceedings{rodionov2025hogwild,
  author = {Gleb Rodionov and Roman Garipov and Alina Shutova and George Yakushev and Erik Schultheis and Vage Egiazarian and Anton Sinitsin and Denis Kuznedelev and Dan Alistarh},
  title = {{Hogwild! Inference: Parallel LLM Generation via Concurrent Attention}},
  booktitle = {Advances in Neural Information Processing Systems},
  year = {2025},
  url = {https://openreview.net/forum?id=roKj4IwaVT},
}
Figure