Research proof of concept. Not for clinical use. Trained and evaluated on synthetic questions; nothing here is clinically validated, and the outputs have not been reviewed by a physician. Do not use it to make or support decisions about individual patients.
Answers a Japanese medical question in Japanese using only the supplied literature passages, as JSON: an answer, citations by document_id / passage_id with the claim each supports, evidence_sufficient (false = abstain, with the reason), and limitations of the evidence.
This is a LoRA adapter only. It does not contain the base model weights.
| Base model | Qwen/Qwen3-8B |
| Revision (commit) | b968826d9c46dd6066d109eabc6255188de91218 |
| Chat template | qwen3, thinking disabled (enable_thinking=False) |
The adapter was trained against this exact revision. adapter_config.json records it, and
AutoPeftModelForCausalLM uses it; if you load the base model yourself, pass revision="b968826d9c46dd6066d109eabc6255188de91218" as below.
import torch
from peft import PeftModel
from transformers import AutoModelForCausalLM, AutoTokenizer
BASE, REV = "Qwen/Qwen3-8B", "b968826d9c46dd6066d109eabc6255188de91218"
tok = AutoTokenizer.from_pretrained(BASE, revision=REV)
model = AutoModelForCausalLM.from_pretrained(BASE, revision=REV, dtype=torch.bfloat16, device_map="auto")
model = PeftModel.from_pretrained(model, "hiimivantang/medgen-ja-qwen3-8b-grounded-answering-lora")
messages = [{"role": "system", "content": SYSTEM_PROMPT},
{"role": "user", "content": USER_PROMPT}] # see "Prompt format" below
inputs = tok.apply_chat_template(messages, add_generation_prompt=True, enable_thinking=False,
return_dict=True, return_tensors="pt").to(model.device)
out = model.generate(**inputs, max_new_tokens=1536, do_sample=False)
print(tok.decode(out[0, inputs["input_ids"].shape[1]:], skip_special_tokens=True))
vllm serve Qwen/Qwen3-8B --revision b968826d9c46dd6066d109eabc6255188de91218 --enable-lora --max-lora-rank 16 \
--lora-modules ga-lora=hiimivantang/medgen-ja-qwen3-8b-grounded-answering-lora
Then request "model": "ga-lora" with temperature 0 and the prompt below. Both adapters from this
project can be served on one base model this way.
The adapter was trained on exactly this system prompt and user template (Japanese). Use them verbatim; other prompts will not reproduce the results below. Replace {question} and one numbered block per evidence passage.
System prompt
あなたは医学文献に基づいて日本語で回答するアシスタントです。提示された根拠文献の内容だけを根拠に答え、文献に書かれていない知識で補ってはいけません。根拠が不十分な場合は、その旨を明示して回答を控えてください。個別の患者への診断や治療の推奨は行いません。
User prompt template
次の質問に、下の根拠文献だけを用いて日本語で回答してください。
規則:
- answer: 根拠文献が示す内容を日本語で簡潔にまとめる。数値(効果量、信頼区間、割合など)は文献の値をそのまま用いる。研究デザインや結果の不一致があれば触れる。
- citations: answer の各主張を支持する文献を、document_id と passage_id(根拠文献に表示されたもの)で示し、claim にその文献が支持する内容を日本語で書く。提示されていない文献は引用しない。
- evidence_sufficient: 根拠文献だけで質問に答えられる場合は true。答えられない場合は false とし、answer で「提示された文献からは回答できない」旨とその理由を述べ、citations は空にする。
- limitations: 根拠の限界(研究デザイン、対象集団、文献間の不一致など)を列挙する。
出力はJSONオブジェクトのみとし、説明文やコードブロック記号は付けないでください。
形式: {"answer": "...", "citations": [{"document_id": "...", "passage_id": "...", "claim": "..."}], "evidence_sufficient": true, "limitations": [...]}
質問:
「{question}」
根拠文献:
[1] document_id: {document_id} / passage_id: {passage_id}
タイトル: {title}
掲載: {journal} ({publication_date}) / セクション: {section}
本文: {text}
The model replies with a single JSON object.
Held-out test set of 430 synthetic items (test_ga, 10 categories; 111 items whose reference an
independent audit rejected are excluded from the primary analysis, leaving 319), identical evidence for every
model, greedy decoding, thinking disabled.
| Model | Grounded composite | Citation validity | Numeric preservation | Judge: acceptable | Judge: completeness (0-4) |
|---|---|---|---|---|---|
| Qwen3-8B (base, same prompt) | 0.943 | 0.994 | 0.921 | 93.7% | 3.15 |
| This adapter | 0.944 | 1.000 | 0.944 | 93.4% | 3.61 |
| gpt-6.1-sol (OpenAI reference) | 0.976 | 1.000 | 0.980 | 99.7% | 3.93 |
| Method | LoRA (PEFT), LLaMA-Factory |
| Rank / alpha / dropout | 16 / 32 / 0.05 |
| Target modules | q_proj, k_proj, v_proj, o_proj |
| Learning rate / epochs | 1e-4 (cosine) / 2 |
| Training examples / steps | 944 / 118 |
| Seed | 42 |
| Precision | bf16 |
| Hardware | NVIDIA DGX Spark (GB10) |
Training metrics are in all_results.json, train_results.json, eval_results.json and trainer_state.json.
Synthetic. Questions, structured labels and reference answers were generated by a local Apache-2.0 teacher model (Qwen3.5-122B) from open-access literature abstracts in Europe PMC, restricted to CC BY and CC0 licences. No OpenAI output was used as training data. Test documents were published after 2026-06-01, later than every training document, and test items share no documents with training.
The adapter weights are released under Apache-2.0. The base model has its own licence; see
Qwen/Qwen3-8B.
Qwen/Qwen3-8B