{"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/clinicalmamba-a-generative-clinical-language","title":"ClinicalMamba: A Generative Clinical Language Model on Longitudinal Clinical Notes","arxiv_id":"2403.05795","date":"2024-03-09","proceeding":null,"authors":["Zhichao Yang","Avijit Mitra","Sunjae Kwon","Hong Yu"],"abstract":"The advancement of natural language processing (NLP) systems in healthcare hinges on language model ability to interpret the intricate information contained within clinical notes. This process often requires integrating information from various time points in a patient's medical history. However, most earlier clinical language models were pretrained with a context length limited to roughly one clinical document. In this study, We introduce ClinicalMamba, a specialized version of the Mamba language model, pretrained on a vast corpus of longitudinal clinical notes to address the unique linguistic characteristics and information processing needs of the medical domain. ClinicalMamba, with 130 million and 2.8 billion parameters, demonstrates a superior performance in modeling clinical language across extended text lengths compared to Mamba and clinical Llama. With few-shot learning, ClinicalMamba achieves notable benchmarks in speed and accuracy, outperforming existing clinical language models and general domain large models like GPT-4 in longitudinal clinical notes information extraction tasks.","url_abs":"https://arxiv.org/abs/2403.05795v1","url_pdf":"https://arxiv.org/pdf/2403.05795v1.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":"clinicalmamba-a-generative-clinical-language","repo_url":"https://github.com/whaleloops/clinicalmamba","is_official":1,"mentioned_in_paper":1,"mentioned_in_github":0,"framework":"pytorch","reach":{"status":"ok","spdx":"MIT"}}],"tasks":[{"task_slug":"few-shot-learning","task_name":"Few-Shot Learning"},{"task_slug":"language-modeling","task_name":"Language Modeling"},{"task_slug":"language-modelling","task_name":"Language Modelling"},{"task_slug":"mamba","task_name":"Mamba"}],"methods":[{"method_slug":"absolute-position-encodings","method_name":"Absolute Position Encodings"},{"method_slug":"adam","method_name":"Adam"},{"method_slug":"attention","method_name":"Attention"},{"method_slug":"bpe","method_name":"BPE"},{"method_slug":"dense-connections","method_name":"Dense Connections"},{"method_slug":"dropout","method_name":"Dropout"},{"method_slug":"gpt-4","method_name":"GPT-4"},{"method_slug":"label-smoothing","method_name":"Label Smoothing"},{"method_slug":"layer-normalization","method_name":"Layer Normalization"},{"method_slug":"linear-layer","method_name":"Linear Layer"},{"method_slug":"multi-head-attention","method_name":"Multi-Head Attention"},{"method_slug":"position-wise-feed-forward-layer","method_name":"Position-Wise Feed-Forward Layer"},{"method_slug":"residual-connection","method_name":"Residual Connection"},{"method_slug":"speed","method_name":"SPEED"},{"method_slug":"softmax","method_name":"Softmax"},{"method_slug":"transformer","method_name":"Transformer"}],"datasets_introduced":[],"methods_introduced":[],"results":[],"syntology":{"syntology_url":null,"atlas_url":"https://app.syntology.ai/?focus=2403.05795","mcp":{"get_harvested_code_for_paper":{"arxiv_id":"2403.05795"}},"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/whaleloops/clinicalmamba","reach":{"status":"ok","spdx":"MIT"}}],"summary":{"ran_violates":1,"ran":6},"by_repo_kind":{"official":{"samples":7,"ran":7,"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":"92ed21244c92c504","entry":"find_threshold_micro","repo":"whaleloops/clinicalmamba","repo_kind":"official","path":"trainer/metrics.py","file_url":"https://github.com/whaleloops/clinicalmamba/blob/HEAD/trainer/metrics.py","link_basis":"plan_row","language":"python","status":"ran_violates","verification_level":1,"contract_check":"VIOLATES","metamorphic_tier":"invariant","behaviour_fingerprint":true,"licence":"MIT","inline_ok":true,"mcp_get_code":{"code_sha256":"92ed21244c92c504"}},{"code_sha256_prefix":"007cb7de15c84c0d","entry":"get_custom_scheduler","repo":"whaleloops/clinicalmamba","repo_kind":"official","path":"trainer/trainer_mamba.py","file_url":"https://github.com/whaleloops/clinicalmamba/blob/HEAD/trainer/trainer_mamba.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":"007cb7de15c84c0d"}},{"code_sha256_prefix":"4b6ebd251c56a3cf","entry":"intersect_size","repo":"whaleloops/clinicalmamba","repo_kind":"official","path":"trainer/metrics.py","file_url":"https://github.com/whaleloops/clinicalmamba/blob/HEAD/trainer/metrics.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":"4b6ebd251c56a3cf"}},{"code_sha256_prefix":"af9c335afae6a5f0","entry":"proc_note","repo":"whaleloops/clinicalmamba","repo_kind":"official","path":"trainer/data.py","file_url":"https://github.com/whaleloops/clinicalmamba/blob/HEAD/trainer/data.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":"af9c335afae6a5f0"}},{"code_sha256_prefix":"24a6705d8df76629","entry":"proc_prompt","repo":"whaleloops/clinicalmamba","repo_kind":"official","path":"trainer/data.py","file_url":"https://github.com/whaleloops/clinicalmamba/blob/HEAD/trainer/data.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":"24a6705d8df76629"}},{"code_sha256_prefix":"04ca90a31900e7e3","entry":"proc_text","repo":"whaleloops/clinicalmamba","repo_kind":"official","path":"trainer/data.py","file_url":"https://github.com/whaleloops/clinicalmamba/blob/HEAD/trainer/data.py","link_basis":"first_harvest_node","language":"python","status":"ran","verification_level":1,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":true,"licence":"MIT","inline_ok":true,"mcp_get_code":{"code_sha256":"04ca90a31900e7e3"}},{"code_sha256_prefix":"3e72bbd1f3c8c717","entry":"union_size","repo":"whaleloops/clinicalmamba","repo_kind":"official","path":"trainer/metrics.py","file_url":"https://github.com/whaleloops/clinicalmamba/blob/HEAD/trainer/metrics.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":"3e72bbd1f3c8c717"}}]},"arxiv_metadata":null,"syntology_extracted_results":null}