Downloads · 30 days
7
18% of all-time downloads
cs552-the-expendables/patientagent-cft-augmented-sft-r16
patientagent-cft-augmented-sft-r16 is a text generation model from cs552-the-expendables. Use it when you need the model to write or continue text. It is set up for peft. The card lists the license as apache-2.0.
This repository contains one experimental LoRA adapter for research on simulated patient responses in clinical dialogue. It is not a medical device, must not be used for patient care, and must not be treated as a sour…
Downloads · 30 days
7
18% of all-time downloads
All-time downloads
40
Public
Repo size
142 MB
Likes
0
Public
Click a slice to open those files.
.safetensors122 MB · 86%
From the Hugging Face model README
This repository contains one experimental LoRA adapter for research on simulated patient responses in clinical dialogue. It is not a medical device, must not be used for patient care, and must not be treated as a source of medical advice.
The adapter is an application of the training idea in Teaching LLMs How to Learn with Contextual Fine-Tuning to PatientAgent's conditional response task. During training, one of ten generic learning-strategy prompts was sampled uniformly and prepended to each canonical SFT context. Loss was still computed only on the exact original patient-response target tokens. The contextual prompt is absent at inference.
This is therefore CFT-augmented SFT, not an exact reproduction of the paper's raw-corpus CFT experiment. Pure raw-text CFT would change PatientAgent's conditional task and train on clinician turns, so it was not used. The implementation is clean-room; no source from the authors' repository was copied. The official reference implementation was reviewed at commit 7b709820c091b40e3e6153fe0a6dceccef75417d; that repository did not declare a top-level license at the reviewed commit.
Qwen/Qwen3.5-4B, resolved training snapshot 851bf6e806efd8d0a36b00ddf55e13ccb7b8cd0a (Apache-2.0).3ff0801933608d6f570468c13125125fb5cabdea, SHA-256 65a28681dd59fc159681ea026e44610f2af7bc64a0e7f892d763eb03d9f503dc (CC BY 4.0).cs552-the-expendables/mts-rl-training-data at revision f188dfcb71fc13a74446b5ad34df9369f1534e57, SHA-256 cf85d176fd64c8575e08feb7e94a63b0baa6aeff0d6e90a28d5cc25d4fe0248e.0a213de3804988cca9ade4b6a7235e981df1dd50a9cde5af6f0083c7d0bd87b8.fd8c8c091f4bc0027c91b22c257cba30a2fd6c21004342f63c6029e82d83e934.The ten prompt strategies were sampled deterministically with seed 11. Counts were: application 477, broader context 486, comparison 497, creative interpretation 478, critical analysis 500, depth 519, key concepts 483, questions 479, reflection 473, and synthesis 485.
| Setting | Value |
|---|---|
| Epochs | 1 |
| Maximum sequence length | 2,048 |
| Per-device batch size | 1 |
| Gradient accumulation | 8 |
| Learning rate | 2e-4 |
| Warmup ratio | 0.03 |
| LoRA rank / alpha / dropout | 16 / 32 / 0.05 |
| Trainer seed / prompt seed | 42 / 11 |
| Trainable parameters | 30,474,240 |
| Hardware | 1 NVIDIA A100 40 GB |
The run used PyTorch 2.8.0+cu128, Transformers 5.2.0, and PEFT 0.19.1. It completed 610/610 optimizer steps without resume in 13,046 seconds. Final training loss was 1.3372108811. The training workload was patientagent-jackn-g43-cft-r16-train-173834 from PatientAgent commit d021583e4989327a023fd438235beab16c3bf5e9.
The saved adapter passed configuration, data-identity, completion, secret, full-model-file, and tensor-integrity checks. All 400 adapter tensors were finite. The adapter weights contain 30,474,240 parameters, are 121,951,008 bytes, and have SHA-256 dab128c9e366ca6ee17e5e6a124682a59c72bda2aad1e593fda974ad449eddb9.
Generation-only validation completed on the same source-eligible IDs used by the current PatientAgent comparison:
f7cb67e94239e78965fd4ba39df533d50ea166c66ecea6754dadd3dad6379ebd.8dc0b91946aa51c813baa260eb0f2e56a05ea9adc938cec306964270b5b0b4dc.The caches passed exact ID/order, facts, turn-structure, unchanged-clinician-text, nonempty-patient-response, and prompt-leakage checks. Manual review found generally concise and context-sensitive outputs, with no systematic prompt leakage or refusal behavior. Some details in long conversations may still be unsupported and should be assessed by the matched evaluator.
Matched G-Eval is complete on the exact same source-eligible IDs as the current comparison. Scores use one Kimi-K2.7-Code judge pass per dialogue with a 100,000-token output ceiling. Hallucination and irrelevance are lower-is-better; anthropomorphism is higher-is-better.
| Scope | Dialogues | Hallucination | Irrelevance | Anthropomorphism | Mean patient-turn chars. |
|---|---|---|---|---|---|
| Test1 | 174 | 0.684 | 1.178 | 8.672 | 27.895 |
| Test2 | 178 | 0.747 | 1.270 | 8.669 | 27.159 |
| Combined micro-average | 352 | 0.716 | 1.224 | 8.670 | 27.523 |
All 352 scores completed without retry, split checkpoints matched the validated cache fingerprints, and an independent validator recomputed every split and combined mean. Against the canonical SFT16 row, the automated point estimates are slightly better for irrelevance (1.22 vs. 1.36) and anthropomorphism (8.67 vs. 8.56), but slightly worse for hallucination (0.72 vs. 0.70). This single run therefore does not establish uniform superiority or statistical significance.
Manual review of 12 representative or extreme CFT dialogues found 11 judge explanations broadly aligned with the rubric and one clear patient/non-patient role-attribution error in a mixed child/parent dialogue. No score was corrected after inspection. Treat these as noisy automated benchmark measurements, not clinical-quality evidence. The complete split conversations/results and combined validation bundle are pinned at patientagent-eval-results@cf538c3a3e9bed5e5f251405e9fc7b588ebc4664.
The matched source-versus-generated discriminator additionally covered the
same frozen 53-dialogue/280-turn manifest used for every established model,
with both A/B orders and analytical 0.5 scores for 21 text-identical pairs.
CFT detection was 0.341 [0.294, 0.412] by patient-turn micro-average and 0.397
[0.321, 0.480] by dialogue macro-average, for a 0.659 fooling rate. All 518 API
calls completed on the first attempt and passed independent recomputation. The
6.4-point detection increase relative to SFT16 was not resolved by the paired
95% cluster interval [-0.7, 11.9 points]. CFT responses were shorter than the
references on average (30.8 versus 45.8 characters), and the judge was 21.4
points more accurate when the CFT response appeared in slot B; this metric
therefore reflects source style and order effects rather than clinical quality.
The complete merged discriminator bundle is pinned at
patientagent-eval-results@cf96ac74aae731f737211c2da69ae0a810401ad1.
from peft import PeftModel
from transformers import AutoModelForCausalLM, AutoTokenizer
base_id = "Qwen/Qwen3.5-4B"
adapter_id = "cs552-the-expendables/patientagent-cft-augmented-sft-r16"
tokenizer = AutoTokenizer.from_pretrained(adapter_id)
base = AutoModelForCausalLM.from_pretrained(
base_id,
revision="851bf6e806efd8d0a36b00ddf55e13ccb7b8cd0a",
device_map="auto",
dtype="auto",
)
model = PeftModel.from_pretrained(base, adapter_id)
model.eval()
Use PatientAgent's normal case-facts and dialogue-history inference prompt. Do not prepend the contextual learning guidance at inference.
@inproceedings{choi2025contextual,
title={Teaching LLMs How to Learn with Contextual Fine-Tuning},
author={Choi, Younwoo and Asif, Muhammad Adil and Han, Ziwen and Willes, John and Krishnan, Rahul G.},
booktitle={International Conference on Learning Representations},
year={2025},
url={https://arxiv.org/abs/2503.09032}
}