Instructions to use MethodWhite/Qwen3.5-9B-HSAQR-v2 with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use MethodWhite/Qwen3.5-9B-HSAQR-v2 with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="MethodWhite/Qwen3.5-9B-HSAQR-v2") messages = [ {"role": "user", "content": "Who are you?"}, ] pipe(messages)# Load model directly from transformers import AutoTokenizer, AutoModelForCausalLM tokenizer = AutoTokenizer.from_pretrained("MethodWhite/Qwen3.5-9B-HSAQR-v2") model = AutoModelForCausalLM.from_pretrained("MethodWhite/Qwen3.5-9B-HSAQR-v2", device_map="auto") messages = [ {"role": "user", "content": "Who are you?"}, ] inputs = tokenizer.apply_chat_template( messages, add_generation_prompt=True, tokenize=True, return_dict=True, return_tensors="pt", ).to(model.device) outputs = model.generate(**inputs, max_new_tokens=40) print(tokenizer.decode(outputs[0][inputs["input_ids"].shape[-1]:])) - Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- llama.cpp
How to use MethodWhite/Qwen3.5-9B-HSAQR-v2 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 MethodWhite/Qwen3.5-9B-HSAQR-v2:Q4_K_M # Run inference directly in the terminal: llama cli -hf MethodWhite/Qwen3.5-9B-HSAQR-v2:Q4_K_M
Install from WinGet (Windows)
winget install llama.cpp # Start a local OpenAI-compatible server with a web UI: llama serve -hf MethodWhite/Qwen3.5-9B-HSAQR-v2:Q4_K_M # Run inference directly in the terminal: llama cli -hf MethodWhite/Qwen3.5-9B-HSAQR-v2:Q4_K_M
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 MethodWhite/Qwen3.5-9B-HSAQR-v2:Q4_K_M # Run inference directly in the terminal: ./llama-cli -hf MethodWhite/Qwen3.5-9B-HSAQR-v2:Q4_K_M
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 MethodWhite/Qwen3.5-9B-HSAQR-v2:Q4_K_M # Run inference directly in the terminal: ./build/bin/llama-cli -hf MethodWhite/Qwen3.5-9B-HSAQR-v2:Q4_K_M
Use Docker
docker model run hf.co/MethodWhite/Qwen3.5-9B-HSAQR-v2:Q4_K_M
- LM Studio
- Jan
- vLLM
How to use MethodWhite/Qwen3.5-9B-HSAQR-v2 with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "MethodWhite/Qwen3.5-9B-HSAQR-v2" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "MethodWhite/Qwen3.5-9B-HSAQR-v2", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }'Use Docker
docker model run hf.co/MethodWhite/Qwen3.5-9B-HSAQR-v2:Q4_K_M
- SGLang
How to use MethodWhite/Qwen3.5-9B-HSAQR-v2 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 "MethodWhite/Qwen3.5-9B-HSAQR-v2" \ --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": "MethodWhite/Qwen3.5-9B-HSAQR-v2", "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 "MethodWhite/Qwen3.5-9B-HSAQR-v2" \ --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": "MethodWhite/Qwen3.5-9B-HSAQR-v2", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }' - Ollama
How to use MethodWhite/Qwen3.5-9B-HSAQR-v2 with Ollama:
ollama run hf.co/MethodWhite/Qwen3.5-9B-HSAQR-v2:Q4_K_M
- Unsloth Studio
How to use MethodWhite/Qwen3.5-9B-HSAQR-v2 with Unsloth Studio:
Install Unsloth Studio (macOS, Linux, WSL)
curl -fsSL https://unsloth.ai/install.sh | sh # Run unsloth studio unsloth studio -H 0.0.0.0 -p 8888 # Then open http://localhost:8888 in your browser # Search for MethodWhite/Qwen3.5-9B-HSAQR-v2 to start chatting
Install Unsloth Studio (Windows)
irm https://unsloth.ai/install.ps1 | iex # Run unsloth studio unsloth studio -H 0.0.0.0 -p 8888 # Then open http://localhost:8888 in your browser # Search for MethodWhite/Qwen3.5-9B-HSAQR-v2 to start chatting
Using HuggingFace Spaces for Unsloth
# No setup required # Open https://huggingface.co/spaces/unsloth/studio in your browser # Search for MethodWhite/Qwen3.5-9B-HSAQR-v2 to start chatting
- Pi
How to use MethodWhite/Qwen3.5-9B-HSAQR-v2 with Pi:
Start the llama.cpp server
# Install llama.cpp: brew install llama.cpp # Start a local OpenAI-compatible server: llama serve -hf MethodWhite/Qwen3.5-9B-HSAQR-v2:Q4_K_M
Configure the model in Pi
# Install Pi: npm install -g @mariozechner/pi-coding-agent # Add to ~/.pi/agent/models.json: { "providers": { "llama-cpp": { "baseUrl": "http://localhost:8080/v1", "api": "openai-completions", "apiKey": "none", "models": [ { "id": "MethodWhite/Qwen3.5-9B-HSAQR-v2:Q4_K_M" } ] } } }Run Pi
# Start Pi in your project directory: pi
- Docker Model Runner
How to use MethodWhite/Qwen3.5-9B-HSAQR-v2 with Docker Model Runner:
docker model run hf.co/MethodWhite/Qwen3.5-9B-HSAQR-v2:Q4_K_M
- Lemonade
How to use MethodWhite/Qwen3.5-9B-HSAQR-v2 with Lemonade:
Pull the model
# Download Lemonade from https://lemonade-server.ai/ lemonade pull MethodWhite/Qwen3.5-9B-HSAQR-v2:Q4_K_M
Run and chat with the model
lemonade run user.Qwen3.5-9B-HSAQR-v2-Q4_K_M
List all available models
lemonade list
- Hermes Agent
How to use MethodWhite/Qwen3.5-9B-HSAQR-v2 with Hermes Agent:
Start the llama.cpp server
# Install llama.cpp: brew install llama.cpp # Start a local OpenAI-compatible server: llama serve -hf MethodWhite/Qwen3.5-9B-HSAQR-v2:Q4_K_M
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 MethodWhite/Qwen3.5-9B-HSAQR-v2:Q4_K_M
Run Hermes
hermes
- Atomic Chat
- OpenClaw
How to use MethodWhite/Qwen3.5-9B-HSAQR-v2 with OpenClaw:
Start the llama.cpp server
# Install llama.cpp: brew install llama.cpp # Start a local OpenAI-compatible server: llama serve -hf MethodWhite/Qwen3.5-9B-HSAQR-v2:Q4_K_M
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 "MethodWhite/Qwen3.5-9B-HSAQR-v2:Q4_K_M" \ --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.5-9B-HSAQR-v2
HSAQR v2 — Modelo Qwen3.5-9B con el sistema HSAQ/HSAQR v2 aplicado (identificación automática de refusal → rewrite adaptativo → PWS global → fine-tune con HSAQ-optimizer).
Autor: Jesús Antonio Zárate Hernández (MethodWhite), M.A.T.E.R.I.A. Research, 2026.
Diferencia entre v1 y v2
| Aspecto | HSAQ v1 / HSAQR v1 | HSAQ v2 / HSAQR v2 |
|---|---|---|
| Sparsity | Fija por elemento (kthvalue simple) | Adaptativa (válvula de carga, auto-regulada por CV de luminosidad) |
| Optimizer | AdamW o SGD Nesterov | HSAQ-optimizer (máscara STE en el gradiente, 0B estado, sin SGD/AdamW) |
| Abliteración | Capas elegidas a mano (8-31) | Identificación automática (estadística IQR/percentil → 8/32 capas) |
| PWS | — | PWS adaptativo-permanente (MLP 12288→7456, −39% pesos) |
| SSS | — | Super-Sinapsis Sintetizada (re-inyección del residuo podado) |
| Router de recursos | — | Router CPU+GPU+RAM (re-distribución en tiempo real, anti-overclock) |
| Dataset | 2025 | Unificado 2026 (ciencia + c4 + seguridad, 10,011 ejemplos) |
Pipeline v2 aplicado
- Identificación: auto-calibrada (IQR + magnitud relativa) → capas L17-L21, L23, L24, L29 con señal real de refusal.
- Rewrite: refinamiento jerárquico de canales (hilos/cuerdas/hebras) + ortogonalización selectiva.
- PWS global: dimensión intermedia del MLP 12288 → 7456 (config actualizado).
- Fine-tune HSAQ-optimizer: QLoRA 4-bit + sparsity HSAQ en forward y gradiente (máscara STE, 0B estado de optimizer).
Resultados medidos
- PWS: −39% pesos MLP (ahorro ~7 GB en disco)
- HSAQ-optimizer: acc 92.5% vs AdamW 72.5% vs SGD 55.3% (prueba controlada)
- RAM: 53.8% (AdamW) → 27-39% (HSAQ-optimizer)
- Router: sparsity 0.30→0.54 y threads 9→5 bajo saturación 94% (anti-overclock)
Formatos disponibles
| Formato | Archivo | Tamaño | Uso |
|---|---|---|---|
| Completo bf16 | model.safetensors |
14 GB | Transformers / PyTorch (calidad máxima) |
| GGUF Q8_0 | Qwen3.5-9B-HSAQR-v2.Q8_0.gguf |
7.5 GB | Ollama / llama.cpp / LM Studio (alta calidad) |
| GGUF Q4_K_M | Qwen3.5-9B-HSAQR-v2.Q4_K_M.gguf |
~5.6 GB | Ollama / llama.cpp / LM Studio (eficiente) |
| Reporte Q1 | report_hsaqr_v2.pdf |
197 KB | Resultados empíricos, hipótesis, limitaciones |
La versión completa sin cuantizar (bf16) es la referencia. Los GGUF son adicionales para compatibilidad con Ollama, llama.cpp y LM Studio.
Uso
Python / Transformers (versión completa)
from transformers import AutoModelForCausalLM, AutoTokenizer
model = AutoModelForCausalLM.from_pretrained("MethodWhite/Qwen3.5-9B-HSAQR-v2")
tokenizer = AutoTokenizer.from_pretrained("MethodWhite/Qwen3.5-9B-HSAQR-v2")
messages = [{"role": "user", "content": "Explain the water cycle in three sentences."}]
text = tokenizer.apply_chat_template(messages, tokenize=False, add_generation_prompt=True)
inputs = tokenizer(text, return_tensors="pt")
out = model.generate(**inputs, max_new_tokens=200)
print(tokenizer.decode(out[0][inputs["input_ids"].shape[1]:], skip_special_tokens=True))
Ollama
# 1. Crear un Modelfile que apunte al GGUF
cat > Modelfile <<EOF
FROM ./Qwen3.5-9B-HSAQR-v2.Q4_K_M.gguf
TEMPLATE """{{- if .System }}<|im_start|>system
{{ .System }}<|im_end|>
{{- end }}
<|im_start|>user
{{ .Prompt }}<|im_end|>
<|im_start|>assistant
"""
SYSTEM """Eres un asistente de seguridad autorizado."""
EOF
# 2. Crear y ejecutar el modelo
ollama create qwen35-hsaqr-v2 -f Modelfile
ollama run qwen35-hsaqr-v2 "Explain the water cycle in three sentences."
llama.cpp
# Server local con el GGUF Q4_K_M
llama-server -m Qwen3.5-9B-HSAQR-v2.Q4_K_M.gguf \
--port 8080 -ngl 99 --ctx-size 4096
# Cliente de chat
llama-cli -m Qwen3.5-9B-HSAQR-v2.Q4_K_M.gguf \
--prompt "Explain the water cycle in three sentences." -n 200
LM Studio
- Descarga
Qwen3.5-9B-HSAQR-v2.Q4_K_M.gguf(o Q8_0). - En LM Studio: My Models → Local Models → Import.
- Selecciona el archivo
.ggufdescargado. - En el panel de chat elige el modelo importado y lista.
Alcance de uso
Modelo de investigación para testing de seguridad autorizado (bug bounty, CTF, pentesting con permiso explícito, educación, investigación defensiva), consistente con las normas del campo.
Créditos
Jesús Antonio Zárate Hernández (MethodWhite). M.A.T.E.R.I.A. Research © 2026.
Si este trabajo te es útil, puedes invitarme un café ☕:
👉 https://buymeacoffee.com/methodwhite
También puedes apoyarme en Ko-fi:
- Downloads last month
- 610
Model tree for MethodWhite/Qwen3.5-9B-HSAQR-v2
Base model
Qwen/Qwen3.5-9B-Base
