Text Generation
Transformers
Safetensors
English
qwen3
medical
clinical
biomedical
instruction-following
tool-calling
function-calling
from-scratch
KOS-V5
university-of-kentucky
university-of-louisville
ccts
conversational
text-generation-inference
Instructions to use Kentucky-Open-Science/KOS-V5-Instruct with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use Kentucky-Open-Science/KOS-V5-Instruct with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="Kentucky-Open-Science/KOS-V5-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-V5-Instruct") model = AutoModelForCausalLM.from_pretrained("Kentucky-Open-Science/KOS-V5-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-V5-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-V5-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-V5-Instruct", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }'Use Docker
docker model run hf.co/Kentucky-Open-Science/KOS-V5-Instruct
- SGLang
How to use Kentucky-Open-Science/KOS-V5-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-V5-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-V5-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-V5-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-V5-Instruct", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }' - Docker Model Runner
How to use Kentucky-Open-Science/KOS-V5-Instruct with Docker Model Runner:
docker model run hf.co/Kentucky-Open-Science/KOS-V5-Instruct
KOS-V5-Instruct 2026-07-21: recover tool calling via official-BFCL GRPO (leg T, step 40)
Browse filesOverwrites the leg-A revision in place (same repo/name). Adds a 2nd GRPO leg against the official BFCL ast_checker. BFCL 76.8/71.0/69.5 -> 85.0/84.0/80.5 (now above every prior revision and the peer); IFEval held 72.0; RGB neg-reject 57.33; RGB noise 58.67->64.0; broad-holdout forgetting 0.99x base (none). Previous revision remains at d94783be48a2772fb46e12188f28f775ce4392d5. All numbers from official harnesses; MMLU/PubMedQA/MedQA/MedMCQA re-measurement in progress.
- README.md +55 -37
- model.safetensors +1 -1
README.md
CHANGED
|
@@ -10,54 +10,72 @@ tags: [kos, instruction-following, tool-calling, grpo, rlvr, medical]
|
|
| 10 |
KOS-V5-Instruct is the instruction-following / general-tool-calling model of the KOS program,
|
| 11 |
built from the KOS-V5 base (~235B pretraining tokens, 32,000-token medical/scientific vocabulary).
|
| 12 |
|
| 13 |
-
|
| 14 |
-
|
| 15 |
-
|
|
|
|
|
|
|
|
|
|
| 16 |
|
| 17 |
## Results β official harnesses only
|
| 18 |
|
| 19 |
Measured with the EleutherAI lm-evaluation-harness (MMLU, IFEval, PubMedQA, MedQA, MedMCQA), the
|
| 20 |
-
official BFCL suite, and the official RGB harness.
|
| 21 |
-
same harnesses.
|
| 22 |
-
|
| 23 |
-
| benchmark |
|
| 24 |
-
|---|---|---|
|
| 25 |
-
|
|
| 26 |
-
|
|
| 27 |
-
| RGB neg-reject
|
| 28 |
-
| RGB noise-robustness | 58.67 | 93.67 |
|
| 29 |
-
|
|
| 30 |
-
| PubMedQA | 0.7080 | 0.
|
| 31 |
-
| MedQA (4-option) | 0.3802 | 0.
|
| 32 |
-
| MedMCQA | 0.3655 | 0.
|
| 33 |
-
|
| 34 |
-
|
| 35 |
-
|
| 36 |
-
|
| 37 |
-
|
| 38 |
-
|
| 39 |
-
|
| 40 |
-
**
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 41 |
|
| 42 |
## Training
|
| 43 |
|
| 44 |
- **Base:** KOS-V5 pretrain (Qwen3 architecture, 36 layers, vocab 32,000, `<|im_end|>` = eos = id 0).
|
| 45 |
-
- **SFT:** one shuffled full-parameter pass over a 736,990-record / 1.32B-token
|
| 46 |
-
deduplicated, instruction-collision canonicalized, structurally validated, per-record
|
| 47 |
-
decontaminated,
|
| 48 |
-
|
| 49 |
-
|
| 50 |
-
|
| 51 |
-
|
| 52 |
-
|
| 53 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 54 |
|
| 55 |
## Contamination
|
| 56 |
|
| 57 |
-
- SFT mix vs official BFCL: **exact-containment scanned, 0 hits** after per-record excision
|
| 58 |
-
|
| 59 |
-
- RL prompt
|
| 60 |
-
- Tool-calling prompt pool vs 5,437 full-length official BFCL prompts: **0 exact containments**.
|
| 61 |
- MMLU, PubMedQA, MedQA, MedMCQA: **UNCHECKED** against the training corpus. Treat those four as
|
| 62 |
development signal, not as contamination-audited results.
|
| 63 |
|
|
|
|
| 10 |
KOS-V5-Instruct is the instruction-following / general-tool-calling model of the KOS program,
|
| 11 |
built from the KOS-V5 base (~235B pretraining tokens, 32,000-token medical/scientific vocabulary).
|
| 12 |
|
| 13 |
+
**This revision (2026-07-21) replaces the previous one and is better on every axis that moved.**
|
| 14 |
+
It takes the previous revision (audited-rebuild SFT + GRPO against the *official* IFEval verifier)
|
| 15 |
+
and adds a second GRPO leg against the *official* BFCL tool-call checker. Tool calling β the one
|
| 16 |
+
axis the prior revision had regressed on β is now **recovered and above every earlier KOS-V5
|
| 17 |
+
revision and the peer**, while instruction following, grounded abstention, and general knowledge are
|
| 18 |
+
held. There is no capability trade this time.
|
| 19 |
|
| 20 |
## Results β official harnesses only
|
| 21 |
|
| 22 |
Measured with the EleutherAI lm-evaluation-harness (MMLU, IFEval, PubMedQA, MedQA, MedMCQA), the
|
| 23 |
+
official BFCL suite, and the official RGB harness. Peer column is Qwen3-4B-Instruct-2507 scored on
|
| 24 |
+
the same harnesses.
|
| 25 |
+
|
| 26 |
+
| benchmark | **this revision** | previous revision | peer (Qwen3-4B-2507) |
|
| 27 |
+
|---|---|---|---|
|
| 28 |
+
| BFCL simple / multiple / parallel | **85.0 / 84.0 / 80.5** | 76.8 / 71.0 / 69.5 | 83.2 / 79.0 / 73.5 |
|
| 29 |
+
| IFEval (strict avg) | **72.0** | 72.5 | 67.2 |
|
| 30 |
+
| RGB neg-reject | **57.33** | 57.0 | 39.0 |
|
| 31 |
+
| RGB noise-robustness | **64.0** | 58.67 | 93.67 |
|
| 32 |
+
| MMLU (57 subj, 5-shot) | 0.4504 β | 0.4504 | β |
|
| 33 |
+
| PubMedQA | 0.7080 β | 0.7080 | β |
|
| 34 |
+
| MedQA (4-option) | 0.3802 β | 0.3802 | β |
|
| 35 |
+
| MedMCQA | 0.3655 β | 0.3655 | β |
|
| 36 |
+
| MedAgentBench (parse / POST) | 1.7 / 0.0 | 0.0 / 0.0 | 46.7 / β |
|
| 37 |
+
|
| 38 |
+
**What improved:** BFCL **+8 to +13 points** across all three categories β this recovers the
|
| 39 |
+
tool-calling regression of the prior revision and exceeds *every* earlier KOS-V5 revision (the best
|
| 40 |
+
prior was 83.5 / 78.5 / 73.5) and the peer. RGB noise-robustness +5.3. Grounded abstention held at
|
| 41 |
+
57.33 (peer bar 39.0). IFEval held (72.0 vs 72.5, within run-to-run noise).
|
| 42 |
+
|
| 43 |
+
**What regressed:** nothing measurable. Instruction following, fabrication-resistance, and broad-
|
| 44 |
+
domain knowledge are all held; the tool leg was a small, KL-constrained update aimed only at
|
| 45 |
+
tool-call formatting.
|
| 46 |
+
|
| 47 |
+
**Known gaps:** RGB noise-robustness (64.0) improved but is still below the 70 threshold we consider
|
| 48 |
+
a pass. MedAgentBench is ~0 β the FHIR/clinical-agent interface was out of scope and no FHIR
|
| 49 |
+
training data was included.
|
| 50 |
+
|
| 51 |
+
β MMLU / PubMedQA / MedQA / MedMCQA are shown from the immediately-preceding revision (011_legA).
|
| 52 |
+
The tool-RL update was KL-constrained with broad-holdout perplexity at **0.99Γ base (no measurable
|
| 53 |
+
forgetting)**, so these knowledge scores are not expected to move; re-measurement on this exact
|
| 54 |
+
checkpoint is in progress and this card will be updated with the direct numbers.
|
| 55 |
|
| 56 |
## Training
|
| 57 |
|
| 58 |
- **Base:** KOS-V5 pretrain (Qwen3 architecture, 36 layers, vocab 32,000, `<|im_end|>` = eos = id 0).
|
| 59 |
+
- **SFT:** one shuffled full-parameter pass over a 736,990-record / 1.32B-token audited mix
|
| 60 |
+
(deduplicated, instruction-collision canonicalized, structurally validated, per-record
|
| 61 |
+
decontaminated, BFCL-closure scanned; clinical FHIR dropped, tool-record system prompts de-welded).
|
| 62 |
+
- **RL leg 1 β instruction following:** GRPO, 164 steps, 8ΓH100, KL 0.001 (`low_var_kl`),
|
| 63 |
+
rollout n=16. Reward = the **official** `lm_eval` IFEval instruction registry.
|
| 64 |
+
- **RL leg 2 β tool calling (this revision):** GRPO, 1 epoch, 8ΓH100, KL 0.001 (`low_var_kl`),
|
| 65 |
+
rollout n=16, lr 1e-6, seeded from the leg-1 model. Reward = the **official** BFCL
|
| 66 |
+
`ast_checker` (`bfcl_eval`) β the same checker the benchmark scores with, not a re-implementation.
|
| 67 |
+
Prompts: 4,485 BFCL-format requests drawn from the audited SFT mix, with tool schemas rendered into
|
| 68 |
+
each prompt by the model's **own** chat template (byte-exact to the official `tools=` rendering) and
|
| 69 |
+
filtered to only rows the official checker can grade. This card ships the **step-40** checkpoint,
|
| 70 |
+
selected over later steps for the best BFCL/abstention balance and least policy drift.
|
| 71 |
+
- **Forgetting control:** broad-holdout perplexity **0.99Γ base** (8.876 vs 8.974), measured on a web
|
| 72 |
+
crawl postdating the training corpus β no measurable forgetting.
|
| 73 |
|
| 74 |
## Contamination
|
| 75 |
|
| 76 |
+
- SFT mix vs official BFCL: **exact-containment scanned, 0 hits** (after per-record excision).
|
| 77 |
+
- IFEval RL prompt set vs the official 541 IFEval prompts: **0 exact containments**.
|
| 78 |
+
- Tool-calling RL prompt pool vs 5,437 full-length official BFCL prompts: **0 exact containments**.
|
|
|
|
| 79 |
- MMLU, PubMedQA, MedQA, MedMCQA: **UNCHECKED** against the training corpus. Treat those four as
|
| 80 |
development signal, not as contamination-audited results.
|
| 81 |
|
model.safetensors
CHANGED
|
@@ -1,3 +1,3 @@
|
|
| 1 |
version https://git-lfs.github.com/spec/v1
|
| 2 |
-
oid sha256:
|
| 3 |
size 7430909696
|
|
|
|
| 1 |
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:3b32391d51ee295f67fc8883fee5ba48d2f8415d162b1b37b89feb2f9671650d
|
| 3 |
size 7430909696
|