知识包:通过KV缓存注入实现零token知识传递
Knowledge Packs: Zero-Token Knowledge Delivery via KV Cache Injection
AI总结:
本文提出知识包,通过预计算的KV缓存实现零token成本的知识传递,实验显示在正确格式下,知识包在700个问题上无差异,比RAG节省95%token,同时支持RAG无法实现的行为引导。
摘要:
RAG浪费token。我们提出知识包:预计算的KV缓存,通过零token成本传递相同知识。对于因果Transformer,从文本F的前向传递产生的KV缓存与F+q的联合传递产生的相同,这直接来自因果掩码。等价性是精确但脆弱的:错误的聊天模板格式会导致6-7pp的降级,我们认为这解释了先前KV优于RAG的声明。在正确格式下:在Qwen3-8B和Llama-3.1-8B上700个问题无差异,最高节省95%token。KV接口还支持RAG无法实现的行为引导。因为RoPE旋转键但不改变值,对比度差在缓存值上可以引导模型行为,而键运算破坏连贯性。效果位于中层值(33-66%),独立方向几乎正交(cos~0)且可组合,且两个通道——知识和引导——在alpha<=0.7时同时运行无干扰。无需训练,无需权重修改。
英文摘要:
RAG wastes tokens. We propose Knowledge Packs: pre-computed KV caches that deliver the same knowledge at zero token cost. For causal transformers, the KV cache from a forward pass on text F is identical to what a joint pass on F+q would produce - this follows directly from the causal mask. The equivalence is exact but fragile: wrong chat template formatting causes 6-7pp degradation, which we believe explains prior claims of KV outperforming RAG. With correct formatting: zero divergences across 700 questions on Qwen3-8B and Llama-3.1-8B, up to 95% token savings. The KV interface also enables behavioral steering that RAG cannot do. Because RoPE rotates keys but leaves values untouched, contrastive deltas on cached values can nudge model behavior while key arithmetic destroys coherence. The effect sits in mid-layer values (33-66%), independent directions are nearly orthogonal (cos~0) and compose, and both channels - knowledge and steering - run simultaneously at alpha<=0.7 without interference. No training, no weight modification.
机构、总结、中文摘要均由AI分析而来,可能存在错误,请以论文正文为准。