TRACE: Transformer Residual Activation Codebook Encoding for Communication-efficient Distributed Edge Inference
Organizations: DIGIT and the Department of Electrical and Computer Engineering, Aarhus University, Denmark · the Data Science Research center, Tampere University, Finland
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.27x 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,624x.
Figures & tables
| Symbol | Description | Symbol | Description |
| System and dimensions | |||
| Number of co-located edge devices | , | Number of Transformer layers; layer index | |
| , | Local device index; peer device index ( ) | , | Total / per-device sequence length ( ) |
| Token index within a device’s local partition | Model (hidden-state) dimension | ||
| , | Number of attention heads; per-head dimension ( ) | Feed-forward (MLP) hidden dimension | |
| Transformer activations | |||
| Method | Payload (bits) | Depends on ? |
|---|---|---|
| Voltage [ 11 ] | Yes | |
| Prism [ 22 ] | Yes | |
| Astra [ 20 ] † | No | |
| Trace -b (ours) | No | |
| Trace -nb (ours) | No |
| ImageNet | CIFAR-100 | |||
| Method | ||||
| Voltage [ 11 ] | 80.32 | 80.32 | 92.30 | 92.30 |
| Astra ( ) [ 20 ] | 78.45 | 77.14 | 89.34 | 88.12 |
| Prism [ 22 ] | 79.66 | 79.47 | 90.10 | 89.69 |
| Trace -nb ( ) | 80.23 | 80.11 | 91.23 | 90.58 |
| Trace -b ( ) | 79.90 | 79.70 | 90.55 | 89.90 |
| Method | Compute | Comm. | Effective † | |
|---|---|---|---|---|
| Voltage [ 11 ] | 2 | 92.5 | 2770.31 | 2862.8 |
| Prism ( ) [ 22 ] | 2 | 95.2 | 140.63 | 235.9 |
| Astra ( ) [ 20 ] | 2 | 115.0 | 1.81 | 116.8 |
| Trace -nb ( ) | 2 | 119.0 | 1.34 | 120.3 |
| Trace -b ( ) | 2 | 106.0 | 1.14 | 106.0 |
| Trace -b ( ) | 2 | 92.0 | 0.58 | 92.0 |
| Devices | Without buffers | With buffers | Gain (%) |
|---|---|---|---|
| 2 | 3441 | 2329 | 32.3 |
| 3 | 2281 | 1596 | 30.0 |
| 4 | 1766 | 1320 | 25.2 |
| 6 | 1213 | 952 | 21.5 |
| 8 | 917 | 719 | 21.6 |
| 10 | 742 | 627 | 15.5 |
| Case | Quantized-copy treatment | ||
|---|---|---|---|
| 1 A.i | residual at block 1; thereafter ( Trace -nb) | 91.23 | 90.58 |
| 2 B | Post-residual VQ; K/V at block 1 ( Trace -b) | 90.51 | 89.90 |
| 2 A | Post-residual VQ; full K/V at block 1 | 90.52 | 88.61 |
| 1 A.ii | No residual at block 1; thereafter | 90.78 | 89.03 |
| 1 A.iii | No residual in any block | 90.51 | 88.59 |
| 1 B | as the block-1 residual and K/V | 90.90 | 89.56 |
| Resolution level | ||||||
|---|---|---|---|---|---|---|
| Metric | 0 | 1 | 2 | 3 | 4 | |
| 2 | Euclidean | 84.91 | 89.18 | 89.89 | 90.52 | 90.55 |
| Cosine | 83.30 | 88.40 | 89.53 | 90.32 | 90.55 | |
| Frequency | 85.56 | 89.29 | 89.73 | 89.72 | 90.55 | |
| 3 | Euclidean | 83.33 | 85.81 | 87.70 | 88.54 | 89.90 |
| Cosine | 82.59 | 85.30 | 86.28 | 87.60 | 88.90 | |
| Update strategy | ||
|---|---|---|
| Gradient-based | 90.47 | 88.44 |
| EMA ( Trace default) | 90.51 | 89.00 |
| EMA + dim. reduction ( ) | 90.79 | 89.30 |
Efficient Transformer Inference
Efficient Transformer Inference studies methods and systems that reduce the latency, memory, and energy needed to run Transformer models.
See all 121 papers