{"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/cats-contextually-aware-thresholding-for","title":"CATS: Contextually-Aware Thresholding for Sparsity in Large Language Models","arxiv_id":"2404.08763","date":"2024-04-12","proceeding":null,"authors":["DongHyun Lee","Je-Yong Lee","Genghan Zhang","Mo Tiwari","Azalia Mirhoseini"],"abstract":"Large Language Models (LLMs) have dramatically advanced AI applications, yet their deployment remains challenging due to their immense inference costs. Recent studies ameliorate the computational costs of LLMs by increasing their activation sparsity but suffer from significant performance degradation on downstream tasks. In this work, we introduce a new framework for sparsifying the activations of base LLMs and reducing inference costs, dubbed Contextually Aware Thresholding for Sparsity (CATS). CATS is relatively simple, easy to implement, and highly effective. At the heart of our framework is a new non-linear activation function. We demonstrate that CATS can be applied to various base models, including Mistral-7B and Llama2-7B, and outperforms existing sparsification techniques in downstream task performance. More precisely, CATS-based models often achieve downstream task performance within 1-2% of their base models without any fine-tuning and even at activation sparsity levels of 50%. Furthermore, CATS-based models converge faster and display better task performance than competing techniques when fine-tuning is applied. Finally, we develop a custom GPU kernel for efficient implementation of CATS that translates the activation of sparsity of CATS to real wall-clock time speedups. Our custom kernel implementation of CATS results in a ~15% improvement in wall-clock inference latency of token generation on both Llama-7B and Mistral-7B.","url_abs":"https://arxiv.org/abs/2404.08763v4","url_pdf":"https://arxiv.org/pdf/2404.08763v4.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":"cats-contextually-aware-thresholding-for","repo_url":"https://github.com/scalingintelligence/cats","is_official":1,"mentioned_in_paper":1,"mentioned_in_github":1,"framework":"pytorch","reach":null},{"paper_slug":"cats-contextually-aware-thresholding-for","repo_url":"https://github.com/infini-ai-lab/sirius","is_official":0,"mentioned_in_paper":0,"mentioned_in_github":1,"framework":"pytorch","reach":{"status":"ok"}},{"paper_slug":"cats-contextually-aware-thresholding-for","repo_url":"https://github.com/zeonfaiho/chess","is_official":0,"mentioned_in_paper":0,"mentioned_in_github":1,"framework":"pytorch","reach":null}],"tasks":[{"task_slug":null,"task_name":"GPU"}],"methods":[{"method_slug":"aware","method_name":"AWARE"},{"method_slug":"base","method_name":"BASE"}],"datasets_introduced":[],"methods_introduced":[],"results":[],"syntology":{"atlas_url":"https://app.syntology.ai/?focus=2404.08763","mcp":{"get_harvested_code_for_paper":{"arxiv_id":"2404.08763"}},"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/scalingintelligence/cats","reach":null},{"provenance":"external:paperswithcode_snapshot_2025-07-28","url":"https://github.com/infini-ai-lab/sirius","reach":{"status":"ok"}},{"provenance":"external:paperswithcode_snapshot_2025-07-28","url":"https://github.com/zeonfaiho/chess","reach":null}],"summary":{"unverified":3},"by_repo_kind":{"official":{"samples":3,"ran":0,"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":"63298b2869799b34","entry":"fuse_gemv_cmp","repo":"scalingintelligence/cats","repo_kind":"official","path":"flash_gemv/flash_gemv/flash_gemv.py","file_url":"https://github.com/scalingintelligence/cats/blob/HEAD/flash_gemv/flash_gemv/flash_gemv.py","link_basis":"first_harvest_node","language":"python","status":"unverified","verification_level":0,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":false,"licence":"MIT","inline_ok":true,"mcp_get_code":{"code_sha256":"63298b2869799b34"}},{"code_sha256_prefix":"da7a42942521cd16","entry":"fuse_gemv_flag","repo":"scalingintelligence/cats","repo_kind":"official","path":"flash_gemv/flash_gemv/flash_gemv.py","file_url":"https://github.com/scalingintelligence/cats/blob/HEAD/flash_gemv/flash_gemv/flash_gemv.py","link_basis":"first_harvest_node","language":"python","status":"unverified","verification_level":0,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":false,"licence":"MIT","inline_ok":true,"mcp_get_code":{"code_sha256":"da7a42942521cd16"}},{"code_sha256_prefix":"6e9d117c3533b52e","entry":"fuse_gemv_flag_gemv","repo":"scalingintelligence/cats","repo_kind":"official","path":"flash_gemv/flash_gemv/flash_gemv.py","file_url":"https://github.com/scalingintelligence/cats/blob/HEAD/flash_gemv/flash_gemv/flash_gemv.py","link_basis":"first_harvest_node","language":"python","status":"unverified","verification_level":0,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":false,"licence":"MIT","inline_ok":true,"mcp_get_code":{"code_sha256":"6e9d117c3533b52e"}}]},"arxiv_metadata":null,"syntology_extracted_results":null}