Views
No views yet

| Data | Description | Link |
|---|---|---|
| MedReason | Our quality filtered data for SFT | Link |
./src/data_generation./configs/dataset_configs.yml./src/data_generation/utils.pypython ./src/data_generation/Generate_Reasoning.py --dataset medqa --sample <number_of_samples> --start_idx 0 --batch_size 1&| Model | Base Model | Link |
|---|---|---|
| MedReason-8B | HuatuoGPT-o1-8B | Link |
| MedReason-Llama | Llama-3.1-8B-Instruct | Link |
| MedReason-Mistral | Mistral-7B-Instruct-v0.2 | Link |
1from transformers import AutoModelForCausalLM, AutoTokenizer
2
3model = AutoModelForCausalLM.from_pretrained('UCSC-VLAA/MedReason-8B',torch_dtype="auto",device_map="auto", use_safetensors= True)
4model.eval()
5
6tokenizer = AutoTokenizer.from_pretrained('UCSC-VLAA/MedReason-8B', trust_remote_code=True, padding_side='left')
7
8input_text = "How to stop a cough?"
9messages = [{"role": "user", "content": input_text}]
10
11inputs = tokenizer(tokenizer.apply_chat_template(messages, tokenize=False,add_generation_prompt=True), return_tensors="pt").to(model.device)
12outputs = model.generate(**inputs, max_new_tokens=2048)
13print(tokenizer.decode(outputs[0], skip_special_tokens=True))1# based on Huatuo-o1-8B
2accelerate launch --config_file ./configs/deepspeed_zero3.yaml \
3 --num_processes 8 \
4 --num_machines 1 \
5 --machine_rank 0 \
6 --deepspeed_multinode_launcher standard ./src/model_training/SFT.py \
7 --model_path FreedomIntelligence/HuatuoGPT-o1-8B \
8 --data_path /path/to/your/data \
9 --n_epochs 3 \
10 --experiment_name huatuo_o1_medreason_8B \
11 --base_model Llama
12
13# based on DeepSeek-distilled-Llama-8B
14accelerate launch --config_file ./configs/deepspeed_zero3.yaml \
15 --num_processes 8 \
16 --num_machines 1 \
17 --machine_rank 0 \
18 --deepspeed_multinode_launcher standard ./src/model_training/SFT.py \
19 --model_path deepseek-ai/DeepSeek-R1-Distill-Llama-8B \
20 --data_path /path/to/your/data\
21 --n_epochs 3 \
22 --experiment_name distilled_llama_medreason_8B \
23 --base_model Llama


1# deploy on 8 GPUs
2log_num=0
3model_name=UCSC-VLAA/MedReason-8B
4port=28${log_num}35
5CUDA_VISIBLE_DEVICES=0,1,2,3,4,5,6,7 python -m sglang.launch_server --model-path $model_name --port $port --mem-fraction-static 0.8 --dp 8 --tp 1 > sglang${log_num}.log 2>&1 &--strict_prompt option to use stricter prompts for more precise answer extraction.1log_num=0
2task_floder=MedReason-8B-results
3model_name=UCSC-VLAA/MedReason-8B
4port=28${log_num}35
5
6eval_file=./eval_data/medbullets_op4.jsonl
7python ./src/evaluation/eval.py --model_name $model_name --eval_file $eval_file --port $port --strict_prompt --batch_size 1000 --max_new_tokens 2000 --task_floder $task_floder1pkill -f sglang
2pkill -f multiprocessing.spawn@misc{wu2025medreasonelicitingfactualmedical,
title={MedReason: Eliciting Factual Medical Reasoning Steps in LLMs via Knowledge Graphs},
author={Juncheng Wu and Wenlong Deng and Xingxuan Li and Sheng Liu and Taomian Mi and Yifan Peng and Ziyang Xu and Yi Liu and Hyunjin Cho and Chang-In Choi and Yihan Cao and Hui Ren and Xiang Li and Xiaoxiao Li and Yuyin Zhou},
year={2025},
eprint={2504.00993},
archivePrefix={arXiv},
primaryClass={cs.CL},
url={https://arxiv.org/abs/2504.00993},
}