Binary and Ternary Natural Language Generation

Zechun Liu, Barlas Oguz, Aasish Pappu, Yangyang Shi, Raghuraman Krishnamoorthi
6/2/2023
cs.CL

Official code: facebookresearch/Ternary_Binary_Transformer (38 stars, last commit 2023-06-06).

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. Our code and models are available at: https://github.com/facebookresearch/Ternary_Binary_Transformer

View on arXivView PDF

Code Implementations(1)

ACL 2023

380Shell, PythonJun 2, 20233 years agoNOASSERTION

Similar Papers

Cite this paper

@article{liu2023binary,
  title  = {Binary and Ternary Natural Language Generation},
  author = {Zechun Liu and Barlas Oguz and Aasish Pappu and Yangyang Shi and Raghuraman Krishnamoorthi},
  year   = {2023},
  eprint = {2306.01841},
  archivePrefix = {arXiv},
  url    = {http://arxiv.org/abs/2306.01841v1}
}

Add a badge to your README

Shows whether official code is linked for this paper.

Code of Paper badge
[![Code of Paper](https://codeofpaper.com/badge/2306.01841.svg)](https://codeofpaper.com/paper/2306.01841)

Discussion