Binaire en ternaire natuurlijke taalgeneratie
Binary and Ternary Natural Language Generation
June 2, 2023
Auteurs: Zechun Liu, Barlas Oguz, Aasish Pappu, Yangyang Shi, Raghuraman Krishnamoorthi
cs.AI
Samenvatting
Ternaire en binaire neurale netwerken maken vermenigvuldigingsvrije berekeningen mogelijk en beloven een efficiëntiewinst van meerdere grootteordes ten opzichte van netwerken met volledige precisie, mits geïmplementeerd op gespecialiseerde hardware. Echter, aangezien zowel de parameter- als de uitvoerruimte sterk gediscretiseerd zijn, blijkt het zeer moeilijk om dergelijke netwerken te optimaliseren. De moeilijkheden worden versterkt voor de klasse van transformer-modellen voor tekstgeneratie vanwege de gevoeligheid van de aandachtoperatie voor kwantisatie en de ruisversterkende effecten van autoregressieve decodering in de uitvoerruimte met hoge kardinaliteit. We benaderen het probleem met een mix van statistiekgebaseerde kwantisatie voor de gewichten en elastische kwantisatie van de activaties, en demonstreren de eerste ternaire en binaire transformer-modellen voor de downstream taken van samenvatting en machinaal vertalen. Onze ternaire BART base behaalt een R1-score van 41 op de CNN/DailyMail benchmark, wat slechts 3,9 punten achterblijft bij het volledige model, terwijl het 16x efficiënter is. Ons binaire model, hoewel minder accuraat, behaalt een zeer niet-triviale score van 35,6. Voor machinaal vertalen behaalden we BLEU-scores van 21,7 en 17,6 op de WMT16 En-Ro benchmark, vergeleken met een score van 26,8 voor een mBART-model met volledige precisie. We vergelijken onze aanpak ook in de setting van 8-bit activaties, waar onze ternaire en zelfs binaire gewichtsmodellen de beste bestaande 8-bit gewichtsmodellen in de literatuur kunnen evenaren of overtreffen. Onze code en modellen zijn beschikbaar op:
https://github.com/facebookresearch/Ternary_Binary_Transformer
English
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