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"
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_MBuild 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_MUse Docker
docker model run hf.co/CaleraLabs/medcodesec-12b-gguf:Q4_K_M- MedCodeSec-12B (GGUF)
- 1. Executive Overview
- 2. Instant 1-Minute Quickstart
- 3. Weight Artifacts & SHA-256 Checksums
- 4. Public-Domain CMS Coverage (Solver Bundle
2027.3) & Clean-Room Firewall - 5. Empirical Benchmark Audit (
MedCodeBench v1.0+v2.0+MIMIC-IV+ Red-Team +BRIDGE+G-PRE-09)- 5.1 Layer 1
MedCodeBench v1.0(240 Held-Out Structured JSON Audit Cases Across 8 CMS 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— Structured Labs/Vitals/Meds Only) - 5.5 Out-of-Box Zero-Flag
llama-cliUsability Smoke Gate (G-PRE-09) - 5.6 Multi-Model Open-Weights Peer Comparison & Methodology Audit (
MedCodeBench v1.0) - 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 Audit, Sequencing & 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
Known Limitations & Honest Scope (
v1.0) — Read Before Deploying
- Standalone GGUF (
Tier 1) is a CMS JSON Audit, Sequencing & Refusal Specialist — NOT a Standalone Free-Text Chart-to-Code Generator: Becausev1.0SFT was80.2%rigid bare-code JSON audits, the standalone GGUF weights alone are not reliable for open-ended free-text clinical vignette-to-code generation without Calera ICX deterministic verification.
- On out-of-distribution free-text Spanish case reports (Harvard/BWH BRIDGE CodiEsp), standalone
Q4_K_Mfabricated35.3%invalid ICD-10-CM codes and92.3%invalid ICD-10-PCS codes before Calera ICX Code-Lock stripped1,065 / 1,065down to0.00%.- On unseen English free-text clinical vignettes tested without ICX, standalone weights can suffer code-description semantic drift (e.g., mapping unrelated valid codes to the wrong condition, inventing non-CMS codes such as
L97.011, or citing nonexistent CMS guideline subsections).- Always Pair With Deterministic ICX Verification (
Tier 2) for Real Coding Workflows: UseMedCodeSecClient(use_remote=True).chat_verified(...)inmedcodesec.pyor a self-hosted ICX solver to enforce hard CMS existence, official description grounding, Excludes1/2, V44 CC/MCC, HAC, and 7-axis PCS verification.- Benchmarks & Disclosed Caveats: See Section 5 for full transparent disclosures on: (a) Arm-B zero-retry first-shot vs. bounded retry-loop accuracy, (b)
G-PRE-09SFT prompt overlap (10/12verbatim), (c)MIMIC-IV Demo 2.2being structured lab/vital/med tables (no discharge notes) withprincipal_dx_exact_rate1.63%vs. Base3.25%, and (d) peer-baseline failure artifacts (Llama-3.1-8Bsafety refusals,OpenBioLLM-8Bmissing chat template,Base Gemma 4512-token truncation).- Upcoming
v2.0Roadmap: A rebalancedv2.0training pipeline (~40%JSON /~10%Arm-B tool loops /~50%CMS-verified clinical prose, PCS surgical prose, and general medical CDI replay) plus an uncontaminated 60-case unseen English vignette benchmark (0%SFT overlap) are staged for our next GPU bake.
1. Executive Overview
MedCodeSec-12B (gemma-4-12b-medcode-bedrock, Series PROD-BEDROCK-002) is a domain-specialized clinical coding audit, sequencing, and refusal 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 — with clean zero-flag llama-cli execution (0 peg-gemma4 errors, 0 repetition loops).
Engineered for Health Information Management (HIM) auditors, Clinical Documentation Integrity (CDI) teams, and healthcare RCM engineering teams pairing a local LLM with deterministic CMS verification, MedCodeSec-12B delivers:
- 100% Air-Gapped Hospital PHI Sovereignty: Runs offline inside your hospital or clinic workstation perimeter, paired with a client-side 18-identifier HIPAA Safe Harbor redactor in
medcodesec.py(218adversarial vectors,0leaks). - Full 6-Pillar Public-Domain CMS Coverage (Solver Bundle
2027.3): 98,780 ICD-10-CM diagnoses (FY2026 & FY2027), 80,174 ICD-10-PCS 7-axis procedures (918 tables + 12,858 CMS PCS index prefixes), 181,783 Exclusion/Sequencing edges, 7,140 Drug Table rows, 1,821 Neoplasm rows, 7,634 Jan 2027 HCPCS Level II (A–V) codes (4,131 CMS 2026Q4 MUE limits + 26 public-domain A–V NCCI PTP edits), 18,469 official CMS MS-DRG V44 CC/MCC designations, 3,996 CMS HAC codes across all 14 categories, and 3,214 MCE V44 Manifestation-Only codes. - Zero-Hallucination Code Lock & Clean Licensing Firewall: Contains zero copyrighted AMA 5-digit procedure codes and zero ODbL/DUA clinical records in weights or Hub assets.
Dual-Tier Capability Profile
| Tier | Deployment Mode | Verified Empirical Benchmarks (T=0.0, Zero GT Fallback) |
Best Use & Honest Boundary |
|---|---|---|---|
| Tier 1: Standalone Model (these GGUF weights) | 100% local / air-gapped (Ollama, llama.cpp, LM Studio) on 16–24 GB RAM |
v1.0 JSON Audits: 74.17% (178/240) Q8_0 • 73.33% (176/240) Q4_K_M & BF16 (+45.83 pp vs. Base 27.50%, McNemar $p = 3.00 \times 10^{-28}$)v2.0 JSON Audits: 67.59% (365/540) across BF16, Q8_0, Q4_K_M (0.00% quant variance)Red-Team Standalone: 35/48 (72.92%) (10/10 prompt injection, 8/8 HAC POA)Zero-Flag llama-cli Smoke (G-PRE-09): 12/12 Q8_0 / 11/12 Q4_K_M (0 PEG errors/loops; see SFT overlap note §5.5) |
Strong at: structured CMS JSON audits, 7th-char 'X' placeholders (100%), Drug/Neoplasm sequencing (93.3%), 7-axis PCS (90–93%), AMA CPT refusal.Not reliable standalone for: open-ended free-text chart-to-code coding ( 35.3% CM / 92.3% PCS fabrication on OOD BRIDGE Spanish notes). |
| Tier 2: Compound Clinical Coprocessor (MedCodeSec-12B + Calera ICX) | medcodesec.py (use_remote=True / chat_verified()), Self-hosted Go Binary, or Calera ICX API (icx.caleralabs.com) |
v1.0: 93.8% (225/240) zero-retry 1st-shot → 100.0% (240/240) w/ bounded prompt-grounded retry loop (33/33 traps)v2.0: 89.4% (483/540) zero-retry 1st-shot → 100.0% (540/540) (90/90 traps)Red-Team: 41.7% (20/48) 1st-shot → 100.0% (48/48)External Fabrication: 0.00% on MIMIC-IV Demo (0/1,179) & 0.00% on Harvard/BWH BRIDGE (1,065/1,065 invalid codes blocked) |
Recommended for all production/clinical workflows. Deterministic Go ICX solver enforces official CMS v2027.3 descriptions, billability, Excludes1/2, V44 CC/MCC, HAC, MCE, PCS 7-axis, and cryptographic sha256_seal 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) — Full CMS Catalog & Arm-B chat_verified()
Offline Demo Subset vs. Full CMS Catalog (
use_remote=True): By default (use_remote=False),medcodesec.pyuses a compact embedded 24-code sample subset sopython3 medcodesec.py --demoruns offline with zero dependencies. For the full public-domain CMS v2027.3 catalog (98,780 ICD-10-CM, 80,174 ICD-10-PCS, 7,634 HCPCS L2, 18,469 V44 CC/MCC, 3,996 HAC, 3,214 MCE), passuse_remote=True(uses the public read-only Calera ICX endpointhttps://icx-data.golt.ggor your own self-hosted ICX URL).
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. Connect to the full CMS v2027.3 deterministic ICX catalog (use_remote=True)
# (Omit use_remote=True ONLY for the compact 24-code offline demo subset.)
client = MedCodeSecClient(use_remote=True)
# 3. Search full CMS ICD-10-CM / ICD-10-PCS / HCPCS Level II deterministically
hits = client.search_codes("laparoscopic total cholecystectomy", system="ICD-10-PCS")
print(hits["hits"][0]["code"], hits["hits"][0]["description"]) # -> 0FT44ZZ
# 4. Run full Tier-2 Arm-B verified local Ollama chat with HIPAA scrub + fail-closed Code-Lock
verified = client.chat_verified(
"A 34-year-old intentionally overdosed on acetaminophen and developed acute hepatic failure without coma.",
model="hf.co/CaleraLabs/medcodesec-12b-gguf",
)
print(verified["verified_response"])
print("Blocked non-CMS codes:", verified["code_lock"]["unregistered_codes"])
print("SHA-256 Receipt:", verified["sha256_seal"])
Run the built-in 6-stage offline showcase or live CLI verification:
python3 medcodesec.py --demo
python3 medcodesec.py --remote --search "acute calculous cholecystitis with obstruction"
python3 medcodesec.py --remote --verify-chat "Audit claim pairing J20.9 with J40 for FY2027."
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 [80.2% JSON, 13.1% prose, 6.6% Arm-B tool calls] + 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).
| 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 | — | HIPAA PHI redactor + chat_verified() Arm-B loop + search_codes() + 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) andQ4_K_M(0.00%vs. unpadded BF16,65.65 tok/s) pass the<= 1.0%parity gate with0thought-token breakage,0peg-gemma4errors, and0repetition loops. Always pair with Calera ICX (use_remote=True/chat_verified()) for real clinical coding tasks.
4. Public-Domain CMS Coverage (Solver Bundle 2027.3) & Clean-Room Firewall
MedCodeSec-12B and the paired Calera ICX Go solver are built 100% from US Government public-domain CMS releases and strictly exclude proprietary third-party code sets.
| Schedule / Authority | Coverage & Scale (v2027.3) |
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; zero private vendor code edits. |
| CMS ICD-10-PCS Tables & Index | 80,174 PCS nodes 918 7-axis tables 12,858 PCS Index prefixes |
• 7-character alphanumeric validation + natural-language surgical procedure search • 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 / Self-Harm (T-code FIRST) • Chapter 2 Z51.11 / Z51.12 / Z51.0 & D63.0 / D64.81 sequencing |
Resolves CMS table dashes (-) to Tabular unspecified leaves with candidate lists. |
| CMS HCPCS Level II & NCCI | 7,634 Jan 2027 Public-Domain A–V codes4,131 2026Q4 MUE caps 26 Public-Domain A–V NCCI PTP edits |
• Modifier Indicator 0 hard locks vs. Modifier Indicator 1 (-59/-XE/-XS/-XP/-XU)• Medically Unlikely Edits (MUE) daily unit enforcement across active A–V codes• Hard Firewall: 5-digit AMA procedure codes refused with REFUSE_OUT_OF_SCOPE_CPT |
Zero copyrighted AMA 5-digit codes in training data, solver bundles, or Space assets. (Full CMS PTP files gated behind AMA click-through licensing are intentionally excluded.) |
| Inpatient MS-DRG V44 & HAC Scrubber | 18,469 official V44 CC/MCC (15,113 CC / 3,356 MCC)3,996 CMS HAC codes (14 categories) 3,214 MCE V44 Manifestation-Only codes |
• Principal Diagnosis acceptability (blocks V/W/X/Y, 3,214 MCE manifestation-only codes, Adverse Effect T-codes)• Official CMS IPPS V44 MCC / CC capture & HAC non-payment suppression when POA=N/U (suppresses only the POA=N HAC's credit while preserving unrelated POA=Y CCs/MCCs) |
Compliance research aid; certified coders retain final claim sign-off authority. |
5. Empirical Benchmark Audit (MedCodeBench v1.0 + v2.0 + MIMIC-IV + Red-Team + BRIDGE + 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) and exact Wilson 95% confidence intervals + exact paired two-sided McNemar tests. Every Arm-B compound case executed real live <call:medcode_*> tool calls against the compiled Go ICX solver (harness_rev=no-gt-fallback-v2, zero ground-truth fallback).
Arm-B Zero-Retry First-Shot vs. Bounded Retry-Loop Transparency: When the model emits a Turn-1
<call:medcode_*>tool call whose argument schema fails a prompt-grounded syntactic check (e.g., wrong key name or missing quoted code from the user prompt — never looking at ground truth), the Arm-B harness allows up to 2 prompt-grounded Turn-1 retries before dispatching to the deterministic Go ICX solver. Both rates are reported explicitly below:
MedCodeBench v1.0(240):225 / 240 (93.75%)zero-retry first-shot →240 / 240 (100.0%)with bounded retry loop.MedCodeBench v2.0(540):483 / 540 (89.44%)zero-retry first-shot →540 / 540 (100.0%)with bounded retry loop.- Adversarial Red-Team (
48):20 / 48 (41.67%)zero-retry first-shot (adversarial prompts intentionally disrupt Turn-1 JSON syntax) →48 / 48 (100.0%)with bounded retry loop.
5.1 Layer 1 MedCodeBench v1.0 (240 Held-Out Structured JSON Audit Cases Across 8 CMS Pillars)
| Clinical Coding Pillar | Base Gemma-4-12B-it (67/240 trunc. @ 512) |
MedCodeSec-12B Alone (Q8_0) |
MedCodeSec-12B Alone (Q4_K_M) |
MedCodeSec-12B + Calera ICX (Q8_0, 93.8% 1st-shot) |
|---|---|---|---|---|
| 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 (89.4% 1st-shot) |
|---|---|---|---|---|
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 (41.7% 1st-shot) |
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 — Structured Labs/Vitals/Meds Only)
- Input Structure Caveat: PhysioNet
MIMIC-IV Demo 2.2does not include free-text clinical discharge notes (MIMIC-IV-Noterequires a separate PhysioNet DUA). All 123 encounters were synthesized strictly from structured ICU/hospital labs, vitals, medications, and services (734unique billed ICD-10-CM codes;0train/eval overlap;0ODbL MIMIC rows in training data;100.0%valid JSON). - Overall Micro-F1 vs. Principal Diagnosis Sequencing Trade-Off:
- Base
google/gemma-4-12B-it: Arm A exact micro-F10.0514(3-char0.1203), Arm B exact micro-F10.0508(3-char0.1153),principal_dx_exact_rate3.25%(3-char9.76%Arm A /11.38%Arm B). MedCodeSec-12BStandalone (Arm A): exact micro-F10.1041(2.03×Base), 3-char micro-F10.1813(1.51×Base), non-CMS fabrication4.92%(61 / 1,240),principal_dx_exact_rate1.63%(3-char7.32%).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,principal_dx_exact_rate1.63%(3-char4.88%), direct CMS solver recognition734 / 734 = 100.0%.
- Base
5.5 Out-of-Box Zero-Flag llama-cli Usability Smoke 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,0peg-gemma4errors,0repetition loops,93.1 tok/s)Q4_K_M(11.30 GB):11 / 12 (91.7%)(5/5critical,0peg-gemma4errors,0repetition loops,101.8 tok/s; missed"1 and 0"phrase onPCS_7AXIS_IO)
Honest Contamination & Errata Disclosure (
G-PRE-09): Post-release audit found that10 / 12G-PRE-09prompt templates appeared verbatim (and1 / 12near-verbatim) in thev5.4SFT prose strata, leaving only1 / 12(SEVENTH_CHAR_X) unseen. TreatG-PRE-09strictly as a GGUF quantization /llama-cliruntime format smoke check, not an unseen clinical knowledge score. Additionally, two prose errata were identified inv1.0passing outputs (I50.22misdescribed as acute-on-chronic instead of chronic systolic HF;Q8_0HAC_POAoverstating that aPOA=NHAC wipes unrelatedPOA=YCC/MCC credit) — both are explicitly corrected in thev2.0training pipeline and verified in the live2027.3Go ICX solver.
5.6 Multi-Model Open-Weights Peer Comparison & Methodology Audit (MedCodeBench v1.0)
All peer runs below were executed at T=0.0 (do_sample=False, unpadded batch size 1, max_new_tokens=512) against CaleraLabs/medcodebench v1.0 (240 cases + Pure-CMS 235 subset). Important peer-evaluation caveats are disclosed inline:
| Model | Params | MedCodeBench v1.0 (240) |
Pure-CMS 235 |
Refusal Traps (33) |
McNemar p vs. Q8_0 |
Disclosed Methodology Caveats (v1.0 Run) |
|---|---|---|---|---|---|---|
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) | 93.75% (225/240) 1st-shot → 100.0% w/ bounded Turn-1 retry |
MedCodeSec-12B Alone (Q8_0) |
12B | 74.17% (178/240)CI [68.3%, 79.3%] |
74.47% (175/235) |
30/33 (9.1%) |
reference | In-distribution JSON audit format (80.2% JSON SFT) |
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) | Attention-protected 4-bit quant |
Qwen3-14B (4-bit NF4, non-thinking) |
14B (NF4) | 32.50% (78/240)CI [26.9%, 38.7%] |
33.19% (78/235) |
13/33 (60.6%) |
$2.82 \times 10^{-18}$ | Evaluated in 4-bit NF4 (non-thinking); emitted synonym "status": "verified" on 13 cases. BF16 re-run queued. |
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}$ | Verbose nested JSON hit 512-token cutoff on 67 / 240 cases (PARSE_ERROR). 1024-token re-run queued. |
Excluded from chart: Llama-3.1-8B-Instruct (4-bit) |
8B (NF4) | 5.00% (12/240) |
5.11% (12/235) |
0/33 |
(confounded) | Confounded: 206 / 240 outputs were generic safety refusals ("I cannot provide medical advice"). Neutral-framing re-run queued. |
Excluded from chart: Llama3-OpenBioLLM-8B (4-bit) |
8B (NF4) | 0.00% (0/240) |
0.00% (0/235) |
0/33 |
(confounded) | Confounded: Upstream repo lacked tokenizer.chat_template, causing 236 / 240 prompt-echo PARSE_ERRORs. Fixed-template re-run queued. |
Clean uncontaminated peer comparisons (google/medgemma-27b-text-it BF16, Qwen/Qwen3-14B BF16, Base google/gemma-4-12B-it at 1024 tokens, fixed-template OpenBioLLM-8B, and neutral-framing Llama-3.1-8B) alongside our new 60-case unseen English clinical vignette suite (0% SFT overlap) are queued for our next Colab Enterprise GPU pass.
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 JSON audits, 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 |
6. Intended Use & Regulatory Compliance
- Intended Use: Structured CMS clinical coding audits (
Excludes1/2, billability, 7th-char'X', FY2026↔FY2027 drift, Drug/Neoplasm sequencing, 7-axis PCS, HCPCS Level II NCCI/MUE), HIPAA-safe air-gapped RCM prototypes, and Tier-2 ICX-verified CDI 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 Audits | 74.17% v1.0 JSON → 100.0% v1/v2/Red-Team (0.00% ICX 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, 512-tok cap) 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 Zero-Retry 1st-Shot (240 cases) on MedCodeBench v1.0 & v2.0 (CMS FY2026/FY2027 + Drug/Neoplasm/PCS/NCCI)self-reported93.750
- MedCodeBench v1.0 MedCodeSec-12B + Calera ICX Bounded Retry Loop (240 cases) 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 Zero-Retry 1st-Shot (540 cases) on MedCodeBench v1.0 & v2.0 (CMS FY2026/FY2027 + Drug/Neoplasm/PCS/NCCI)self-reported89.440
Install (macOS, Linux)
# 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