Base model
- Base model:
Qwen/Qwen2.5-1.5B-Instruct
- Architecture: decoder-only Qwen2.5 causal language model
- Adapter method: QLoRA / PEFT LoRA
- Quantization during training: 4-bit NF4
- Training framework: Unsloth + TRL + PEFT
The base model is distributed under Apache-2.0.
Dataset
Training used the English configuration of:
FreedomIntelligence/medical-o1-reasoning-SFT
Dataset fields used:
Question
Complex_CoT
Response
The complete dataset contained 19,704 examples and was split deterministically:
Table with columns: Split, Examples, Purpose| Split | Examples | Purpose |
|---|
| Train | 18,704 | Gradient updates |
| Validation | 500 | Checkpoint/generalization monitoring |
| Test | 500 | Final held-out comparison |
| Total | 19,704 | |
The dataset is distributed under Apache-2.0 by its publisher.
Each example was formatted using the Qwen chat template in the following logical form:
system:You are a medical reasoning assistant.user:<Question>assistant:<reasoning><Complex_CoT></reasoning><Response>
The <reasoning> tags were plain text delimiters in the training content.
Training configuration
Table with columns: Parameter, Value| Parameter | Value |
|---|
| Epochs run | 5 |
| Selected checkpoint | Epoch 2 / step 2118 |
| Max sequence length | 1536 |
| Physical batch size | 4 |
| Gradient accumulation | 2 |
| Effective batch size | 8 |
| Learning rate | 2e-4 |
| LR scheduler | Cosine |
| Warmup steps | 75 |
The LoRA adapter contained approximately 36.9M trainable parameters.
Validation behavior
The original 5-epoch run reached its minimum validation loss at Epoch 2:
Table with columns: Epoch, Validation loss| Epoch | Validation loss |
|---|
| 1 | 1.437329 |
| 2 | 1.423186 |
| 3 | 1.443278 |
| 4 | 1.496967 |
| 5 | 1.549110 |
Validation performance improved through Epoch 2 and then degraded through
Epochs 3-5.
Held-out test results
The untouched 500-example test split was evaluated using the same formatting
and max_sequence_length=1536. No test examples were truncated.
Table with columns: Model, Test loss, Perplexity, Mean token accuracy| Model | Test loss | Perplexity | Mean token accuracy |
|---|
| Base Qwen2.5-1.5B-Instruct | 2.006018 | 7.4337 | 0.551078 |
| Medical adapter — Epoch 2 | 1.452841 | 4.2752 | 0.623556 |
| Medical adapter — Epoch 5 | 1.582141 | 4.8654 | 0.613223 |
Relative to the base model, the Epoch 2 adapter reduced test loss by about
27.58% and increased mean token accuracy by about 7.25 percentage points.
Continuing from Epoch 2 to Epoch 5 increased test loss by about 8.90% and
reduced mean token accuracy by about 1.03 percentage points.
Multi-seed replication
To test whether the Epoch 2 result was simply a lucky training trajectory, the
same training configuration and the same fixed train/validation split were
repeated with five training seeds:
42, 123, 456, 789, 2026
Epoch 2 was the best validation checkpoint in 5/5 runs.
Table with columns: Training seed, Best epoch, Best validation loss| Training seed | Best epoch | Best validation loss |
|---|
| 42 | 2 | 1.423093 |
| 123 | 2 | 1.422025 |
| 456 | 2 | 1.422589 |
| 789 | 2 | 1.422546 |
| 2026 | 2 | 1.422715 |
Mean Epoch-2 validation loss across these runs was approximately
1.422594 ± 0.000384 SD.
This supports training-seed robustness for the observed Epoch-2 optimum under
this fixed data split and hyperparameter configuration. It does not establish
that Epoch 2 is universally optimal under different data splits, datasets,
models, or hyperparameters.
Using the adapter
Install the required libraries:
pip install -U transformers peft accelerate torch
Example:
import torchfrom transformers import AutoTokenizer, AutoModelForCausalLMfrom peft import PeftModel BASE_MODEL = "Qwen/Qwen2.5-1.5B-Instruct"ADAPTER = "adityag-india/qwen25-1.5b-medical-o1-qlora" tokenizer = AutoTokenizer.from_pretrained(BASE_MODEL) base_model = AutoModelForCausalLM.from_pretrained( BASE_MODEL, torch_dtype="auto", device_map="auto",) model = PeftModel.from_pretrained(base_model, ADAPTER)model.eval() messages = [ { "role": "system", "content": "You are a medical reasoning assistant." }, { "role": "user", "content": "What are common causes of iron-deficiency anemia?" }] inputs = tokenizer.apply_chat_template( messages, add_generation_prompt=True, tokenize=True, return_tensors="pt",).to(model.device) with torch.inference_mode(): outputs = model.generate( inputs, max_new_tokens=512, do_sample=False, ) print(tokenizer.decode(outputs[0], skip_special_tokens=True))
Evaluation scope and limitations
The reported evaluation metrics are token-level language-model metrics.
They measure likelihood/perplexity and next-token accuracy on the held-out
Medical-O1 test split.
They do not directly establish:
- clinical correctness,
- diagnostic safety,
- treatment quality,
- hallucination rate,
- calibration,
- performance on real patient records,
- performance across medical specialties,
- robustness to adversarial or ambiguous prompts.
The dataset includes generated reasoning traces, so the adapter may learn
patterns and stylistic properties of those traces in addition to medical
content.
The model should therefore be treated as a research artifact and not as a
clinical system.
Reproducibility notes
The main experimental artifacts retained with this repository are intentionally
small:
- selected PEFT adapter weights,
- adapter configuration,
- final held-out test comparison,
- dataset split metadata,
- training summary,
- per-seed summary JSON files.
Large optimizer states, scheduler states, caches, intermediate checkpoints,
downloaded base-model weights, raw dataset copies, and training logs are
intentionally omitted from this repository.
Licenses and upstream resources
- Base model:
Qwen/Qwen2.5-1.5B-Instruct — Apache-2.0
- Dataset:
FreedomIntelligence/medical-o1-reasoning-SFT — Apache-2.0
Please review the upstream model and dataset repositories for their full terms,
documentation, and attribution requirements.
Reference Research Papers
- @inproceedings{bui2025seeds,
title = {Assessing the Macro and Micro Effects of Random Seeds on Fine-Tuning Large Language Models},
author = {Bui, Nghia T. and Savova, Guergana and Wang, Lijing},
booktitle = {Proceedings of the 14th International Joint Conference on Natural Language Processing and the 4th Conference of the Asia-Pacific Chapter of the Association for Computational Linguistics},
pages = {41--46},
year = {2025},
url = {https://aclanthology.org/2025.ijcnlp-short.3.pdf}
}