用上下文流直接更新模型参数,实现高效测试时自适应
StreamAdapter: Efficient Test Time Adaptation from Contextual Streams
- 通过上下文映射与权重吸收,将演示转化为参数更新
- 仅需少量示例即达媲美甚至超越传统提示学习效果
- 推理时间复杂度恒定,适合大规模演示场景
上下文学习(ICL)使大语言模型能直接从给定示例中适配新任务,无需梯度更新。尽管近期研究已扩展上下文窗口以容纳更多示例,但此举并未显著提升性能且增加了推理成本。为此,我们提出 StreamAdapter,一种在测试时直接从上下文流中更新模型参数的新方法,无需显式提供上下文示例。StreamAdapter 采用上下文映射与权重吸收机制,将 ICL 示例动态转化为参数更新,仅引入极少量额外参数。该方法大幅降低对大量上下文示例的依赖,显著减少推理开销,并实现与示例数量无关的常数时间复杂度。在多种任务和模型架构上的实验表明,StreamAdapter 在适配能力上可媲美或超越 ICL,且所需示例更少。其在语言理解与生成任务中均展现出优越的任务适配与上下文编码能力,为大模型测试时自适应提供了新范式,支持跨场景高效适配与低成本推理。
原文摘要 · Abstract (English)
In-context learning (ICL) allows large language models (LLMs) to adapt to new tasks directly from the given demonstrations without requiring gradient updates. While recent advances have expanded context windows to accommodate more demonstrations, this approach increases inference costs without necessarily improving performance. To mitigate these issues, We propose StreamAdapter, a novel approach that directly updates model parameters from context at test time, eliminating the need for explicit in-context demonstrations. StreamAdapter employs context mapping and weight absorption mechanisms to dynamically transform ICL demonstrations into parameter updates with minimal additional parameters. By reducing reliance on numerous in-context examples, StreamAdapter significantly reduce inference costs and allows for efficient inference with constant time complexity, regardless of demonstration count. Extensive experiments across diverse tasks and model architectures demonstrate that StreamAdapter achieves comparable or superior adaptation capability to ICL while requiring significantly fewer demonstrations. The superior task adaptation and context encoding capabilities of StreamAdapter on both language understanding and generation tasks provides a new perspective for adapting LLMs at test time using context, allowing for more efficient adaptation across scenarios and more cost-effective inference
Thank you to arXiv for use of its open access interoperability. PaperDance 不是 arXiv 官方产品;中文卡片由大模型生成,请以原文为准。