Abstract
Ternary and binary neural networks enable multiplication-free computation and promise multiple orders of magnitude efficiency gains over full-precision networks if implemented on specialized hardware. However, since both the parameter and the output space are highly discretized, such networks have proven very difficult to optimize. The difficulties are compounded for the class of transformer text generation models due to the sensitivity of the attention operation to quantization and the noise-compounding effects of autoregressive decoding in the high-cardinality output space. We approach the problem with a mix of statistics-based quantization for the weights and elastic quantization of the activations and demonstrate the first ternary and binary transformer models on the downstream tasks of summarization and machine translation. Our ternary BART base achieves an R1 score of 41 on the CNN/DailyMail benchmark, which is merely 3.9 points behind the full model while being 16x more efficient. Our binary model, while less accurate, achieves a highly non-trivial score of 35.6. For machine translation, we achieved BLEU scores of 21.7 and 17.6 on the WMT16 En-Ro benchmark, compared with a full precision mBART model score of 26.8. We also compare our approach in the 8-bit activation setting, where our ternary and even binary weight models can match or outperform the best existing 8-bit weight models in the literature.
Introduction
Large-scale generative transformers, such as BART and GPT, have revolutionized natural language processing but remain computationally expensive and memory-intensive. While quantization is a standard technique to mitigate these costs, pushing precision down to binary (1-bit) or ternary (2-bit) levels typically results in significant performance degradation or training instability. This is particularly true for generative models, where autoregressive decoding causes quantization errors to compound over time, often leading to incoherent outputs. Most prior work has focused on encoder-only models or 8-bit quantization; TBT (Ternary/Binary Transformer) aims to break the 1-bit barrier for generative tasks.
Methodology: The TBT Framework
The TBT framework introduces two primary innovations to stabilize training and preserve representational power in ultra-low-bit settings:
- Stats-based Max-Entropy Isometric Weight Quantization: To maximize information retention, weights are forced into a balanced distribution across available levels (e.g., equal counts of -1, 0, and 1 in ternary). This "Max-Entropy" approach is paired with isometric mapping to align the magnitude of quantized weights with real-valued weights, preventing gradient explosion or vanishing during training.
- Learning-Based Elastic Activation Quantization: Activations are dynamic and require flexible scaling. TBT uses learnable scaling factors that adapt to the distribution of activations. The framework applies asymmetric quantization to layers with strictly positive values (like those following ReLU or Softmax) and symmetric quantization elsewhere.
Experimental Results
The TBT framework was evaluated on summarization (CNN/DailyMail, XSUM) and machine translation (WMT16 En-Ro) benchmarks.
As shown in the results table below, the ternary (2-bit) TBT model achieves performance remarkably close to full-precision baselines. On the CNN/DailyMail task, the ternary model (2-2-2 bits for E-W-A) reached a ROUGE-1 score of 41.03, compared to 44.90 for the 32-bit BART-base model. Notably, TBT's ultra-low-bit models frequently outperformed existing state-of-the-art methods that utilized higher-precision 8-bit weights. For instance, the TBT binary-weight model (1-1-8) achieved a ROUGE-1 of 42.66 on CNN/DailyMail, surpassing several 8-bit weight baselines.
Key Insights and Discussion
- The "Multiplication-Free" Promise: By reducing weights and activations to 1 or 2 bits, TBT enables replacing expensive floating-point multiplications with simple bitwise operations or additions. This offers a path toward orders-of-magnitude speedups on specialized hardware.
- Ternary as the "Sweet Spot": Ternary models provide a superior balance of efficiency and accuracy. A 16x reduction in memory is achieved with only a minor drop in ROUGE or BLEU scores.
- Stability through Gradients: The proposed weight quantization method stabilizes training, allowing 1-bit generative models to converge where previous attempts often failed.
Conclusion and Future Work
TBT demonstrates the feasibility of binary and ternary quantization for generative transformers. While binary models achieve up to 32x memory reduction, a noticeable accuracy gap remains compared to ternary and full-precision models. Furthermore, realizing the theoretical 58x speedup requires specialized hardware or custom kernels, as current general-purpose GPUs are not optimized for sub-8-bit operations. Future research will explore the performance of these models on longer sequences and the development of optimized hardware implementations.
Summary updated