文本越长,必要性越强:推理时训练助力长文本生成
With Greater Text Comes Greater Necessity: Inference-Time Training Helps Long Text Generation
AI总结:
针对长文本生成对现有语言模型的挑战,该研究提出Temp-Lora方法,通过临时Lora模块嵌入上下文信息并在推理时逐步训练,在提升生成质量的同时兼容现有方法、降低计算成本。
摘要:
长文本生成(例如小说创作和具备极长上下文的语篇级翻译)对当前语言模型提出了严峻挑战。现有方法主要通过长度外推等策略扩展模型的上下文窗口,但这些方法在训练和/或推理阶段需要大量硬件资源。我们提出的Temp-Lora方法引入了一种全新思路:它不依赖KV缓存存储所有上下文信息,而是将这些信息直接嵌入一个临时Lora模块中。在长文本生成过程中,该模块会利用此前生成的文本逐步进行训练。这种方式不仅能高效保留上下文知识,还不会对模型参数造成任何永久性改变,因为该模块会在生成结束后被丢弃。我们在PG19语言建模基准和GuoFeng语篇级翻译基准上开展了大量实验,验证了Temp-Lora的有效性。结果表明:1)Temp-Lora大幅提升了长文本的生成质量,具体表现为在PG19的一个子集上困惑度(PPL)下降13.2%,在GuoFeng的一个子集上PPL下降29.3%且BLEU得分提升113.2%;2)Temp-Lora与大多数现有长文本生成方法兼容并能增强其效果;3)Temp-Lora可通过缩短上下文窗口大幅降低计算成本,例如,我们能在保证生成质量适度提升(PPL下降3.8%)的同时,实现内存使用量减少51.5%、推理延迟降低60.0%。
英文摘要:
Long text generation, such as novel writing and discourse-level translation with extremely long contexts, presents significant challenges to current language models. Existing methods mainly focus on extending the model's context window through strategies like length extrapolation. However, these approaches demand substantial hardware resources during the training and/or inference phases. Our proposed method, Temp-Lora, introduces an alternative concept. Instead of relying on the KV cache to store all context information, we embeds this information directly into a temporary Lora module. In the process of long text generation, this module is progressively trained with text generated previously. This approach not only efficiently preserves contextual knowledge but also prevents any permanent alteration to the model's parameters given that the module is discarded post-generation. Extensive experiments on the PG19 language modeling benchmark and the GuoFeng discourse-level translation benchmark validate the effectiveness of Temp-Lora. Our results show that: 1) Temp-Lora substantially enhances generation quality for long text, as indicated by a 13.2% decrease in perplexity (PPL) on a subset of PG19, and a 29.3% decrease in PPL along with a 113.2% increase in BLEU score on a subset of GuoFeng, 2) Temp-Lora is compatible with and enhances most existing long text generation methods, and 3) Temp-Lora can greatly reduce computational costs by shortening the context window. For example, we can ensure a moderate improvement in generation quality (a decrease of 3.8% in PPL) while enabling a 51.5% memory usage reduction and a 60.0% decrease in latency for inference.
机构、总结、中文摘要均由AI分析而来,可能存在错误,请以论文正文为准。