Generazione del Linguaggio Naturale Binario e Ternario
Binary and Ternary Natural Language Generation
June 2, 2023
Autori: Zechun Liu, Barlas Oguz, Aasish Pappu, Yangyang Shi, Raghuraman Krishnamoorthi
cs.AI
Abstract
Le reti neurali ternarie e binarie consentono calcoli senza moltiplicazioni e promettono guadagni di efficienza di diversi ordini di grandezza rispetto alle reti a precisione completa se implementate su hardware specializzato. Tuttavia, poiché sia lo spazio dei parametri che quello degli output sono altamente discretizzati, tali reti si sono rivelate molto difficili da ottimizzare. Le difficoltà sono ulteriormente accentuate per la classe di modelli di generazione di testo basati su transformer, a causa della sensibilità dell'operazione di attenzione alla quantizzazione e degli effetti di accumulo del rumore nel decoding autoregressivo nello spazio degli output ad alta cardinalità. Affrontiamo il problema con un mix di quantizzazione basata su statistiche per i pesi e quantizzazione elastica delle attivazioni, e dimostriamo i primi modelli transformer ternari e binari sui task di riassunto e traduzione automatica. Il nostro modello ternario BART base ottiene un punteggio R1 di 41 sul benchmark CNN/DailyMail, che è solo 3,9 punti inferiore al modello completo pur essendo 16 volte più efficiente. Il nostro modello binario, sebbene meno accurato, raggiunge un punteggio altamente significativo di 35,6. Per la traduzione automatica, abbiamo ottenuto punteggi BLEU di 21,7 e 17,6 sul benchmark WMT16 En-Ro, rispetto a un punteggio di 26,8 del modello mBART a precisione completa. Confrontiamo inoltre il nostro approccio nell'impostazione delle attivazioni a 8 bit, dove i nostri modelli con pesi ternari e persino binari possono eguagliare o superare i migliori modelli con pesi a 8 bit esistenti in letteratura. Il nostro codice e i nostri modelli sono disponibili all'indirizzo: 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