SYNTOLOGY HomeExplorerAtlasCodeMethodologyAboutDevelopersFeedPricing
Paper · 2403.05795 · 2024

ClinicalMamba: A Generative Clinical Language Model on Longitudinal Clinical Notes

arXiv · PDF · Open in the Atlas

Code that ran

7 of 7 samples (functions and classes) lifted from this paper's linked repositories executed on a synthesized input in Syntology's jail (0 of them constructed an object rather than computing a result; 2 honoured the contract we drafted, 1 violated it and 0 have no contract verdict; 4 failures of our instrument; 0 no recorded run), measured 2026-11-22; repository links from the Papers with Code archive attributed under CC BY-SA, no affiliation; bodies inline only under a permissive licence as GitHub detects it. Not a reproduction of the paper's results.

"Ran" means the function executed on a synthesized input and returned a value. It is not a reproduction of the paper's results. This record, dated, as JSON: /api/ran/2403.05795.json · badge: /api/ran/2403.05795.svg

Each repository's role is a label: a classifier's output recorded on the link, or, where no role is recorded, what the Papers with Code archive marked. The line under it names its basis. Neither says who wrote the code.

RepositoryRoleRan
whaleloops/clinicalmamba canonical (classifier label)
classifier basis: census
7 ran · 0 no recorded run
FunctionStatusWhere it lives
find_threshold_micro Ran
ran, violated the contract we drafted
whaleloops/clinicalmamba/trainer/metrics.py
code served (permissive licence) · get_code("92ed21244c92c504")
How it ran

Ran in Syntology's sandbox on this synthesized input (drafted by a language model, Claude Haiku 4.5, prompt python_fixture_v1) and returned float32, ndim 0, dtype family float, shape () as a later run recorded it. The image it ran in was not recorded. If your copy returns the same type, ndim and shape on these inputs, it matched what we observed; nothing here checks that. It does NOT mean the output is correct: nothing has compared it to the paper.

import numpy as np

# Create small numpy arrays for the function parameters
# dev_yhat_raw: raw predictions (scores), should be reshaped to 1D
# dev_y: binary labels, should be reshaped to 1D

np.random.seed(0)

# Create small sample data
# Using shape (2, 3) for dev_yhat_raw and dev_y to have distinct dimensions
dev_yhat_raw = np.array([[0.1, 0.8, 0.3],
                         [0.6, 0.2, 0.9]], dtype=np.float32)

dev_y = np.array([[0, 1, 0],
                  [1, 0, 1]], dtype=np.int32)

ARGS = {
    "dev_yhat_raw": dev_yhat_raw,
    "dev_y": dev_y
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1
Imports
numpy — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type float32, ndim 0, dtype family float, shape () — shape () as a later run recorded it
dtype family
int means an integer dtype; float means any other dtype the instrument saw, bool and complex included (fixture_check.py records only these two families)
Environment
image not recorded; re-verify against syntology-harvest-sandbox:v5-deps; not recorded for this sample: the harness installs a cuda-to-cpu shim (cuda_shim.py) before every sample and no run records whether a sample needed it; seed: none by the harness; any seed is in the setup block
get_custom_scheduler Ran
ran; our contract draft was wrong, not the code
whaleloops/clinicalmamba/trainer/trainer_mamba.py
code served (permissive licence) · get_code("007cb7de15c84c0d")
How it ran

Ran in Syntology's sandbox on this synthesized input (drafted by a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API) and returned LambdaLR. The image it ran in was not recorded. If your copy returns the same type on these inputs, it matched what we observed; nothing here checks that. It does NOT mean the output is correct: nothing has compared it to the paper.

import torch
import torch.nn as nn

torch.manual_seed(0)

# Create a simple model
model = nn.Linear(4, 3)

# Create an optimizer
optimizer = torch.optim.SGD(model.parameters(), lr=0.1)

# Define scheduler parameters
num_warmup_steps = 100
num_training_steps = 1000
min_lr = 0.01

ARGS = {
    "optimizer": optimizer,
    "num_warmup_steps": num_warmup_steps,
    "num_training_steps": num_training_steps,
    "min_lr": min_lr
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
torch — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type LambdaLR — a LambdaLR output has no array shape of its own; none is stated — the instrument coerces any output to an array; for a LambdaLR output the recorded ndim 0 and dtype family float describe that coercion, not the output, and are not stated
Environment
image not recorded; re-verify against syntology-harvest-sandbox:v5-deps; not recorded for this sample: the harness installs a cuda-to-cpu shim (cuda_shim.py) before every sample and no run records whether a sample needed it; seed: none by the harness; any seed is in the setup block
intersect_size Ran
ran, honoured the contract we drafted
whaleloops/clinicalmamba/trainer/metrics.py
code served (permissive licence) · get_code("4b6ebd251c56a3cf")
How it ran

Ran in Syntology's sandbox on this synthesized input (drafted by a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API) and returned ndarray, ndim 1, dtype family float, shape (4,) as a later run recorded it. The image it ran in was not recorded. If your copy returns the same type, ndim and shape on these inputs, it matched what we observed; nothing here checks that. It does NOT mean the output is correct: nothing has compared it to the paper.

import numpy as np

# Create small binary arrays for yhat and y
# The function performs logical_and and sums along an axis
yhat = np.array([[1, 0, 1, 0],
                 [0, 1, 1, 1]], dtype=bool)

y = np.array([[1, 1, 0, 0],
              [0, 1, 1, 0]], dtype=bool)

axis = 0

ARGS = {
    'yhat': yhat,
    'y': y,
    'axis': axis
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
numpy — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type ndarray, ndim 1, dtype family float, shape (4,) — shape (4,) as a later run recorded it
dtype family
int means an integer dtype; float means any other dtype the instrument saw, bool and complex included (fixture_check.py records only these two families)
Environment
image not recorded; re-verify against syntology-harvest-sandbox:v5-deps; not recorded for this sample: the harness installs a cuda-to-cpu shim (cuda_shim.py) before every sample and no run records whether a sample needed it; seed: none by the harness; any seed is in the setup block
proc_note Ran
ran; our contract draft was wrong, not the code
whaleloops/clinicalmamba/trainer/data.py
code served (permissive licence) · get_code("af9c335afae6a5f0")
How it ran

Ran in Syntology's sandbox on this synthesized input (drafted by a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API) and returned list, ndim 1, dtype family float; no output shape is stated. The image it ran in was not recorded. If your copy returns the same type and ndim on these inputs, it matched what we observed; nothing here checks that. It does NOT mean the output is correct: nothing has compared it to the paper.

import re

def proc_text(text):
    text = re.sub('\\[\\*\\*[^\\]]*\\*\\*\\]', '', text)
    text = re.sub('Dr\\.', 'doctor', text)
    text = re.sub('dr\\.', 'doctor', text)
    text = re.sub('M\\.D\\.', 'doctor', text)
    text = re.sub('--|__|==', '', text)
    step1 = re.sub('\r', '\n', text)
    step2 = re.sub('(?<!\\n)\\n(?!\\n)', ' ', step1)
    text = re.sub('\\n{2,}', '\n', step2)
    return re.sub('  +', ' ', text)

def proc_note(notes):
    results = []
    for docs in notes:
        docs_new = proc_text(docs)
        results.append(docs_new)
    return results

ARGS = {
    "notes": [
        "This is a test note with Dr. Smith and M.D. credentials [**sensitive**] here.",
        "Another note with dr. Jones and -- some dashes __ underscores == equals.",
        "Text\rwith\rcarriage\rreturns\nand\n\nmultiple\n\n\nnewlines and  multiple   spaces.",
    ]
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
none outside the standard library — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type list, ndim 1, dtype family float — a list output has no array shape of its own; none is stated
dtype family
int means an integer dtype; float means any other dtype the instrument saw, bool and complex included (fixture_check.py records only these two families)
Environment
image not recorded; re-verify against syntology-harvest-sandbox:v5-deps; not recorded for this sample: the harness installs a cuda-to-cpu shim (cuda_shim.py) before every sample and no run records whether a sample needed it; seed: none by the harness; any seed is in the setup block
proc_prompt Ran
ran; our contract draft was wrong, not the code
whaleloops/clinicalmamba/trainer/data.py
code served (permissive licence) · get_code("24a6705d8df76629")
How it ran

Ran in Syntology's sandbox on this synthesized input (drafted by a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API) and returned str. The image it ran in was not recorded. If your copy returns the same type on these inputs, it matched what we observed; nothing here checks that. It does NOT mean the output is correct: nothing has compared it to the paper.

import torch

torch.manual_seed(0)

# The function expects index2prompt to be a dict-like object (or list) 
# where it can iterate through indices 0 to num_prompts-1
# Each element should be a string (prompta variable is joined with strings)

index2prompt = {
    0: "First prompt text",
    1: "Second prompt text",
    2: "Third prompt text"
}

ARGS = {
    "index2prompt": index2prompt,
    "return_mask": True
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
torch — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type str — a str output has no array shape of its own; none is stated — the instrument coerces any output to an array; for a str output the recorded ndim 0 and dtype family float describe that coercion, not the output, and are not stated
Environment
image not recorded; re-verify against syntology-harvest-sandbox:v5-deps; not recorded for this sample: the harness installs a cuda-to-cpu shim (cuda_shim.py) before every sample and no run records whether a sample needed it; seed: none by the harness; any seed is in the setup block
proc_text Ran
ran; our contract draft was wrong, not the code
whaleloops/clinicalmamba/trainer/data.py
code served (permissive licence) · get_code("04ca90a31900e7e3")
How it ran

Ran in Syntology's sandbox on this synthesized input (drafted by a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API) and returned str. The image it ran in was not recorded. If your copy returns the same type on these inputs, it matched what we observed; nothing here checks that. It does NOT mean the output is correct: nothing has compared it to the paper.

import re

def proc_text(text):
    text = re.sub('\\[\\*\\*[^\\]]*\\*\\*\\]', '', text)
    text = re.sub('Dr\\.', 'doctor', text)
    text = re.sub('dr\\.', 'doctor', text)
    text = re.sub('M\\.D\\.', 'doctor', text)
    text = re.sub('--|__|==', '', text)
    step1 = re.sub('\r', '\n', text)
    step2 = re.sub('(?<!\\n)\\n(?!\\n)', ' ', step1)
    text = re.sub('\\n{2,}', '\n', step2)
    return re.sub('  +', ' ', text)


ARGS = {
    'text': 'Dr. Smith and dr. Jones, M.D. discussed the [**patient**] case. \r\nThe -- case __ involved == multiple\n\nlines and  extra   spaces.'
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
none outside the standard library — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type str — a str output has no array shape of its own; none is stated — the instrument coerces any output to an array; for a str output the recorded ndim 0 and dtype family float describe that coercion, not the output, and are not stated
Environment
image not recorded; re-verify against syntology-harvest-sandbox:v5-deps; not recorded for this sample: the harness installs a cuda-to-cpu shim (cuda_shim.py) before every sample and no run records whether a sample needed it; seed: none by the harness; any seed is in the setup block
union_size Ran
ran, honoured the contract we drafted
whaleloops/clinicalmamba/trainer/metrics.py
code served (permissive licence) · get_code("3e72bbd1f3c8c717")
How it ran

Ran in Syntology's sandbox on this synthesized input (drafted by a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API) and returned ndarray, ndim 1, dtype family float, shape (2,) as a later run recorded it. The image it ran in was not recorded. If your copy returns the same type, ndim and shape on these inputs, it matched what we observed; nothing here checks that. It does NOT mean the output is correct: nothing has compared it to the paper.

import numpy as np

# Create small numpy arrays for yhat and y
# These should be binary arrays suitable for logical_or operation
yhat = np.array([[1, 0, 1, 0],
                 [0, 1, 0, 1]], dtype=bool)

y = np.array([[1, 1, 0, 0],
              [0, 1, 1, 0]], dtype=bool)

# axis can be None, 0, 1, or other integer values
axis = 1

ARGS = {
    "yhat": yhat,
    "y": y,
    "axis": axis
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
numpy — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type ndarray, ndim 1, dtype family float, shape (2,) — shape (2,) as a later run recorded it
dtype family
int means an integer dtype; float means any other dtype the instrument saw, bool and complex included (fixture_check.py records only these two families)
Environment
image not recorded; re-verify against syntology-harvest-sandbox:v5-deps; not recorded for this sample: the harness installs a cuda-to-cpu shim (cuda_shim.py) before every sample and no run records whether a sample needed it; seed: none by the harness; any seed is in the setup block

Also present in other papers' code

Of 7 samples lifted from this paper's linked repositories, 7 carry a function identity and 0 do not. Of the 7 distinct functions with an identity, 1 are also present in other papers whose code we hold (1 with at least one paper dated earlier, 0 the same month, 0 later) and 6 are only here among the 52,977 papers whose code Syntology holds (as of 2026-09-26).

Only here means: among the 52,977 papers whose code Syntology holds (51,887 with lifted samples, 1,090 through their assemblies only), as of 2026-09-26, no other paper's lifted samples or current assembly bricks contain an identical function body after normalisation.

FunctionAlso present inEarliest-datedOthers named
find_threshold_micro 1 other paper
1 dated earlier
2210.03304 (2022-10)
Knowledge Injected Prompt Based Fine-tuning for Multi-label Few-shot ICD Coding

Presence, not direction: an identical function body in two papers' repositories does not say who wrote it, which came from which, or that either paper's method rests on it. Matching is exact after normalisation, so a renamed or edited function is not matched. Dates are when papers appeared, not when code was written. Only .py files the harvester lifted are covered; notebooks are not read. A new-style arXiv id YYMM.NNNN dates a paper to the month 20YY-MM; otherwise Paper.year dates it to the year; otherwise it is undated. Dates are when the paper appeared, not when the code was written. Read 2026-11-22.

Repositories linked to this paper

Some links come from the archived Papers with Code dataset (CC BY-SA 4.0): attribution and licence.

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.

For agents

The same record, over MCP at https://syntology.ai/mcp:

get_harvested_code_for_paper("2403.05795")
get_code_for_paper("2403.05795")
have("2403.05795")

The run record, dated, one paper per request, free:

curl https://syntology.ai/api/ran/2403.05795.json

A badge for a README (the split and the date, never a ratio):

[![Syntology run record](https://syntology.ai/api/ran/2403.05795.svg)](https://syntology.ai/paper/2403.05795)

Connect an agent — have() is free.