{"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/the-hidden-attention-of-mamba-models","title":"The Hidden Attention of Mamba Models","arxiv_id":"2403.01590","date":"2024-03-03","proceeding":null,"authors":["Ameen Ali","Itamar Zimerman","Lior Wolf"],"abstract":"The Mamba layer offers an efficient selective state space model (SSM) that is highly effective in modeling multiple domains, including NLP, long-range sequence processing, and computer vision. Selective SSMs are viewed as dual models, in which one trains in parallel on the entire sequence via an IO-aware parallel scan, and deploys in an autoregressive manner. We add a third view and show that such models can be viewed as attention-driven models. This new perspective enables us to empirically and theoretically compare the underlying mechanisms to that of the self-attention layers in transformers and allows us to peer inside the inner workings of the Mamba model with explainability methods. Our code is publicly available.","url_abs":"https://arxiv.org/abs/2403.01590v2","url_pdf":"https://arxiv.org/pdf/2403.01590v2.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":"the-hidden-attention-of-mamba-models","repo_url":"https://github.com/ameenali/hiddenmambaattn","is_official":1,"mentioned_in_paper":1,"mentioned_in_github":1,"framework":"pytorch","reach":{"status":"ok"}}],"tasks":[{"task_slug":"mamba","task_name":"Mamba"}],"methods":[],"datasets_introduced":[],"methods_introduced":[],"results":[],"syntology":{"syntology_url":"https://syntology.ai/paper/2403.01590","atlas_url":"https://app.syntology.ai/?focus=2403.01590","mcp":{"get_harvested_code_for_paper":{"arxiv_id":"2403.01590"}},"developers":"https://syntology.ai/developers","read_at":"2026-09-25T09:33:49+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/ameenali/hiddenmambaattn","reach":{"status":"ok"}}],"summary":{"ran_honours":1,"ran":3,"ran_draft_wrong":1,"unverified":3},"by_repo_kind":{"official":{"samples":8,"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":8,"samples":[{"code_sha256_prefix":"f50a8d20efb35c68","entry":"broadcat","repo":"ameenali/hiddenmambaattn","repo_kind":"official","path":"vim/rope.py","file_url":"https://github.com/ameenali/hiddenmambaattn/blob/HEAD/vim/rope.py","link_basis":"harvester_set","language":"python","status":"ran_honours","verification_level":1,"contract_check":"HONOURS","metamorphic_tier":null,"behaviour_fingerprint":false,"licence":"NONE","inline_ok":false,"mcp_get_code":{"code_sha256":"f50a8d20efb35c68"}},{"code_sha256_prefix":"5a98eb7226d25564","entry":"compute_rollout_attention","repo":"ameenali/hiddenmambaattn","repo_kind":"official","path":"vim/xai_utils.py","file_url":"https://github.com/ameenali/hiddenmambaattn/blob/HEAD/vim/xai_utils.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":"5a98eb7226d25564"}},{"code_sha256_prefix":"166972325ad0ce37","entry":"generate_raw_attn","repo":"ameenali/hiddenmambaattn","repo_kind":"official","path":"vim/xai_utils.py","file_url":"https://github.com/ameenali/hiddenmambaattn/blob/HEAD/vim/xai_utils.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":"166972325ad0ce37"}},{"code_sha256_prefix":"4a0feeebf8ac43a8","entry":"new_data_aug_generator","repo":"ameenali/hiddenmambaattn","repo_kind":"official","path":"vim/augment.py","file_url":"https://github.com/ameenali/hiddenmambaattn/blob/HEAD/vim/augment.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":"4a0feeebf8ac43a8"}},{"code_sha256_prefix":"58823d9435a8751b","entry":"rotate_half","repo":"ameenali/hiddenmambaattn","repo_kind":"official","path":"vim/rope.py","file_url":"https://github.com/ameenali/hiddenmambaattn/blob/HEAD/vim/rope.py","link_basis":"harvester_set","language":"python","status":"ran_draft_wrong","verification_level":1,"contract_check":"MISDECLARED","metamorphic_tier":"invariant","behaviour_fingerprint":true,"licence":"NONE","inline_ok":false,"mcp_get_code":{"code_sha256":"58823d9435a8751b"}},{"code_sha256_prefix":"d58967bba23da4e6","entry":"build_dataset","repo":"ameenali/hiddenmambaattn","repo_kind":"official","path":"vim/datasets.py","file_url":"https://github.com/ameenali/hiddenmambaattn/blob/HEAD/vim/datasets.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":"d58967bba23da4e6"}},{"code_sha256_prefix":"ebeb7b6e20a434cf","entry":"build_transform","repo":"ameenali/hiddenmambaattn","repo_kind":"official","path":"vim/datasets.py","file_url":"https://github.com/ameenali/hiddenmambaattn/blob/HEAD/vim/datasets.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":"ebeb7b6e20a434cf"}},{"code_sha256_prefix":"c8f47a670b4d9489","entry":"generate_mamba_attr","repo":"ameenali/hiddenmambaattn","repo_kind":"official","path":"vim/xai_utils.py","file_url":"https://github.com/ameenali/hiddenmambaattn/blob/HEAD/vim/xai_utils.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":"c8f47a670b4d9489"}}]},"arxiv_metadata":null,"syntology_extracted_results":null}