{"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/efficient-inference-of-vision-instruction","title":"Efficient Inference of Vision Instruction-Following Models with Elastic Cache","arxiv_id":"2407.18121","date":"2024-07-25","proceeding":null,"authors":["Zuyan Liu","Benlin Liu","Jiahui Wang","Yuhao Dong","Guangyi Chen","Yongming Rao","Ranjay Krishna","Jiwen Lu"],"abstract":"In the field of instruction-following large vision-language models (LVLMs), the efficient deployment of these models faces challenges, notably due to the high memory demands of their key-value (KV) caches. Conventional cache management strategies for LLMs focus on cache eviction, which often fails to address the specific needs of multimodal instruction-following models. Recognizing this gap, in this paper, we introduce Elastic Cache, a novel approach that benefits from applying distinct acceleration methods for instruction encoding and output generation stages. We investigate the metrics of importance in different stages and propose an importance-driven cache merging strategy to prune redundancy caches. Instead of discarding less important caches, our strategy identifies important key/value vectors as anchor points. Surrounding less important caches are then merged with these anchors, enhancing the preservation of contextual information in the KV caches while yielding an arbitrary acceleration ratio. For instruction encoding, we utilize the frequency to evaluate the importance of caches. Regarding output generation, we prioritize tokens based on their distance with an offset, by which both the initial and most recent tokens are retained. Results on a range of LVLMs demonstrate that Elastic Cache not only boosts efficiency but also notably outperforms existing pruning methods in language generation across various tasks. Code is available at https://github.com/liuzuyan/ElasticCache","url_abs":"https://arxiv.org/abs/2407.18121v1","url_pdf":"https://arxiv.org/pdf/2407.18121v1.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":"efficient-inference-of-vision-instruction","repo_url":"https://github.com/liuzuyan/elasticcache","is_official":1,"mentioned_in_paper":1,"mentioned_in_github":1,"framework":"pytorch","reach":{"status":"ok","spdx":"MIT"}}],"tasks":[{"task_slug":"instruction-following","task_name":"Instruction Following"},{"task_slug":"text-generation","task_name":"Text Generation"}],"methods":[{"method_slug":"focus","method_name":"Focus"},{"method_slug":"pruning","method_name":"Pruning"}],"datasets_introduced":[],"methods_introduced":[],"results":[],"syntology":{"atlas_url":"https://app.syntology.ai/?focus=2407.18121","mcp":{"get_harvested_code_for_paper":{"arxiv_id":"2407.18121"}},"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/liuzuyan/elasticcache","reach":{"status":"ok","spdx":"MIT"}},{"provenance":"deterministic:regex_extraction","url":"https://github.com/liuzuyan/ElasticCache","reach":{"status":"ok","spdx":"MIT"}}],"summary":{"ran":2,"ran_draft_wrong":1,"ran_fixture":2},"by_repo_kind":{"official":{"samples":5,"ran":5,"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":0,"samples":[{"code_sha256_prefix":"5cf50677fba77b26","entry":"ElasticCache","repo":"liuzuyan/ElasticCache","repo_kind":"official","path":"kv_cache.py","file_url":"https://github.com/liuzuyan/ElasticCache/blob/HEAD/kv_cache.py","link_basis":"first_harvest_node","language":"python","status":"ran","verification_level":1,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":false,"licence":"MIT","inline_ok":true,"mcp_get_code":{"code_sha256":"5cf50677fba77b26"}},{"code_sha256_prefix":"bb945d226af806a7","entry":"load_image","repo":"liuzuyan/elasticcache","repo_kind":"official","path":"convert_rouge_llava.py","file_url":"https://github.com/liuzuyan/elasticcache/blob/HEAD/convert_rouge_llava.py","link_basis":"first_harvest_node","language":"python","status":"ran","verification_level":1,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":false,"licence":"MIT","inline_ok":true,"mcp_get_code":{"code_sha256":"bb945d226af806a7"}},{"code_sha256_prefix":"2564045c0e65006b","entry":"slice1d","repo":"liuzuyan/elasticcache","repo_kind":"official","path":"kv_cache.py","file_url":"https://github.com/liuzuyan/elasticcache/blob/HEAD/kv_cache.py","link_basis":"plan_row","language":"python","status":"ran_draft_wrong","verification_level":1,"contract_check":"MISDECLARED","metamorphic_tier":"invariant","behaviour_fingerprint":true,"licence":"MIT","inline_ok":true,"mcp_get_code":{"code_sha256":"2564045c0e65006b"}},{"code_sha256_prefix":"19c86edfcb34276c","entry":"slice2d","repo":"liuzuyan/elasticcache","repo_kind":"official","path":"kv_cache.py","file_url":"https://github.com/liuzuyan/elasticcache/blob/HEAD/kv_cache.py","link_basis":"plan_row","language":"python","status":"ran_fixture","verification_level":1,"contract_check":"RAISES","metamorphic_tier":"invariant","behaviour_fingerprint":false,"licence":"MIT","inline_ok":true,"mcp_get_code":{"code_sha256":"19c86edfcb34276c"}},{"code_sha256_prefix":"8884022644d5af82","entry":"slice3d","repo":"liuzuyan/elasticcache","repo_kind":"official","path":"kv_cache.py","file_url":"https://github.com/liuzuyan/elasticcache/blob/HEAD/kv_cache.py","link_basis":"plan_row","language":"python","status":"ran_fixture","verification_level":1,"contract_check":"RAISES","metamorphic_tier":"invariant","behaviour_fingerprint":false,"licence":"MIT","inline_ok":true,"mcp_get_code":{"code_sha256":"8884022644d5af82"}}]},"arxiv_metadata":null,"syntology_extracted_results":null}