ChatPaper.aiChatPaper

Binäre und ternäre natürliche Sprachgenerierung

Binary and Ternary Natural Language Generation

June 2, 2023
Autoren: Zechun Liu, Barlas Oguz, Aasish Pappu, Yangyang Shi, Raghuraman Krishnamoorthi
cs.AI

Zusammenfassung

Ternäre und binäre neuronale Netze ermöglichen eine multiplikationsfreie Berechnung und versprechen Effizienzgewinne um mehrere Größenordnungen im Vergleich zu Netzen mit voller Präzision, sofern sie auf spezialisierter Hardware implementiert werden. Da jedoch sowohl der Parameter- als auch der Ausgaberaum stark diskretisiert sind, hat sich die Optimierung solcher Netze als äußerst schwierig erwiesen. Diese Schwierigkeiten verstärken sich bei der Klasse von Transformer-Modellen zur Textgenerierung aufgrund der Empfindlichkeit der Attention-Operation gegenüber Quantisierung und der rauschverstärkenden Effekte des autoregressiven Decodings im hochkardinalen Ausgaberaum. Wir nähern uns dem Problem mit einer Mischung aus statistisch basierter Quantisierung der Gewichte und elastischer Quantisierung der Aktivierungen und demonstrieren die ersten ternären und binären Transformer-Modelle für die nachgelagerten Aufgaben der Zusammenfassung und maschinellen Übersetzung. Unser ternäres BART-Base-Modell erreicht einen R1-Score von 41 auf dem CNN/DailyMail-Benchmark, was lediglich 3,9 Punkte hinter dem vollständigen Modell liegt, während es 16-mal effizienter ist. Unser binäres Modell, obwohl weniger genau, erreicht einen beachtlichen Score von 35,6. Für die maschinelle Übersetzung erzielten wir BLEU-Scores von 21,7 und 17,6 auf dem WMT16 En-Ro-Benchmark, verglichen mit einem Score von 26,8 für das vollpräzise mBART-Modell. Wir vergleichen unseren Ansatz auch im 8-Bit-Aktivierungssetting, wo unsere ternären und sogar binären Gewichtsmodelle die besten existierenden 8-Bit-Gewichtsmodelle in der Literatur erreichen oder übertreffen können. Unser Code und unsere Modelle sind verfügbar unter: 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
PDF30December 15, 2024