Text Generation
Transformers
Safetensors
English
qwen3
medical
clinical
biomedical
radiology
from-scratch
base-model
university-of-kentucky
university-of-louisville
ccts
text-generation-inference
Instructions to use Kentucky-Open-Science/KOS-V5-Base with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use Kentucky-Open-Science/KOS-V5-Base with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="Kentucky-Open-Science/KOS-V5-Base")# pip install -U transformers accelerate # Load model directly from transformers import AutoTokenizer, AutoModelForCausalLM tokenizer = AutoTokenizer.from_pretrained("Kentucky-Open-Science/KOS-V5-Base") model = AutoModelForCausalLM.from_pretrained("Kentucky-Open-Science/KOS-V5-Base", device_map="auto") - Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- vLLM
How to use Kentucky-Open-Science/KOS-V5-Base with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "Kentucky-Open-Science/KOS-V5-Base" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "Kentucky-Open-Science/KOS-V5-Base", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }'Use Docker
docker model run hf.co/Kentucky-Open-Science/KOS-V5-Base
- SGLang
How to use Kentucky-Open-Science/KOS-V5-Base with SGLang:
Install from pip and serve model
# Install SGLang from pip: pip install sglang # Start the SGLang server: python3 -m sglang.launch_server \ --model-path "Kentucky-Open-Science/KOS-V5-Base" \ --host 0.0.0.0 \ --port 30000 # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:30000/v1/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "Kentucky-Open-Science/KOS-V5-Base", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }'Use Docker images
docker run --gpus all \ --shm-size 32g \ -p 30000:30000 \ -v ~/.cache/huggingface:/root/.cache/huggingface \ --env "HF_TOKEN=<secret>" \ --ipc=host \ lmsysorg/sglang:latest \ python3 -m sglang.launch_server \ --model-path "Kentucky-Open-Science/KOS-V5-Base" \ --host 0.0.0.0 \ --port 30000 # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:30000/v1/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "Kentucky-Open-Science/KOS-V5-Base", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }' - Docker Model Runner
How to use Kentucky-Open-Science/KOS-V5-Base with Docker Model Runner:
docker model run hf.co/Kentucky-Open-Science/KOS-V5-Base
Model card: UK CoM/CCTS attribution in structured metadata; win/loss by quartile; comparator roster; drop step count
Browse files
README.md
CHANGED
|
@@ -79,6 +79,10 @@ line, and it is released as a research artifact.
|
|
| 79 |
|
| 80 |
**Result: 28 wins, 16 losses, 50 mid-pool.**
|
| 81 |
|
|
|
|
|
|
|
|
|
|
|
|
|
| 82 |
Every comparator was trained on **1.3β153Γ more data** than KOS-V5 (0.3β36T tokens vs our 0.235T).
|
| 83 |
|
| 84 |
### The comparator pool (16 external models + KOS-V5 = 17)
|
|
@@ -110,6 +114,8 @@ Every comparator was trained on **1.3β153Γ more data** than KOS-V5 (0.3β36T
|
|
| 110 |
|
| 111 |
### Wins β top quartile (28)
|
| 112 |
|
|
|
|
|
|
|
| 113 |
| Metric | Value | Rank |
|
| 114 |
|---|---|---|
|
| 115 |
| **BPB, 5-corpus mean** (held-out medical text) | **0.4635** | **1 / 17** |
|
|
@@ -138,6 +144,8 @@ placements are therefore conservative, not inflated.
|
|
| 138 |
|
| 139 |
### Losses β bottom quartile (16)
|
| 140 |
|
|
|
|
|
|
|
| 141 |
| Metric | Value | Rank |
|
| 142 |
|---|---|---|
|
| 143 |
| **MedHALT false-confidence test (T8-FCT)** | **0.0280** | **16 / 17** β worst placement |
|
|
@@ -156,6 +164,8 @@ are MedHALT-FCT, two general-domain reasoning sets, one HoC probe and one RadGra
|
|
| 156 |
|
| 157 |
### Mid-pool β neither a win nor a loss (50)
|
| 158 |
|
|
|
|
|
|
|
| 159 |
Reported because they are frequently mistaken for one or the other:
|
| 160 |
|
| 161 |
| Metric | Value | Rank |
|
|
@@ -171,6 +181,137 @@ above KOS-V4. It is a post-training problem, not a token-budget one.
|
|
| 171 |
|
| 172 |
---
|
| 173 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 174 |
## KOS-V5 vs KOS-V4 β a corpus trade-off, now settled
|
| 175 |
|
| 176 |
Both models are ours, both are finished, and both were run on the identical harness. **KOS-V5 is
|
|
@@ -254,12 +395,12 @@ neither quantify the cost nor claim there is none. The tokenizer is baked into t
|
|
| 254 |
embedding table, so it is not fixable by fine-tuning β removing it requires retraining with a
|
| 255 |
digit-splitting pre-tokenizer. Treat any numeric medical task on this model with that in mind.
|
| 256 |
|
| 257 |
-
**2. Low medical single-token rate (STRR β bottom quartile, rank 15/17).** Deliberate: BBPE spends its
|
| 258 |
32k vocabulary on byte-level compression rather than memorising whole medical terms. It single-tokens
|
| 259 |
only ~19% of radiology and ~23% of chest-xray terms. The trade appears sound β tokens-per-byte is a
|
| 260 |
top-quartile 4/17 and BPB is 1/17 β but it is a trade, and it is the same trade as the digit issue.
|
| 261 |
|
| 262 |
-
**3. MedHALT-FCT is the worst placement in the model (rank 16/17).** A base model with no refusal prior
|
| 263 |
has essentially no mechanism for declining a question whose premise is false, and KOS-V5 answers
|
| 264 |
anyway. This is the axis a grounded medical model most needs to improve, and it is a target for the
|
| 265 |
instruction/RL stage rather than for more pretraining.
|
|
|
|
| 79 |
|
| 80 |
**Result: 28 wins, 16 losses, 50 mid-pool.**
|
| 81 |
|
| 82 |
+
π **Every test is defined in [Test definitions](#test-definitions) below** β what it measures, on what
|
| 83 |
+
data, and which direction is better. The tier codes (T1, T1b, T2 β¦) used in the tables are all
|
| 84 |
+
explained there.
|
| 85 |
+
|
| 86 |
Every comparator was trained on **1.3β153Γ more data** than KOS-V5 (0.3β36T tokens vs our 0.235T).
|
| 87 |
|
| 88 |
### The comparator pool (16 external models + KOS-V5 = 17)
|
|
|
|
| 114 |
|
| 115 |
### Wins β top quartile (28)
|
| 116 |
|
| 117 |
+
*Tier codes (T1, T2 β¦) are defined in [Test definitions](#test-definitions).*
|
| 118 |
+
|
| 119 |
| Metric | Value | Rank |
|
| 120 |
|---|---|---|
|
| 121 |
| **BPB, 5-corpus mean** (held-out medical text) | **0.4635** | **1 / 17** |
|
|
|
|
| 144 |
|
| 145 |
### Losses β bottom quartile (16)
|
| 146 |
|
| 147 |
+
*Tier codes are defined in [Test definitions](#test-definitions).*
|
| 148 |
+
|
| 149 |
| Metric | Value | Rank |
|
| 150 |
|---|---|---|
|
| 151 |
| **MedHALT false-confidence test (T8-FCT)** | **0.0280** | **16 / 17** β worst placement |
|
|
|
|
| 164 |
|
| 165 |
### Mid-pool β neither a win nor a loss (50)
|
| 166 |
|
| 167 |
+
*Tier codes are defined in [Test definitions](#test-definitions).*
|
| 168 |
+
|
| 169 |
Reported because they are frequently mistaken for one or the other:
|
| 170 |
|
| 171 |
| Metric | Value | Rank |
|
|
|
|
| 181 |
|
| 182 |
---
|
| 183 |
|
| 184 |
+
## Test definitions
|
| 185 |
+
|
| 186 |
+
What each tier actually measures. **"dir"** is the direction that is better. Every metric is ranked
|
| 187 |
+
against the same 17-model pool unless marked *reference-only*.
|
| 188 |
+
|
| 189 |
+
### Block A β general LM diagnostics (58 metrics)
|
| 190 |
+
|
| 191 |
+
#### T1 Β· Bits-per-byte on held-out medical text β *the headline* (dir: lower)
|
| 192 |
+
Negative log-likelihood divided by **UTF-8 bytes**, not tokens β so it is **tokenizer-agnostic** and
|
| 193 |
+
directly comparable across models with different vocabularies. Measured on **five held-out medical
|
| 194 |
+
corpora**, none of which appear in training: `radiology_reports`, `chest_xray_reports`,
|
| 195 |
+
`clinical_narratives`, `biomedical_literature`, `medical_textbooks`, plus their mean.
|
| 196 |
+
*Caveat we state against ourselves:* a model distilled from a larger teacher can print lower BPB
|
| 197 |
+
regardless of true quality, which **flatters the trillion-token externals, not a from-scratch model** β
|
| 198 |
+
so our BPB placements are conservative.
|
| 199 |
+
|
| 200 |
+
#### T1b Β· Tokenizer statistics (dir: STRR higher; fragment & tokens-per-byte lower)
|
| 201 |
+
- **STRR** (*Single-Token Rate Ratio*) β the fraction of medical terms the tokenizer encodes as **one
|
| 202 |
+
token**, over a union vocabulary of **21,978 medical terms** across the 5 domains. Reported per
|
| 203 |
+
domain, plus a macro mean and a union-weighted aggregate.
|
| 204 |
+
- **fragment_score** β average number of subword pieces per medical term.
|
| 205 |
+
- **tokens_per_byte** β raw compression efficiency (how compactly the tokenizer encodes text).
|
| 206 |
+
|
| 207 |
+
#### T2 Β· Attention pathology (dir: lower for sinks/collapse; higher for min-entropy)
|
| 208 |
+
Per-(layer, head) attention diagnostics over medical text:
|
| 209 |
+
- **collapsed_head_frac** β fraction of heads whose attention has degenerated to a near-constant pattern.
|
| 210 |
+
- **bos_sink_mass** β attention mass dumped on the first token (the classic "attention sink").
|
| 211 |
+
- **layers_with_sink** β fraction of layers exhibiting a sink.
|
| 212 |
+
- **entropy_norm_min** β the lowest normalised attention entropy in the model (higher = no head has
|
| 213 |
+
collapsed to a single position).
|
| 214 |
+
|
| 215 |
+
#### T3 Β· Representation flow (dir: lens accuracy higher; dead-neuron lower)
|
| 216 |
+
- **peak_lens / final_lens accuracy** β logit-lens probe accuracy: how well the correct token can be
|
| 217 |
+
read out of intermediate layers (peak across depth, and at the final layer).
|
| 218 |
+
- **lens_AUC** β area under the depth-vs-accuracy curve.
|
| 219 |
+
- **max_dead_neuron_frac** β the worst layer's fraction of neurons that never activate.
|
| 220 |
+
|
| 221 |
+
#### T4 Β· Representation geometry (dir: RankMe higher; isotropy lower = less anisotropic)
|
| 222 |
+
Measured at **5 proportional depths**:
|
| 223 |
+
- **RankMe** β the *effective rank* (soft rank of the singular-value spectrum) of the hidden
|
| 224 |
+
representations. Higher = the model uses more of its representational space rather than collapsing
|
| 225 |
+
into a low-dimensional cone.
|
| 226 |
+
- **isotropy** β directional uniformity of the embedding cloud.
|
| 227 |
+
|
| 228 |
+
#### T5 Β· WeightWatcher power-law Ξ± β structural maturity
|
| 229 |
+
Fits a power law to each layer's weight spectrum. **Ξ± β [2, 6] is the healthy band**; Ξ± > 6 means
|
| 230 |
+
under-trained, Ξ± < 2 over-trained.
|
| 231 |
+
- **safe_layer_ratio** (dir: higher) β fraction of layers inside the healthy band.
|
| 232 |
+
- **under_ratio** (dir: lower) β fraction of layers that are under-trained.
|
| 233 |
+
- **median_Ξ± / min_Ξ±** β **reference-only, deliberately unranked**: Ξ± is a *target band*, not a
|
| 234 |
+
monotone quantity, so "more is better" is meaningless. (Ranking it higher-is-better would literally
|
| 235 |
+
reward being under-trained β and would have *improved* our reported result from rank 15 to rank 3. We
|
| 236 |
+
declined to take the favourable reading of an ill-defined metric.)
|
| 237 |
+
|
| 238 |
+
#### T9 Β· Calibration (dir: lower)
|
| 239 |
+
**Expected Calibration Error (ECE)**, averaged over **15 multiple-choice calibration tasks**: the gap
|
| 240 |
+
between the model's confidence and its actual accuracy. Low ECE = the model's confidence means something.
|
| 241 |
+
|
| 242 |
+
#### T10 Β· Context-length scaling + needle-in-a-haystack
|
| 243 |
+
- **Bucket BPB** (dir: lower) β BPB measured at {L/8, L/4, L/2, L} where L = min(model's max position,
|
| 244 |
+
4096), so every model is judged inside its own usable window. A separate KOS-only extension probes
|
| 245 |
+
the full **32,768**-token window.
|
| 246 |
+
- **Needle retrieval** (dir: higher) β a numeric medical fact is hidden at depth **0.1 / 0.5 / 0.9**
|
| 247 |
+
inside a long context and must be retrieved, at fixed lengths **512 / 1,024 / 2,048 / 4,096** tokens.
|
| 248 |
+
Reported per length, per depth, and as a 3-depth mean.
|
| 249 |
+
|
| 250 |
+
#### T11 Β· Demographic bias (dir: disparity lower; frac_stereotyped closer to 0.5)
|
| 251 |
+
**CrowS-Pairs**: for each minimally-different sentence pair (stereotyping vs anti-stereotyping), which
|
| 252 |
+
does the model prefer? `|disparity|` measures how strongly it prefers one; `frac_stereotyped` is the
|
| 253 |
+
fraction of pairs where the stereotyping sentence wins (0.5 = no preference).
|
| 254 |
+
|
| 255 |
+
### Block B β medical knowledge and entity extraction (32 metrics)
|
| 256 |
+
|
| 257 |
+
#### T6 Β· Closed-book multiple choice (dir: higher)
|
| 258 |
+
**16 log-likelihood MCQ tasks**, scored with the standard lm-evaluation-harness (no chain-of-thought,
|
| 259 |
+
no prompting tricks β this is a base model):
|
| 260 |
+
- *Medical specialist:* **MedQA** (4-option, USMLE-style), **MedMCQA**, **PubMedQA**, and the **8 MMLU
|
| 261 |
+
medical subjects** (anatomy, clinical knowledge, college biology, college medicine, high-school
|
| 262 |
+
biology, medical genetics, nutrition, professional medicine, virology).
|
| 263 |
+
- *Augmented / regional / expert:* **MedXpertQA-Text**, **AfriMed-QA**.
|
| 264 |
+
- *General-reasoning controls:* **PIQA**, **HellaSwag**.
|
| 265 |
+
|
| 266 |
+
#### T6b Β· MedThink-LL (dir: rank-1 higher; margin lower)
|
| 267 |
+
A PubMedQA-substitute: the correct answer must be ranked above **4 distractors** by log-likelihood.
|
| 268 |
+
**rank1_acc** = how often it is; **mean_logprob_margin** = the confidence gap.
|
| 269 |
+
|
| 270 |
+
#### T7 Β· BLURB linear probes (dir: higher)
|
| 271 |
+
A **linear probe** is trained on the frozen model's representations β this reads the *semantic geometry*
|
| 272 |
+
of the upper layers, independent of any generation ability:
|
| 273 |
+
- **BC5CDR-Chem** β chemical NER (macro / micro F1).
|
| 274 |
+
- **NCBI-Disease** β disease NER (macro / micro F1).
|
| 275 |
+
- **BIOSSES** β biomedical sentence-similarity (Pearson / Spearman).
|
| 276 |
+
- **HoC** β Hallmarks-of-Cancer document classification (micro / macro / samples F1).
|
| 277 |
+
- **BLURB mean** β the headline: mean of BC5CDR-macro, NCBI-macro, BIOSSES-Spearman, HoC-micro.
|
| 278 |
+
|
| 279 |
+
#### T8 Β· Med-HALT β hallucination resistance (dir: higher)
|
| 280 |
+
- **FCT** (*false-confidence test*) β the question's **premise is wrong**; the model should decline.
|
| 281 |
+
A base model has no refusal prior, which is exactly why this is our worst placement.
|
| 282 |
+
- **NOTA** (*none-of-the-above*) β the correct answer is "none of the above".
|
| 283 |
+
- **FQT** (*fake-question test*) β the question is fabricated; it should be rejected.
|
| 284 |
+
- **PMID2Title** β recall a paper's title from its PubMed ID (a memorisation probe; **degenerate** β
|
| 285 |
+
every model in the pool scores 0.0, so it is excluded from the tally).
|
| 286 |
+
|
| 287 |
+
### Block C β radiology-specific (6 metrics)
|
| 288 |
+
|
| 289 |
+
#### DR.1 / DR.2 / DR.3 Β· RadGraph entity + relation extraction (dir: higher)
|
| 290 |
+
Structured extraction of clinical entities and their relations from radiology reports, scored as
|
| 291 |
+
macro-F1 and micro-F1:
|
| 292 |
+
- **DR.1 β RadGraph-XL**: chest CT + abdomen-pelvis CT + brain MRI.
|
| 293 |
+
- **DR.2 β RadGraph-CXR**: chest x-ray (50 MIMIC + 50 CheXpert).
|
| 294 |
+
- **DR.3 β RadGraph2-CXR**: adds the CHAN (change) relation class.
|
| 295 |
+
|
| 296 |
+
#### DPM.1 Β· PMR-Q&A (reference-only)
|
| 297 |
+
English physiotherapy / rehabilitation Q&A, rank-1 accuracy. **Unranked** β too few comparators have a
|
| 298 |
+
score for it to be a meaningful ranking.
|
| 299 |
+
|
| 300 |
+
### How ranks are computed
|
| 301 |
+
|
| 302 |
+
- **Pool = KOS-V5 + the 16 external models = 17.** KOS-V4 is *excluded* from the pool β it is our own
|
| 303 |
+
prior model, and is reported separately in its own head-to-head below.
|
| 304 |
+
- Each metric is ranked **in its own correct direction** (lower-is-better for BPB, ECE, sinks,
|
| 305 |
+
fragmentation; higher-is-better for accuracy, F1, RankMe, STRR).
|
| 306 |
+
- **Denominators vary** where a comparator has no score for a metric: Gemma-2-9B has no T10 result and
|
| 307 |
+
BioMedLM is architecturally capped at 1,024 tokens (so it is skipped in the longer needle tables).
|
| 308 |
+
That is why some ranks read "of 16" or "of 12" rather than "of 17" β the rank is always taken over
|
| 309 |
+
whichever models actually have that metric.
|
| 310 |
+
- **Two metrics are reference-only** (the WeightWatcher Ξ± pair) and **one is degenerate** (PMID2Title,
|
| 311 |
+
where all 17 models score 0.0), leaving **93 metrics in the tally**.
|
| 312 |
+
|
| 313 |
+
---
|
| 314 |
+
|
| 315 |
## KOS-V5 vs KOS-V4 β a corpus trade-off, now settled
|
| 316 |
|
| 317 |
Both models are ours, both are finished, and both were run on the identical harness. **KOS-V5 is
|
|
|
|
| 395 |
embedding table, so it is not fixable by fine-tuning β removing it requires retraining with a
|
| 396 |
digit-splitting pre-tokenizer. Treat any numeric medical task on this model with that in mind.
|
| 397 |
|
| 398 |
+
**2. Low medical single-token rate ([STRR](#t1b--tokenizer-statistics-dir-strr-higher-fragment--tokens-per-byte-lower) β bottom quartile, rank 15/17).** Deliberate: BBPE spends its
|
| 399 |
32k vocabulary on byte-level compression rather than memorising whole medical terms. It single-tokens
|
| 400 |
only ~19% of radiology and ~23% of chest-xray terms. The trade appears sound β tokens-per-byte is a
|
| 401 |
top-quartile 4/17 and BPB is 1/17 β but it is a trade, and it is the same trade as the digit issue.
|
| 402 |
|
| 403 |
+
**3. MedHALT-FCT ([false-confidence test](#t8--med-halt--hallucination-resistance-dir-higher)) is the worst placement in the model (rank 16/17).** A base model with no refusal prior
|
| 404 |
has essentially no mechanism for declining a question whose premise is false, and KOS-V5 answers
|
| 405 |
anyway. This is the axis a grounded medical model most needs to improve, and it is a target for the
|
| 406 |
instruction/RL stage rather than for more pretraining.
|