arXiv:2610.22435cs.LGOct 2026

Manuscript Offprint

arXiv:2610.22435

TRACE: Transformer Residual Activation Codebook Encoding for Communication-efficient Distributed Edge Inference

Muhammad Azlan Qazi, Alexandros Iosifidis, Qi Zhang

Muhammad Azlan Qazi, Alexandros Iosifidis, and Qi Zhang

Abstract—Distributed Transformer inference across co-located edge devices is fundamentally communication-bound, as exchanging activations between sequence-parallel partitions dominates inference latency under commodity edge bandwidths. Existing compression schemes reduce this cost but retain a structural bottleneck: the received data must still undergo key/value projection before attention can proceed, serializing computation behind communication. This paper presents Transformer Residual Activation Codebook Encoding (TRACE), a framework that addresses these limitations. TRACE places a Vector Quantizer (VQ) at the post-attention residual of every Transformer layer and precomputes codebook-indexed key/value representations. During inference, exchanged activations are encoded into compact codebook indices, allowing receivers to directly recover keys and values through table lookup instead of executing the downstream computations required to derive them. By eliminating the received data downstream computation, TRACE enables communication-computation overlap and reduces a key latency bottleneck in distributed Transformer inference. A hierarchical clustering further structures the learned codebook into a multi-resolution hierarchy, enabling runtime adaptation of the communication bitrate without retraining. The framework supports two operating variants: one prioritizing accuracy and the other balancing accuracy and efficiency through buffer-compatible quantization. Experiments on ViT-Base (ImageNet-1K and CIFAR-100) and ViViT-B (UCF-101) show that TRACE achieves up to 1.89% higher accuracy and up to 1.27×1.27 \times end-to-end inference speedup compared with the state-of-the-art VQ-based distributed inference framework. Compared with uncompressed sequence-parallel inference, TRACE reduces communication overhead by up to 22,624×22,624 \times.

Index Terms—Distributed inference, edge computing, communication-efficient machine learning, model compression, Transformer neural networks, vector quantization.

I. INTRODUCTION

TRANSFORMER architectures have emerged as the dominant computational paradigm across vision, language, and multimodal artificial intelligence. Trained at scale, they now define state-of-the-art performance across perception, understanding, and generation tasks [1]-[7]. Their accuracy, however, comes at a steep computational and memory price: a single forward pass through a state-of-the-art Transformer model involves billions of floating-point operations and hundreds of megabytes of intermediate activations, making single-device deployment on resource-constrained edge nodes impractical.

Centralized cloud serving is increasingly unsuitable for IoT workloads. End-user latency targets, privacy guarantees, energy budgets, and unreliable wide-area connectivity all motivate to bring inference at the network edge [8]–[10]. When a single edge device cannot host the model alone, the natural answer is collaborative or distributed inference, in which a model is partitioned across multiple co-located edge nodes whose aggregate compute and memory cover the model's demands [11]–[13]. Three parallelism families have been developed for this purpose, namely tensor parallelism in Megatron-LM [14], pipeline parallelism in GPipe [15], and sequence parallelism [16]. All three were designed for high-bandwidth datacenter interconnects such as NVLink, where all-reduce and ring activation transfers consume negligible time.

The picture changes dramatically at edge bandwidths. In a sequence-parallel deployment with hidden dimension D, sequence length N, and P participating devices, every Transformer layer must exchange (P−1)ND/P(P-1)ND/P floating-point values per device per layer before the next layer can proceed [11]. At commodity edge bandwidths of tens to a few hundreds Mbps, this volume implies per-layer communication latencies of tens to hundreds of milliseconds, which is several orders of magnitude above local computation time [17]–[19]. Empirical measurements confirm that under bandwidth constraints below 100 Mbps, inter-device communication accounts for roughly 60–93% of total inference latency in distributed BERT execution (N=1024,P=4)(N=1024, P=4), largely negating the speed-up that parallelism is supposed to provide [20].

To address this bottleneck, several lines of work directly compress the communicated payload. Theoretical results in distributed inference [21] establish that combined sparsification and quantization preserve convergence at extremely low bit budgets, providing the foundation for compressed inter-device communication. VOLTAGE [11], illustrated in Fig. 2(d), is the baseline sequence-parallel design: each device transmits its full-precision hidden-state partition to peers at the partitioning boundary, with communication volume (P−1)ND/P(P-1)ND/P per layer and no compression of any kind. PRISM [22], shown in Fig. 2(c), takes a significant step by replacing this full transmission with training-free Segment Means (columnwise averages of token sub-groups) substantially reducing communication at the cost of approximation accuracy. ASTRA [20], shown in Fig. 2(b), applies vector quantization (VQ) inside multi-head self-attention, quantizing pre-attention token embeddings exchanged between devices and recovering them on the receiver for direct use in the attention kernel.

ASTRA and PRISM share a common structural limitation visible in Figs. 2(b)–(c), i.e., both still require the receiver to complete K/V projection step before attention can proceed, preventing full overlap of communication with downstream

Muhammad Azlan Qazi and Qi Zhang are with DIGIT and the Department of Electrical and Computer Engineering, Aarhus University, Denmark (e-mail: maq@ece.au.dk; qz@ece.au.dk)

Alexandros Iosifidis is with the Data Science Research center, Tampere University, Finland (e-mail: alexandros.iosifidis@tuni.fi) computation (Section II). PRISM’s per-token payload also remains a D-dimensional float vector, so communication volume scales with model dimension regardless of compression ratio. ASTRA’s bitrate is fixed at finetuning time with no mechanism for adaptive resolution.

This paper proposes Transformer Residual Activation Codebook Encoding (TRACE), a communication-efficient framework for distributed Transformer inference that closes both gaps simultaneously. The core idea is to place VQ at the post-attention layer boundary (on the hidden state Z produced by the multi-head self-attention sublayer and its first residual addition) and to amortize the next layer's K and V projections into precomputed lookup buffers indexed by codebook entry, so that the receiver recovers cross-device quantized K/V via direct table lookup with zero matrix-multiply computation. A hierarchical k-medoids clustering [23] of the trained codebook then exposes a multi-resolution sub-codebook hierarchy, allowing the deployed model to select bitrate at inference time without retraining. It is imperative to mention that, this paper targets the encoder-only architectures used for perception and understanding tasks (e.g., ViT, ViViT). Extending the mechanism to autoregressive decoder-only LLMs is discussed as future work in Section VI.

Across all settings, TRACE closely matches baseline accuracy at significant communication overhead reduction compared with uncompressed sequence-parallel inference methods, and is also superior to the best prior compression methods while enabling seamless compute-communication overlap that those methods cannot provide.

The main contributions of this work are:

• Two accuracy-latency variants. TRACE offers two variants that differ in the placement of vector quantization relative to the post-attention residual (Section V-E). TRACE-nb quantizes before the residual and retains runtime-dependent residual information for higher accuracy, whereas TRACE-b quantizes after the residual, enabling deterministic mapping to precomputed key/value entries and compute-communication overlap.

• Post-attention VQ with precomputed K/V buffers. The hidden state Z at the post-attention boundary is quantized using a learned codebook, while the downstream layer normalization, MLP, and K/V representations of each codeword are precomputed during post-training calibration. At inference, only codebook indices are transmitted and cross-device K/V representations are recovered by direct table lookup, eliminating receiver-side matrix multiplication for reconstruction.

• Communication–computation overlap. In TRACE-b, devices transmit codebook indices while concurrently executing local MLP and K/V computations on their available partition data. This removes the receiver-side projection dependency on incoming activations, avoiding the communication–computation serialization that limits prior sequence-parallel methods.

• Multi-resolution bitrate adaptation. TRACE constructs a hierarchical multi-resolution codebook using k-medoids clustering [23] on the trained codebook. Each hierarchy level forms a valid sub-codebook, enabling runtime bitrate selection without retraining and adaptation to changing bandwidth and resource constraints.

• Modal evaluation. TRACE is evaluated on image classification (ViT-Base/16 on ImageNet-1K and CIFAR-100) and video classification (ViViT-B/16 on UCF-101). TRACE-nb improves top-1 accuracy by up to 1.89% over the strongest prior VQ-based method, while TRACE-b achieves up to 1.27×1.27\times faster inference with up to 1.45% higher accuracy; both variants reduce transmitted activation payloads by up to 22,624×22,624\times for ViT-Base/16 and 24,500×24,500\times for ViViT-B/16 compared with uncompressed sequence-parallel inference.

The remainder of this paper is organized as follows. Section II reviews the relevant background and related work. Section III provides a high-level overview of TRACE and its operational lifecycle. Section IV presents the technical details of codebook training, K/V buffer calibration, distributed inference, and multi-resolution operation. Section V describes the experimental setup and results. Section VI discusses the implications, limitations, and future directions, and Section VII concludes the paper.

Notation. Bold uppercase (X) and lowercase (x) denote matrices and vectors, respectively. Italic lowercase (k, n) denotes scalars or indices; italic uppercase (N, D, P) and Greek letters ( γ\gamma, σ\sigma) denote constants or hyperparameters. Calligraphic letters (I) denote sets, and R the reals. Device, peers and edge device are used interchangeably.

References (35)