2025-02-14 · 专家 · 自然语言处理 · 机器学习

InfiniteHiP: Extending Language Model Context Up to 3 Million Tokens on a Single GPU

本文提出了一种名为InfiniteHiP的新型语言模型推理框架,通过动态删除无关的上下文标记和优化缓存策略,实现了在单个GPU上处理高达300万个标记的上下文,同时保持了高效的推理速度。

更新于 2025-02-14。作者:Heejun Lee、Geon Park、Jaduk Suh、Sung Ju Hwang。

中文摘要

在现代大型语言模型(LLMs)中,处理非常长的上下文长度带来了显著挑战,因为它会导致推理速度变慢和内存成本增加。此外,大多数现有的预训练LLMs无法泛化到其原始训练序列长度之外。为了实现高效且实用的长上下文利用,我们引入了InfiniteHiP,这是一种新颖且实用的LLM推理框架,通过模块化分层令牌剪枝算法动态消除无关的上下文令牌来加速处理。我们的方法还可以通过根据LLM内部的注意力模式选择性地应用各种RoPE调整方法,来实现对更长序列的泛化。此外,我们在推理过程中将关键值缓存卸载到主机内存,显著降低了GPU内存压力。因此,InfiniteHiP能够在单个L40s 48GB GPU上处理高达300万个令牌——是原来的3倍——而不会丢失任何上下文信息。我们的框架在不进行额外训练的情况下,实现了1百万令牌上下文注意力解码的18.95倍速度提升。我们在SGLang框架中实现了我们的方法,并通过广泛的评估证明了其有效性和实用性。

英文摘要

In modern large language models (LLMs), handling very long context lengths presents significant challenges as it causes slower inference speeds and increased memory costs. Additionally, most existing pre-trained LLMs fail to generalize beyond their original training sequence lengths. To enable efficient and practical long-context utilization, we introduce InfiniteHiP, a novel, and practical LLM inference framework that accelerates processing by dynamically eliminating irrelevant context tokens through a modular hierarchical token pruning algorithm. Our method also allows generalization to longer sequences by selectively applying various RoPE adjustment methods according to the internal attention patterns within LLMs. Furthermore, we offload the key-value cache to host memory during inference, significantly reducing GPU memory pressure. As a result, InfiniteHiP enables the processing of up to 3 million tokens on a single L40s 48GB GPU -- 3x larger -- without any permanent loss of context information. Our framework achieves an 18.95x speedup in attention decoding for a 1 million token context without requiring additional training. We implement our method in the SGLang framework and demonstrate its effectiveness and practicality through extensive evaluations.

解读

一句话总结

本文提出了一种名为InfiniteHiP的新型语言模型推理框架,通过动态删除无关的上下文标记和优化缓存策略,实现了在单个GPU上处理高达300万个标记的上下文,同时保持了高效的推理速度。

问题1:这篇论文想要解决什么具体问题?

问题2:论文的核心创新点是什么?

问题3:实验结果如何验证了方法的有效性?

问题4:这个研究的实际应用价值是什么?

来源

机器可读索引:llms.txt