亚马逊论文:按KV缓存策略微调可防长上下文失效

Rohan Paul · @rohanpaul_ai · X·2026-08-31 20:24·26分钟前
AI 导读

亚马逊新论文表明,KV缓存策略不仅是推理优化,还能改变模型所需的训练方式。若模型推理时会遗忘部分上下文,训练时也应模拟这种遗忘——将微调与KV缓存策略匹配,可防止长上下文失效。在128k token测试中,全注意力微调模型在稀疏推理下常产生冗长无意义回答,而匹配缓存策略微调的模型能正常作答并停止;该方法支持任意缓存策略,可在40 GB A100上计算4B模型梯度。

Rohan Paul@rohanpaul_ai
45AI 编辑部评分,满分 100

亚马逊论文:按KV缓存策略微调可防长上下文失效

2026-08-31 20:24· 26分钟前
AI 导读

亚马逊新论文表明,KV缓存策略不仅是推理优化,还能改变模型所需的训练方式。若模型推理时会遗忘部分上下文,训练时也应模拟这种遗忘——将微调与KV缓存策略匹配,可防止长上下文失效。在128k token测试中,全注意力微调模型在稀疏推理下常产生冗长无意义回答,而匹配缓存策略微调的模型能正常作答并停止;该方法支持任意缓存策略,可在40 GB A100上计算4B模型梯度。

New Amazon paper shows KV-cache policy is not just an inference optimization; but it can change the training regime the model needs.

If your LLM will forget parts of its context at inference, train it to forget that way too: this paper shows matching fine-tuning to the KV-cache policy can prevent long-context failures.

Sparse attention lets long-context inference use a fixed-size KV cache by keeping only part of the model’s past context. But models are often fine-tuned with full attention, then asked to work with missing memory at inference.

That mismatch can break behavior. In 128k-token tests, models trained with full attention often produced long, nonsensical answers under sparse inference, while models fine-tuned with the same cache policy learned to answer and stop normally.

The method makes this policy-matched training practical for arbitrary cache policies, including computing gradients for a 4B model on a 40 GB A100.

– arxiv. org/abs/2608.19920

Title: "Learning how to Forget: Fine-tuning for Long-Context Sparse Attention"