Introduction
Running Large Language Models (LLMs) like GPT-4 or LLaMA on edge devices—such as smartphones, IoT nodes, and local servers—presents significant challenges due to the models' massive memory footprints. Standard partitioning techniques typically split models at the layer level, assigning different layers to different devices. However, the autoregressive nature of LLM inference causes the Key/Value (K/V) cache to grow with each generated token, eventually exceeding the memory capacity of individual edge nodes and causing significant latency spikes.
Proposed Methodology: Fine-Grained Partitioning
To address these limitations, this paper introduces a resource-aware partitioning strategy that operates at the attention head level. Instead of treating an entire decoder layer as an indivisible block, each individual attention head and its corresponding K/V cache are treated as independent units.
Key Components
- Attention Head-Level Partitioning: By breaking layers into smaller "Lego bricks," the system can more effectively utilize the fragmented memory across a network of heterogeneous devices. Unlike layers, which must be processed sequentially, attention heads within the same layer can be computed in parallel.
- Myopic Allocation Algorithm: A centralized controller periodically executes a "myopic" algorithm. This algorithm evaluates the current state of the network—including available memory, compute power, and bandwidth—to optimize block placement using a scoring function $S(i, j, \tau)$.
- Dynamic Migration: As the K/V cache grows during inference, the system can dynamically migrate attention heads to less burdened devices. The controller weighs the migration cost against the potential reduction in inference delay to maintain optimal performance.
Experimental Setup
The proposed approach was evaluated using a custom discrete-event simulator. The simulation modeled a single-layer decoder-only Transformer (32 heads, 2048 embedding dimension) across a heterogeneous network of 25 devices with memory capacities ranging from 2 to 8 GB and compute power from 5 to 50 GFLOPS. The performance was benchmarked against EdgeShard (static layer-based partitioning) and Galaxy (tensor/sequence parallelism).
Results and Discussion
The fine-grained approach demonstrated significant improvements in both latency and memory efficiency. In large-scale simulations involving 1000 tokens, the resource-aware method maintained inference latency under 200 seconds, whereas the EdgeShard baseline surpassed 1000 seconds—representing a 9–10x speedup.
Furthermore, the dynamic allocation strategy proved more memory-efficient, requiring approximately 6 GB of total memory for a 1000-token sequence, compared to over 7.5 GB for competing frameworks. This efficiency stems from the ability to fill small "memory gaps" across the network that larger layer-level blocks cannot occupy.
Conclusion and Future Work
This research highlights that the K/V cache, rather than just model weights, is the primary bottleneck for edge-based LLM inference. Fine-grained, dynamic partitioning at the attention head level offers a viable path toward low-latency execution on resource-constrained hardware. Future work will explore extending this approach to multi-layer models and incorporating predictive "foresight" into the allocation algorithm to further optimize resource utilization.
Summary updated