EMNLP 2024main6 citations

Memorize Step by Step: Efficient Long-Context Prefilling with Incremental Memory and Decremental Chunk

Zhiyuan Zeng, Qipeng Guo, Xiaoran Liu, Zhangyue Yin, Wentao Shu, Mianqiu Huang, Bo Wang, Yunhua Zhou

Abstract

The evolution of Large Language Models (LLMs) has led to significant advancements, with models like Claude and Gemini capable of processing contexts up to 1 million tokens. However, efficiently handling long sequences remains challenging, particularly during the prefilling stage when input lengths exceed GPU memory capacity. Traditional methods often segment sequence into chunks and compress them iteratively with fixed-size memory. However, our empirical analysis shows that the fixed-size memory results in wasted computational and GPU memory resources. Therefore, we introduces Incremental Memory (IM), a method that starts with a small memory size and gradually increases it, optimizing computational efficiency. Additionally, we propose Decremental Chunk based on Incremental Memory (IMDC), which reduces chunk size while increasing memory size, ensuring stable and lower GPU memory usage. Our experiments demonstrate that IMDC is consistently faster (1.45x) and reduces GPU memory consumption by 23.3% compared to fixed-size memory, achieving comparable performance on the LongBench Benchmark.

BibTeX
@inproceedings{zeng-etal-2024-memorize,
    title = "Memorize Step by Step: Efficient Long-Context Prefilling with Incremental Memory and Decremental Chunk",
    author = "Zeng, Zhiyuan  and
      Guo, Qipeng  and
      Liu, Xiaoran  and
      Yin, Zhangyue  and
      Shu, Wentao  and
      Huang, Mianqiu  and
      Wang, Bo  and
      Zhou, Yunhua  and
      Li, Linlin  and
      Liu, Qun  and
      Qiu, Xipeng",
    editor = "Al-Onaizan, Yaser  and
      Bansal, Mohit  and
      Chen, Yun-Nung",
    booktitle = "Proceedings of the 2024 Conference on Empirical Methods in Natural Language Processing",
    month = nov,
    year = "2024",
    address = "Miami, Florida, USA",
    publisher = "Association for Computational Linguistics",
    url = "https://aclanthology.org/2024.emnlp-main.1169/",
    doi = "10.18653/v1/2024.emnlp-main.1169",
    pages = "21021--21034"
}
Memorize Step by Step: Efficient Long-Context Prefilling with Incremental Memory and Decremental Chunk · EMNLP 2024