Saved in:
Bibliographic Details
Main Authors: Wang, Yumeng, Xiao, Zhenyang
Format: Preprint
Published: 2024
Subjects:
Online Access:https://arxiv.org/abs/2401.09486
Tags: Add Tag
No Tags, Be the first to tag this record!
_version_ 1866911770701987840
author Wang, Yumeng
Xiao, Zhenyang
author_facet Wang, Yumeng
Xiao, Zhenyang
contents Large Language Models (LLMs) face limitations due to the high demand on GPU memory and computational resources when handling long contexts. While sparsify the Key-Value (KV) cache of transformer model is a typical strategy to alleviate resource usage, it unavoidably results in the loss of information. We introduce Lossless Compressed Memory Attention (LoMA), a novel approach that enables lossless compression of the KV cache, thereby reducing the memory and computational demands during autoregressive generation. LoMA incorporates a specialized training or fine-tuning precedure alongside an autoregressive generation algorithm optimized for the compressed context. Our method compresses the KV cache after every $tc$ generated tokens with a compression ratio of $c$ and a target compressed length $t$, and this process occurs within a single inference pass without dependency on auxiliary models. We engineered an efficient training scheme involving specific inputs, attention masks, and position identifiers to instill this compression capability. Experimental validation has demonstrated that LoMA significantly reducing computational consumption and memory usage through achieving lossless KV cache compression.
format Preprint
id arxiv_https___arxiv_org_abs_2401_09486
institution arXiv
publishDate 2024
record_format arxiv
spellingShingle LoMA: Lossless Compressed Memory Attention
Wang, Yumeng
Xiao, Zhenyang
Machine Learning
Computation and Language
Large Language Models (LLMs) face limitations due to the high demand on GPU memory and computational resources when handling long contexts. While sparsify the Key-Value (KV) cache of transformer model is a typical strategy to alleviate resource usage, it unavoidably results in the loss of information. We introduce Lossless Compressed Memory Attention (LoMA), a novel approach that enables lossless compression of the KV cache, thereby reducing the memory and computational demands during autoregressive generation. LoMA incorporates a specialized training or fine-tuning precedure alongside an autoregressive generation algorithm optimized for the compressed context. Our method compresses the KV cache after every $tc$ generated tokens with a compression ratio of $c$ and a target compressed length $t$, and this process occurs within a single inference pass without dependency on auxiliary models. We engineered an efficient training scheme involving specific inputs, attention masks, and position identifiers to instill this compression capability. Experimental validation has demonstrated that LoMA significantly reducing computational consumption and memory usage through achieving lossless KV cache compression.
title LoMA: Lossless Compressed Memory Attention
topic Machine Learning
Computation and Language
url https://arxiv.org/abs/2401.09486