{"about":{"site":"https://codewithpapers.app","non_affiliation":"Code with Papers and Syntology are not affiliated with, endorsed by, or sponsored by Papers with Code, Meta, or the pwc-archive mirror.","licence":"CC BY-SA 4.0","licence_url":"https://creativecommons.org/licenses/by-sa/4.0/legalcode","attribution":"https://codewithpapers.app/attribution","modified":"archive material modified by Syntology; see the attribution page"},"url":"/paper/cacheblend-fast-large-language-model-serving","title":"CacheBlend: Fast Large Language Model Serving for RAG with Cached Knowledge Fusion","arxiv_id":"2405.16444","date":"2024-05-26","proceeding":null,"authors":["Jiayi Yao","Hanchen Li","YuHan Liu","Siddhant Ray","Yihua Cheng","Qizheng Zhang","Kuntai Du","Shan Lu","Junchen Jiang"],"abstract":"Large language models (LLMs) often incorporate multiple text chunks in their inputs to provide the necessary contexts. To speed up the prefill of the long LLM inputs, one can pre-compute the KV cache of a text and re-use the KV cache when the context is reused as the prefix of another LLM input. However, the reused text chunks are not always the input prefix, and when they are not, their precomputed KV caches cannot be directly used since they ignore the text's cross-attention with the preceding text in the LLM input. Thus, the benefits of reusing KV caches remain largely unrealized. This paper tackles just one question: when an LLM input contains multiple text chunks, how to quickly combine their precomputed KV caches in order to achieve the same generation quality as the expensive full prefill (i.e., without reusing KV cache)? We present CacheBlend, a scheme that reuses the pre-computed KV caches, regardless prefix or not, and selectively recomputes the KV values of a small subset of tokens to partially update each reused KV cache. In the meantime,the small extra delay for recomputing some tokens can be pipelined with the retrieval of KV caches within the same job,allowing CacheBlend to store KV caches in slower devices with more storage capacity while retrieving them without increasing the inference delay. By comparing CacheBlend with the state-of-the-art KV cache reusing schemes on three open-source LLMs of various sizes and four popular benchmark datasets of different tasks, we show that CacheBlend reduces time-to-first-token (TTFT) by 2.2-3.3X and increases the inference throughput by 2.8-5X, compared with full KV recompute, without compromising generation quality or incurring more storage cost.","url_abs":"https://arxiv.org/abs/2405.16444v2","url_pdf":"https://arxiv.org/pdf/2405.16444v2.pdf","source":{"archive":"pwc-archive (Hugging Face), CC BY-SA 4.0","snapshot":"2025-07-28","licence_url":"https://creativecommons.org/licenses/by-sa/4.0/legalcode","row_kind":"abstracts"},"code_links":[{"paper_slug":"cacheblend-fast-large-language-model-serving","repo_url":"https://github.com/YaoJiayi/CacheBlend","is_official":1,"mentioned_in_paper":0,"mentioned_in_github":1,"framework":"pytorch","reach":{"status":"ok"}},{"paper_slug":"cacheblend-fast-large-language-model-serving","repo_url":"https://github.com/lmcache/lmcache","is_official":0,"mentioned_in_paper":0,"mentioned_in_github":1,"framework":"pytorch","reach":{"status":"ok","spdx":"Apache-2.0"}}],"tasks":[{"task_slug":"language-modeling","task_name":"Language Modeling"},{"task_slug":"language-modelling","task_name":"Language Modelling"},{"task_slug":"large-language-model","task_name":"Large Language Model"},{"task_slug":"rag","task_name":"RAG"}],"methods":[{"method_slug":"speed","method_name":"SPEED"}],"datasets_introduced":[],"methods_introduced":[],"results":[],"syntology":{"atlas_url":"https://app.syntology.ai/?focus=2405.16444","mcp":{"get_harvested_code_for_paper":{"arxiv_id":"2405.16444"}},"developers":"https://syntology.ai/developers","read_at":"2026-09-24T18:15:14+00:00","read_at_is":"when the build read Syntology's graph, not when any sample ran","claim":"Per-sample execution status on synthesized fixtures; not a correctness claim about the paper. Samples come from repositories linked to the paper, official or community; repo_kind says which.","repos":[{"provenance":"external:paperswithcode_snapshot_2025-07-28","url":"https://github.com/lmcache/lmcache","reach":{"status":"ok","spdx":"Apache-2.0"}},{"provenance":"external:paperswithcode_snapshot_2025-07-28","url":"https://github.com/YaoJiayi/CacheBlend","reach":{"status":"ok"}}],"summary":{"ran":8,"unverified":6},"by_repo_kind":{"official":{"samples":14,"ran":8,"repositories":1}},"repo_kind_vocabulary":{"official":"The archive marks this repository official for the paper","named_in_paper":"The archive records that the paper mentions this repository; it is not marked official","listed":"In the archive's code links for this paper, not marked official and not recorded as mentioned in the paper","found_in_text":"Syntology found this repository in the paper's own text; whether it is the authors' implementation is not asserted","community":"Not in the archive's code links for this paper; a community repository Syntology harvested"},"n_pointer_only_for_licence":14,"samples":[{"code_sha256_prefix":"5109c385e92b727e","entry":"async_request_deepspeed_mii","repo":"YaoJiayi/CacheBlend","repo_kind":"official","path":"vllm_blend/benchmarks/backend_request_func.py","file_url":"https://github.com/YaoJiayi/CacheBlend/blob/HEAD/vllm_blend/benchmarks/backend_request_func.py","link_basis":"harvester_set","language":"python","status":"ran","verification_level":1,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":false,"licence":"NONE","inline_ok":false,"mcp_get_code":{"code_sha256":"5109c385e92b727e"}},{"code_sha256_prefix":"23a62a462a38f854","entry":"async_request_tgi","repo":"YaoJiayi/CacheBlend","repo_kind":"official","path":"vllm_blend/benchmarks/backend_request_func.py","file_url":"https://github.com/YaoJiayi/CacheBlend/blob/HEAD/vllm_blend/benchmarks/backend_request_func.py","link_basis":"first_harvest_node","language":"python","status":"ran","verification_level":1,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":false,"licence":"NONE","inline_ok":false,"mcp_get_code":{"code_sha256":"23a62a462a38f854"}},{"code_sha256_prefix":"fa581ebc13cb414d","entry":"async_request_trt_llm","repo":"YaoJiayi/CacheBlend","repo_kind":"official","path":"vllm_blend/benchmarks/backend_request_func.py","file_url":"https://github.com/YaoJiayi/CacheBlend/blob/HEAD/vllm_blend/benchmarks/backend_request_func.py","link_basis":"harvester_set","language":"python","status":"ran","verification_level":1,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":false,"licence":"NONE","inline_ok":false,"mcp_get_code":{"code_sha256":"fa581ebc13cb414d"}},{"code_sha256_prefix":"5ae630bfc3821b6e","entry":"run_and_read_all","repo":"YaoJiayi/CacheBlend","repo_kind":"official","path":"vllm_blend/collect_env.py","file_url":"https://github.com/YaoJiayi/CacheBlend/blob/HEAD/vllm_blend/collect_env.py","link_basis":"harvester_set","language":"python","status":"ran","verification_level":1,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":false,"licence":"NONE","inline_ok":false,"mcp_get_code":{"code_sha256":"5ae630bfc3821b6e"}},{"code_sha256_prefix":"fd6dc735c20e21a1","entry":"run_vllm","repo":"YaoJiayi/CacheBlend","repo_kind":"official","path":"vllm_blend/benchmarks/benchmark_throughput.py","file_url":"https://github.com/YaoJiayi/CacheBlend/blob/HEAD/vllm_blend/benchmarks/benchmark_throughput.py","link_basis":"first_harvest_node","language":"python","status":"ran","verification_level":1,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":false,"licence":"NONE","inline_ok":false,"mcp_get_code":{"code_sha256":"fd6dc735c20e21a1"}},{"code_sha256_prefix":"f55439b30be97107","entry":"sample_requests","repo":"YaoJiayi/CacheBlend","repo_kind":"official","path":"vllm_blend/benchmarks/benchmark_throughput.py","file_url":"https://github.com/YaoJiayi/CacheBlend/blob/HEAD/vllm_blend/benchmarks/benchmark_throughput.py","link_basis":"first_harvest_node","language":"python","status":"ran","verification_level":1,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":false,"licence":"NONE","inline_ok":false,"mcp_get_code":{"code_sha256":"f55439b30be97107"}},{"code_sha256_prefix":"755fbe4f15780723","entry":"sample_sharegpt_requests","repo":"YaoJiayi/CacheBlend","repo_kind":"official","path":"vllm_blend/benchmarks/benchmark_serving.py","file_url":"https://github.com/YaoJiayi/CacheBlend/blob/HEAD/vllm_blend/benchmarks/benchmark_serving.py","link_basis":"first_harvest_node","language":"python","status":"ran","verification_level":1,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":false,"licence":"NONE","inline_ok":false,"mcp_get_code":{"code_sha256":"755fbe4f15780723"}},{"code_sha256_prefix":"d87074ce933e7862","entry":"sample_sonnet_requests","repo":"YaoJiayi/CacheBlend","repo_kind":"official","path":"vllm_blend/benchmarks/benchmark_serving.py","file_url":"https://github.com/YaoJiayi/CacheBlend/blob/HEAD/vllm_blend/benchmarks/benchmark_serving.py","link_basis":"first_harvest_node","language":"python","status":"ran","verification_level":1,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":false,"licence":"NONE","inline_ok":false,"mcp_get_code":{"code_sha256":"d87074ce933e7862"}},{"code_sha256_prefix":"c382c6353e8cccb0","entry":"awq_dequantize","repo":"YaoJiayi/CacheBlend","repo_kind":"official","path":"vllm_blend/vllm/_custom_ops.py","file_url":"https://github.com/YaoJiayi/CacheBlend/blob/HEAD/vllm_blend/vllm/_custom_ops.py","link_basis":"harvester_set","language":"python","status":"unverified","verification_level":0,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":false,"licence":"NONE","inline_ok":false,"mcp_get_code":{"code_sha256":"c382c6353e8cccb0"}},{"code_sha256_prefix":"f3fcfeaca594c86f","entry":"awq_gemm","repo":"YaoJiayi/CacheBlend","repo_kind":"official","path":"vllm_blend/vllm/_custom_ops.py","file_url":"https://github.com/YaoJiayi/CacheBlend/blob/HEAD/vllm_blend/vllm/_custom_ops.py","link_basis":"harvester_set","language":"python","status":"unverified","verification_level":0,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":false,"licence":"NONE","inline_ok":false,"mcp_get_code":{"code_sha256":"f3fcfeaca594c86f"}},{"code_sha256_prefix":"4def2cf22c36f4e8","entry":"gptq_gemm","repo":"YaoJiayi/CacheBlend","repo_kind":"official","path":"vllm_blend/vllm/_custom_ops.py","file_url":"https://github.com/YaoJiayi/CacheBlend/blob/HEAD/vllm_blend/vllm/_custom_ops.py","link_basis":"harvester_set","language":"python","status":"unverified","verification_level":0,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":false,"licence":"NONE","inline_ok":false,"mcp_get_code":{"code_sha256":"4def2cf22c36f4e8"}},{"code_sha256_prefix":"6b73fe0480a96ad9","entry":"run","repo":"YaoJiayi/CacheBlend","repo_kind":"official","path":"vllm_blend/collect_env.py","file_url":"https://github.com/YaoJiayi/CacheBlend/blob/HEAD/vllm_blend/collect_env.py","link_basis":"harvester_set","language":"python","status":"unverified","verification_level":0,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":false,"licence":"NONE","inline_ok":false,"mcp_get_code":{"code_sha256":"6b73fe0480a96ad9"}},{"code_sha256_prefix":"ce7a62e37fe78c0d","entry":"run_and_parse_first_match","repo":"YaoJiayi/CacheBlend","repo_kind":"official","path":"vllm_blend/collect_env.py","file_url":"https://github.com/YaoJiayi/CacheBlend/blob/HEAD/vllm_blend/collect_env.py","link_basis":"harvester_set","language":"python","status":"unverified","verification_level":0,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":false,"licence":"NONE","inline_ok":false,"mcp_get_code":{"code_sha256":"ce7a62e37fe78c0d"}},{"code_sha256_prefix":"0745e2813903bd8d","entry":"run_hf","repo":"YaoJiayi/CacheBlend","repo_kind":"official","path":"vllm_blend/benchmarks/benchmark_throughput.py","file_url":"https://github.com/YaoJiayi/CacheBlend/blob/HEAD/vllm_blend/benchmarks/benchmark_throughput.py","link_basis":"first_harvest_node","language":"python","status":"unverified","verification_level":0,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":false,"licence":"NONE","inline_ok":false,"mcp_get_code":{"code_sha256":"0745e2813903bd8d"}}]},"arxiv_metadata":null,"syntology_extracted_results":null}