mlsanityData to 14 Oct 2026

Let the Code LLM Edit Itself When You Edit the Code

arXiv 2407.03157 ↗First posted 3 Jul 2024cs.CL cs.AI cs.LGcited by 10

On the map: Efficient LLM inference and serving → KV cache optimization

Abstract (arXiv)

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 underlinetextbfPositional Integrity Encoding (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.

Key facts. Cited by 10 papers in the map (data through 14 Oct 2026). Placed in KV cache optimization, one of 12 directions in Efficient LLM inference and serving. Builds on 59 of its 68 references that are in the map. First posted on arXiv 3 Jul 2024.

Builds on

59 of 68 references.

Closest ancestors · 3

Same direction, newest first

  1. 2023Efficient Memory Management for Large Language Model Serving with PagedAttention12 Sep
  2. 2023H2O: Heavy-Hitter Oracle for Efficient Generative Inference of Large Language Models24 Jun
  3. 2023Scissorhands: Exploiting the Persistence of Importance Hypothesis for LLM KV Cache Compression at Test Time26 May

Other references · 56

  1. 2017Attention Is All You Needcited by 60,361
  2. 2019Exploring the Limits of Transfer Learning with a Unified Text-to-Text Transformercited by 14,599
  3. 2023Llama 2: Open Foundation and Fine-Tuned Chat Modelscited by 13,028
  4. 2021Swin Transformer: Hierarchical Vision Transformer using Shifted Windowscited by 12,139
  5. 2021Evaluating Large Language Models Trained on Codecited by 8,320
  6. 2021RoFormer: Enhanced Transformer with Rotary Position Embeddingcited by 4,703
  7. 2019DistilBERT, a distilled version of BERT: smaller, faster, cheaper and lightercited by 4,307
  8. 2022FlashAttention: Fast and Memory-Efficient Exact Attention with IO-Awarenesscited by 3,673
  9. 2020Longformer: The Long-Document Transformercited by 3,413
  10. 2023FlashAttention-2: Faster Attention with Better Parallelism and Work Partitioningcited by 2,598
  11. 2023Efficient Streaming Language Models with Attention Sinkscited by 2,186
  12. 2023Code Llama: Open Foundation Models for Codecited by 2,139
38 more
  1. 2020Transformers are RNNs: Fast Autoregressive Transformers with Linear Attentioncited by 2,022
  2. 2019Transformer-XL: Attentive Language Models Beyond a Fixed-Length Contextcited by 1,850
  3. 2020Reformer: The Efficient Transformercited by 1,668
  4. 2022Fast Inference from Transformers via Speculative Decodingcited by 1,653
  5. 2020Rethinking Attention with Performerscited by 1,601
  6. 2019Generating Long Sequences with Sparse Transformerscited by 1,546
  7. 2020Linformer: Self-Attention with Linear Complexitycited by 1,474
  8. 2022SmoothQuant: Accurate and Efficient Post-Training Quantization for Large Language Modelscited by 1,386
  9. 2024DeepSeek-Coder: When the Large Language Model Meets Programming -- The Rise of Code Intelligencecited by 1,181
  10. 2023PaLM 2 Technical Reportcited by 1,162
  11. 2023SparseGPT: Massive Language Models Can Be Accurately Pruned in One-Shotcited by 1,121
  12. 2018Self-Attention with Relative Position Representationscited by 1,120
  13. 2021Train Short, Test Long: Attention with Linear Biases Enables Input Length Extrapolationcited by 1,103
  14. 2023Accelerating Large Language Model Decoding with Speculative Samplingcited by 1,006
  15. 2022GLM-130B: An Open Bilingual Pre-trained Modelcited by 843
  16. 2024Medusa: Simple LLM Inference Acceleration Framework with Multiple Decoding Headscited by 843
  17. 2021CodeXGLUE: A Machine Learning Benchmark Dataset for Code Understanding and Generationcited by 744
  18. 2023LLM-Pruner: On the Structural Pruning of Large Language Modelscited by 650
  19. 2024EAGLE: Speculative Sampling Requires Rethinking Feature Uncertaintycited by 578
  20. 2023FlexGen: High-Throughput Generative Inference of Large Language Models with a Single GPUcited by 575
  21. 2022Efficiently Scaling Transformer Inferencecited by 539
  22. 2022ZeroQuant: Efficient and Affordable Post-Training Quantization for Large-Scale Transformerscited by 526
  23. 2024Taming Throughput-Latency Tradeoff in LLM Inference with Sarathi-Servecited by 526
  24. 2020Efficient Content-Based Sparse Attention with Routing Transformerscited by 471
  25. 2023RepoBench: Benchmarking Repository-Level Code Auto-Completion Systemscited by 353
  26. 2023LLM-QAT: Data-Free Quantization Aware Training for Large Language Modelscited by 324
  27. 2018Blockwise Parallel Decoding for Deep Autoregressive Modelscited by 323
  28. 2023CodeGeeX: A Pre-Trained Model for Code Generation with Multilingual Benchmarking on HumanEval-Xcited by 300
  29. 2020Sparse Sinkhorn Attentioncited by 251
  30. 2020SpAtten: Efficient Sparse Attention Architecture with Cascade Token and Head Pruningcited by 234
  31. 2020IntelliCode Compose: Code Generation Using Transformercited by 227
  32. 2019Blockwise Self-Attention for Long Document Understandingcited by 159
  33. 2023Accelerating LLM Inference with Staged Speculative Decodingcited by 151
  34. 2023REST: Retrieval-Based Speculative Decodingcited by 150
  35. 2022A Length-Extrapolatable Transformercited by 127
  36. 2023Rethinking the Expressive Power of GNNs via Graph Biconnectivitycited by 119
  37. 2021Accelerated Sparse Neural Training: A Provable and Efficient Method to Find N:M Transposable Maskscited by 103
  38. 2022KERPLE: Kernelized Relative Positional Embedding for Length Extrapolationcited by 86

50 most cited of 56 All 56 (JSON)

Built on by

Cited by year (2026 to 14 Oct)

Citing papers per year: 2024: 1; 2025: 3; 2026: 6.

10 papers.

Similar, not cited

Close in wording, no citation either way

  1. 2026Copy-as-Decode: Grammar-Constrained Parallel Prefill for LLM Editing
  2. 2024Get More with LESS: Synthesizing Recurrence with KV Cache Compression for Efficient LLM Inference
  3. 2026KVEraser: Learning to Steer KV Cache for Efficient Localized Context Erasing
  4. 2026From Brute Force to Semantic Insight: Performance-Guided Data Transformation Design with LLMs
  5. 2024RefreshKV: Updating Small KV Cache During Long-form Generation
  6. 2025KVShare: An LLM Service System with Efficient and Effective Multi-Tenant KV Cache Reuse
  7. 2024Don't Transform the Code, Code the Transforms: Towards Precise Code Rewriting using LLMs
  8. 2024SelfCodeAlign: Self-Alignment for Code Generation