Manuscript Offprint

arXiv:2610.34824

SPARTA: A Sparse Ternary LLM Accelerator with Adaptive Attention and Unified Datapath for Long-Context Edge Inference

Yanzhen Zhou, Zhengyu Han, Qunyou Liu, Zheyu Yan, Weihong Xu, Cheng Zhuo

Open access. PaperVantage converted this article to text, so layout and figures may differ from the original.

Yanzhen Zhou*, Zhengyu Han*, Qunyou Liu†, Zheyu Yan*, Weihong Xu*‡, Cheng Zhuo*

*Zhejiang University †Veloxis AI ‡Corresponding author

{yanzhenzhou, zhengyu.han, zyan2, wh.xu, czhuo}@zju.edu.cn, liuqun1006@gmail.com

Abstract—Large language models (LLMs) are increasingly deployed on edge devices, where limited memory capacity and bandwidth constrain both model size and inference efficiency. Recent ternary LLMs with 1.58-bit weights substantially reduce model memory footprint, largely eliminating weight storage as the primary bottleneck. As context lengths grow, however, the bottleneck shifts to the key-value (KV) cache and attention, whose memory traffic increases linearly with sequence length and dominates long-context inference. Existing LLM accelerators mostly handle ternary linear layers and attention with separate datapaths, resulting in inefficient end-to-end execution and costly hardware overhead. To address these challenges, we propose SPARTA, a sparse ternary LLM accelerator for efficient long-context edge inference. SPARTA is built on three key techniques: (1) SPARTA features a phase-aware sparse dataflow that jointly exploits heterogeneous sparsity across compute-bound prefill and memory-bound decode. (2) We design a unified compute fabric in SPARTA to map ternary SpMM/SpMV and bit-serial attention onto a shared processing-element, efficiently exploiting both zero-weight and zero-bit sparsity. (3) To improve the efficiency of long-context inference, we propose an adaptive attention engine with two-stage selection. It first applies coarse-grained page-level Top-k selection to reduce K-cache accesses, and then performs fine-grained token-level Top-p pruning to further minimize V-cache traffic. Across SOTA ternary LLMs, SPARTA reduces KV traffic by 4.1–4.8× over full attention and 1.3–1.5× over a SOTA sparse-attention scheme with task-dependent quality loss. Against an NVIDIA Jetson AGX Orin GPU, SPARTA achieves 3.9× higher generation throughput and 8.3× higher end-to-end energy efficiency on average; against an AMD Ryzen 7 9700X CPU, the improvements are 5.0× and 81.7×, respectively. Against SOTA LLM accelerators, SPARTA achieves 1.6–12.0× higher throughput than FIGLUT, TeLLMe, and MCBP, 2.0–4.2× higher energy efficiency, and 1.3–51.4× higher area efficiency.

I. INTRODUCTION

Large language models (LLMs) have achieved remarkable proficiency in open-ended dialogue, code generation, mathematical reasoning, and long-document understanding [1, 2], with recent advances extending to multi-modal perception and generation. LLM deployment is increasingly migrating from the cloud to the edge, where personal assistants, in-vehicle copilots, and robots run inference locally to protect private data, avoid network latency, and eliminate token costs [3, 4]. However, edge devices impose stringent memory, bandwidth, and power constraints, which become particularly severe for long-context inference.

(a) Model size and intelligence

Figure

(b) Per-token traffic split

Fig. 1: (a) Weight storage and intelligence retention vs. full-precision base models; (b) per-token weight and KV traffic.

Model weights and attention are the two dominant memory bottlenecks in long-context edge inference. Prior work reduces model size through low-bit quantization [5–9], while LUT-based designs accelerate mixed-precision execution [10]. As shown in Fig. 1(a), recent ternary LLMs [4, 11–13] further compress weights to 1.58 bits using {−1,0,+1}\{-1, 0, +1\} while preserving 88–97% of full-precision intelligence with only one-fifth of the storage of 8-bit models. Their ternary arithmetic also replaces multiplication with add, subtract, or skip operations. However, as the context grows to tens of thousands of tokens, the KV cache scales linearly and dominates per-token memory traffic, as shown in Fig. 1(b). Ternary quantization therefore alleviates weight traffic but exposes KV cache traffic as the new dominant bottleneck.

As summarized in Table I, existing LLM accelerators [14–19] optimize only subsets of the end-to-end inference pipeline and fall short in three key aspects:

(1) Limited exploitation of heterogeneous sparsity across inference phases: Ternary LLMs exhibit multiple forms of sparsity, including static zero-weight sparsity [18], bit-level sparsity in attention computation [14], and dynamic attention sparsity [20]. Meanwhile, prefill is dominated by compute-bound SpMM (sparse-dense matrix multiplication), whereas decode is dominated by memory-bound SpMV (sparse matrix-vector multiplication) and repeated accesses to weights and the KV cache. Existing ternary accelerators mainly optimize either ternary linear computation [15, 16, 21] or sparse attention [17], but fail to jointly exploit these complementary sparsities. This leads to suboptimal end-to-end inference efficiency.

(2) Limited datapath unification for sparse ternary

TABLE I: Comparison of LLM accelerators.

DesignPrecisionLinearAttentionEfficiencyMax Seq.
MCBP [14]W8/A8SparseSparse (Top-k)Medium8K
Vec-LUT [15]W1.58/A8DenseDenseLow-
TeLLMe [16]W1.58/A8DenseDenseLow1K
TENET [17]W1.58/A8DenseSparse (Static)Medium1.5K
VitaLLM [19]W1.58/A8DenseSparse (Top-k)Medium4K
SPARTAW1.58/A8SparseSparse (Adaptive)High32K

inference: Ternary LLMs exhibit substantial precision heterogeneity: linear layers use {−1,0,+1}\{-1,0,+1\} weights, whereas attention requires multi-bit computation to preserve model quality. Existing designs [16, 17, 21] typically employ lookup-table-based ternary matrix-multiplication engines. However, these LUT-based PEs are optimized for dense ternary computation and cannot efficiently support sparse SpMM and SpMV at the same time. As a result, they fail to exploit the abundant zero-weight sparsity in ternary LLMs and often require separate datapaths for linear layers and attention [19, 22].

(3) Inefficient sparse attention for long-context inference: Prior accelerators support either dense [16, 21], fixed-pattern [17], or Top-k [14, 19, 23] attention, making them poorly suited to long contexts. Fixed-pattern [17, 24] schemes cannot capture input-dependent attention sparsity, while fixed Top-k selection [14, 19, 23] imposes a rigid token budget. A small budget may discard important tokens, whereas a large budget introduces redundant KV-cache accesses. Consequently, existing schemes cannot adapt the selected KV set to the highly variable attention distributions across layers, heads, and inputs.

To address these limitations, we present SPARTA, a sparse ternary LLM accelerator for long-context edge inference. SPARTA systematically exploits heterogeneous sparsity across inference phases and kernels. As shown in Table I, SPARTA is, to the best of our knowledge, the first accelerator to efficiently support sequence lengths beyond 8K.

We make the following contributions:

  • Sparse Dataflow for Ternary LLMs: We identify complementary sparsity across ternary weights, attention bit patterns, and KV accesses. We propose a phase-aware sparse dataflow that jointly exploits these sparsity opportunities across inference phases, enabling efficient long-context inference under edge resource constraints.

  • Unified Datapath for Sparse Inference: We formulate ternary SpMM/SpMV and bit-serial QK/PV as a common outer-product conditional-accumulation primitive. Then, we propose a shared compute fabric design with a unified datapath for various sparsity patterns. The proposed design can be reused to accelerate compute-bound prefill, memory-bound decode, ternary linear layers, and sparse attention, while benefiting from sparsity.

  • Adaptive Sparse Attention: To improve long-sequence inference efficiency, we propose a two-stage adaptive attention scheme that combines coarse-grained page-level Top-k selection with fine-grained token-level Top-p pruning to progressively reduce K and V traffic. We address the implementation complexity with an adaptive sparse attention engine that integrates a bitonic Top-k selector and a streaming-histogram Top-p engine to efficiently realize the proposed dataflow.

Figure

(a)

Figure

(b)

Fig. 2: (a) Decoder block of ternary LLMs; (b) Content-aware sparse attention.

  • Key Results: Across SOTA ternary LLMs [12, 25], SPARTA reduces KV traffic by 4.1−4.8×4.1 - 4.8 \times, with task-dependent quality loss. Compared with an NVIDIA Jetson AGX Orin GPU, SPARTA achieves 3.9×3.9 \times higher generation throughput and 8.3×8.3 \times higher end-to-end energy efficiency; the corresponding gains over an AMD Ryzen 7 9700X CPU are 5.0×5.0 \times and 81.7×81.7 \times. Against SOTA LLM accelerators [10, 14, 16, 17], SPARTA achieves 1.6−12.0×1.6 - 12.0 \times higher throughput than FIGLUT, TeLLMe, and MCBP, and 2.0−4.2×2.0 - 4.2 \times higher energy efficiency across prefill and decode.

References (78)