Multi-Context Concatenation Across Requests for LLMs
Open Access
Abstract
Reusing separate, pre-filled Key-Value (KV) Caches for multiple contexts has become a common practice in handling multi-context scenarios with Large Language Models. However, this leads to a lack of cross-attention mechanisms between contexts. To address this, we propose CatLLM, the first method that concatenates multiple contexts across requests offline to compensate for this deficiency. Specifically, during offline processing, CatLLM identifies contexts that severely lack cross-attention by incorporating the weighted inner products of Q and K vectors from tokens in an un-concatenated context into an equivalently transformed weighted formulation for concatenated Q and K inner products. This yields a weighting corresponding to the output vector difference, which can then be used to identify contexts with severe cross-attention deficiencies and concatenate them into a single context for KV Cache computation. Experimental results show that, compared to the baseline of separate caching (i.e., no concatenation), fully concatenating all contexts improves the F1 score by 6%. Meanwhile, the proposed method reduces the number of contexts requiring caching from 10 to 7 while achieving a 3% F1 score, thereby maximizing performance improvement while minimizing the degree of context compression.
Keywords
Funding Information
- National Natural Science Foundation of China (62176074)
- National Natural Science Foundation of China (62406087)
- Natural Science Foundation of Shandong Province (ZR2024QF139)
- State Key Laboratory of Processors (CLQ202406)
This publication has 22 references indexed in Scilit:
- Sparse Attention Across Multiple-Context KV CacheProceedings of the AAAI Conference on Artificial Intelligence, 2026
- : Retrieve, Remove, and Return facts in multi-hop QAExpert Systems with Applications, 2025
- CacheBlend: Fast Large Language Model Serving with Cached Knowledge FusionarXiv, 2024
- A Survey on Efficient Inference for Large Language ModelsarXiv, 2024
- LongBench: A Bilingual, Multitask Benchmark for Long Context Understanding2024
- RoFormer: Enhanced transformer with Rotary Position EmbeddingNeurocomputing, 2023
- Qwen Technical ReportarXiv, 2023
- RPA: Reasoning Path Augmentation in Iterative Retrieving for Multi-Hop QAProceedings of the AAAI Conference on Artificial Intelligence, 2023
- LLaMA: Open and Efficient Foundation Language ModelsarXiv, 2023
- BERT: Pre-training of Deep Bidirectional Transformers for Language Understanding2019