SliceGPT: Comprimere Modelli Linguistici di Grandi Dimensioni Eliminando Righe e Colonne
SliceGPT: Compress Large Language Models by Deleting Rows and Columns
January 26, 2024
Autori: Saleh Ashkboos, Maximilian L. Croci, Marcelo Gennari do Nascimento, Torsten Hoefler, James Hensman
cs.AI
Abstract
I grandi modelli linguistici sono diventati il pilastro dell'elaborazione del linguaggio naturale, ma il loro utilizzo comporta costi significativi in termini di risorse computazionali e di memoria. La sparsificazione offre una soluzione per alleviare questi vincoli di risorse, e lavori recenti hanno dimostrato che i modelli addestrati possono essere sparsificati post-hoc. Le tecniche di sparsificazione esistenti affrontano sfide in quanto richiedono strutture dati aggiuntive e offrono un miglioramento di velocità limitato con l'hardware attuale. In questo articolo presentiamo SliceGPT, un nuovo schema di sparsificazione post-addestramento che sostituisce ogni matrice dei pesi con una matrice più piccola (densa), riducendo la dimensione di embedding della rete. Attraverso un'ampia sperimentazione, dimostriamo che SliceGPT può rimuovere fino al 25% dei parametri del modello (inclusi gli embedding) per i modelli LLAMA2-70B, OPT 66B e Phi-2, mantenendo rispettivamente il 99%, 99% e 90% delle prestazioni zero-shot del modello denso. I nostri modelli "affettati" funzionano su meno GPU e sono più veloci senza alcuna ottimizzazione aggiuntiva del codice: su GPU consumer da 24GB riduciamo il calcolo totale per l'inferenza su LLAMA2-70B al 64% rispetto al modello denso; su GPU A100 da 40GB lo riduciamo al 66%. Offriamo una nuova intuizione, l'invarianza computazionale nelle reti di trasformatori, che abilita SliceGPT e speriamo che possa ispirare e abilitare future strade per ridurre le richieste di memoria e calcolo per i modelli pre-addestrati. Il codice è disponibile all'indirizzo: https://github.com/microsoft/TransformerCompression
English
Large language models have become the cornerstone of natural language
processing, but their use comes with substantial costs in terms of compute and
memory resources. Sparsification provides a solution to alleviate these
resource constraints, and recent works have shown that trained models can be
sparsified post-hoc. Existing sparsification techniques face challenges as they
need additional data structures and offer constrained speedup with current
hardware. In this paper we present SliceGPT, a new post-training sparsification
scheme which replaces each weight matrix with a smaller (dense) matrix,
reducing the embedding dimension of the network. Through extensive
experimentation, we show that SliceGPT can remove up to 25% of the model
parameters (including embeddings) for LLAMA2-70B, OPT 66B and Phi-2 models
while maintaining 99%, 99% and 90% zero-shot task performance of the dense
model respectively. Our sliced models run on fewer GPUs and run faster without
any additional code optimization: on 24GB consumer GPUs we reduce the total
compute for inference on LLAMA2-70B to 64% of that of the dense model; on 40GB
A100 GPUs we reduce it to 66%. We offer a new insight, computational invariance
in transformer networks, which enables SliceGPT and we hope it will inspire and
enable future avenues to reduce memory and computation demands for pre-trained
models. Code is available at:
https://github.com/microsoft/TransformerCompression