ByteDance Seed
首页模型博客&论文Seed Edge加入我们
首页模型博客&论文Seed Edge加入我们
体验豆包AI 体验中心

2025-04-24

Let the Code LLM Edit Itself When You Edit the Code

Download PDF
上一篇下一篇

摘要

In this work, we investigate a typical scenario in code generation where a developer edits existing code in real time and requests a code assistant, e.g., a large language model, to re-predict the next token or next line on the fly. Naively, the LLM needs to re-encode the entire KV cache to provide an accurate prediction. However, this process is computationally expensive, especially when the sequence length is long. Simply encoding the edited subsequence and integrating it to the original KV cache meets the temporal confusion problem, leading to significantly worse performance. We address this efficiency and accuracy trade-off by introducing \underline{\textbf{Positional \textbf{I}ntegrity \textbf{E}ncoding} (PIE). Building upon the rotary positional encoding, PIE first removes the rotary matrices in the Key cache that introduce temporal confusion and then reapplies the correct rotary matrices. This process ensures that positional relationships between tokens are correct and requires only a single round of matrix multiplication. We validate the effectiveness of PIE through extensive experiments on the RepoBench-C-8k dataset, utilizing DeepSeek-Coder models with 1.3B, 6.7B, and 33B parameters. Our evaluation includes three real-world coding tasks: code insertion, code deletion, and multi-place code editing. Results demonstrate that PIE reduces computational overhead by over 85% compared to the standard full recomputation approach across all model sizes and tasks while well approximating the model performance.

作者

Zhenyu He, Jun Zhang, Shengjie Luo, Jingjing Xu, Zhi Zhang, Di He

期刊/会议

ICLR 2025

追求智能上限,创造社会价值
欢迎加入字节跳动 Seed
模型成果
Seed2.1
Seedance 2.5
Seedream 5.5
SeedRealtime
Seed Audio 1.0
Seed GR-RL
了解更多
论文
Seed Edge
Seed STEM 科学家计划
校园招聘
Copyright© 2026 Bytedance Seed
网站声明联系我们 : seed.feedback@bytedance.com
Seed2.1Seedance 2.5Seedream 5.5SeedRealtimeSeed Audio 1.0Seed GR-RL
论文Seed EdgeSeed STEM 科学家计划校园招聘
追求智能上限,创造社会价值
欢迎加入字节跳动 Seed
Copyright© 2026 Bytedance Seed
网站声明
联系我们 : seed.feedback@bytedance.com
追求智能上限,创造社会价值
联系我们 : seed.feedback@bytedance.com
Copyright© 2026 Bytedance Seed网站声明