One matrix operation replaces full KV cache recomputation in LLMs and lets LLMs update code predictions 85% faster.
Positional Integrity Encoding (PIE) rewrites how LLMs handle code edits by fixing token positions without full recalculation
Original Problem π―:
LLMs need to re-encode entire Key-Value (KV) cache after each code edit, causing high latency in real-time coding scenarios. Simply encoding edited subsequence leads to temporal confusion and poor performance.
Solution in this Paper π§:
β’ Introduces Positional Integrity Encoding (PIE) built on rotary positional encoding
β’ Removes rotary matrices in Key cache causing temporal confusion
β’ Reapplies correct rotary matrices through single matrix multiplication
β’ Maintains positional relationships between tokens
β’ Requires only one round of matrix operations to modify KV cache
Key Insights from this Paper π‘:
β’ Temporal confusion is more critical than semantic impact in code editing
β’ PIE can be seamlessly integrated with other optimization techniques
β’ Works effectively across different model sizes and code editing tasks
β’ Particularly effective for long sequence scenarios
Results π:
β’ Reduces computational overhead by over 85% vs full recomputation
β’ Tested on DeepSeek-Coder models (1.3B, 6.7B, 33B parameters)
β’ Maintains performance comparable to full recomputation
β’ Evaluated on RepoBench-C-8k dataset for code insertion, deletion, and multi-place editing
β’ Achieves cosine similarity near 1.0 with full recomputation across all layers
π‘ PIE offers significant benefits:
Reduces computational overhead by over 85% compared to full recomputation
Maintains prediction accuracy comparable to full recomputation
Requires only a single round of matrix operations to modify KV cache
Works effectively across different model sizes and code editing tasks.



