A QLoRA adapter (LoRA + pointer head) for jaredpalmer/kev-27b, a decision model: it reads a Korean transcript of an ambulance crew's transfer-request call to an emergency room and returns calibrated probabilities for three typed questions, without generating text:
Question (questions.json) |
Options |
|---|---|
cc_major: chief complaint, KTAS major category |
17 KTAS categories (A 물질오용 … Q 일반) + 판단 보류 (cannot tell) |
gender |
남성 / 여성 / 판단 보류 |
age_group |
10대 미만, 10대, … 90대이상 / 판단 보류 |
It was made for the GoldenLink emergency-transfer project to structure call content and to pre-label / verify labels with a confidence that can be thresholded. It does not replace clinical judgement: outputs are meant to be shown to and corrected by EMS staff.
Held-out test split, 1,998 calls, read once, after the model was chosen on the development split. Probabilities
are calibrated with a single temperature fitted on a separate calibration split (T = 1.414, stored in head.pt).
| Field | Kev-27B zero-shot | this adapter | Δ (95% CI, paired bootstrap) |
|---|---|---|---|
| Chief complaint (KTAS major, 18-way) — accuracy | 0.771 | 0.900 | +0.130 [+0.111, +0.149] |
| Chief complaint — macro-F1 | 0.765 | 0.913 | |
| Age group (11-way) — accuracy | 0.998 | 0.9985 | |
| Gender (3-way) — accuracy | 0.9995 | 0.9995 | |
| All 3 questions — accuracy | 0.923 | 0.966 | +0.043 [+0.037, +0.050] |
| All 3 questions — Brier | 0.108 | 0.049 | −0.060 [−0.066, −0.054] |
| All 3 questions — ECE | 0.0093 | 0.0036 | |
| Coverage at ≤ 5% error (share of answers that can be automated) | 95.3% | 100% |
Age group and gender were already near ceiling for the released model; the gain is in the chief complaint. The
largest per-class F1 gains on the test split were 판단 보류 (cannot tell; 0.391 → 0.970, only 17 test calls),
Q 일반 (0.372 → 0.776) and O 환경손상 (0.479 → 0.822). Development-split numbers (1,001 calls) agree:
0.902 chief complaint / 0.966 overall, versus 0.784 / 0.927 zero-shot. Full metrics: results/.
No forgetting of the released skills on a public check (Kev's decision-v7 development set, 100 groups):
accuracy 0.8125 zero-shot → 0.826 after fine-tuning.
A 9B sibling was fine-tuned the same way (1,600 training calls, lr 2e-4, NF4 QLoRA on the released Kev checkpoint) and is published at Playedwell03/kev-9b-119ko-ktas. This 27B is slightly better on the chief complaint; the 9B runs on a single GPU and trains ~3.6× faster per record.
| test split (1,998 calls), calibrated | Kev-27B (this) | Kev-9B |
|---|---|---|
| Chief complaint accuracy | 0.900 | 0.881 |
| Chief complaint macro-F1 | 0.913 | 0.897 |
| Age group / Gender | 0.9985 / 0.9995 | 0.997 / 0.9995 |
| All three — accuracy | 0.966 | 0.959 |
| All three — Brier | 0.049 | 0.062 |
| Coverage at ≤ 5% error | 100% | 100% |
| Serving footprint | 2 GPUs (NF4) | 1 GPU (~16 GB bf16) |
Paired bootstrap on the chief complaint: 27B − 9B = +1.95 points (95% CI [+0.75, +3.15]). Pick 27B for the best chief-complaint accuracy; pick 9B when one GPU or faster iteration matters more.
af0e6d551bdc2cc724f3e9d7a8bee1cd4fb8f7bf (shard SHA-256 checked against
Kev's own record), quantized to NF4 with double quantization while loading and kept frozen. The pointer head is
warm-started from Kev-27B; the LoRA is new.q,k,v,o,gate,up,down_proj, in_proj_qkv,in_proj_z,in_proj_a,in_proj_b,out_proj); 119.3M trainable parameters
including the head.kev.train loss and augmentation (option shuffling, "none of the above" insertion and removal,
distractors at Kev's defaults), shared-prefix forward, gradient checkpointing; lr 2e-4, one-cycle schedule with 10%
warm-up, 1 epoch = 200 optimizer steps, batch 1 × 8 accumulation, AdamW (wd 0.01), gradient clip 1.0, seed 0.questions.json.This adapter sits on a quantized full-weight Kev checkpoint, which stock Kev does not load (kev.checkpoint refuses
it on purpose). Apply the patch in code/ to Kev at the commit it was made against:
git clone https://github.com/jaredpalmer/kev.git && cd kev
git checkout 2ecafc49fe1e8945cd600443e6c04c1cf0b3a78f
# from this repository: code/kev_qlora.patch and code/qlora.py
git apply kev_qlora.patch && cp qlora.py kev/qlora.py
uv sync --extra serve && uv pip install bitsandbytes # Linux + CUDA; tested with torch 2.8, transformers 5.17, peft 0.21, bitsandbytes 0.50.2
import json
import torch
from huggingface_hub import hf_hub_download
from kev import qlora
from kev.api import SystemOneRequest, to_record
from kev.model import training_context
REPO = "Playedwell03/kev-27b-119ko-ktas-qlora"
tok, model = qlora.load_run(REPO) # NF4 backbone split over the visible GPUs (2 x 11 GB is enough), calibrated head
questions = json.load(open(hf_hub_download(REPO, "questions.json"), encoding="utf-8"))
ctx = training_context(2048)
transcript = "네 응급실입니다\n119구급대입니다 환자 이송 문의드립니다\n..."
rec, meta = to_record(SystemOneRequest.model_validate({"state": transcript, "questions": questions}))
enc = model.encode(tok, rec, max_state=ctx["max_state"], max_branch=ctx["max_branch"], strict=True)
with torch.no_grad():
logits = model.forward_batch([enc], shared_prefix=True)[0] # already divided by the stored temperature
for m, z in zip(meta, logits):
p = torch.softmax(z.float(), -1)
print(m["id"], m["keys"][int(p.argmax())], round(float(p.max()), 3))
code/ also holds the training and evaluation scripts (kevft/), the data conversion (prepare_data.py) and the
numerical checks listed above. License: Apache-2.0, like Kev-27B and Qwen3.8-27B; see NOTICE.
adapter_model.safetensors 467 MBhead.pt 10 MBjaredpalmer/kev-27b