YAML Metadata Warning:empty or missing yaml metadata in repo card
Check out the documentation for more information.
LoRA-Prompt-Tradeoff-PubMedQA
This repository contains LoRA adapters trained on the PubMedQA dataset to compare LoRA fine-tuning vs prompt engineering for biomedical question answering.
Base model: meta-llama/Meta-Llama-3.1-8B
π Research Goal
- Evaluate trade-offs between LoRA fine-tuning and prompt-based baselines (zero-shot, domain-specific, chain-of-thought).
- Domain: biomedical QA with yes/no/maybe answers.
- Metrics: Accuracy, Macro F1, GPU memory usage, runtime efficiency.
π Usage
Load the LoRA Adapter
from transformers import AutoModelForCausalLM, AutoTokenizer
from peft import PeftModel
base_model = AutoModelForCausalLM.from_pretrained(
"meta-llama/Meta-Llama-3.1-8B",
device_map="auto"
)
tokenizer = AutoTokenizer.from_pretrained("Keerthan097/LoRA-Prompt-Tradeoff-PubMedQA")
model = PeftModel.from_pretrained(base_model, "Keerthan097/LoRA-Prompt-Tradeoff-PubMedQA")
# Example inference
question = "Does aspirin reduce the risk of stroke?"
context = "A randomized controlled trial showed significant reduction..."
prompt = f"Question: {question}\nContext: {context}\nAnswer with one word: yes, no, maybe.\nAnswer:"
inputs = tokenizer(prompt, return_tensors="pt").to(model.device)
outputs = model.generate(**inputs, max_new_tokens=4)
print(tokenizer.decode(outputs[0], skip_special_tokens=True))
Inference Providers NEW
This model isn't deployed by any Inference Provider. π Ask for provider support