Views
No views yet
BrainHealthAI/MedQA_mutilangual. Companion to the larger
trilingual-trained MedQA-Llama3.1-8B-SFT-Big.
Part of the BRAIN HEALTH / Operation HELIX-FT project.Output format: wraps the final answer in<answer>...</answer>, replies in the question's language.
BrainHealthAI/MedQA_mutilangual(context_question, question, answer, language, speciality)f"{context_question}, {question}"| Setting | Value |
|---|---|
| Base model | meta-llama/Llama-3.1-8B-Instruct |
| Quantization | 4-bit NF4 + double quant |
| LoRA rank / α / dropout | 64 / 128 / 0.1 |
| Effective batch size | 16 (per_device 2 × grad_accum 8) |
| Learning rate | 2e-4 cosine, warmup 0.03 |
| Epochs | 3 (interrupted at intermediate checkpoint) |
| Max sequence length | 2048 |
| Hardware | RunPod L40S 48 GB |

1from transformers import AutoTokenizer, AutoModelForCausalLM
2from peft import PeftModel
3import torch
4
5base = AutoModelForCausalLM.from_pretrained(
6 "meta-llama/Llama-3.1-8B-Instruct",
7 torch_dtype=torch.bfloat16, device_map="auto",
8)
9model = PeftModel.from_pretrained(base, "BrainHealthAI/MedQA-Llama3.1-8B-SFT-Small")
10tok = AutoTokenizer.from_pretrained("BrainHealthAI/MedQA-Llama3.1-8B-SFT-Small")
11
12msgs = [
13 {"role": "system", "content": "You are a careful medical assistant. Provide your final answer between <answer>...</answer>."},
14 {"role": "user", "content": "Question: My wife started Pradaxa a week ago. What happens if she stops it abruptly?"},
15]
16inputs = tok.apply_chat_template(msgs, return_tensors="pt", add_generation_prompt=True).to(model.device)
17out = model.generate(inputs, max_new_tokens=512, do_sample=False)
18print(tok.decode(out[0], skip_special_tokens=True))Williamsanderson/MedQA-Llama3.1-8B-SFT-Big — trilingual trained on 50K stratified samples + Dorosz KG. Best eval loss 0.768.1@misc{medqa_sft_small_2026,
2 title = { MedQA-Llama3.1-8B-SFT-Small: Medical QA via QLoRA SFT on Llama-3.1-8B },
3 author = { BRAIN HEALTH project — Operation HELIX-FT },
4 year = { 2026 },
5 url = { https://huggingface.co/BrainHealthAI/MedQA-Llama3.1-8B-SFT-Small }
6}