TL;DR
FastTPS introduces a hardware-aware dataflow framework designed to accelerate the token generation phase of LLM inference on AI accelerators. By eliminating memory-bound KV Cache reorganization and aggressively fusing operators within both the attention and MLP blocks, it achieves up to a 6× speedup on modern NPUs while maintaining high numerical precision.
What Problem Does This Paper Address?
Large Language Model (LLM) inference is split into two distinct phases: the prefill phase (which processes the initial prompt) and the token phase (which autoregressively generates text, one token at a time). Because the token phase processes only a single token per iteration, it suffers from low parallelism and is heavily memory-bound.
AI accelerators often sit idle, starved for data, while waiting for model weights and the ever-growing Key-Value (KV) Cache to load from memory. Standard deep learning frameworks frequently offload KV Cache concatenation to the CPU, creating a massive performance bottleneck due to CPU-accelerator synchronization overhead. While existing acceleration methods like FlashAttention mitigate some of these bottlenecks, they can introduce numerical precision loss—a major drawback for accuracy-sensitive applications. FastTPS aims to solve these memory bottlenecks without sacrificing computational accuracy.
Methods
FastTPS tackles token-phase bottlenecks through three core hardware-aware optimizations:
- Global KV Cache Management (GKVC): Instead of relying on the CPU to dynamically concatenate new tokens to the KV Cache, GKVC pre-allocates a static 3D memory region directly in the accelerator's L3 cache. It uses an address-jumping strategy to write new tokens directly, eliminating memory fragmentation and the need for a costly
Concatoperator. - TPSFLAT (Fused Logit Attention Tiling): Tailored for the token phase, TPSFLAT fuses the entire attention pipeline—including Rotary Position Embedding (RoPE), $Q K^T$ matrix multiplication, Softmax, and $P V$ multiplication—directly within the tight constraints of the on-chip L1 cache. It also processes $Q$ and $K$ jointly to share sinusoidal tensors, drastically reducing memory roundtrips to L3.
- Fusion MLP: The Multi-Layer Perceptron (MLP) block typically accounts for two-thirds of an LLM's parameters. FastTPS introduces an interlaced layout of gate-up weights, combining the gate and up projections into a single, larger matrix multiplication. This larger operation is then fused with the SiLU activation and elementwise multiplication, backed by fine-grained pipeline scheduling to hide weight-loading latency.
Datasets
The authors evaluate FastTPS using popular open-source Large Language Models rather than training datasets, benchmarking them on the MLPerf workload suite tasks (such as Content Generation, Creative Writing, Summarization, and Code Generation). The evaluated models include:
- ChatGLM3-6B
- Llama2-7B
- Llama3-8B-instruct
- Llama3.2-1B
- Phi3-mini-4k-instruct
- Qwen2.5-7B
Key Insights and Ideas
- Ditching the CPU for KV Management: Moving KV Cache management entirely onto the AI accelerator via static pre-allocation removes the costly synchronization overhead between the CPU and the accelerator, unlocking continuous execution.
- Interlacing Weights for Fusion: Simply trying to fuse memory-bound activation functions with compute-bound matrix multiplications yields limited results. By physically rearranging the layout of the gate and up weights in memory, the authors created the necessary conditions to execute them as a single, highly efficient kernel.
- Precision without Compromise: Unlike FlashAttention, which can suffer from accuracy degradation as sequence lengths grow, FastTPS maintains up to 10× higher numerical accuracy because its optimizations focus on dataflow restructuring rather than mathematical approximations.
Key Results
- Overall Speedup: FastTPS achieved over a 5× speedup compared to standard HuggingFace implementations across multiple LLMs.
- Component-level Gains: The attention block saw speedups up to 13.07×, while the MLP block was accelerated by up to 3.14×.
- Hardware Efficiency: Tested on an AMD Ryzen AI 300 series NPU with BF16 precision, FastTPS delivered a 6× speed improvement for Phi3-mini-4k-instruct, sustaining an exceptional 93% peak memory bandwidth utilization.
- Cross-Hardware Performance: When benchmarked against competitive architectures like Intel's Lunar Lake NPU and Nvidia Nano, the FastTPS-powered AMD platform demonstrated superior token-per-second performance in several MLPerf categories.
Limitations and Future Work
- Hardware Specificity: While the principles of FastTPS (like hierarchical cache tiling and static memory allocation) are theoretically generalizable to GPUs, TPUs, and ASICs, the empirical evaluation in this paper is heavily centered on the AMD Ryzen AI NPU architecture.
- Integration with Compression: The current framework focuses on dense, high-precision (BF16) execution. The authors note that future work will explore integrating FastTPS with model compression techniques like weight quantization and distillation to push performance boundaries even further.
Summary updated