大语言模型(LLMs)的最新进展已在众多领域取得显著成功。然而,由于注意力机制的二次时间与空间复杂度,以及生成过程中键值缓存不断增长的内存消耗,处理长上下文对LLMs而言仍是一项重大挑战。本文提出MemLong:面向长文本生成的记忆增强检索(Memory-Augmented Retrieval for Long Text Generation),该方法通过利用外部检索器进行历史信息检索,以增强长上下文语言建模能力。MemLong将不可微的“ret-mem”模块与部分可训练的解码器-only语言模型相结合,并引入一种细粒度、可控的检索注意力机制,利用语义级相关块。在多个长上下文语言建模基准上的综合评估表明,MemLong始终优于其他最先进的LLMs。更重要的是,MemLong可在单个3090 GPU上将上下文长度从4k扩展到80k。我们的代码可在 https://github.com/Bui1dMySea/MemLong 获取。
英文摘要:
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
Beyond the Parameters: A Technical Survey of Contextual Enrichment in Large Language Models: From In-Context Prompting to Causal Retrieval-Augmented Generation
Benchmarking Foundation Models with Retrieval-Augmented Generation in Olympic-Level Physics Problem Solving
AAII, University of Technology Sydney, New South Wales, Australia(AAII,悉尼大学,新南威尔士州,澳大利亚);Eindhoven University of Technology, Eindhoven, The Netherlands(埃因霍温理工大学,埃因霍温,荷兰);University of Liverpool, Liverpool, United Kingdom(利物浦大学,利物浦,英国);University of New South Wales, New South Wales, Australia(新南威尔士大学,新南威尔士州,澳大利亚)
Improving Context Fidelity via Native Retrieval-Augmented Reasoning
DIRO, Université de Montréal(蒙特利尔大学计算机科学与运筹学系);MetaGPT;Mila - Quebec AI Institute(米拉-魁北克人工智能研究所);McGill University(麦吉尔大学);Yale University(耶鲁大学);Canada CIFAR AI Chair(加拿大CIFAR人工智能教席)
A Systematic Study of Retrieval Pipeline Design for Retrieval-Augmented Medical Question Answering
Department of Mechatronics & Industrial Engineering, Chittagong University of Engineering & Technology(吉大港工程与技术大学机电与工业工程系);Department of Mechanical Engineering, Chittagong University of Engineering & Technology(吉大港工程与技术大学机械工程系)
Towards Comprehensive Vietnamese Retrieval-Augmented Generation and Large Language Models
Foundation Models Lab, BKAI(BKAI基础模型实验室);Hanoi University of Science and Technology(河内科技大学);University of Information Technology(信息技术大学);Vietnam National University HCMC(胡志明市越南国家大学)
R^2AG: Incorporating Retrieval Information into Retrieval Augmented Generation
School of Computer Science, South China Normal University(华南师范大学计算机学院);The Hong Kong University of Science and Technology (Guangzhou)(香港科技大学(广州));The Hong Kong University of Science and Technology(香港科技大学)
Retrieval-Augmented Large Language Models for Evidence-Informed Guidance on Cannabidiol Use in Older Adults
Lawrence Bloomberg Faculty of Nursing, University of Toronto(多伦多大学劳伦斯·布隆伯格护理学院);KITE Research Institute, Toronto Rehabilitation Institute, University Health Network(大学健康网络多伦多康复研究所KITE研究所);College of Engineering and Technology, American University of the Middle East(中东美国大学工程与技术学院)