Instructions to use reyanshgupta/qwen-3.5-4b-primaryhealthcare-csci566 with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- PEFT
How to use reyanshgupta/qwen-3.5-4b-primaryhealthcare-csci566 with PEFT:
Task type is invalid.
- Transformers
How to use reyanshgupta/qwen-3.5-4b-primaryhealthcare-csci566 with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="reyanshgupta/qwen-3.5-4b-primaryhealthcare-csci566") messages = [ {"role": "user", "content": "Who are you?"}, ] pipe(messages)# Load model directly from transformers import AutoModel model = AutoModel.from_pretrained("reyanshgupta/qwen-3.5-4b-primaryhealthcare-csci566", device_map="auto") - Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- llama.cpp
How to use reyanshgupta/qwen-3.5-4b-primaryhealthcare-csci566 with llama.cpp:
Install (macOS, Linux)
curl -LsSf https://llama.app/install.sh | sh # Start a local OpenAI-compatible server with a web UI: llama serve -hf reyanshgupta/qwen-3.5-4b-primaryhealthcare-csci566:BF16 # Run inference directly in the terminal: llama cli -hf reyanshgupta/qwen-3.5-4b-primaryhealthcare-csci566:BF16
Install from WinGet (Windows)
winget install llama.cpp # Start a local OpenAI-compatible server with a web UI: llama serve -hf reyanshgupta/qwen-3.5-4b-primaryhealthcare-csci566:BF16 # Run inference directly in the terminal: llama cli -hf reyanshgupta/qwen-3.5-4b-primaryhealthcare-csci566:BF16
Use pre-built binary
# Download pre-built binary from: # https://github.com/ggerganov/llama.cpp/releases # Start a local OpenAI-compatible server with a web UI: ./llama-server -hf reyanshgupta/qwen-3.5-4b-primaryhealthcare-csci566:BF16 # Run inference directly in the terminal: ./llama-cli -hf reyanshgupta/qwen-3.5-4b-primaryhealthcare-csci566:BF16
Build from source code
git clone https://github.com/ggerganov/llama.cpp.git cd llama.cpp cmake -B build cmake --build build -j --target llama-server llama-cli # Start a local OpenAI-compatible server with a web UI: ./build/bin/llama-server -hf reyanshgupta/qwen-3.5-4b-primaryhealthcare-csci566:BF16 # Run inference directly in the terminal: ./build/bin/llama-cli -hf reyanshgupta/qwen-3.5-4b-primaryhealthcare-csci566:BF16
Use Docker
docker model run hf.co/reyanshgupta/qwen-3.5-4b-primaryhealthcare-csci566:BF16
- LM Studio
- Jan
- vLLM
How to use reyanshgupta/qwen-3.5-4b-primaryhealthcare-csci566 with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "reyanshgupta/qwen-3.5-4b-primaryhealthcare-csci566" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "reyanshgupta/qwen-3.5-4b-primaryhealthcare-csci566", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }'Use Docker
docker model run hf.co/reyanshgupta/qwen-3.5-4b-primaryhealthcare-csci566:BF16
- SGLang
How to use reyanshgupta/qwen-3.5-4b-primaryhealthcare-csci566 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 "reyanshgupta/qwen-3.5-4b-primaryhealthcare-csci566" \ --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": "reyanshgupta/qwen-3.5-4b-primaryhealthcare-csci566", "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 "reyanshgupta/qwen-3.5-4b-primaryhealthcare-csci566" \ --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": "reyanshgupta/qwen-3.5-4b-primaryhealthcare-csci566", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }' - Ollama
How to use reyanshgupta/qwen-3.5-4b-primaryhealthcare-csci566 with Ollama:
ollama run hf.co/reyanshgupta/qwen-3.5-4b-primaryhealthcare-csci566:BF16
- Unsloth Desktop
- Pi
How to use reyanshgupta/qwen-3.5-4b-primaryhealthcare-csci566 with Pi:
Start the llama.cpp server
# Install llama.cpp: brew install llama.cpp # Start a local OpenAI-compatible server: llama serve -hf reyanshgupta/qwen-3.5-4b-primaryhealthcare-csci566:BF16
Configure the model in Pi
# Install Pi: npm install -g @earendil-works/pi-coding-agent # Add to ~/.pi/agent/models.json: { "providers": { "llama-cpp": { "baseUrl": "http://localhost:8080/v1", "api": "openai-completions", "apiKey": "none", "models": [ { "id": "reyanshgupta/qwen-3.5-4b-primaryhealthcare-csci566:BF16" } ] } } }Run Pi
# Start Pi in your project directory: pi
- Docker Model Runner
How to use reyanshgupta/qwen-3.5-4b-primaryhealthcare-csci566 with Docker Model Runner:
docker model run hf.co/reyanshgupta/qwen-3.5-4b-primaryhealthcare-csci566:BF16
- Lemonade
How to use reyanshgupta/qwen-3.5-4b-primaryhealthcare-csci566 with Lemonade:
Pull the model
# Download Lemonade from https://lemonade-server.ai/ lemonade pull reyanshgupta/qwen-3.5-4b-primaryhealthcare-csci566:BF16
Run and chat with the model
lemonade run user.qwen-3.5-4b-primaryhealthcare-csci566-BF16
List all available models
lemonade list
- Hermes Agent
How to use reyanshgupta/qwen-3.5-4b-primaryhealthcare-csci566 with Hermes Agent:
Start the llama.cpp server
# Install llama.cpp: brew install llama.cpp # Start a local OpenAI-compatible server: llama serve -hf reyanshgupta/qwen-3.5-4b-primaryhealthcare-csci566:BF16
Configure Hermes
# Install Hermes: curl -fsSL https://hermes-agent.nousresearch.com/install.sh | bash hermes setup # Point Hermes at the local server: hermes config set model.provider custom hermes config set model.base_url http://127.0.0.1:8080/v1 hermes config set model.default reyanshgupta/qwen-3.5-4b-primaryhealthcare-csci566:BF16
Run Hermes
hermes
- Atomic Chat
- OpenClaw
How to use reyanshgupta/qwen-3.5-4b-primaryhealthcare-csci566 with OpenClaw:
Start the llama.cpp server
# Install llama.cpp: brew install llama.cpp # Start a local OpenAI-compatible server: llama serve -hf reyanshgupta/qwen-3.5-4b-primaryhealthcare-csci566:BF16
Configure OpenClaw
# Install OpenClaw: npm install -g openclaw@latest # Register the local server and set it as the default model: openclaw onboard --non-interactive --mode local \ --auth-choice custom-api-key \ --custom-base-url http://127.0.0.1:8080/v1 \ --custom-model-id "reyanshgupta/qwen-3.5-4b-primaryhealthcare-csci566:BF16" \ --custom-provider-id llama-cpp \ --custom-compatibility openai \ --custom-text-input \ --accept-risk \ --skip-health
Run OpenClaw
openclaw agent --local --agent main --message "Hello from Hugging Face"
Model Card for Qwen 3.5 4B — Primary Healthcare Fine-tune
Fine-tuned version of unsloth/Qwen3.5-4B on a large medical QA dataset for primary healthcare, developed as part of the CSCI 566 (Deep Learning) course project at USC.
Model Details
Model Description
This model is a LoRA fine-tune of Qwen3.5-4B, trained on ~146K medical multiple-choice QA examples to improve performance on clinical reasoning tasks relevant to primary healthcare. Both LoRA adapter weights and quantized GGUF files are provided.
- Model type: Causal Language Model (LoRA fine-tune)
- Language(s) (NLP): English
- License: Apache 2.0
- Finetuned from model: unsloth/Qwen3.5-4B
Uses
Direct Use
Answer medical multiple-choice questions and provide evidence-based clinical reasoning for primary healthcare queries.
Downstream Use
Can be further fine-tuned or used as a backbone for medical decision-support tools, clinical education assistants, or healthcare chatbots.
Out-of-Scope Use
This model is not intended for direct clinical diagnosis or as a replacement for qualified medical professionals. It should not be used for emergency medical advice or high-stakes clinical decisions without human oversight.
Bias, Risks, and Limitations
- The model may produce plausible-sounding but incorrect medical information.
- Performance may degrade on rare conditions, non-English queries, or highly specialized subspecialties.
Recommendations
Always consult a qualified healthcare professional for personal medical advice. Outputs from this model should be treated as informational only and verified against authoritative clinical sources.
How to Get Started with the Model
With LoRA adapter (Transformers + PEFT)
from transformers import AutoTokenizer, AutoModelForCausalLM
from peft import PeftModel
base_model = AutoModelForCausalLM.from_pretrained("unsloth/Qwen3.5-4B")
tokenizer = AutoTokenizer.from_pretrained("reyanshgupta/qwen-3.5-4b-primaryhealthcare-csci566", subfolder="adapter")
model = PeftModel.from_pretrained(base_model, "reyanshgupta/qwen-3.5-4b-primaryhealthcare-csci566", subfolder="adapter")
With GGUF (llama.cpp / Ollama)
huggingface-cli download reyanshgupta/qwen-3.5-4b-primaryhealthcare-csci566 gguf/qwen-3.5-4b.Q4_K_M.gguf
Training Details
Training Data
~146,354 medical multiple-choice QA examples in ShareGPT chat format, covering a broad range of primary care topics including internal medicine, pharmacology, and clinical reasoning. A validation split of ~5,548 examples was held out during training.
The system prompt used during training:
"You are a knowledgeable medical AI assistant. Provide accurate, evidence-based medical information. Always recommend consulting a qualified healthcare professional for personal medical advice."
Training Procedure
Training Hyperparameters
- Training regime: bf16 mixed precision
- Fine-tuning method: LoRA via Unsloth + TRL SFTTrainer
- LoRA rank (r): 32
- LoRA alpha: 64
- LoRA dropout: 0.0
- RSLoRA: Yes
- Target modules: q_proj, k_proj, v_proj, o_proj, gate_proj, up_proj, down_proj
- Max sequence length: 800
- Per-device batch size: 4
- Gradient accumulation steps: 8 (effective batch size: 32)
- Learning rate: 2e-4
- Warmup steps: 400
- Weight decay: 0.01
- Epochs: 1
- Optimizer: AdamW
Evaluation
Testing Data, Factors & Metrics
Testing Data
Held-out validation split (~5,548 examples) from the same medical QA distribution as training data, plus standard medical benchmarks (MedQA, MedMCQA).
Metrics
- Accuracy on multiple-choice medical QA benchmarks
Results
| Benchmark | Base Model | Fine-tuned |
|---|---|---|
| CareQA | 78.53% | 72.55% |
| HEADQA | 78.99% | 79.03% |
| MedQA | 71.33% | 67.32% |
| MMLU (Medical) | 82.60% | 78.41% |
| MMLU-Pro (Medical) | 60.76% | 56.72% |
| PubMedQA | 74.60% | 68.20% |
Summary
Qwen3.5-4B is the strongest base model in the comparison, achieving the highest scores across all benchmarks. Fine-tuning led to modest decreases on most benchmarks, with the exception of HEADQA where performance marginally improved. The strong base performance suggests the model already has substantial medical knowledge; the drop after fine-tuning is likely due to the narrow training distribution over a single epoch. HEADQA improvement indicates the fine-tune did reinforce some relevant clinical reasoning patterns.
Technical Specifications
Model Architecture and Objective
Decoder-only transformer (Qwen3.5-4B) with LoRA adapters applied to attention and MLP projection layers. Trained with next-token prediction (SFT) on chat-formatted medical QA data.
Compute Infrastructure
Hardware
NVIDIA RTX 5090 GPU: 24GB (CUDA 12.8)
Software
- Python 3.13
- Unsloth
- TRL (SFTTrainer)
- PEFT
- Transformers
Model Card Authors
Reyansh Gupta — USC CSCI 566
Model Card Contact
- Downloads last month
- 27
4-bit
Model tree for reyanshgupta/qwen-3.5-4b-primaryhealthcare-csci566
Evaluation results
- Accuracy on CareQAself-reported72.550
- Accuracy on HEADQA (EN)self-reported79.030
- Accuracy on MedQA USMLEself-reported67.320
- Accuracy on MMLU (Medical)self-reported78.410
- Accuracy on MMLU-Pro (Medical)self-reported56.720
- Accuracy on PubMedQAself-reported68.200