paper-with-me

홈 › Papers

Let the Code LLM Edit Itself When You Edit the Code

2024-07-03 · Zhenyu He, Jun Zhang, Shengjie Luo, Jingjing Xu, Zhi Zhang, Di He

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.

📄 PDF Abstract BibTeX arXiv:2407.03157

Code (0)

등록된 구현이 없습니다.

Tasks

8kCode GenerationLanguage ModellingLarge Language Model

Similar Papers 제목 키워드 기반

Forgedit: Text Guided Image Editing via Learning and Forgetting

2023-09-19 · Shiwen Zhang, Shuai Xiao, Weilin Huang

Text-guided image editing on real or synthetic images, given only the original image itself and the target text prompt as inputs, is a very general and challenging task. It requires an editing model to estimate by itself…

text-guided-image-editing

A Structural Model for Contextual Code Changes

2020-05-27 · Shaked Brody, Uri Alon, Eran Yahav

We address the problem of predicting edit completions based on a learned model that was trained on past edits. Given a code snippet that is partially edited, our goal is to predict a completion of the edit for the rest o…

EditCompletionmodel

Lode Encoder: AI-constrained co-creativity

2023-08-02 · Debosmita Bhaumik, Ahmed Khalifa, Julian Togelius

We present Lode Encoder, a gamified mixed-initiative level creation system for the classic platform-puzzle game Lode Runner. The system is built around several autoencoders which are trained on sets of Lode Runner levels…

To Diff or Not to Diff? Structure-Aware and Adaptive Output Formats for Efficient LLM-based Code Editing

2026-04-30 · Wei Cheng, Yongchang Cao, Chen Shen, Binhua Li 외 arxiv

Large Language Models (LLMs) are increasingly used for code editing, yet the prevalent full-code generation paradigm suffers from severe efficiency bottlenecks, posing challenges for interactive coding assistants that de…

Code Generation

Inspecting and Editing Knowledge Representations in Language Models

2023-04-03 · Evan Hernandez, Belinda Z. Li, Jacob Andreas

Neural language models (LMs) represent facts about the world described by text. Sometimes these facts derive from training data (in most LMs, a representation of the word "banana" encodes the fact that bananas are fruits…

AnatomyAttributeSentence