MemLong: Memory-Augmented Retrieval for Long Text Modeling

Fuente: arXiv
Gespeichert in:
Bibliographische Detailangaben
Hauptverfasser: Liu, Weijie, Tang, Zecheng, Li, Juntao, Chen, Kehai, Zhang, Min
Format: Preprint
Veröffentlicht: 2024
Schlagworte:
Online-Zugang:
Tags: Tag hinzufügen
Keine Tags, Fügen Sie den ersten Tag hinzu!
_version_ 1866910584114511872
author Liu, Weijie
Tang, Zecheng
Li, Juntao
Chen, Kehai
Zhang, Min
author_facet Liu, Weijie
Tang, Zecheng
Li, Juntao
Chen, Kehai
Zhang, Min
contents Recent advancements in Large Language Models (LLMs) have yielded remarkable success across diverse fields. However, handling long contexts remains a significant challenge for LLMs due to the quadratic time and space complexity of attention mechanisms and the growing memory consumption of the key-value cache during generation. This work introduces MemLong: Memory-Augmented Retrieval for Long Text Generation, a method designed to enhance the capabilities of long-context language modeling by utilizing an external retriever for historical information retrieval. MemLong combines a non-differentiable ``ret-mem'' module with a partially trainable decoder-only language model and introduces a fine-grained, controllable retrieval attention mechanism that leverages semantic-level relevant chunks. Comprehensive evaluations on multiple long-context language modeling benchmarks demonstrate that MemLong consistently outperforms other state-of-the-art LLMs. More importantly, MemLong can extend the context length on a single 3090 GPU from 4k up to 80k. Our code is available at https://github.com/Bui1dMySea/MemLong
format Preprint
id arxiv_https___arxiv_org_abs_2408_16967
institution arXiv
publishDate 2024
record_format arxiv
spellingShingle MemLong: Memory-Augmented Retrieval for Long Text Modeling
Liu, Weijie
Tang, Zecheng
Li, Juntao
Chen, Kehai
Zhang, Min
Computation and Language
Artificial Intelligence
Recent advancements in Large Language Models (LLMs) have yielded remarkable success across diverse fields. However, handling long contexts remains a significant challenge for LLMs due to the quadratic time and space complexity of attention mechanisms and the growing memory consumption of the key-value cache during generation. This work introduces MemLong: Memory-Augmented Retrieval for Long Text Generation, a method designed to enhance the capabilities of long-context language modeling by utilizing an external retriever for historical information retrieval. MemLong combines a non-differentiable ``ret-mem'' module with a partially trainable decoder-only language model and introduces a fine-grained, controllable retrieval attention mechanism that leverages semantic-level relevant chunks. Comprehensive evaluations on multiple long-context language modeling benchmarks demonstrate that MemLong consistently outperforms other state-of-the-art LLMs. More importantly, MemLong can extend the context length on a single 3090 GPU from 4k up to 80k. Our code is available at https://github.com/Bui1dMySea/MemLong
title MemLong: Memory-Augmented Retrieval for Long Text Modeling
topic Computation and Language
Artificial Intelligence
url https://arxiv.org/abs/2408.16967