无需修改模型参数,用预训练记忆模块实现高效领域适配。
Memory Decoder: A Pretrained, Plug-and-Play Memory for Large Language Models
- 用小Transformer解码器模仿外部检索器行为,构建可即插即用的记忆模块。
- 在生物、金融、法律三领域平均降低困惑度6.17点,提升模型表现。
- 适合需快速适配新领域的场景,兼容多种主流大模型,部署简单。
大型语言模型在通用语言任务中表现出色,但将其适配到特定领域仍具挑战。现有方法如领域自适应预训练(DAPT)需全参数训练且易发生灾难性遗忘;而检索增强生成(RAG)因昂贵的最近邻搜索带来显著推理延迟。本文提出Memory Decoder,一种可即插即用的预训练记忆组件,实现不修改原模型参数的高效领域适配。该模块采用小型Transformer解码器,学习模仿外部非参数检索器的行为。训练完成后,可无缝集成至任意共享分词器的预训练语言模型中,无需模型定制化调整。实验表明,Memory Decoder成功将Qwen和Llama系列模型适配至生物医学、金融与法律三个专业领域,平均困惑度降低6.17点。整体上,Memory Decoder引入了一种以专门预训练记忆为核心的新范式,具备插件式集成能力,在多个模型上均能持续提升目标领域的性能。
原文摘要 · Abstract (English)
Large Language Models (LLMs) have shown strong abilities in general language tasks, yet adapting them to specific domains remains a challenge. Current method like Domain Adaptive Pretraining (DAPT) requires costly full-parameter training and suffers from catastrophic forgetting. Meanwhile, Retrieval-Augmented Generation (RAG) introduces substantial inference latency due to expensive nearest-neighbor searches and longer context. This paper introduces Memory Decoder, a plug-and-play pretrained memory that enables efficient domain adaptation without changing the original model's parameters. Memory Decoder employs a small transformer decoder that learns to imitate the behavior of an external non-parametric retriever. Once trained, Memory Decoder can be seamlessly integrated with any pretrained language model that shares the same tokenizer, requiring no model-specific modifications. Experimental results demonstrate that Memory Decoder enables effective adaptation of various Qwen and Llama models to three distinct specialized domains: biomedicine, finance, and law, reducing perplexity by an average of 6.17 points. Overall, Memory Decoder introduces a novel paradigm centered on a specially pretrained memory component designed for domain-specific adaptation. This memory architecture can be integrated in a plug-and-play manner, consistently enhancing performance across multiple models within the target domain.
Thank you to arXiv for use of its open access interoperability. PaperDance 不是 arXiv 官方产品;中文卡片由大模型生成,请以原文为准。