Accelerating Cross-Model LLM Inference via Attention Map Reuse
Listen
Radio episode about this paper
Transcript
Introduction to the show: ident: AI Radio. Generated commentary on the latest Artificial Intelligence papers.
Tom: Today's paper: "Accelerating Cross-Model LLM Inference via Attention Map Reuse".
Jane: The gist The gist MapFlow, a system for efficient heterogeneous LLM serving via cross-model attention map reuse,
Tom: First, who's behind it and why it matters.
Paper summary: Tom: So we just talked about how this paper, "Accelerating Cross-Model LLM Inference via Attention Map Reuse," proposes using attention maps instead of KV states to speed up serving when you use different models in one workflow. The main thesis is that attention maps capture the token dependency structure better than KV states for cross-model transfer.
Jane: Right, so the authors point out that existing prefix caching methods are mostly limited to reusing KV tensors because they are too model-specific, and MapFlow tries to solve this by reusing attention maps across different models.
Lu: The paper claims that by combining partial recomputation with lightweight linear translation across layers and heads, you can enable efficient and accurate reuse of these attention maps even when the models have different internal structures.
Meng: So it’s not just a direct copy-paste of maps, but there's this mapping process to handle the differences between layers and heads, right? That sounds like a lot of bookkeeping on top of the core idea.
Tom: Exactly. They introduce Layer Mapping to map each receiver layer j to a sender layer m(j), and they get that attention map by sourcing it from A m(j)(S) where S is the sender model.
Jane: And then there’s Head Mapping, which figures out how each reuse receiver head Aˆj i(R) is computed using a linear transformation applied to the source attention map A m(j)(S).
Lu: This entire design addresses the issue of raw attention maps having quadratic size in context length and the overhead of directly reconstructing them on the receiver side.
Meng: That sounds like they're tackling the memory bloat problem head-on, which is huge when you're dealing with long contexts. How do they handle storing those maps compactly?
Tom: They tackle that with an Attention State Compressor that filters the attention map before it’s cached, using a hardware-friendly block-level Top-p filtering scheme to store the attention map in a compact Block Sparse Row format.
Jane: And for retrieval, they have this custom GPU kernel that fuses the reconstruction of the receiver’s attention map with the matrix multiplication of its value vectors, which avoids creating any intermediate dense material.
Conclusion: Tom: So looking at "Accelerating Cross-Model LLM Inference via Attention Map Reuse," the authors are arguing that cross-model prefix reuse is a bottleneck in complex AI data workflows, and they provide a system called MapFlow to tackle it with attention map reuse.
Jane: In simple terms, what this means for the listener is that when you have multiple different AI models working together on a long task—say, one model plans and another refines—this system can speed up the initial response time by fifteen to twenty percent.
Lu: It suggests that attention maps are a viable intermediate execution state for heterogeneous LLM serving, moving away from the tight architectural coupling of reusing KV states and offering more flexibility across models.
Meng: For someone who actually runs this stuff in production, it means you get a tangible performance boost on prefilling latency and throughput when you’re running those multi-model routing assistants.
Tom: It’s about finding a way to make that reuse practical for long contexts, and the results suggest it can serve as an effective execution primitive for those kinds of workflows.
Jane: So, the core idea is that attention maps are a promising way to achieve prefix reuse when you need to switch between different models in a sequence.
Zhan Jin, Yuze Luo, Bin Cui, Xupeng Miao
Peking University
cs.LG
Submitted: 2026-10-10
Updated: 2026-10-10
Journal ref: SIGMOD 2027
DOI: 10.1145/3856312
Code: https://github.com/PKU-DAIR/MapFlow
License: http://creativecommons.org/licenses/by/4.0/
Importance score: 83/100
The gist: The gist The gist MapFlow, a system for efficient heterogeneous LLM serving via cross-model attention map reuse, reduces prefilling latency and improves end-to-end serving efficiency while preserving
Key concepts
- Attention Maps
- These are internal representations within a Transformer model that encode the token-to-token dependency structure. The paper suggests they are more structurally similar across different models than standard Key-Value (KV) tensors, making them a viable state for cross-model reuse.
- Partial Recomputation
- This technique involves running the receiver model on the initial layers of a workflow to get accurate hidden states. For later layers, instead of performing expensive attention calculations, the system skips them and reuses previously cached attention maps from the sender model.
- Layer Mapping and Head Mapping
- These components manage how to translate attention maps from one model (sender) to another (receiver). Layer mapping links receiver layers to specific sender layers, while head mapping uses linear transformations to determine how individual attention heads are computed in the receiver model.
Summary
The gist The gist MapFlow, a system for efficient heterogeneous LLM serving via cross-model attention map reuse, reduces prefilling latency and improves end-to-end serving efficiency while preserving generation quality across heterogeneous model pairs and multi-turn routing workloads.
Motivation
LLM-augmented data workflows often involve multiple heterogeneous models operating over substantial shared context, such as schemas, tool specifications, interaction history, and intermediate results to long, structured contexts, including database schemas, system constraints, tool specifications, prior interaction history, and intermediate results. When multiple requests share the same prompt prefix and are served by the same model Key-Value (KV) tensors can be reused to avoid redundant prefilling and reduce Time-to-First-Token (TTFT), as demonstrated by recent LLM serving systems such as vLLM [33] and SGLang [84]. However, this assumption does not hold in many LLM-augmented data systems, where a single data workflow often involves multiple heterogeneous LLMs or agents. Existing prefix caching mechanisms are largely restricted to identical model instances.
Attention Maps as Reuse States
The key insight is that while KV states are model-specific latent representations, attention maps encode token-to-token dependency structure in Transformer models. For models that share the same tokenizer and process the same context, these dependency patterns can exhibit stronger structural similarity across models than KV tensors do. MapFlow transfers attention maps from a sender model to a receiver model, uses lightweight linear translation to bridge differences in layers and heads, and combines this with partial recomputation to preserve semantic fidelity. This makes attention maps a more suitable reusable state for heterogeneous execution.
MapFlow System Design
MapFlow addresses the challenges of raw attention maps having quadratic size in context length and the overhead of directly reconstructing dense receiver-side attention. It is designed with three core components:
-
Partial Recomputation, where for the first r layers, the receiver model R performs standard computation to obtain accurate hidden states, and for subsequent layers (j > r), R skips the heavy attention computation and instead reuses the cached attention maps from the sender model S.
-
Layer Mapping, which maps each reuse receiver layer j to a sender layer m(j) and Aˆj(R) is sourced from A m(j)(S).
-
Head Mapping, which determines how each reuse receiver head Aˆj i(R) is computed via A m(j)(S), utilizing linear transformation as head mapping.
Practical Implementation Details
To manage memory bloat, MapFlow employs an Attention State Compressor that filters the attention map before it is cached, using a hardware-friendly block-level Top-p filtering scheme to store the attention map in a compact Block Sparse Row (BSR) format. It also implements a Block Manager that organizes the cache by maintaining a prefix-hash-based indexing system for efficient retrieval. The Attention Retrieval uses a custom GPU kernel that fuses the reconstruction of the receiver’s attention map with the matrix multiplication of the receiver’s value vectors, directly producing the attention output without intermediate dense materialization.
Experimental Results
Experiments show that MapFlow reduces TTFT by 15%–20% while maintaining generation quality, and improves end-to-end throughput by up to 25% under the same latency target. These results suggest that cross-model attention reuse can serve as an effective execution primitive for LLM-augmented data systems. The benefits are especially pronounced in long-context, multi-turn settings, where repeated workflow-level context amplifies the cost of standard prefilling. MapFlow achieves lower P90 TTFT across all arrival rates and achieves at most 25% higher throughput (QPS) under same P90 TTFT constraint across different model pairs.
Conclusion
Ultimately, MapFlow provides a scalable, memory-efficient solution that significantly accelerates serving times for complex multi-model workflows. It demonstrates that attention maps provide a promising systems abstraction for heterogeneous prefix reuse. The system achieves a 15% to 20% reduction in Time-toFirst-Token and up to a 25% increase in end-to-end throughput for multi-turn routing, all while maintaining generation quality. It is particularly suitable for TTFT-sensitive, routing-heavy, and long-context workflows where repeated prefill constitutes a substantial fraction of execution time.
Acknowledgement
We thank the anonymous SIGMOD reviewers for their comments and helpful feedback. This work is supported by National Natural Science Foundation of China (U23B2048, U22B2037), Beijing Municipal Natural Science Foundation (Grant No. L2603008), and the Fundamental Research Funds for the Central Universities, Peking University. The corresponding authors are Bin Cui and Xupeng Miao.
References
[1] Amey Agrawal, Ashish Panwar, Jayashree Mohan, Nipun Kwatra, Bhargav S. Gulavani, and Ramachandran Ramjee. 2024. SARATHI: Efficient LLM Inference by Piggybacking Decodes with Chunked Prefills. In 18th USENIX Symposium on Operating Systems Design and Implementation (OSDI 24). USENIX Association, 537–552.
[2] Anysphere Inc. 2025. Cursor: The AI Code Editor. https://www.cursor.com/. Accessed: 2025-04-23.
[3] Yushi Bai, Xin Lv, Jiajie Zhang, Hongchang Lyu, Jiankai Tang, Zhidian Huang, Zhengxiao Du, Xiao Liu, Aohan Zeng, Lei Hou, Yuxiao Dong, Jie Tang, and Juanzi Li. 2024. LongBench: A Bilingual Multitask Benchmark for Long Context Understanding. In Proceedings of the 62nd Annual Meeting of the Association for Computational Linguistics (Volume 1: Long Papers). Association for Computational Linguistics.
[4] Butterfly Effect AI. 2025. Manus: AI Agent. https://manus.im/. Accessed: 2025-04-23.
[5] Beidi Chen, Tri Dao, Eric Winsor, Zhao Song, Atri Rudra, and Christopher Ré. 2021. Scatterbrain: Unifying sparse and low-rank attention. In Advances in Neural Information Processing Systems, Vol. 34.
[6] Liana Chen et al. 2024. Punica: Multi-Tenant LoRA Serving. In Proceedings of the 29th ACM International Conference on Architectural Support for Programming Languages and Operating Systems (ASPLOS).
[7] Lingjiao Chen, Matei Zaharia, and James Zou. 2023. FrugalGPT: How to Use Large Language Models While Reducing Cost and Improving Performance. In Advances in Neural Information Processing Systems (NeurIPS).
[8] Zui Chen, Lei Cao, Sam Madden, Tim Kraska, Zeyuan Shang, Ju Fan, Nan Tang, Zihui Gu, Chunwei Liu, and Michael Cafarella. 2023. SEED: Domain-specific data curation with large language models. arXiv preprint arXiv:2310.00749 (2023).
[9] Wei-Lin Chiang, Zhuohan Li, Zi Lin, Ying Sheng, Zhanghao Wu, Hao Zhang, Lianmin Zheng, Siyuan Zhuang, Yonghao Zhuang, Joseph E. Gonzalez, Ion Stoica, and Eric P. Xing. 2023. Vicuna:
Improvements for AI systems
- Bold header: Cross-Model Prefix Reuse via Attention Map Transfer
This improvement allows heterogeneous LLM serving systems to reuse attention maps instead of tightly coupled KV states, addressing the limitation that KV tensors are tightly coupled to model-specific architectures
by transferring attention maps from a sender model to a receiver model.
- Bold header: Lightweight Linear Translation for Head Mapping
To bridge architectural differences between models, the system uses lightweight linear translation across layers and heads
via learned weights, formally defined as applying the transformation where Aˆji(R) = (Aⱼi(R), 1 ≤ j ≤ r Ali(S) · wⱼi
to approximate the receiver's attention map.
- Bold header: Hardware-Friendly Block-Level Sparse Compression
The system employs a hardware-friendly block-level top−p sparse compression scheme to store attention maps in a compact block-sparse layout,
which reduces the quadratic space complexity of attention maps and ensures minimal loss in precision
by retaining only tokens necessary to satisfy a cumulative probability threshold p.
- Bold header: Fused Retrieval Kernel for Online Reconstruction
MapFlow implements a custom fused GPU kernel (Algorithm 2) that reconstructs the receiver’s attention and computes the output on the fly, without allocating global memory for intermediate dense states,
effectively overcoming the bottleneck where explicitly materializing An(R) requires O (nL2) memory.
- Bold header: Accelerated Prefix Caching in Data Workflows
The resulting system can serve prefix-heavy data workflows
by reducing prefilling latency by 15%–20%
and improving end-to-end throughput by up to 25%,
which is especially beneficial in long-context, multi-turn settings where context accumulation amplifies standard prefilling costs.
Abstract
LLM-augmented data workflows often involve multiple heterogeneous models operating over substantial shared context, such as schemas, tool specifications, interaction history, and intermediate results. Although prefix caching can reduce prefilling overhead, existing approaches are largely limited to reuse within the same model because KV states are tightly coupled to model-specific architectures. We present MapFlow, a system for efficient heterogeneous LLM serving via cross-model attention map reuse. Instead of reusing KV states, MapFlow reuses attention maps, which capture token dependency patterns and are more transferable across models. To enable efficient and accurate reuse, we combine partial recomputation with lightweight linear translation across layers and heads. To make attention reuse practical for long contexts, we further introduce block-level sparse compression and a fused retrieval kernel. Experiments show that MapFlow reduces prefilling latency and improves end-to-end serving efficiency while preserving generation quality across heterogeneous model pairs and multi-turn routing workloads. These results suggest that attention maps provide an effective reusable state for heterogeneous LLM serving, especially in prefix-heavy data workflows. Our code is available: https://github.com/PKU-DAIR/MapFlow.
Sources
- SEED: Domain-Specific Data Curation With Large Language Models
- Latent Space Communication via K-V Cache Alignment
- Cache-to-Cache: Direct Semantic Communication Between Large Language Models
- {\lambda}-Tune: Harnessing Large Language Models for Automated Database System Tuning
- RULER: What's the Real Context Size of Your Long-Context Language Models?
- ChatDB: Augmenting LLMs with Databases as Their Symbolic Memory
- RouterBench: A Benchmark for Multi-LLM Routing System
- Automated Design of Agentic Systems
- LlamaTune: Sample-Efficient DBMS Configuration Tuning
- Q-KVComm: Efficient Multi-Agent Communication Via Adaptive KV Cache Compression
- FlexPrefill: A Context-Aware Sparse Attention Mechanism for Efficient Long-Sequence Inference
- Personal LLM Agents: Insights and Survey about the Capability, Efficiency and Security
- SnapKV: LLM Knows What You are Looking for Before Generation
- Ministral 3
- DroidSpeak: KV Cache Sharing for Cross-LLM Communication and Multi-LLM Serving
- Coral: Cost-Efficient Multi-LLM Serving over Heterogeneous Cloud GPUs
- Qwen3 Technical Report
- LLMs as On-demand Customizable Service
- Multi-Segment Attention: Enabling Efficient KV-Cache Management for Faster Large Language Model Serving
- Quest: Query-Aware Sparsity for Efficient Long-Context LLM Inference
Related papers
- Polynomial-Augmented Neural Networks (PANNs) with Weak Orthogonality Constraints for Enhanced Function and PDE Approximation
- AIRL-S: Unifying Reinforcement Learning and Search-Based Test-Time Scaling via Adversarial Inverse Reinforcement Learning
- Transformers as Bayesian In-Context Experimenters: Smoothness-Adaptive Efficient ATE Estimation
- Convergence issues in Relational Concept Analysis based on AOC-posets
- Beliefs Beyond Posteriors: The Predictive Cost of ELBO Binding
- Understanding Diffusion Models via Ratio-Based Function Approximation with SignReLU Networks