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
Card: restore full peer comparison (Qwen3-4B-2507) that was wrongly stripped; update KOS column to leg-T (BFCL now above peer, IFEval/knowledge honest vs peer)
Browse files
README.md
CHANGED
|
@@ -10,71 +10,62 @@ 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 |
-
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.
|
| 24 |
-
|
| 25 |
-
|
| 26 |
-
| benchmark |
|
| 27 |
-
|---|---|---|
|
| 28 |
-
|
|
| 29 |
-
|
|
| 30 |
-
| RGB neg-reject | **57.33** |
|
| 31 |
-
| RGB noise-robustness |
|
| 32 |
-
|
|
| 33 |
-
| PubMedQA | 0.7060 | 0.
|
| 34 |
-
| MedQA (4-option) | 0.3802 | 0.
|
| 35 |
-
| MedMCQA | 0.3648 | 0.
|
| 36 |
-
|
| 37 |
-
|
| 38 |
-
|
| 39 |
-
|
| 40 |
-
|
| 41 |
-
|
| 42 |
-
|
| 43 |
-
|
| 44 |
-
|
| 45 |
-
|
| 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 |
-
All four knowledge benchmarks (MMLU, PubMedQA, MedQA, MedMCQA) were re-measured **directly on this
|
| 52 |
-
checkpoint** with the official lm-evaluation-harness and are flat vs the prior revision β exactly as
|
| 53 |
-
the 0.99Γ broad-holdout forgetting gate predicted (MMLU 0.4504β0.4512, PubMedQA 0.7080β0.7060, MedQA
|
| 54 |
-
unchanged at 0.3802, MedMCQA 0.3655β0.3648). No knowledge was traded for the tool-calling gain.
|
| 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
|
| 60 |
-
|
| 61 |
-
decontaminated, BFCL-closure scanned; clinical FHIR
|
| 62 |
-
-
|
| 63 |
-
|
| 64 |
-
|
| 65 |
-
|
| 66 |
-
|
| 67 |
-
|
| 68 |
-
|
| 69 |
-
|
| 70 |
-
|
| 71 |
-
- **Forgetting control:** broad-holdout perplexity **0.99Γ base**
|
| 72 |
-
crawl postdating the training corpus β no measurable forgetting
|
|
|
|
| 73 |
|
| 74 |
## Contamination
|
| 75 |
|
| 76 |
-
- SFT mix vs official BFCL: **exact-containment scanned, 0 hits**
|
| 77 |
-
|
|
|
|
| 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.
|
|
|
|
| 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 |
+
A from-scratch 3.7B model: supervised fine-tuning on a fully audited data mix, followed by two GRPO
|
| 14 |
+
legs against *official* verifiers β the IFEval instruction registry, then the BFCL tool-call checker.
|
| 15 |
+
It follows instructions strongly for its scale, calls tools accurately, and abstains rather than
|
| 16 |
+
fabricating when a question is not answerable from context.
|
|
|
|
|
|
|
| 17 |
|
| 18 |
## Results β official harnesses only
|
| 19 |
|
| 20 |
Measured with the EleutherAI lm-evaluation-harness (MMLU, IFEval, PubMedQA, MedQA, MedMCQA), the
|
| 21 |
+
official BFCL suite, and the official RGB harness. The peer, Qwen3-4B-Instruct-2507, is scored on the
|
| 22 |
+
same harnesses.
|
| 23 |
+
|
| 24 |
+
| benchmark | KOS-V5-Instruct | Qwen3-4B-Instruct-2507 |
|
| 25 |
+
|---|---|---|
|
| 26 |
+
| IFEval (strict-avg) | 72.0 | **84.7** |
|
| 27 |
+
| MMLU (57 subj, 5-shot) | 0.4512 | **0.7266** |
|
| 28 |
+
| RGB neg-reject (grounded abstention) | **57.33** | 39.0 |
|
| 29 |
+
| RGB noise-robustness | 64.0 | **93.67** |
|
| 30 |
+
| BFCL simple / multiple / parallel | **85.0 / 84.0 / 80.5** | 83.2 / 79.0 / 73.5 |
|
| 31 |
+
| PubMedQA | 0.7060 | **0.7720** |
|
| 32 |
+
| MedQA (4-option) | 0.3802 | **0.6159** |
|
| 33 |
+
| MedMCQA | 0.3648 | **0.5804** |
|
| 34 |
+
|
| 35 |
+
**Where it stands out:** general **tool calling** β BFCL 85.0 / 84.0 / 80.5, now *above* the peer on
|
| 36 |
+
all three categories β and **grounded abstention**, RGB neg-reject 57.33 against the peer's 39.0
|
| 37 |
+
(KOS-V5-Instruct declines unanswerable questions far more often than it invents an answer). IFEval
|
| 38 |
+
72.0 is a strong instruction-following result for a from-scratch 3.7B model, below the much larger
|
| 39 |
+
instruction-tuning effort behind the Qwen peer. The peer, trained on orders of magnitude more data,
|
| 40 |
+
leads on parametric knowledge (MMLU, medical QA).
|
| 41 |
+
|
| 42 |
+
**Known gap:** RGB noise-robustness (64.0) is below the 70 threshold we consider a pass β improved
|
| 43 |
+
from the prior revision's 58.67 but not yet passing.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 44 |
|
| 45 |
## Training
|
| 46 |
|
| 47 |
- **Base:** KOS-V5 pretrain (Qwen3 architecture, 36 layers, vocab 32,000, `<|im_end|>` = eos = id 0).
|
| 48 |
+
- **SFT:** one shuffled full-parameter pass over a 736,990-record / 1.32B-token mix. The mix was
|
| 49 |
+
deduplicated, instruction-collision canonicalized, structurally validated, per-record
|
| 50 |
+
decontaminated, and BFCL-closure scanned; clinical FHIR records were dropped and tool-record
|
| 51 |
+
system prompts de-welded so tool use binds to the request rather than to a fixed frame.
|
| 52 |
+
- **RL leg 1 β instruction following:** GRPO, 1 epoch, 8ΓH100, KL 0.001 (`low_var_kl`), rollout n=16.
|
| 53 |
+
The reward is the **official** `lm_eval` IFEval instruction registry β the same checkers the
|
| 54 |
+
benchmark uses, not a re-implementation. Training reward rose 0.481 β 0.821.
|
| 55 |
+
- **RL leg 2 β tool calling:** a second GRPO leg seeded from the leg-1 model, same optimizer settings.
|
| 56 |
+
The reward is the **official** BFCL `ast_checker` (`bfcl_eval`); each prompt renders its tool schemas
|
| 57 |
+
through the model's own chat template, and the prompt set is filtered to only rows the official
|
| 58 |
+
checker can grade. This lifted BFCL from 76.8 / 71.0 / 69.5 to **85.0 / 84.0 / 80.5** with
|
| 59 |
+
instruction following, abstention, and knowledge all held.
|
| 60 |
+
- **Forgetting control:** out-of-distribution broad-holdout perplexity at **0.99Γ the pre-RL base**
|
| 61 |
+
(8.88 vs 8.97), measured on a web crawl postdating the training corpus β no measurable forgetting
|
| 62 |
+
(MMLU/PubMedQA/MedQA/MedMCQA moved by β€0.002 across the tool-calling leg).
|
| 63 |
|
| 64 |
## Contamination
|
| 65 |
|
| 66 |
+
- SFT mix vs official BFCL: **exact-containment scanned, 0 hits** after per-record excision of 1,155
|
| 67 |
+
contaminated records.
|
| 68 |
+
- IFEval RL prompt set vs the official 541 IFEval prompts: **0 exact containments** across 5,535 prompts.
|
| 69 |
- Tool-calling RL prompt pool vs 5,437 full-length official BFCL prompts: **0 exact containments**.
|
| 70 |
- MMLU, PubMedQA, MedQA, MedMCQA: **UNCHECKED** against the training corpus. Treat those four as
|
| 71 |
development signal, not as contamination-audited results.
|