Text Generation
Transformers
Safetensors
English
qwen3
clinical
medical
instruction-following
tool-calling
function-calling
KOS-V4
from-scratch
conversational
text-generation-inference
Instructions to use Kentucky-Open-Science/KOS-V4-Instruct with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use Kentucky-Open-Science/KOS-V4-Instruct with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="Kentucky-Open-Science/KOS-V4-Instruct") messages = [ {"role": "user", "content": "Who are you?"}, ] pipe(messages)# pip install -U transformers accelerate # Load model directly from transformers import AutoTokenizer, AutoModelForCausalLM tokenizer = AutoTokenizer.from_pretrained("Kentucky-Open-Science/KOS-V4-Instruct") model = AutoModelForCausalLM.from_pretrained("Kentucky-Open-Science/KOS-V4-Instruct", device_map="auto") messages = [ {"role": "user", "content": "Who are you?"}, ] inputs = tokenizer.apply_chat_template( messages, add_generation_prompt=True, tokenize=True, return_dict=True, return_tensors="pt", ).to(model.device) outputs = model.generate(**inputs, max_new_tokens=256) print(tokenizer.decode(outputs[0][inputs["input_ids"].shape[-1]:])) - Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- vLLM
How to use Kentucky-Open-Science/KOS-V4-Instruct 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-V4-Instruct" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "Kentucky-Open-Science/KOS-V4-Instruct", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }'Use Docker
docker model run hf.co/Kentucky-Open-Science/KOS-V4-Instruct
- SGLang
How to use Kentucky-Open-Science/KOS-V4-Instruct 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-V4-Instruct" \ --host 0.0.0.0 \ --port 30000 # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:30000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "Kentucky-Open-Science/KOS-V4-Instruct", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }'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-V4-Instruct" \ --host 0.0.0.0 \ --port 30000 # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:30000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "Kentucky-Open-Science/KOS-V4-Instruct", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }' - Docker Model Runner
How to use Kentucky-Open-Science/KOS-V4-Instruct with Docker Model Runner:
docker model run hf.co/Kentucky-Open-Science/KOS-V4-Instruct
Rebrand to KOS-V4; David-vs-Goliath GPT-3.5 framing; complete peer tables
Browse files
README.md
CHANGED
|
@@ -10,13 +10,13 @@ tags:
|
|
| 10 |
- instruction-following
|
| 11 |
- tool-calling
|
| 12 |
- function-calling
|
| 13 |
-
-
|
| 14 |
- from-scratch
|
| 15 |
---
|
| 16 |
|
| 17 |
-
##
|
| 18 |
|
| 19 |
-
|
| 20 |
completely from scratch**: a custom 32k medical tokenizer, a from-scratch pretrained base, and task-specialized
|
| 21 |
post-training, assembled into a **grounded clinical RAG system** (a retriever, grounded readers that abstain when
|
| 22 |
the answer is absent, and an instruction and tool model). The goal is not to memorize medicine; it is to reliably
|
|
@@ -24,20 +24,20 @@ follow the standard of care retrieved for it.
|
|
| 24 |
|
| 25 |
**David and Goliath.** The base was trained on **180 billion tokens using 24 GPUs** over about six days. For
|
| 26 |
contrast, OpenAI built the original ChatGPT (**GPT-3.5**) on a Microsoft supercomputer of roughly **10,000 GPUs**
|
| 27 |
-
and 285,000 CPU cores, one of the largest machines in the world at the time.
|
| 28 |
fewer GPUs**, a small fraction of the data, and trained from scratch as a small group.
|
| 29 |
|
| 30 |
-
**And it reaches that bar.** On **IFEval**, the standard instruction-following benchmark,
|
| 31 |
**AVG4 62.7**, on par with and a touch above the reported **GPT-3.5-turbo (60.7)**, and within about three points of
|
| 32 |
a current big-company 3B, **Qwen2.5-3B-Instruct (65.4)**.
|
| 33 |
|
| 34 |
| IFEval (AVG4 of the four strict and loose metrics) | score | who built it, and how |
|
| 35 |
| :-- | :-- | :-- |
|
| 36 |
-
| **
|
| 37 |
| GPT-3.5-turbo, the original ChatGPT (reported) | 60.7 | OpenAI, about 10,000-GPU supercomputer |
|
| 38 |
| Qwen2.5-3B-Instruct | 65.4 | Alibaba, about 18 trillion tokens |
|
| 39 |
|
| 40 |
-
**Where it genuinely leads.** On the RAG tasks it was built for,
|
| 41 |
- **Guideline grounding** (RGB negative-rejection: refusing when the guidance does not cover the question) is
|
| 42 |
**45.0**, the best in our comparison set, above even the newer Qwen3-4B (40.7).
|
| 43 |
- **Retrieval** (BEIR SciFact, zero-shot) is **NDCG@10 = 0.7327**, inside the strong-dense band (0.70 to 0.76) and
|
|
@@ -50,16 +50,16 @@ results, including where it trails.
|
|
| 50 |
|
| 51 |
---
|
| 52 |
|
| 53 |
-
#
|
| 54 |
|
| 55 |
-
**
|
| 56 |
a decoder-only transformer (Qwen3 architecture, bespoke 3B configuration) optimized for **instruction following and
|
| 57 |
tool / function calling** over clinical and general English text. Its instruction ability comes from **GRPO
|
| 58 |
reinforcement learning** on a from-scratch clinical base, reaching **IFEval AVG4 = 62.7**. That is on par with the
|
| 59 |
reported score for the original ChatGPT (**GPT-3.5-turbo, 60.7**) and within about three points of
|
| 60 |
**Qwen2.5-3B-Instruct (65.4)**, from a fraction of the data and compute. It also adds reliable **tool and function
|
| 61 |
calling** (BFCL 81/73/62), a capability the original ChatGPT did not have at launch. It is the flagship of the
|
| 62 |
-
**
|
| 63 |
|
| 64 |
## Core specifications
|
| 65 |
| Attribute | Detail |
|
|
@@ -83,7 +83,7 @@ calling** (BFCL 81/73/62), a capability the original ChatGPT did not have at lau
|
|
| 83 |
from transformers import AutoModelForCausalLM, AutoTokenizer
|
| 84 |
import torch
|
| 85 |
|
| 86 |
-
model_id = "Kentucky-Open-Science/
|
| 87 |
tok = AutoTokenizer.from_pretrained(model_id)
|
| 88 |
model = AutoModelForCausalLM.from_pretrained(model_id, torch_dtype=torch.bfloat16, device_map="auto")
|
| 89 |
|
|
@@ -98,7 +98,7 @@ print(tok.decode(out[0][inputs.shape[1]:], skip_special_tokens=True))
|
|
| 98 |
Serve with vLLM / TGI as a standard `Qwen3`-architecture causal LM. **Pin RoPE θ = 25000** on any GGUF/quantized export.
|
| 99 |
|
| 100 |
## Prompt / chat format
|
| 101 |
-
|
| 102 |
```
|
| 103 |
<|im_start|>system
|
| 104 |
{system prompt (optional)}<|im_end|>
|
|
@@ -110,7 +110,7 @@ kos-v4-instruct uses **ChatML**:
|
|
| 110 |
`<|im_end|>` is the true end-of-turn / eos token. Tool calling uses dedicated `<|tool_call|>` / `<|tool_response|>`
|
| 111 |
tokens; pass tools via the tokenizer's chat template `tools=` argument.
|
| 112 |
|
| 113 |
-
## Pre-training (the
|
| 114 |
Trained from scratch, not distilled or continued from another model.
|
| 115 |
|
| 116 |
### Hyperparameters & schedule
|
|
@@ -162,23 +162,23 @@ AVG4 rose across GRPO steps from **47.7 (SFT base)** to **62.7 at step 1120 (shi
|
|
| 162 |
|
| 163 |
## Evaluation & benchmarks
|
| 164 |
Public benchmarks only. **IFEval** is the EleutherAI lm-evaluation-harness with `--apply_chat_template`, AVG4 of the
|
| 165 |
-
four strict and loose metrics. **BFCL** is the Berkeley Function-Calling AST checker. We measured
|
| 166 |
Qwen2.5-3B ourselves on this harness. The GPT-3.5-turbo column is OpenAI's model **as reported** in published
|
| 167 |
instruction-following evaluations, included as the original-ChatGPT reference point rather than run by us.
|
| 168 |
|
| 169 |
-
| Benchmark |
|
| 170 |
| :--- | :--- | :--- | :--- |
|
| 171 |
| **IFEval** AVG4 | **62.7** | 60.7 | 65.4 |
|
| 172 |
| IFEval prompt-strict / inst-strict / prompt-loose / inst-loose | 55.8 / 67.0 / 58.4 / 69.7 | 53.8 / 64.7 / 56.6 / 67.5 | 59.5 / 68.5 / 62.1 / 71.3 |
|
| 173 |
| **BFCL** simple / multiple / parallel | **81 / 73 / 62** | none at launch | 95 / 89 / 75 |
|
| 174 |
-
| *(reference)*
|
| 175 |
|
| 176 |
**Reading.** From a small team's from-scratch 3B, IFEval **62.7** lands right on the original ChatGPT
|
| 177 |
(GPT-3.5-turbo, a reported 60.7) and within about three points of Qwen2.5-3B-Instruct (65.4), while being
|
| 178 |
-
**15.0 points above our own SFT base** (47.7). On tool-calling,
|
| 179 |
original ChatGPT lacked at launch; general instruct models trained on far more tool data score higher (Qwen2.5-3B
|
| 180 |
at 95/89/75). Newer, more heavily distilled small models trained on 50 to 200 times more data also score higher on
|
| 181 |
-
IFEval;
|
| 182 |
|
| 183 |
## Compute footprint & requirements
|
| 184 |
### Training
|
|
@@ -194,16 +194,16 @@ IFEval; kos-v4's result is notable for its data and compute budget, not a claim
|
|
| 194 |
|
| 195 |
## Intended use & limitations
|
| 196 |
- **Intended use:** general instruction following, structured output, and function/tool calling in clinical-adjacent
|
| 197 |
-
workflows. For grounded record/guideline reading with abstention use **
|
| 198 |
- **Not a medical-knowledge QA model.** It follows instructions and calls tools; it does not reliably recall
|
| 199 |
parametric medical facts and is not intended for medical multiple-choice exams. **Ground it with retrieval instead.**
|
| 200 |
- This instruction-tuned checkpoint trades away grounded abstention (its RGB negative-rejection is near zero), so for
|
| 201 |
-
non-fabrication on unanswerable questions use **
|
| 202 |
- IFEval 62.7 is on the original-ChatGPT (GPT-3.5-turbo) level and near Qwen2.5-3B (65.4); newer small models trained
|
| 203 |
on far more data score higher. English only. Strong public-benchmark numbers are not validation on real clinical data.
|
| 204 |
|
| 205 |
-
## The
|
| 206 |
-
- **
|
| 207 |
-
- **[
|
| 208 |
-
- **[
|
| 209 |
-
- **[
|
|
|
|
| 10 |
- instruction-following
|
| 11 |
- tool-calling
|
| 12 |
- function-calling
|
| 13 |
+
- KOS-V4
|
| 14 |
- from-scratch
|
| 15 |
---
|
| 16 |
|
| 17 |
+
## KOS-V4: a from-scratch 3B clinical suite that reaches original-ChatGPT-level instruction-following
|
| 18 |
|
| 19 |
+
KOS-V4 is a **first release from a small team**, not a large lab. It is a family of **3B clinical models built
|
| 20 |
completely from scratch**: a custom 32k medical tokenizer, a from-scratch pretrained base, and task-specialized
|
| 21 |
post-training, assembled into a **grounded clinical RAG system** (a retriever, grounded readers that abstain when
|
| 22 |
the answer is absent, and an instruction and tool model). The goal is not to memorize medicine; it is to reliably
|
|
|
|
| 24 |
|
| 25 |
**David and Goliath.** The base was trained on **180 billion tokens using 24 GPUs** over about six days. For
|
| 26 |
contrast, OpenAI built the original ChatGPT (**GPT-3.5**) on a Microsoft supercomputer of roughly **10,000 GPUs**
|
| 27 |
+
and 285,000 CPU cores, one of the largest machines in the world at the time. KOS-V4 used on the order of **400 times
|
| 28 |
fewer GPUs**, a small fraction of the data, and trained from scratch as a small group.
|
| 29 |
|
| 30 |
+
**And it reaches that bar.** On **IFEval**, the standard instruction-following benchmark, KOS-V4-Instruct scores
|
| 31 |
**AVG4 62.7**, on par with and a touch above the reported **GPT-3.5-turbo (60.7)**, and within about three points of
|
| 32 |
a current big-company 3B, **Qwen2.5-3B-Instruct (65.4)**.
|
| 33 |
|
| 34 |
| IFEval (AVG4 of the four strict and loose metrics) | score | who built it, and how |
|
| 35 |
| :-- | :-- | :-- |
|
| 36 |
+
| **KOS-V4-Instruct (ours)** | **62.7** | a small team, from scratch, 180B tokens, 24 GPUs |
|
| 37 |
| GPT-3.5-turbo, the original ChatGPT (reported) | 60.7 | OpenAI, about 10,000-GPU supercomputer |
|
| 38 |
| Qwen2.5-3B-Instruct | 65.4 | Alibaba, about 18 trillion tokens |
|
| 39 |
|
| 40 |
+
**Where it genuinely leads.** On the RAG tasks it was built for, KOS-V4 is competitive or best in class:
|
| 41 |
- **Guideline grounding** (RGB negative-rejection: refusing when the guidance does not cover the question) is
|
| 42 |
**45.0**, the best in our comparison set, above even the newer Qwen3-4B (40.7).
|
| 43 |
- **Retrieval** (BEIR SciFact, zero-shot) is **NDCG@10 = 0.7327**, inside the strong-dense band (0.70 to 0.76) and
|
|
|
|
| 50 |
|
| 51 |
---
|
| 52 |
|
| 53 |
+
# KOS-V4-Instruct (3B, from scratch)
|
| 54 |
|
| 55 |
+
**KOS-V4-Instruct** is an open-weights **3B language model trained completely from scratch** by a small team. It is
|
| 56 |
a decoder-only transformer (Qwen3 architecture, bespoke 3B configuration) optimized for **instruction following and
|
| 57 |
tool / function calling** over clinical and general English text. Its instruction ability comes from **GRPO
|
| 58 |
reinforcement learning** on a from-scratch clinical base, reaching **IFEval AVG4 = 62.7**. That is on par with the
|
| 59 |
reported score for the original ChatGPT (**GPT-3.5-turbo, 60.7**) and within about three points of
|
| 60 |
**Qwen2.5-3B-Instruct (65.4)**, from a fraction of the data and compute. It also adds reliable **tool and function
|
| 61 |
calling** (BFCL 81/73/62), a capability the original ChatGPT did not have at launch. It is the flagship of the
|
| 62 |
+
**KOS-V4** family (a retriever and two grounded readers ship alongside it).
|
| 63 |
|
| 64 |
## Core specifications
|
| 65 |
| Attribute | Detail |
|
|
|
|
| 83 |
from transformers import AutoModelForCausalLM, AutoTokenizer
|
| 84 |
import torch
|
| 85 |
|
| 86 |
+
model_id = "Kentucky-Open-Science/KOS-V4-Instruct"
|
| 87 |
tok = AutoTokenizer.from_pretrained(model_id)
|
| 88 |
model = AutoModelForCausalLM.from_pretrained(model_id, torch_dtype=torch.bfloat16, device_map="auto")
|
| 89 |
|
|
|
|
| 98 |
Serve with vLLM / TGI as a standard `Qwen3`-architecture causal LM. **Pin RoPE θ = 25000** on any GGUF/quantized export.
|
| 99 |
|
| 100 |
## Prompt / chat format
|
| 101 |
+
KOS-V4-Instruct uses **ChatML**:
|
| 102 |
```
|
| 103 |
<|im_start|>system
|
| 104 |
{system prompt (optional)}<|im_end|>
|
|
|
|
| 110 |
`<|im_end|>` is the true end-of-turn / eos token. Tool calling uses dedicated `<|tool_call|>` / `<|tool_response|>`
|
| 111 |
tokens; pass tools via the tokenizer's chat template `tools=` argument.
|
| 112 |
|
| 113 |
+
## Pre-training (the KOS-V4 base)
|
| 114 |
Trained from scratch, not distilled or continued from another model.
|
| 115 |
|
| 116 |
### Hyperparameters & schedule
|
|
|
|
| 162 |
|
| 163 |
## Evaluation & benchmarks
|
| 164 |
Public benchmarks only. **IFEval** is the EleutherAI lm-evaluation-harness with `--apply_chat_template`, AVG4 of the
|
| 165 |
+
four strict and loose metrics. **BFCL** is the Berkeley Function-Calling AST checker. We measured KOS-V4 and
|
| 166 |
Qwen2.5-3B ourselves on this harness. The GPT-3.5-turbo column is OpenAI's model **as reported** in published
|
| 167 |
instruction-following evaluations, included as the original-ChatGPT reference point rather than run by us.
|
| 168 |
|
| 169 |
+
| Benchmark | KOS-V4-Instruct (ours) | GPT-3.5-turbo (original ChatGPT, reported) | Qwen2.5-3B-Instruct |
|
| 170 |
| :--- | :--- | :--- | :--- |
|
| 171 |
| **IFEval** AVG4 | **62.7** | 60.7 | 65.4 |
|
| 172 |
| IFEval prompt-strict / inst-strict / prompt-loose / inst-loose | 55.8 / 67.0 / 58.4 / 69.7 | 53.8 / 64.7 / 56.6 / 67.5 | 59.5 / 68.5 / 62.1 / 71.3 |
|
| 173 |
| **BFCL** simple / multiple / parallel | **81 / 73 / 62** | none at launch | 95 / 89 / 75 |
|
| 174 |
+
| *(reference)* KOS-V4 SFT base, pre-RL, IFEval AVG4 | 47.7 | | |
|
| 175 |
|
| 176 |
**Reading.** From a small team's from-scratch 3B, IFEval **62.7** lands right on the original ChatGPT
|
| 177 |
(GPT-3.5-turbo, a reported 60.7) and within about three points of Qwen2.5-3B-Instruct (65.4), while being
|
| 178 |
+
**15.0 points above our own SFT base** (47.7). On tool-calling, KOS-V4 is functional (81/73/62), a capability the
|
| 179 |
original ChatGPT lacked at launch; general instruct models trained on far more tool data score higher (Qwen2.5-3B
|
| 180 |
at 95/89/75). Newer, more heavily distilled small models trained on 50 to 200 times more data also score higher on
|
| 181 |
+
IFEval; KOS-V4's result is notable for its data and compute budget, not a claim to lead the current frontier.
|
| 182 |
|
| 183 |
## Compute footprint & requirements
|
| 184 |
### Training
|
|
|
|
| 194 |
|
| 195 |
## Intended use & limitations
|
| 196 |
- **Intended use:** general instruction following, structured output, and function/tool calling in clinical-adjacent
|
| 197 |
+
workflows. For grounded record/guideline reading with abstention use **KOS-V4-Grounded-Record** / **KOS-V4-Grounded-Guideline**; for retrieval use **KOS-V4-Retriever**.
|
| 198 |
- **Not a medical-knowledge QA model.** It follows instructions and calls tools; it does not reliably recall
|
| 199 |
parametric medical facts and is not intended for medical multiple-choice exams. **Ground it with retrieval instead.**
|
| 200 |
- This instruction-tuned checkpoint trades away grounded abstention (its RGB negative-rejection is near zero), so for
|
| 201 |
+
non-fabrication on unanswerable questions use **KOS-V4-Grounded-Record** or **KOS-V4-Grounded-Guideline**.
|
| 202 |
- IFEval 62.7 is on the original-ChatGPT (GPT-3.5-turbo) level and near Qwen2.5-3B (65.4); newer small models trained
|
| 203 |
on far more data score higher. English only. Strong public-benchmark numbers are not validation on real clinical data.
|
| 204 |
|
| 205 |
+
## The KOS-V4 family
|
| 206 |
+
- **KOS-V4-Instruct**, this model (general instruction + tool calling).
|
| 207 |
+
- **[KOS-V4-Retriever](https://huggingface.co/Kentucky-Open-Science/KOS-V4-Retriever)**, clinical dense retriever (BEIR SciFact 0.7327 zero-shot).
|
| 208 |
+
- **[KOS-V4-Grounded-Record](https://huggingface.co/Kentucky-Open-Science/KOS-V4-Grounded-Record)**, patient-record grounding specialist (RGB neg-rejection 35.0).
|
| 209 |
+
- **[KOS-V4-Grounded-Guideline](https://huggingface.co/Kentucky-Open-Science/KOS-V4-Grounded-Guideline)**, clinical-guideline grounding specialist (RGB neg-rejection 45.0).
|