Introduction
Large Language Models (LLMs) like LLaMA2-7B have revolutionized natural language processing but remain difficult to deploy on edge devices due to extreme memory and bandwidth requirements. A 4-bit quantized 7B model requires approximately 3.5GB of memory, which nearly exhausts the 4GB capacity of common embedded FPGA platforms like the Xilinx KV260. This paper presents a hardware-software co-design that achieves efficient LLM decoding by maximizing memory utilization and bandwidth efficiency on such resource-constrained hardware.
Proposed System Architecture
The core challenge in deploying a 7B model on a 4GB device is the overhead of the operating system. Standard Linux distributions consume significant RAM, leaving insufficient space for the model weights and the Key-Value (KV) cache. To overcome this, the researchers implemented a bare-metal execution environment. By removing the OS, the system reclaims critical memory, allowing the 3.5GB model and a 1024-token KV cache to fit within the 4GB DDR4 limit, reaching a staggering 93.3% capacity utilization.
The architecture partitions tasks between the Processing System (PS) CPU, which handles tokenization and decoding logic, and the Programmable Logic (PL) hardware accelerator. The PL contains a Vector Processing Unit (VPU) with a dot engine for matrix-vector multiplications and a Special Processing Unit (SPU) for non-linear operations like RoPE, Softmax, and RMSNorm.
Optimization Strategies
To address the bandwidth-bound nature of LLM decoding, several key optimizations were implemented:
Quantization and Data Arrangement
The system employs W4A16 quantization (4-bit weights, 16-bit activations) and KV8 quantization (8-bit KV cache). To maximize memory throughput, weights, scales, and zero points are interleaved in DDR4 memory. This arrangement enables the AXI bus to perform long, sequential burst transfers, achieving 85% of the theoretical bandwidth limit.
Operator Fusion Pipeline
Rather than executing layers sequentially with frequent memory access, the design uses an operator fusion pipeline. This approach overlaps heavy matrix computations with smaller miscellaneous operations.
As shown in the pipeline diagram, operations like RoPE, Softmax, and Quantization are executed in parallel with the main linear projections. This "hides" the latency of these operators, ensuring the hardware remains primarily occupied with the bottleneck task: moving weights from memory to the computation engine.
Performance and Results
The system was evaluated using the LLaMA2-7B model. The implementation achieved a measured decoding speed of 4.9 tokens per second, with a theoretical peak of 5.8 tokens/s.
Notably, the 84.5% bandwidth utilization efficiency significantly outperforms software-based solutions on other edge platforms, such as llama.cpp on a Raspberry Pi 4B (2.8%) and even the NVIDIA Jetson Orin Nano (79.2%) using optimized libraries. The entire system operates at a low power profile of just 6.57W.
Conclusion
By stripping away the operating system and employing a bandwidth-area optimized hardware accelerator, this work demonstrates that 7B parameter LLMs can be effectively deployed on 4GB embedded FPGAs. The system pushes the limits of the KV260 hardware, achieving high throughput and exceptional energy efficiency, paving the way for sophisticated AI capabilities in low-power edge applications.
Summary updated