LlamaMed-3.1-8B-Reasoner

LlamaMed-3.1-8B-Reasoner

LlamaMed-3.1-8B-Reasoner is a fine-tune of Llama-3.1-8B-Instruct trained on ReasonMed, a dataset of chain-of-thought medical reasoning over multiple-choice clinical questions. The model works through a question step by step — considering each answer option in turn — before giving a final answer, in the same structured reasoning style as its training data.

Model Details

Usage

from transformers import AutoTokenizer, AutoModelForCausalLM, BitsAndBytesConfig
import torch

bnb_config = BitsAndBytesConfig(
    load_in_4bit=True,
    bnb_4bit_quant_type="nf4",
    bnb_4bit_compute_dtype=torch.float16,
)

tokenizer = AutoTokenizer.from_pretrained("Rumiii/LlamaMed-3.1-8B-Reasoner")
model = AutoModelForCausalLM.from_pretrained(
    "Rumiii/LlamaMed-3.1-8B-Reasoner",
    device_map={"": 0},
    quantization_config=bnb_config,
)

messages = [
    {"role": "user", "content": "A 45-year-old man presents with polyuria, polydipsia, and weight loss. Fasting blood glucose is 210 mg/dL. What is the most likely diagnosis?\nA. Type 1 Diabetes Mellitus\nB. Type 2 Diabetes Mellitus\nC. Diabetes Insipidus\nD. Cushing's Syndrome"},
]

inputs = tokenizer.apply_chat_template(
    messages,
    add_generation_prompt=True,
    tokenize=True,
    return_dict=True,
    return_tensors="pt",
).to(model.device)

outputs = model.generate(**inputs, max_new_tokens=1500, temperature=0.6, top_p=0.95)
print(tokenizer.decode(outputs[0][inputs["input_ids"].shape[-1]:], skip_special_tokens=True))

Training

Trained on a single Tesla T4 GPU using Unsloth for memory-efficient QLoRA fine-tuning, with periodic adapter checkpoints saved during training.

Intended Use

This model is a research checkpoint intended for exploring medical reasoning fine-tunes. It is not validated for clinical use and should not be used to inform real medical decisions.

Downloads last month
1,702
Safetensors
Model size
8B params
Tensor type
BF16
·
Inference Providers NEW
This model isn't deployed by any Inference Provider. 🙋 Ask for provider support

Model tree for Rumiii/LlamaMed-3.1-8B-Reasoner

Dataset used to train Rumiii/LlamaMed-3.1-8B-Reasoner