用状态空间模型融合多段上下文,提升生成速度与质量
PICASO: Permutation-Invariant Context Composition with State Space Models
- 通过状态组合算法将多段上下文映射为单一状态
- 在WikiText和MSMARCO上实现5.4倍推理加速,性能媲美最优基线
- 支持上下文顺序无关性,适合动态知识注入场景
在推理时向大语言模型提供相关上下文知识可显著提升生成质量。通常通过将外部知识库中检索到的文本片段‘上下文’拼接至输入来实现。然而在线处理额外上下文会带来与长度成比例的计算开销。状态空间模型(SSMs)为此提供了一种解决方案:将上下文数据库映射为固定维度的状态,作为生成起点。当需利用多个独立上下文信息时,现有方法难以有效建模。为此,本文基于SSM动态特性提出一种数学关系,将多个状态组合为一个近似等效于原始上下文拼接的效果。由于上下文顺序常无意义,我们通过在所有可能顺序下对状态进行高效平均,实现排列不变性。在WikiText和MSMARCO数据集上,无论零样本或微调设置,均达到最强基线性能,且平均提速5.4倍。
原文摘要 · Abstract (English)
Providing Large Language Models with relevant contextual knowledge at inference time has been shown to greatly improve the quality of their generations. This is often achieved by prepending informative passages of text, or 'contexts', retrieved from external knowledge bases to their input. However, processing additional contexts online incurs significant computation costs that scale with their length. State Space Models (SSMs) offer a promising solution by allowing a database of contexts to be mapped onto fixed-dimensional states from which to start the generation. A key challenge arises when attempting to leverage information present across multiple contexts, since there is no straightforward way to condition generation on multiple independent states in existing SSMs. To address this, we leverage a simple mathematical relation derived from SSM dynamics to compose multiple states into one that efficiently approximates the effect of concatenating raw context tokens. Since the temporal ordering of contexts can often be uninformative, we enforce permutation-invariance by efficiently averaging states obtained via our composition algorithm across all possible context orderings. We evaluate our resulting method on WikiText and MSMARCO in both zero-shot and fine-tuned settings, and show that we can match the strongest performing baseline while enjoying on average 5.4x speedup.
Thank you to arXiv for use of its open access interoperability. PaperDance 不是 arXiv 官方产品;中文卡片由大模型生成,请以原文为准。