Instructions to use ameowra/qwen3-4b-backpain-fused with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use ameowra/qwen3-4b-backpain-fused with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="ameowra/qwen3-4b-backpain-fused") messages = [ {"role": "user", "content": "Who are you?"}, ] pipe(messages)# Load model directly from transformers import AutoModel model = AutoModel.from_pretrained("ameowra/qwen3-4b-backpain-fused", device_map="auto") - Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- llama.cpp
How to use ameowra/qwen3-4b-backpain-fused 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 ameowra/qwen3-4b-backpain-fused:F16 # Run inference directly in the terminal: llama cli -hf ameowra/qwen3-4b-backpain-fused:F16
Install from WinGet (Windows)
winget install llama.cpp # Start a local OpenAI-compatible server with a web UI: llama serve -hf ameowra/qwen3-4b-backpain-fused:F16 # Run inference directly in the terminal: llama cli -hf ameowra/qwen3-4b-backpain-fused:F16
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 ameowra/qwen3-4b-backpain-fused:F16 # Run inference directly in the terminal: ./llama-cli -hf ameowra/qwen3-4b-backpain-fused:F16
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 ameowra/qwen3-4b-backpain-fused:F16 # Run inference directly in the terminal: ./build/bin/llama-cli -hf ameowra/qwen3-4b-backpain-fused:F16
Use Docker
docker model run hf.co/ameowra/qwen3-4b-backpain-fused:F16
- LM Studio
- Jan
- vLLM
How to use ameowra/qwen3-4b-backpain-fused with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "ameowra/qwen3-4b-backpain-fused" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "ameowra/qwen3-4b-backpain-fused", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }'Use Docker
docker model run hf.co/ameowra/qwen3-4b-backpain-fused:F16
- SGLang
How to use ameowra/qwen3-4b-backpain-fused 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 "ameowra/qwen3-4b-backpain-fused" \ --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": "ameowra/qwen3-4b-backpain-fused", "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 "ameowra/qwen3-4b-backpain-fused" \ --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": "ameowra/qwen3-4b-backpain-fused", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }' - Ollama
How to use ameowra/qwen3-4b-backpain-fused with Ollama:
ollama run hf.co/ameowra/qwen3-4b-backpain-fused:F16
- Unsloth Desktop
- Pi
How to use ameowra/qwen3-4b-backpain-fused with Pi:
Start the llama.cpp server
# Install llama.cpp: brew install llama.cpp # Start a local OpenAI-compatible server: llama serve -hf ameowra/qwen3-4b-backpain-fused:F16
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": "ameowra/qwen3-4b-backpain-fused:F16" } ] } } }Run Pi
# Start Pi in your project directory: pi
- Docker Model Runner
How to use ameowra/qwen3-4b-backpain-fused with Docker Model Runner:
docker model run hf.co/ameowra/qwen3-4b-backpain-fused:F16
- Lemonade
How to use ameowra/qwen3-4b-backpain-fused with Lemonade:
Pull the model
# Download Lemonade from https://lemonade-server.ai/ lemonade pull ameowra/qwen3-4b-backpain-fused:F16
Run and chat with the model
lemonade run user.qwen3-4b-backpain-fused-F16
List all available models
lemonade list
- Hermes Agent
How to use ameowra/qwen3-4b-backpain-fused with Hermes Agent:
Start the llama.cpp server
# Install llama.cpp: brew install llama.cpp # Start a local OpenAI-compatible server: llama serve -hf ameowra/qwen3-4b-backpain-fused:F16
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 ameowra/qwen3-4b-backpain-fused:F16
Run Hermes
hermes
- Atomic Chat
- OpenClaw
How to use ameowra/qwen3-4b-backpain-fused with OpenClaw:
Start the llama.cpp server
# Install llama.cpp: brew install llama.cpp # Start a local OpenAI-compatible server: llama serve -hf ameowra/qwen3-4b-backpain-fused:F16
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 "ameowra/qwen3-4b-backpain-fused:F16" \ --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"
Qwen3-4B Back-Pain Coaching (LoRA fine-tune)
A LoRA fine-tune of Qwen/Qwen3-4B-Instruct-2507, specialized for
back-pain coaching conversations: it asks structured intake questions,
screens for red-flag symptoms, and otherwise suggests general exercises,
stretches, and lifestyle/diet guidance.
This is not a diagnostic tool and is not a substitute for professional medical advice.
Intended use
- General exercise, stretch, and lifestyle/diet suggestions for common, non-red-flag back pain
- Structured intake before any recommendation: pain location, duration, and what aggravates or relieves it
- Recognizing red-flag symptoms (groin/inner-thigh numbness, loss of bowel or bladder control, fever, unexplained weight loss, recent significant trauma, progressive leg weakness) and directing the user to urgent care instead of answering the question itself
Not intended for
- Diagnosing any medical condition
- Prescribing specific diets, supplements, or dosages
- Emergency medical guidance, or as the sole safety mechanism in a deployed system
This model was trained and evaluated alongside an independent,
rules-based red-flag safety check (inference/safety.py in the project
repo below) that runs before the model is ever called and does not
depend on model behavior. Deploying this model without an equivalent
independent safety layer is not the intended or recommended use.
Files in this repo
adapter_config.json+adapters.safetensorsโ the trained LoRA adapter (29MB), applied on top of the base model at load time (MLX) or used to fuse/convert to another formatqwen3-4b-instruct-2507-backpain-f16.ggufโ full-precision GGUF (~8GB)qwen3-4b-instruct-2507-backpain-q4_k_m.ggufโ quantized GGUF (~2.5GB), the one this project actually serves viallama-cpp-python
No full fused HF-transformers-format safetensors checkpoint is hosted
here โ the adapter was fused directly into an MLX checkpoint and converted
straight to GGUF, skipping an intermediate HF-format export.
hf download ameowra/qwen3-4b-backpain-fused \
qwen3-4b-instruct-2507-backpain-q4_k_m.gguf --local-dir models/
Training
- Base model:
Qwen/Qwen3-4B-Instruct-2507 - Method: LoRA fine-tuning via
mlx_lm.lora(MLX, Apple Silicon) โ rank 8, dropout 0.0, scale 20.0, 16 of 36 layers tuned (7.34M / 4022M trainable params, 0.182%); adam optimizer, lr 1e-5 constant, batch size 4, max sequence length 2048; fused into the base weights and converted to GGUF viallama.cpp - Data: 136 hand-authored chat-format examples (110 train / 26 valid, ~27,470 tokens/epoch) across 6 categories โ structured intake, exercise/stretch recommendation, diet/lifestyle guidance, red-flag referral, medical-term explanation, and back-muscle anatomy โ grounded in real sources (Mayo Clinic, NHS Inform, Kaiser, Arthritis UK, Spine Health's glossary, NCBI StatPearls, TeachMeAnatomy) collected via Firecrawl and paraphrased rather than copied verbatim
- Checkpoint selection: trained for 430 of a nominal 1000 iterations on an Apple M5 Max (~1.7 it/s, ~6 minutes wall clock); validation loss bottomed out at iteration 100 (0.441) and rose steadily after while train loss kept falling โ plain overfitting on a small dataset, so iteration 100 was selected rather than the final checkpoint. At this dataset size, ~100-150 iterations is the useful range; a longer run needs more data, not more patience.
System prompt
This model was fine-tuned against a fixed system prompt and expects to be
served with it verbatim (see inference/config.yaml in the project
repo):
You are a back-pain coaching assistant based in Australia but you have
globally sourced knowledge. Ask about pain location, duration, and what
aggravates or relieves it before recommending anything. Screen for
red-flag symptoms (numbness in the groin/inner thighs, loss of bowel or
bladder control, fever, unexplained weight loss, recent significant
trauma, progressive leg weakness) and tell the user to call 000 and seek
medical care immediately if any are present. Otherwise, suggest general
exercises, stretches, and lifestyle/diet guidance only. Avoid diagnosing
a condition, never prescribe a specific diet or supplement dosage, and
always recommend seeing a doctor or physiotherapist for anything beyond
general advice.
Limitations
- Small base model (4B parameters) and a small fine-tuning set (136 examples) โ expect narrower conversational range than a frontier model
- Style transfer more than knowledge transfer: the adapter mainly changes how the model responds (ask first, screen, defer, stay non-prescriptive) rather than adding back-pain knowledge the base model lacked
- Single-turn training data โ multi-turn conversations work if prior turns are replayed as history, but every training example was one user turn and one reply
- English only
- "Call 000" guidance is Australia-specific; adapt for other regions
- General lifestyle advice only, not personalized clinical guidance
Usage
Recommended: run via the project's own inference server, which wires in the independent red-flag safety check ahead of every model call:
git clone https://gitlab.com/assignments6633205/mai602/chatbot.git
cd chatbot
uv sync --extra inference
uv run inference/serve.py
Direct usage via MLX, applying the adapter on top of the base model:
from mlx_lm import load, generate
from mlx_lm.sample_utils import make_sampler
model, tokenizer = load(
"Qwen/Qwen3-4B-Instruct-2507",
adapter_path="path/to/downloaded/adapter_config.json's directory",
)
messages = [
{"role": "system", "content": "<see System prompt section above>"},
{"role": "user", "content": "My lower back has been aching for about a week."},
]
prompt = tokenizer.apply_chat_template(messages, add_generation_prompt=True)
print(generate(model, tokenizer, prompt=prompt, max_tokens=512,
sampler=make_sampler(temp=0.7, top_p=0.9)))
There is no full fused HF-transformers-format checkpoint hosted in this
repo (see "Files in this repo" above) โ direct transformers usage would
require fusing the adapter into the base weights yourself first (e.g. via
mlx_lm.fuse then a HF-format export), or using one of the GGUF builds
via llama.cpp/llama-cpp-python as shown above, which is what this
project's own inference server actually does. See the project repo for
the full training-to-serving pipeline and the ProjectScope.md design
rationale (structured intake, hardcoded safety layer, planned RAG
grounding, fully local/offline deployment).
- Downloads last month
- 28
4-bit
16-bit
Model tree for ameowra/qwen3-4b-backpain-fused
Base model
Qwen/Qwen3-4B-Instruct-2507