arXiv:2610.08403cs.LGOct 2026

Manuscript Offprint

arXiv:2610.08403

SSR: Sparse Segment Reduction for Ternary GEMM Acceleration

Adeline Pittet, Shien Zhu, Valérie Verdan, Gustavo Alonso

Adeline Pittet, Shien Zhu, Valérie Verdan, Gustavo Alonso

Systems Group, ETH Zurich, Switzerland

apittet@ethz.ch, shien.zhu@inf.ethz.ch, verdanv@student.ethz.ch, alonso@inf.ethz.ch

Abstract—Large Language Models (LLMs) require substantial computational resources, limiting their deployment on resource-constrained hardware. Ternary LLMs mitigate these demands through weight quantization via ternary values, achieving significant compression often with 50 – 90% sparsity. However, existing approaches have limitations: methods optimized for ternary weights, such as BitNet, redundant segment reduction (RSR), and its improved version RSR++, do not exploit sparsity structures, while conventional sparse formats neglect ternary characteristics, foregoing dual optimization opportunities.

In this paper, we introduce Sparse Segment Reduction (SSR), a ternary matrix multiplication method designed to accelerate the inference of ternary LLMs and general Ternary Weight Networks (TWNs). SSR has a dedicated optimized ternary data format and an algorithm that systematically exploits sparsity patterns through computation trees that scale with the sparsity. SSR provides theoretical gains with asymptotically faster inference than RSR++ for sparsity above 50%, while practical evaluations reveal performance improvements across all sparsity levels. Evaluation results show that SSR achieves 2.1-11.3× speedup over RSR++ on ternary GEMM with 45-95% sparsity. Furthermore, SSR achieves 3.5-6.3× end-to-end speedup and 4.9% of memory saving over RSR++ on the Llama-3 1B model inference.

Index Terms—Sparse GEMM, Ternary LLM, Edge Computing

I. INTRODUCTION

Large Language Models (LLMs) have emerged as a powerful tool across many domains, yet their substantial computational and memory requirements limit their usage on resource-constrained devices [1]. Quantization addresses this [2], [3] by reducing bit precision of weights and activations, decreasing the memory usage, the energy consumption, and the inference time while aiming to close the accuracy gap. For example, Nvidia and AMD GPUs adopt FP8, FP6, and even FP4 quantization for LLM inference.

Binary Weight Networks (BWNs) constrain weights to {−1,+1}\{-1,+1\} for extreme compression, which introduces an accuracy drop and requires dense computation [4]. Ternary Weight Networks (TWNs) expand the weight space to {−1,0,+1}\{-1,0,+1\}, enabling higher accuracy and efficiency while introducing sparsity [5], [6]. Compared with FP8 quantization, TWNs achieve a 4×4\times compression and replace the multiplication operations in GEMM with lightweight addition and subtraction operations [5], [7]. Ternary-Weight LLMs apply TWNs to large language models, reducing size and accelerating inference [8]. Ternary-Weight LLMs inherit the features of TWNs in the LLM era and share the same addition-based sparse GEMM on ternary weights and dense activations.

Ternary LLM and general TWNs exhibit high sparsity which frequently exceeds 50% and even surpasses 90% in practice [9]. For example, induced weight sparsity by learning binary gate variables reaches 95.84% [10], Faraone et al. achieve 97.6% sparsity in ternary networks using quantization threshold regularization and pruning [11], and up to 99.58% has been reported in recent work [9]. Since zero-valued weights contribute nothing to matrix multiplications, this inherent sparsity provides significant opportunities for computational and memory optimizations. Conservative methods typically target around 50% sparsity for balanced trade-offs [12], [13], whereas in practice 90–95% sparsity is achievable without notable accuracy loss [9].

However, the ternary-weight dense-activation sparse GEMM (ternary GEMM) is under-optimized. Traditional sparse formats such as CSR, JDS, and COO [14]–[16] are designed for general scientific computing and cannot exploit the structural properties of ternary networks. Similarly, general-purpose libraries such as Eigen and PyTorch Sparse provide optimized sparse GEMM kernels but do not exploit the ternary structure of TWNs. Consequently, existing inference frameworks fail to translate the given structural properties into meaningful computational benefits. For example in our experiments, PyTorch Sparse GEMM based on CSC is slower than PyTorch Dense GEMM with 90% or lower sparsity on CPUs, which is much lower than the 10× theoretical speedup of sparse GEMM. Though related works have proposed algorithms that use the ternary structure such as BitNet.cpp [17], RSR, and RSR++ [18], they do not fully exploit the sparsity feature of ternary weights to reduce the computation complexity. In addition, their data formats have redundant values that brings larger memory footprint in ternary GEMM.

In this paper, we propose Sparse Segment Reduction (SSR) to achieve efficient ternary GEMM for ternary LLMs and general TWNs. We achieve asymptotic improvements over BitNet [17] and RSR++ [18] in ternary GEMM independent of hardware or structured sparsity constraints. SSR systematically leverages the inherent sparsity patterns of TWNs through preprocessing stages that exclude zero-pattern elements, yielding compact computation trees that scale well with sparsity. During inference, these optimizations eliminate redundant

© 2026 EDAA. This is the author's version of the work. It is posted here for personal use. The definitive version was published in the Proceedings of the Design, Automation & Test in Europe Conference (DATE 2026), DOI: 10.23919/DATE69613.2026.11539457.

operations and reduce memory traffic, achieving asymptotically superior performance for matrices with sparsity levels exceeding 50%, while delivering practical performance gains across low and high sparsity levels compared to RSR++ [18].

We implement the SSR algorithm with code optimizations like unrolling, AVX2 SIMD, and multi-threading on CPUs (code is available at [19]). Evaluation results show that SSR achieves 2.1−11.3×2.1-11.3\times speedup over RSR++ on ternary GEMM with 45-95% sparsity. SSR also achieves up to 59.4% faster speed over PyTorch Sparse GEMM. SSR achieves 1.8−7.5×1.8-7.5\times speedup up to 17.8% of memory saving over RSR++ at the layer level on Llama-MLP blocks. Furthermore, SSR achieves 3.5−6.3×3.5-6.3\times end-to-end speedup and 4.9% memory saving over RSR++ on Llama-3 1B model inference.

References (32)