EFIM: Efficient Serving of LLMs for Infilling Tasks with Improved KV Cache Reuse
On the map: Efficient LLM inference and serving → KV cache optimization
Abstract (arXiv)
Large language models (LLMs) are often used for infilling tasks, which involve predicting or generating missing information in a given text. These tasks typically require multiple interactions with similar context. To reduce the computation of repeated historical tokens, cross-request key-value (KV) cache reuse, a technique that stores and reuses intermediate computations, has become a crucial method in multi-round interactive services. However, in infilling tasks, the KV cache reuse is often hindered by the structure of the prompt format, which typically consists of a prefix and suffix relative to the insertion point. Specifically, the KV cache of the prefix or suffix part is frequently invalidated as the other part (suffix or prefix) is incrementally generated. To address the issue, we propose EFIM, a transformed prompt format of FIM to unleash the performance potential of KV cache reuse. Although the transformed prompt can solve the inefficiency, it exposes subtoken generation problems in current LLMs, where they have difficulty generating partial words accurately. Therefore, we introduce a fragment tokenization training method which splits text into multiple fragments before tokenization during data processing. Experiments on two representative LLMs show that LLM serving with EFIM can lower the latency by 52% and improve the throughput by 98% while maintaining the original infilling capability. EFIM's source code is publicly available at https://github.com/gty111/EFIM.
Key facts. Cited by 1 paper in the map (data through 7 Oct 2026). Placed in KV cache optimization, one of 12 directions in Efficient LLM inference and serving. Builds on 30 of its 36 references that are in the map. First posted on arXiv 28 May 2025.
Builds on
30 of 36 references.
Closest ancestors · 6
Same direction, newest first
- 2024InfiniGen: Efficient Generative Inference of Large Language Models with Dynamic KV Cache Management28 Jun
- 2024Cost-Efficient Large Language Model Serving for Multi-turn Conversations with CachedAttention23 Mar
- 2024ChunkAttention: Efficient Self-Attention with Prefix-Aware KV Cache and Two-Phase Partition23 Feb
- 2023Stateful Large Language Model Serving with Pensieve9 Dec
- 2023Efficient Memory Management for Large Language Model Serving with PagedAttention12 Sep
- 2023H2O: Heavy-Hitter Oracle for Efficient Generative Inference of Large Language Models24 Jun
Other references · 24
- 2017Attention Is All You Needcited by 59,932
- 2018BERT: Pre-training of Deep Bidirectional Transformers for Language Understandingcited by 40,204
- 2020Language Models are Few-Shot Learnerscited by 32,199
- 2024The Llama 3 Herd of Modelscited by 14,192
- 2021Evaluating Large Language Models Trained on Codecited by 8,053
- 2022PaLM: Scaling Language Modeling with Pathwayscited by 5,304
- 2022FlashAttention: Fast and Memory-Efficient Exact Attention with IO-Awarenesscited by 3,611
- 2023FlashAttention-2: Faster Attention with Better Parallelism and Work Partitioningcited by 2,551
- 2023Efficient Streaming Language Models with Attention Sinkscited by 2,115
- 2023Code Llama: Open Foundation Models for Codecited by 2,105
- 2024DeepSeek-Coder: When the Large Language Model Meets Programming -- The Rise of Code Intelligencecited by 1,154
- 2024Qwen2.5-Coder Technical Reportcited by 1,151
12 more
- 2023SGLang: Efficient Execution of Structured Language Model Programscited by 1,107
- 2022CodeGen: An Open Large Language Model for Code with Multi-Turn Program Synthesiscited by 876
- 2023StarCoder: may the source be with you!cited by 790
- 2022Efficiently Scaling Transformer Inferencecited by 529
- 2022InCoder: A Generative Model for Code Infilling and Synthesiscited by 492
- 2024StarCoder 2 and The Stack v2: The Next Generationcited by 484
- 2022DeepSpeed Inference: Enabling Efficient Inference of Transformer Models at Unprecedented Scalecited by 403
- 2023MINT: Evaluating LLMs in Multi-turn Interaction with Tools and Language Feedbackcited by 293
- 2023Prompt Cache: Modular Attention Reuse for Low-Latency Inferencecited by 255
- 2022Efficient Training of Language Models to Fill in the Middlecited by 248
- 2023CrossCodeEval: A Diverse and Multilingual Benchmark for Cross-File Code Completioncited by 181
- 2023CodeGen2: Lessons for Training LLMs on Programming and Natural Languagescited by 124
Built on by
Citing papers per year: 2026: 1.
1 paper.
Similar, not cited
Close in wording, no citation either way
- 2025KVShare: An LLM Service System with Efficient and Effective Multi-Tenant KV Cache Reuse
- 2026KV Packet: Recomputation-Free Context-Independent KV Caching for LLMs
- 2026KVShareArena: KV-Cache Reuse Across Contexts and Model Checkpoints
- 2024Model Tells You Where to Merge: Adaptive KV Cache Merging for LLMs on Long-Context Tasks
- 2024Keep the Cost Down: A Review on Methods to Optimize LLM' s KV-Cache Consumption
- 2025KV Cache Recycling to Expand Usable Context Capacity in Low Parameter LLMs
- 2024CacheBlend: Fast Large Language Model Serving for RAG with Cached Knowledge Fusion
- 2026KV Cache Optimization Strategies for Scalable and Efficient LLM Inference