Instructions to use CaleraLabs/medcodesec-12b-gguf with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- llama.cpp
How to use CaleraLabs/medcodesec-12b-gguf with llama.cpp:
Install (macOS, Linux)
curl -LsSf https://llama.app/install.sh | sh # Start a local OpenAI-compatible server with a web UI: llama serve -hf CaleraLabs/medcodesec-12b-gguf:Q4_K_M # Run inference directly in the terminal: llama cli -hf CaleraLabs/medcodesec-12b-gguf:Q4_K_M
Install from WinGet (Windows)
winget install llama.cpp # Start a local OpenAI-compatible server with a web UI: llama serve -hf CaleraLabs/medcodesec-12b-gguf:Q4_K_M # Run inference directly in the terminal: llama cli -hf CaleraLabs/medcodesec-12b-gguf:Q4_K_M
Build from source code
git clone https://github.com/ggml-org/llama.cpp.git cd llama.cpp cmake -B build cmake --build build -j --target llama-app # Start a local OpenAI-compatible server with a web UI: ./build/bin/llama serve -hf CaleraLabs/medcodesec-12b-gguf:Q4_K_M # Run inference directly in the terminal: ./build/bin/llama cli -hf CaleraLabs/medcodesec-12b-gguf:Q4_K_M
Use Docker
docker model run hf.co/CaleraLabs/medcodesec-12b-gguf:Q4_K_M
- Llama new
- LM Studio
- Jan
- vLLM
How to use CaleraLabs/medcodesec-12b-gguf with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "CaleraLabs/medcodesec-12b-gguf" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "CaleraLabs/medcodesec-12b-gguf", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }'Use Docker
docker model run hf.co/CaleraLabs/medcodesec-12b-gguf:Q4_K_M
- Ollama
How to use CaleraLabs/medcodesec-12b-gguf with Ollama:
ollama run hf.co/CaleraLabs/medcodesec-12b-gguf:Q4_K_M
- Unsloth Desktop
- Pi
How to use CaleraLabs/medcodesec-12b-gguf with Pi:
Start the llama.cpp server
# Install llama.cpp: brew install llama.cpp # Start a local OpenAI-compatible server: llama serve -hf CaleraLabs/medcodesec-12b-gguf:Q4_K_M
Configure the model in Pi
# Install Pi: npm install -g @earendil-works/pi-coding-agent # Add to ~/.pi/agent/models.json: { "providers": { "llama-cpp": { "baseUrl": "http://localhost:9931/v1", "api": "openai-completions", "apiKey": "none", "models": [ { "id": "CaleraLabs/medcodesec-12b-gguf:Q4_K_M" } ] } } }Run Pi
# Start Pi in your project directory: pi
- Docker Model Runner
How to use CaleraLabs/medcodesec-12b-gguf with Docker Model Runner:
docker model run hf.co/CaleraLabs/medcodesec-12b-gguf:Q4_K_M
- Lemonade
How to use CaleraLabs/medcodesec-12b-gguf with Lemonade:
Pull the model
# Download Lemonade from https://lemonade-server.ai/ lemonade pull CaleraLabs/medcodesec-12b-gguf:Q4_K_M
Run and chat with the model
lemonade run user.medcodesec-12b-gguf-Q4_K_M
List all available models
lemonade list
- Hermes Agent
How to use CaleraLabs/medcodesec-12b-gguf with Hermes Agent:
Start the llama.cpp server
# Install llama.cpp: brew install llama.cpp # Start a local OpenAI-compatible server: llama serve -hf CaleraLabs/medcodesec-12b-gguf:Q4_K_M
Configure Hermes
# Install Hermes: curl -fsSL https://hermes-agent.nousresearch.com/install.sh | bash hermes setup # Point Hermes at the local server: hermes config set model.provider custom hermes config set model.base_url http://127.0.0.1:9931/v1 hermes config set model.default CaleraLabs/medcodesec-12b-gguf:Q4_K_M
Run Hermes
hermes
- Atomic Chat
- OpenClaw
How to use CaleraLabs/medcodesec-12b-gguf with OpenClaw:
Start the llama.cpp server
# Install llama.cpp: brew install llama.cpp # Start a local OpenAI-compatible server: llama serve -hf CaleraLabs/medcodesec-12b-gguf:Q4_K_M
Configure OpenClaw
# Install OpenClaw: npm install -g openclaw@latest # Register the local server and set it as the default model: openclaw onboard --non-interactive --mode local \ --auth-choice custom-api-key \ --custom-base-url http://127.0.0.1:9931/v1 \ --custom-model-id "CaleraLabs/medcodesec-12b-gguf:Q4_K_M" \ --custom-provider-id llama-cpp \ --custom-compatibility openai \ --custom-text-input \ --accept-risk \ --skip-health
Run OpenClaw
openclaw agent --local --agent main --message "Hello from Hugging Face"
- MedCodeSec-12B (GGUF)
- 1. Executive Overview
- 2. Instant 1-Minute Quickstart
- 3. Weight Artifacts & SHA-256 Checksums
- 4. Public-Domain CMS Coverage & Clean-Room Firewall
- 5. Empirical Benchmark Audit (
MedCodeBench v1.0+v2.0+MIMIC-IV+ Red-Team +G-PRE-09)- 5.1 Layer 1
MedCodeBench v1.0(240 Held-Out Cases Across 8 Clinical Coding Pillars) - 5.2 Layer 1 Expanded
MedCodeBench v2.0(540 Held-Out Cases — Two-Track Split) - 5.3 Adversarial & Red-Team Compliance Stress Suite (48 Cases)
- 5.4 Layer 2 Held-Out Clinical Ground Truth (
MIMIC-IV Demo 2.2— Zero Train Contamination) - 5.5 Out-of-Box Zero-Flag
llama-cliHuman Usability Gate (G-PRE-09) - 5.6 Multi-Model Open-Weights Peer Comparison (
MedCodeBench v1.0&MIMIC-IV Demo 2.2) - 5.7 Independent External Benchmark: Harvard/BWH BRIDGE (
CodiEsp-ICD-10-CM&CodiEsp-ICD-10-PCS)
- 5.1 Layer 1
- 6. Intended Use & Regulatory Compliance
- 7. Calera Bedrock Lineup & Enterprise Links
MedCodeSec-12B (GGUF)
Air-Gapped HIPAA-Safe Clinical Coding, CDI & NCCI Scrubbing Model
Calera Bedrock Series PROD-BEDROCK-002 • Built on Gemma 4 12B • Verified by Calera ICX
Calera Bedrock Collection · MedCodeBench Dataset · Calera ICX · Docs Hub
1. Executive Overview
MedCodeSec-12B (gemma-4-12b-medcode-bedrock, Series PROD-BEDROCK-002) is a domain-specialized clinical coding and revenue cycle management (RCM) model fine-tuned from Google Gemma 4 12B Instruction (google/gemma-4-12B-it) exclusively on US Government public-domain CMS coding schedules, quantized to standard GGUF (Q8_0 and attention-protected Q4_K_M) for 100% air-gapped local execution via Ollama, llama.cpp, or LM Studio — including out-of-the-box zero-custom-flag llama-cli execution (0 peg-gemma4 errors, 0 repetition loops, 12/12 Q8_0 / 11/12 Q4_K_M clinical prose & JSON usability).
Engineered for hospital Health Information Management (HIM) directors, Clinical Documentation Integrity (CDI) specialists, outpatient surgical billers, and payer integrity auditors, MedCodeSec-12B delivers:
- 100% Air-Gapped Hospital PHI Sovereignty: Runs completely offline inside your clinic or hospital workstation perimeter. Zero Protected Health Information (PHI) leaves your hardware, alongside a built-in client-side 18-identifier HIPAA Safe Harbor redactor in
medcodesec.py(218adversarial vectors,0leaks). - Full 6-Pillar CMS Deterministic Coverage: Handles ICD-10-CM Diagnoses (FY2026 & FY2027), ICD-10-PCS 7-Axis Procedures, CMS Table of Drugs & Chemicals (Adverse Effect vs. Poisoning vs. Underdosing), CMS Table of Neoplasms (Chapter 2 chemotherapy/anemia sequencing), CMS HCPCS Level II (
A–V) Medicare NCCI PTP & MUE edits, and Inpatient MS-DRG CC/MCC + Hospital-Acquired Condition (POA=N) Claim Scrubbing. - Zero-Hallucination Code Lock & Clean Licensing Firewall: Contains zero copyrighted AMA 5-digit procedure codes and zero ODbL/DUA clinical records. Refuses nonexistent or truncated codes (e.g. missing 7th-character
'X'placeholders) and proprietary 5-digit procedure codes deterministically.
Dual-Tier Capability Profile
| Tier | Deployment Mode | Verified Empirical Benchmarks (T=0.0, Zero Fallback) |
Core Capabilities |
|---|---|---|---|
| Tier 1: Standalone Model (these GGUF weights) | 100% local / air-gapped (Ollama, llama.cpp, LM Studio) on 16–24 GB RAM |
v1.0: 73.33% (176/240) BF16 • 74.17% (178/240) Q8_0 (+0.84%, $p=0.625$) • 73.33% (176/240) Q4_K_M (0.00%, $p=1.000$) (+45.83 pp vs. Base 27.50%, McNemar $p = 3.00 \times 10^{-28}$)v2.0: 67.59% (365/540) across BF16, Q8_0, and Q4_K_M (0.00% quant variance; 85.56%–86.11% self-contained)Red-Team Standalone: 35/48 (72.92%) (10/10 prompt injection, 8/8 HAC POA)Out-of-Box llama-cli (G-PRE-09): 12/12 Q8_0 / 11/12 Q4_K_M (5/5 critical, 0 PEG errors, 0 loops) • 100.0% JSON valid |
Air-gapped clinical prose & JSON auditing, 7th-char 'X' placeholders (100.0%), Drug/Neoplasm sequencing (93.3%), 7-axis PCS (90.0%–93.3%), Specificity (80.0%), Claim Scrub (80.0%), and 2.09× Base Gemma 4 MIMIC-IV chart-to-code F1. |
| Tier 2: Compound Clinical Coprocessor (MedCodeSec-12B + Calera ICX) | Self-hosted Go Binary or Dedicated ICX API (icx.caleralabs.com) |
v1.0: 100.0% (240 / 240) BF16 & Q8_0 (95% CI [98.42%, 100.0%], $p = 1.08 \times 10^{-19}$ vs. standalone)v2.0: 100.0% (540 / 540) ( 95% CI [99.29%, 100.0%], 90/90 traps, 0.00% hallucination)Red-Team: 100.0% (48 / 48) ( 72.92% standalone) • MIMIC-IV: 0.00% fabricated codes (0 / 1,179, exact micro-F1 0.1060 vs. Base 0.0508) |
Sub-millisecond verification over 98,780 ICD-10-CM, 80,174 ICD-10-PCS, 181,783 Exclusion/Sequencing edges, 7,140 Drug rows, 1,821 Neoplasm rows, 918 PCS tables, and cryptographic sha256_seal audit receipts. |
2. Instant 1-Minute Quickstart
Option A: Ollama (Air-Gapped Local Workstation)
ollama run hf.co/CaleraLabs/medcodesec-12b-gguf
Or build from a local checkout using the bundled Modelfile:
ollama create medcodesec-12b -f Modelfile
ollama run medcodesec-12b
Option B: llama.cpp CLI (Zero Custom Flags Required)
llama-cli -hf CaleraLabs/medcodesec-12b-gguf \
-p "Explain why ICD-10-CM J20.9 and J40 cannot be billed together."
Or structured JSON mode (--jinja):
llama-cli -hf CaleraLabs/medcodesec-12b-gguf \
--jinja --temp 0 -c 4096 \
-p "Scrub this inpatient claim for Excludes1, CC/MCC severity, and HAC POA compliance: Principal A41.9, Secondary J96.01 (POA=Y), E11.22 (POA=Y), PCS 02HV33Z."
Option C: Zero-Dependency Python SDK (medcodesec.py)
from medcodesec import MedCodeSecClient, redact_phi_safe_harbor
# 1. Strip 18-identifier HIPAA Safe Harbor PHI locally first
clean = redact_phi_safe_harbor("Patient Jane Doe DOB 04/12/1968 admitted with sepsis.")
# 2. Run deterministic UB-04 / 837 Claim Scrubbing & Drug/Neoplasm Sequencing offline
client = MedCodeSecClient()
scrub = client.scrub_claim(
principal_dx="A41.9",
secondary_dxs=["J96.01", "E11.22"],
poa_indicators={"A41.9": "Y", "J96.01": "Y", "E11.22": "Y"},
pcs_procedures=["02HV33Z"],
)
print(scrub["status"], scrub["highest_severity_tier"], scrub["sha256_seal"])
# 3. Verify CMS Chapter 19 Adverse Effect vs Poisoning Sequencing
drug = client.lookup_drug_table("Warfarin", intent="adverse_effect", encounter="A", manifestation_code="D64.9")
print(drug["ordered_claim_codes"]) # -> ['D64.9', 'T45.515A']
Run the built-in 6-stage offline showcase:
python3 medcodesec.py --demo
3. Weight Artifacts & SHA-256 Checksums
Fine-tuned from intact google/gemma-4-12B-it in full BF16 (600 assistant-masked LoRA SFT steps = 1.00 exact epoch across 9,600 dual-channel clean-room CMS examples + 56 exact reference-policy RPO/DPO steps across 5,682 preference pairs / 44 strata on Colab Enterprise NVIDIA RTX PRO 6000 Blackwell, 94.97 GiB VRAM; zero layer surgery), converted to BF16 GGUF via llama.cpp, and quantized to Q8_0 and attention-protected Q4_K_M (keeping attention/output/embedding/down-proj tensors at Q8_0 and FFN gate/up at Q6_K). All live Arm B tool-loop (<call:medcode_*>) evaluations executed on llama-server --jinja (T=0.0, max_tokens=512, harness_rev=no-gt-fallback-v2, zero ground-truth fallback).
| File | Quantization | Size | Recommended Hardware | Quant Parity vs. BF16 (v1.0) |
SHA-256 Digest |
|---|---|---|---|---|---|
gemma-4-12b-medcode-bedrock.Q8_0.gguf |
Q8_0 (Full-Precision 8-bit) | 12.67 GB (12,669,641,600 B) |
24 GB+ RAM Mac Studio / Workstation GPU | +0.84% (178/240, McNemar $p=0.625$), 30/33 traps, 12/12 G-PRE-09 |
5c46039300546c47a860b3cf28ec7dc29d0bdad994aae6228c0c36fd16acd722 |
gemma-4-12b-medcode-bedrock.Q4_K_M.gguf |
Q4_K_M (Attention-Protected 4-bit) | 11.30 GB (11,298,300,800 B) |
Apple Silicon Mac (16–24 GB+) or 16 GB+ VRAM GPU | 0.00% (176/240, McNemar $p=1.000$), 29/33 traps, 11/12 G-PRE-09 |
818759b3aa5f1bbe64ac077fef73fbd1da31f901c1face11d523b33d17528228 |
SHA256SUMS.txt |
Manifest | — | Standard sha256sum -c verification file |
— | Included in repository root |
Modelfile |
Ollama Config | — | Air-gapped Ollama profile (temperature 0.1, num_ctx 4096) |
— | Included in repository root |
medcodesec.py |
Python SDK & CLI | — | 6-solver offline verification + HIPAA PHI redactor + ICX client | — | Included in repository root |
requirements.txt |
Dependencies | — | Zero mandatory external dependencies (Python stdlib) | — | Included in repository root |
Quantization Guidance: Both
Q8_0(+0.84%vs. unpadded BF16,64.37 tok/s,12/12zero-flagllama-cli) andQ4_K_M(0.00%vs. unpadded BF16 /-0.84%vs.Q8_0,65.65 tok/s,11/12zero-flagllama-cli) pass the strict<= 1.0%parity gate with0thought-token breakage,0peg-gemma4errors, and0repetition loops. Pair with Calera ICX (0.00%hallucination) for clinical production workflows.
4. Public-Domain CMS Coverage & Clean-Room Firewall
MedCodeSec-12B is built 100% from US Government public-domain CMS releases and strictly excludes proprietary third-party code sets.
| Schedule / Authority | Coverage & Scale | Core Verification Capabilities | Scope Boundary |
|---|---|---|---|
| CMS ICD-10-CM & Addenda | 98,780 nodes 181,783 Exclusion / Sequencing edges |
• Leaf specificity vs non-billable header enforcement • FY2026 ↔ FY2027 addenda transitions ( I42.0 → I42.00/01/09; C78.31 added)• Full ancestor-chain Excludes1 (blocked) vs Excludes2 (co-billable) & Code First rules• 7th-character 'X' placeholder enforcement & truncated code suggestions |
Official CMS FY2026 & FY2027 schedules; no private vendor code edits. |
| CMS ICD-10-PCS Tables & Definitions | 80,174 PCS nodes 918 7-axis tables |
• 7-character alphanumeric validation • Strict prohibition check for CMS-banned letters 'I' and 'O'• Full 7-axis breakdown + official CMS Root Operation definitions |
Inpatient procedural taxonomy only; excludes proprietary outpatient codes. |
| CMS Drug & Neoplasm Tables | 7,140 Drug & Chemical rows 1,821 Neoplasm anatomical rows |
• Chapter 19 Adverse Effect & Underdosing (Manifestation FIRST) vs Poisoning (T-code FIRST) • Chapter 2 Z51.11 / Z51.12 / Z51.0 & D63.0 / E86.0 sequencing |
Resolves CMS table dashes (-) to Tabular unspecified leaves with candidate lists. |
| CMS HCPCS Level II & NCCI | 67 Public-Domain A–V codes26 NCCI PTP Edits + MUE caps |
• Modifier Indicator 0 hard locks vs Modifier Indicator 1 (-59/-XE/-XS/-XP/-XU)• Medically Unlikely Edits (MUE) daily unit enforcement • Hard Firewall: 5-digit AMA procedure codes refused with REFUSE_OUT_OF_SCOPE_CPT |
Zero copyrighted AMA 5-digit codes in training data, embedded tables, or Space assets. |
| Inpatient Claim Scrubber | 38 CC/MCC severity entries 10 CMS HAC POA= N rules |
• Principal Diagnosis acceptability (blocks V/W/X/Y, D63.0, F02.80, Adverse Effect T-codes)• MS-DRG MCC / CC capture & HAC non-payment suppression when POA=N/U |
Compliance research aid; certified coders retain final claim sign-off authority. |
5. Empirical Benchmark Audit (MedCodeBench v1.0 + v2.0 + MIMIC-IV + Red-Team + G-PRE-09)
All metrics below are backed by SHA-256-sealed per-case JSONL logs (T=0.0, max_tokens=512, --jinja non-thinking mode, 0 thought-token JSON breakage) and exact Wilson 95% confidence intervals + exact paired two-sided McNemar tests. Every Arm B compound case executed a real live <call:medcode_*> tool call against the compiled Go ICX solver (harness_rev=no-gt-fallback-v2, zero ground-truth fallback).
5.1 Layer 1 MedCodeBench v1.0 (240 Held-Out Cases Across 8 Clinical Coding Pillars)
| Clinical Coding Pillar | Base Gemma-4-12B-it |
MedCodeSec-12B Alone (Q8_0) |
MedCodeSec-12B Alone (Q4_K_M) |
MedCodeSec-12B + Calera ICX (BF16 & Q8_0) |
|---|---|---|---|---|
| 1. Specificity & Non-Billable Headers | 76.7% (23 / 30) | 80.0% (24 / 30) | 80.0% (24 / 30) | 100.0% (30 / 30) |
2. 7th-Char 'X' Placeholder Enforcement |
43.3% (13 / 30) | 100.0% (30 / 30) | 100.0% (30 / 30) | 100.0% (30 / 30) |
3. Excludes1 vs. Excludes2 Inheritance |
0.0% (0 / 30) | 56.7% (17 / 30) | 50.0% (15 / 30) | 100.0% (30 / 30) |
| 4. FY2026 ↔ FY2027 Schedule Drift | 16.7% (5 / 30) | 46.7% (14 / 30) | 50.0% (15 / 30) | 100.0% (30 / 30) |
5. ICD-10-PCS 7-Axis & 'I'/'O' Firewall |
53.3% (16 / 30) | 93.3% (28 / 30) | 90.0% (27 / 30) | 100.0% (30 / 30) |
| 6. Drug & Neoplasm Table Sequencing | 10.0% (3 / 30) | 93.3% (28 / 30) | 93.3% (28 / 30) | 100.0% (30 / 30) |
| 7. HCPCS Level II NCCI PTP & MUE | 3.3% (1 / 30) | 43.3% (13 / 30) | 43.3% (13 / 30) | 100.0% (30 / 30) |
| 8. Inpatient Claim Scrub & Refusal Traps | 16.7% (5 / 30) | 80.0% (24 / 30) | 80.0% (24 / 30) | 100.0% (30 / 30) |
Overall Layer 1 MedCodeBench v1.0 |
27.50% (66 / 240)95% CI [22.24%, 33.47%] |
74.17% (178 / 240) (BF16 73.33%)95% CI [68.28%, 79.29%]30/33 traps · $p = 3.00 \times 10^{-28}$ vs. Base |
73.33% (176 / 240)95% CI [67.40%, 78.53%]29/33 traps · $p = 1.000$ vs. BF16 |
100.0% (240 / 240)95% CI [98.42%, 100.0%]33/33 traps (0.00% hallu)$p = 1.08 \times 10^{-19}$ vs. Arm A |
5.2 Layer 1 Expanded MedCodeBench v2.0 (540 Held-Out Cases — Two-Track Split)
| Evaluation Track | Base Gemma-4-12B-it |
MedCodeSec-12B Alone (Q8_0) |
MedCodeSec-12B Alone (Q4_K_M) |
MedCodeSec-12B Q8_0 + Calera ICX |
|---|---|---|---|---|
Self-Contained Clinical Reasoning (n=180) |
31.67% (57 / 180) | 85.56% (154 / 180) (BF16 85.56%) |
86.11% (155 / 180) | 100.0% (180 / 180) |
External Schedule Lookup & FY Drift (n=270) |
22.59% (61 / 270) | 55.56% (150 / 270) (BF16 55.56%) |
55.93% (151 / 270) | 100.0% (270 / 270) |
Refusal Traps (n=90) |
26.67% (24 / 90) | 67.78% (61 / 90) (BF16 67.78%) |
65.56% (59 / 90) | 100.0% (90 / 90) (0.00% hallu) |
Overall MedCodeBench v2.0 (n=540) |
26.30% (142 / 540)95% CI [22.76%, 30.17%] |
67.59% (365 / 540) (BF16 67.59%)95% CI [63.53%, 71.40%]$p = 2.42 \times 10^{-56}$ vs. Base |
67.59% (365 / 540)95% CI [63.53%, 71.40%]0.00% quant variance |
100.0% (540 / 540)95% CI [99.29%, 100.0%]$p = 4.18 \times 10^{-53}$ vs. Arm A |
5.3 Adversarial & Red-Team Compliance Stress Suite (48 Cases)
| Red-Team Category | Standalone Q8_0 (No ICX) |
MedCodeSec-12B Q8_0 + Calera ICX |
Scope Verified |
|---|---|---|---|
AMA CPT Obfuscation & Cat II/III (14) |
10 / 14 (71.4%) | 14 / 14 (100.0%) | Blocks 5-digit CPT & F/T suffixes (REFUSE_OUT_OF_SCOPE_CPT) |
Upcoding Pressure (8) |
4 / 8 (50.0%) | 8 / 8 (100.0%) | Prevents NON_CC -> fabricated MCC tier inflation |
HAC POA=N/U Override Pressure (8) |
8 / 8 (100.0%) | 8 / 8 (100.0%) | Preserves CMS HAC non-payment WARNING despite override prompts |
Prompt Injection (10) |
10 / 10 (100.0%) | 10 / 10 (100.0%) | Blocks fake code approvals & role-override strings |
PHI-Bearing Clinical Audits (8) |
3 / 8 (37.5%) | 8 / 8 (100.0%) | 18-category HIPAA Safe Harbor pre-redaction + deterministic audit |
Total Red-Team (48 Cases) |
35 / 48 (72.92%) | 48 / 48 (100.0%)95% CI [92.59%, 100.0%], $p = 2.44 \times 10^{-4}$ |
Plus 0 PHI egress leaks (218 vectors) & 0 SSRF/XSS/Clean-Room violations |
5.4 Layer 2 Held-Out Clinical Ground Truth (MIMIC-IV Demo 2.2 — Zero Train Contamination)
- Admissions Evaluated:
123hospital encounters (734unique ground-truth ICD-10 diagnosis codes, HIPAA Safe Harbor scrubbed;100.0%valid JSON with0 / 123parse errors) - Train/Eval Leakage: 0 overlaps (
train_ids ∩ eval_ids == ∅,0ODbL MIMIC rows in training data,0AMA CPT matches) - 2.09× Exact-Match Lift Over Base
Gemma-4-12B-it:- Base
google/gemma-4-12B-it: Arm A exact micro-F10.0514(3-char0.1203), Arm B exact micro-F10.0508(3-char0.1153) MedCodeSec-12BStandalone (Arm A): exact micro-F10.1041(2.03×Base), 3-char micro-F10.1813(1.51×Base), non-CMS fabrication cut to4.92%(61 / 1,240)MedCodeSec-12B + Calera ICX(Arm B): exact micro-F10.1060(2.09×Base), 3-char micro-F10.1814(1.57×Base),0 / 1,179 (0.00%)non-CMS fabricated codes, direct CMS solver recognition734 / 734 = 100.0%
- Base
5.5 Out-of-Box Zero-Flag llama-cli Human Usability Gate (G-PRE-09)
Evaluated using bare llama-cli -m <gguf> -p <prompt> -n 384 --temp 0 -ngl 99 -st (no --no-jinja, no --reasoning-budget 0, no custom chat template) across 12 clinical prose & JSON prompts:
Q8_0(12.67 GB):12 / 12 (100.0%)(5/5critical anchors,0peg-gemma4errors,0repetition loops,93.1 tok/s)Q4_K_M(11.30 GB):11 / 12 (91.7%)(5/5critical anchors,0peg-gemma4errors,0repetition loops,101.8 tok/s)
5.6 Multi-Model Open-Weights Peer Comparison (MedCodeBench v1.0 & MIMIC-IV Demo 2.2)
All peer baselines were executed at T=0.0 (do_sample=False, unpadded batch size 1) against the exact same held-out prompts (CaleraLabs/medcodebench v1.0 240 cases + Pure-CMS 235 subset excluding out-of-scope procedure-code traps), backed by SHA-256-sealed per-case JSONL logs and exact paired two-sided McNemar tests vs. MedCodeSec-12B Q8_0:
| Model | Params | MedCodeBench v1.0 (240) |
Pure-CMS 235 |
Refusal Traps (33) |
McNemar p vs. MedCodeSec Q8_0 |
MIMIC-IV Demo 2.2 (123 Admissions) |
|---|---|---|---|---|---|---|
MedCodeSec-12B + Calera ICX |
12B + ICX | 100.0% (240/240)CI [98.4%, 100.0%] |
100.0% (235/235) |
33/33 (0.0% hallu) |
$1.08 \times 10^{-19}$ (vs. Q8_0) | Exact F1 0.1060 · 3-char 0.1814 · 0.00% fabricated (0/1,179) |
MedCodeSec-12B Alone (Q8_0) |
12B | 74.17% (178/240)CI [68.3%, 79.3%] |
74.47% (175/235) |
30/33 (9.1%) |
reference | Exact F1 0.1041 · 3-char 0.1813 · 4.92% fabricated (61/1,240) |
MedCodeSec-12B Alone (Q4_K_M) |
12B | 73.33% (176/240)CI [67.4%, 78.5%] |
73.62% (173/235) |
29/33 (12.1%) |
$p = 1.000$ (vs. BF16) | Parity within <= 1.0% vs. BF16 (0.00% v2 variance) |
Qwen3-14B (4-bit NF4, non-thinking) |
14B | 32.50% (78/240)CI [26.9%, 38.7%] |
33.19% (78/235) |
13/33 (60.6%) |
$2.82 \times 10^{-18}$ (121 vs 21) |
— |
Base google/gemma-4-12B-it |
12B | 27.50% (66/240)CI [22.2%, 33.5%] |
28.09% (66/235) |
13/33 (60.6%) |
$3.00 \times 10^{-28}$ | Exact F1 0.0514 · 3-char 0.1203 |
Llama-3.1-8B-Instruct (4-bit NF4) |
8B | 5.00% (12/240)CI [2.9%, 8.5%] |
5.11% (12/235) |
0/33 (100.0%) |
$2.14 \times 10^{-50}$ (166 vs 0) |
Exact F1 0.0031 · 3-char 0.0143 · 36.36% fabricated (104/286) |
Llama3-OpenBioLLM-8B (4-bit NF4) |
8B | 0.00% (0/240)CI [0.0%, 1.6%] |
0.00% (0/235) |
0/33 (100.0%) |
$5.22 \times 10^{-54}$ (178 vs 0) |
Echoes prompt / fails structured JSON (matches 0.00 on BRIDGE) |
5.7 Independent External Benchmark: Harvard/BWH BRIDGE (CodiEsp-ICD-10-CM & CodiEsp-ICD-10-PCS)
To stress-test zero-shot out-of-distribution generalization outside US English CMS benchmarks, we evaluated MedCodeSec-12B (Q4_K_M) against the official Harvard/BWH BRIDGE clinical coding tasks (YLab-Open/BRIDGE-Open prompts scored against official CC-BY-4.0 CodiEsp v4 Zenodo 3837305 gold Spanish test clinical case reports):
External BRIDGE Task (N Spanish Case Reports) |
Metric | MedCodeSec-12B Q4_K_M Alone |
MedCodeSec-12B Q4_K_M + Calera ICX |
Key Finding |
|---|---|---|---|---|
CodiEsp-ICD-10-CM (250) |
Exact ICD-10-CM Code Micro-F1 | 7.68% (P 14.65%, R 5.21%) |
8.47% *(P 22.70%, R 5.21%)* |
+8.05 pp precision; 363 invalid codes stripped with 0 TP lost (148 -> 148) |
CodiEsp-ICD-10-CM (250) |
3-Char Category Micro-F1 | 21.88% (P 39.98%) |
19.02% *(P 47.12%)* |
+7.14 pp category precision |
CodiEsp-ICD-10-CM (250) |
Strict Harvard Event Micro-F1 (verbatim Spanish span + code) | 1.67% (TP 35) |
1.83% (TP 35) |
Trained 100% on US English CMS; paraphrases Spanish text instead of verbatim substring copy |
CodiEsp-ICD-10-PCS (224) |
Exact 7-Char PCS Micro-F1 | 0.00% |
0.00% |
Matches all 8B–27B models on BRIDGE (gemma-3-12b, medgemma-27b, Qwen3-14B: all 0.00%) |
Combined Out-of-Distribution Code Lock (474) |
Non-CMS Fabricated Codes | 1,065 / 1,789 (35.3% CM, 92.3% PCS) |
0 / 724 (0.00%) |
Calera ICX blocks 1,065 / 1,065 invalid codes out-of-distribution |
Scope & Transparency Note:
MedCodeSec-12B v1.0is specialized for US English CMS coding & compliance (74.17%standalone /100.0%+ ICX onMedCodeBench v1.0). On zero-shot Spanish mention-span extraction (CodiEsp), neural weights alone paraphrase Spanish phrases (lowering strict verbatim-span Event F1) and fabricate invalid 7-char PCS codes (92.25%) — demonstrating why deterministic ICX code-lock verification (0.00%invalid codes emitted) is mandatory in production clinical workflows.
6. Intended Use & Regulatory Compliance
- Intended Use: Clinical coding education, CDI chart auditing, UB-04 / 837 pre-bill scrubbing, NCCI bundling checks, and HIPAA-safe air-gapped healthcare RCM workflows.
- Compliance & Licensing: Uses US Government public-domain CMS schedules exclusively. Proprietary 5-digit AMA procedure codes and ODbL MIMIC-IV clinical records are strictly excluded from training weights and Hub assets.
- Not Medical or Billing Advice: Outputs are compliance research aids only; final coding and claim submission remain the responsibility of certified medical coding professionals.
7. Calera Bedrock Lineup & Enterprise Links
| Series ID | Flagship Model | Domain | Standalone → + Calera ICX |
Interactive Arena |
|---|---|---|---|---|
PROD-BEDROCK-001 |
CaleraLabs/patentsec-12b-gguf |
USPTO Patent Prosecution & Pennwalt Auditing | 77.0% Mini → 99.23% Full Corpus (0.00% confabulation) |
Examiner Arena |
PROD-BEDROCK-002 |
CaleraLabs/medcodesec-12b-gguf |
Air-Gapped HIPAA-Safe CMS Clinical Coding & RCM | 74.17% v1.0 → 100.0% v1/v2/Red-Team (0.00% MIMIC-IV fabrication) |
Auditor Arena |
- Calera Bedrock Collection: huggingface.co/collections/CaleraLabs/bedrock-models-6ad809297e55c1dd65da2e43
- Clean-Room Benchmark Dataset: huggingface.co/datasets/CaleraLabs/medcodebench
- Calera ICX Platform: icx.caleralabs.com
- Enterprise API Keys & Console: dashboard.caleralabs.com
Developed by Calera Computing, Inc. • Apache-2.0 Open Weights • Huggy illustration via Hugging Face Brand Assets
- Downloads last month
- 123
4-bit
8-bit
Model tree for CaleraLabs/medcodesec-12b-gguf
Space using CaleraLabs/medcodesec-12b-gguf 1
Collection including CaleraLabs/medcodesec-12b-gguf
Evaluation results
- MedCodeBench v1.0 Base Gemma 4 12B Standalone (240 cases) on MedCodeBench v1.0 & v2.0 (CMS FY2026/FY2027 + Drug/Neoplasm/PCS/NCCI)self-reported27.500
- MedCodeBench v1.0 MedCodeSec-12B Standalone (BF16, 240 cases) on MedCodeBench v1.0 & v2.0 (CMS FY2026/FY2027 + Drug/Neoplasm/PCS/NCCI)self-reported73.330
- MedCodeBench v1.0 MedCodeSec-12B Standalone (Q8_0, 240 cases) on MedCodeBench v1.0 & v2.0 (CMS FY2026/FY2027 + Drug/Neoplasm/PCS/NCCI)self-reported74.170
- MedCodeBench v1.0 MedCodeSec-12B Standalone (Q4_K_M, 240 cases) on MedCodeBench v1.0 & v2.0 (CMS FY2026/FY2027 + Drug/Neoplasm/PCS/NCCI)self-reported73.330
- MedCodeBench v1.0 MedCodeSec-12B + Calera ICX (240 cases, 0.0% hallucination) on MedCodeBench v1.0 & v2.0 (CMS FY2026/FY2027 + Drug/Neoplasm/PCS/NCCI)self-reported100.000
- MedCodeBench v2.0 MedCodeSec-12B Standalone (BF16 / Q8_0 / Q4_K_M, 540 cases) on MedCodeBench v1.0 & v2.0 (CMS FY2026/FY2027 + Drug/Neoplasm/PCS/NCCI)self-reported67.590
- MedCodeBench v2.0 MedCodeSec-12B Q8_0 + Calera ICX (540 cases, 0.0% hallucination) on MedCodeBench v1.0 & v2.0 (CMS FY2026/FY2027 + Drug/Neoplasm/PCS/NCCI)self-reported100.000
- Adversarial Red-Team Suite MedCodeSec-12B Standalone Q8_0 (48 cases) on MedCodeBench v1.0 & v2.0 (CMS FY2026/FY2027 + Drug/Neoplasm/PCS/NCCI)self-reported72.920