TL;DR: Modern LLMs increasingly rely on long-context optimizations like Retrieval-Augmented Generation (RAG) and sparse attention, but these introduce massive memory processing overheads. By conceptualizing these optimizations into a unified four-stage pipeline and offloading memory-bound stages to an FPGA, this research demonstrates up to a 2.2× speedup and a 4.7× reduction in energy consumption compared to GPU-only baselines.
The Bottleneck of Long Contexts
As Large Language Models (LLMs) scale toward "infinite" context windows (processing 128k to 1M+ tokens), the standard approach of storing every Key-Value (KV) pair becomes a severe bottleneck. To mitigate this, researchers have developed various algorithmic optimizations, including sparse attention (processing only a subset of tokens), RAG (fetching external documents), and compressed contextual memory.
However, these optimizations are typically treated in isolation, lacking a systematic understanding of their hardware implications. The authors' profiling reveals a startling reality: these memory processing steps actually consume between 22% and 97% of total inference latency. Furthermore, while GPUs excel at dense mathematical computations, they struggle with the irregular memory access patterns and "skinny" matrix operations required by these algorithms. As context grows, the time spent "finding" information eventually dwarfs the time spent "thinking" (the actual LLM forward pass).
A Unified Memory Processing Pipeline
Despite looking different on the surface, optimizations like RAG and Sparse Attention are functionally identical at the hardware level—both involve searching a large index to find a small subset of relevant data. The authors propose a conceptual framework that formalizes memory processing into four universal stages:
- Prepare Memory: Preprocessing raw data into a structured format (e.g., linear projections).
- Compute Relevancy: Assigning importance scores to memory entries (e.g., dot products or BM25 scores).
- Retrieval: Selecting the top-scoring entries (e.g., Top-K search).
- Apply to Inference: Integrating the retrieved data back into the decoding process.
Heterogeneous Hardware: The GPU-FPGA Solution
Recognizing that the Prepare and Apply stages are compute-bound (ideal for GPUs), while Compute Relevancy and Retrieval are memory-bound and irregular (ideal for FPGAs), the researchers designed a GPU-FPGA heterogeneous system.
They built a prototype using an AMD MI210 GPU and an Alveo U55C FPGA connected via PCIe. By utilizing Peer-to-Peer (P2P) data transfer, the system bypasses system DRAM, allowing direct communication between the GPU and FPGA with minimal latency. Custom FPGA kernels were designed using a streaming dataflow architecture to maximize the effective bandwidth of the FPGA's High-Bandwidth Memory (HBM). While GPUs have higher peak memory bandwidth, their effective bandwidth drops significantly during irregular tasks like Top-K searching. FPGAs, conversely, can be customized to maintain high efficiency for these specific, "messy" data patterns.
Evaluation and Key Results
The system was evaluated across several state-of-the-art LLM optimization frameworks, including sparse attention (DeepSeek V3.2, Qwen 3 8B, Llama 3.1 8B), RAG (evaluated on a Wikipedia dump of up to 20 million documents), and compressed memory (Qwen 2.5 7B), with sequence lengths ranging from 4k to 1 million tokens.
- End-to-End Speedup: The heterogeneous system achieved 1.04× to 2.2× faster inference across various models.
- Kernel Acceleration: Specific memory processing steps saw speedups of 1.5× to 5.7× for sparse attention and 5.1× to 7.7× for RAG.
- Energy Reduction: The system reduced energy costs by 1.1× to 4.7× (geomean). Because FPGA kernels operate at significantly lower power than their GPU equivalents, the energy savings per request are substantial even when speedups are modest.
- Scalability: Performance gains generally increased alongside sequence length or document count, highlighting the system's utility for ultra-long context applications.
(Note: While tested on AMD hardware, the authors estimate similar benefits when pairing an NVIDIA A100 with the same FPGA.)
Limitations and Future Directions
While highly effective for single requests or small batches, the system exhibits batching sensitivity. For certain methods (like MemAgent), high batch sizes (e.g., > 2) allow the GPU to reuse weights so efficiently that the FPGA becomes a bottleneck. The authors suggest a "dynamic fallback" to GPU-only mode for such scenarios.
Additionally, developing custom FPGA kernels involves significant programming overhead, prompting future exploration into design automation to help researchers deploy new algorithms more easily. Finally, while the current prototype relies on separate PCIe cards, integrating GPU and FPGA-like logic onto a single heterogeneous ASIC could eliminate PCIe overhead and further maximize efficiency.
Summary updated