MedLLaMA is a fine-tuned version of LLaMA-2 designed for clinical instruction following. It was trained on the Llama2-MedTuned-Instructions dataset (200,000 samples) using LoRA and 4-bit quantization (QLoRA). The model specializes in tasks like medical question answering, named entity recognition (NER), and relation extraction.
- β Fine-tuned LLaMA-2β7B using LoRA + 4-bit QLoRA
- β
Instruction-style prompting (
[INST] ... [/INST]) for clinical NLP tasks - β GPT-4-based evaluation showed a +2.1 improvement in accuracy and +1.8 in helpfulness over the base model across 30 prompts
- β Streamlit app for real-time interaction
- β π Dynamic RAG integration for live web-powered answers
In addition to fine-tuning, MedLLaMA now supports Dynamic RAG, combining web search with medical domain reasoning:
- π Uses DuckDuckGo + BeautifulSoup to fetch real-time content
- π Chunks and embeds retrieved web pages using
MiniLM - π§ Generates responses using your fine-tuned MedLLaMA model
- π¦ Hugging Face Transformers + QLoRA (4-bit)
- π LangChain (Dynamic RAG pipeline)
- π§ ChromaDB (vector store for chunked web context)
- π DuckDuckGo Search + BeautifulSoup (real-time web scraping)
- ποΈ Streamlit (UI demo)
- π dotenv (secure environment variable handling)
-
Clone the repo and install dependencies:
pip install -r requirements.txt
-
Create a
.envfile with your Hugging Face token:HF_TOKEN=your_token_here -
Run the app:
streamlit run streamlit_app.py
Q: Is creatine monohydrate dangerous?
A: Creatine is a substance that occurs naturally in the body and is found in small amounts in foods such as meat and fish. It is also available as a dietary supplement. There is no evidence that creatine is dangerous. However, it can cause some side effects, such as weight gain, water retention, and stomach cramps. It can also interact with some medications, so it is important to talk to a doctor before taking creatine.
π§ͺ This answer was generated by combining retrieved content from sources like Mayo Clinic and WebMD, then passing it to your LLaMA-2 medical model.
- Sampled 30 prompts from the validation split of the MedTuned dataset
- Compared base LLaMA-2 and MedLLaMA outputs side-by-side
- GPT-4 scored each pair on accuracy, completeness, and helpfulness
π MedLLaMA consistently outperformed the base model.
This project is for research and educational purposes only.
The model is not a substitute for professional medical advice.