Instructions to use pedrobsb/alzbot-qwen3-4b-lora with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- PEFT
How to use pedrobsb/alzbot-qwen3-4b-lora with PEFT:
from peft import PeftModel from transformers import AutoModelForCausalLM base_model = AutoModelForCausalLM.from_pretrained("Qwen/Qwen3-4B-Instruct-2507") model = PeftModel.from_pretrained(base_model, "pedrobsb/alzbot-qwen3-4b-lora") - Transformers
How to use pedrobsb/alzbot-qwen3-4b-lora with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="pedrobsb/alzbot-qwen3-4b-lora") messages = [ {"role": "user", "content": "Who are you?"}, ] pipe(messages)# Load model directly from transformers import AutoModel model = AutoModel.from_pretrained("pedrobsb/alzbot-qwen3-4b-lora", dtype="auto") - Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- vLLM
How to use pedrobsb/alzbot-qwen3-4b-lora with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "pedrobsb/alzbot-qwen3-4b-lora" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "pedrobsb/alzbot-qwen3-4b-lora", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }'Use Docker
docker model run hf.co/pedrobsb/alzbot-qwen3-4b-lora
- SGLang
How to use pedrobsb/alzbot-qwen3-4b-lora with SGLang:
Install from pip and serve model
# Install SGLang from pip: pip install sglang # Start the SGLang server: python3 -m sglang.launch_server \ --model-path "pedrobsb/alzbot-qwen3-4b-lora" \ --host 0.0.0.0 \ --port 30000 # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:30000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "pedrobsb/alzbot-qwen3-4b-lora", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }'Use Docker images
docker run --gpus all \ --shm-size 32g \ -p 30000:30000 \ -v ~/.cache/huggingface:/root/.cache/huggingface \ --env "HF_TOKEN=<secret>" \ --ipc=host \ lmsysorg/sglang:latest \ python3 -m sglang.launch_server \ --model-path "pedrobsb/alzbot-qwen3-4b-lora" \ --host 0.0.0.0 \ --port 30000 # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:30000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "pedrobsb/alzbot-qwen3-4b-lora", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }' - Docker Model Runner
How to use pedrobsb/alzbot-qwen3-4b-lora with Docker Model Runner:
docker model run hf.co/pedrobsb/alzbot-qwen3-4b-lora
AlzBot: Alzheimer's Disease Research Assistant (LoRA Adapter)
A domain-specific LoRA adapter fine-tuned on 95,374 biomedical records (~110M tokens) from 13 public data sources, specializing in Alzheimer's disease research.
Model Details
| Parameter | Value |
|---|---|
| Base Model | Qwen/Qwen3-4B-Instruct-2507 |
| Adapter Type | LoRA (r=64, ฮฑ=128) |
| Trainable Parameters | 161.5M (2.1% of 7.66B total) |
| Training Data | 95,374 examples from 13 biomedical APIs |
| Training Tokens | ~110M |
| Best Eval Loss | 0.830 |
| Token Accuracy | 80.4% |
| Training Time | 72.6 hours on NVIDIA A10G |
| Training Cost | ~$88 |
Data Sources
The AlzCorpus was constructed from 13 public biomedical APIs:
- Europe PMC (75,954 articles) โ research abstracts and open-access full text
- openFDA (25,100) โ drug labels, indications, warnings
- PubMed (9,994) โ articles with metadata
- ClinicalTrials.gov (4,194) โ clinical trial records
- SIDER (1,226) โ drug side effects
- Open Targets (868) โ drug-target associations
- Plus: ChEMBL, PharmGKB, OMIM, and 6,104 conversational Q&A pairs
All records are evidence-graded (A-E) based on study type, sample size, and recency.
Usage
import torch
from transformers import AutoModelForCausalLM, AutoTokenizer
from peft import PeftModel
base = AutoModelForCausalLM.from_pretrained(
"Qwen/Qwen3-4B-Instruct-2507",
dtype=torch.bfloat16,
device_map="auto",
)
tokenizer = AutoTokenizer.from_pretrained("Qwen/Qwen3-4B-Instruct-2507")
model = PeftModel.from_pretrained(base, "pedrobsb/alzbot-qwen3-4b-lora")
model.eval()
messages = [
{"role": "system", "content": "You are AlzBot, a specialized Alzheimer's disease research assistant."},
{"role": "user", "content": "What are the FDA-approved treatments for Alzheimer's disease?"},
]
text = tokenizer.apply_chat_template(messages, tokenize=False, add_generation_prompt=True)
inputs = tokenizer(text, return_tensors="pt").to(model.device)
with torch.no_grad():
output = model.generate(**inputs, max_new_tokens=512, temperature=0.3, top_p=0.9, do_sample=True)
print(tokenizer.decode(output[0][inputs["input_ids"].shape[1]:], skip_special_tokens=True))
Training Configuration
- LoRA targets: q_proj, k_proj, v_proj, o_proj, gate_proj, up_proj, down_proj
- Optimizer: Paged AdamW 8-bit
- Learning rate: 1e-4 (cosine schedule, 500 warmup steps)
- Batch size: 16 (effective)
- Sequence length: 512 tokens (with packing)
- Precision: float16
- Epochs: 2
- GPU: NVIDIA A10G (24 GB VRAM), AWS g5.2xlarge
Eval Results
| Epoch | Eval Loss | Token Accuracy |
|---|---|---|
| 0.5 | 0.855 | 79.8% |
| 1.0 | 0.836 | 80.2% |
| 1.5 | 0.832 | 80.3% |
| 2.0 | 0.830 | 80.4% |
Topics Covered
- FDA-approved treatments (donepezil, rivastigmine, galantamine, memantine, lecanemab, donanemab)
- Genetic risk factors (APOE e4, PSEN1, APP)
- Biomarkers (amyloid-beta, tau, CSF markers, PET imaging)
- Clinical trials and emerging therapies
- Drug interactions and contraindications
- Caregiver support and patient care
- Evidence grading and source citations
Citation
@article{albuquerque2026alzbot,
title={AlzBot: Toward Community-Driven Lightweight Domain Language Models as Living Alternatives to Systematic Literature Reviews},
author={Albuquerque, Pedro H. M.},
year={2026}
}
Disclaimer
This model is designed as a research tool for clinicians and researchers, not as a direct-to-patient advisory system. It should not be used for individual treatment decisions without verification by a qualified clinician.
Framework Versions
- PEFT 0.19.1
- Transformers 5.12.1
- PyTorch 2.12.1+cu130
- TRL 1.7.0
- Downloads last month
- 21
Model tree for pedrobsb/alzbot-qwen3-4b-lora
Base model
Qwen/Qwen3-4B-Instruct-2507