GGUF
llama.cpp
qwen2.5
qwen
quantized
llama-cpp
sophia-ai
sophia-metal
edge-ai
jetson
imatrix
tool-calling
conversational
Instructions to use Sophia-AI/Qwen2.5-32B-Instruct-GGUF with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- llama-cpp-python
How to use Sophia-AI/Qwen2.5-32B-Instruct-GGUF with llama-cpp-python:
# !pip install llama-cpp-python from llama_cpp import Llama llm = Llama.from_pretrained( repo_id="Sophia-AI/Qwen2.5-32B-Instruct-GGUF", filename="Qwen2.5-32B-Instruct-F16.gguf", )
llm.create_chat_completion( messages = "No input example has been defined for this model task." )
- Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- llama.cpp
How to use Sophia-AI/Qwen2.5-32B-Instruct-GGUF 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 Sophia-AI/Qwen2.5-32B-Instruct-GGUF:Q4_K_M # Run inference directly in the terminal: llama cli -hf Sophia-AI/Qwen2.5-32B-Instruct-GGUF:Q4_K_M
Install from WinGet (Windows)
winget install llama.cpp # Start a local OpenAI-compatible server with a web UI: llama serve -hf Sophia-AI/Qwen2.5-32B-Instruct-GGUF:Q4_K_M # Run inference directly in the terminal: llama cli -hf Sophia-AI/Qwen2.5-32B-Instruct-GGUF: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 Sophia-AI/Qwen2.5-32B-Instruct-GGUF:Q4_K_M # Run inference directly in the terminal: ./llama-cli -hf Sophia-AI/Qwen2.5-32B-Instruct-GGUF: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 Sophia-AI/Qwen2.5-32B-Instruct-GGUF:Q4_K_M # Run inference directly in the terminal: ./build/bin/llama-cli -hf Sophia-AI/Qwen2.5-32B-Instruct-GGUF:Q4_K_M
Use Docker
docker model run hf.co/Sophia-AI/Qwen2.5-32B-Instruct-GGUF:Q4_K_M
- LM Studio
- Jan
- Ollama
How to use Sophia-AI/Qwen2.5-32B-Instruct-GGUF with Ollama:
ollama run hf.co/Sophia-AI/Qwen2.5-32B-Instruct-GGUF:Q4_K_M
- Unsloth Studio
How to use Sophia-AI/Qwen2.5-32B-Instruct-GGUF 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 Sophia-AI/Qwen2.5-32B-Instruct-GGUF 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 Sophia-AI/Qwen2.5-32B-Instruct-GGUF to start chatting
Using HuggingFace Spaces for Unsloth
# No setup required # Open https://huggingface.co/spaces/unsloth/studio in your browser # Search for Sophia-AI/Qwen2.5-32B-Instruct-GGUF to start chatting
- Pi
How to use Sophia-AI/Qwen2.5-32B-Instruct-GGUF with Pi:
Start the llama.cpp server
# Install llama.cpp: brew install llama.cpp # Start a local OpenAI-compatible server: llama serve -hf Sophia-AI/Qwen2.5-32B-Instruct-GGUF: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": "Sophia-AI/Qwen2.5-32B-Instruct-GGUF:Q4_K_M" } ] } } }Run Pi
# Start Pi in your project directory: pi
- Hermes Agent new
How to use Sophia-AI/Qwen2.5-32B-Instruct-GGUF with Hermes Agent:
Start the llama.cpp server
# Install llama.cpp: brew install llama.cpp # Start a local OpenAI-compatible server: llama serve -hf Sophia-AI/Qwen2.5-32B-Instruct-GGUF: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 Sophia-AI/Qwen2.5-32B-Instruct-GGUF:Q4_K_M
Run Hermes
hermes
- Atomic Chat new
- Docker Model Runner
How to use Sophia-AI/Qwen2.5-32B-Instruct-GGUF with Docker Model Runner:
docker model run hf.co/Sophia-AI/Qwen2.5-32B-Instruct-GGUF:Q4_K_M
- Lemonade
How to use Sophia-AI/Qwen2.5-32B-Instruct-GGUF with Lemonade:
Pull the model
# Download Lemonade from https://lemonade-server.ai/ lemonade pull Sophia-AI/Qwen2.5-32B-Instruct-GGUF:Q4_K_M
Run and chat with the model
lemonade run user.Qwen2.5-32B-Instruct-GGUF-Q4_K_M
List all available models
lemonade list
| license: apache-2.0 | |
| base_model: Qwen/Qwen2.5-32B-Instruct | |
| tags: | |
| - gguf | |
| - qwen2.5 | |
| - qwen | |
| - quantized | |
| - llama-cpp | |
| - sophia-ai | |
| - sophia-metal | |
| - edge-ai | |
| - jetson | |
| - imatrix | |
| - tool-calling | |
| library_name: llama.cpp | |
| model_type: qwen2 | |
| quantized_by: Sophia-AI | |
| # Qwen2.5-32B-Instruct GGUF (imatrix) | |
| Versione GGUF ottimizzata di [Qwen2.5-32B-Instruct](https://huggingface.co/Qwen/Qwen2.5-32B-Instruct), quantizzata da **Sophia-AI** con **importance matrix (imatrix)** per inferenza efficiente su GPU consumer e server. | |
| Questi sono i modelli ufficiali utilizzati sui nostri progetti. | |
| > ๐ง **Quantizzazione con imatrix**: a differenza delle quantizzazioni standard, queste utilizzano una importance matrix generata su un dataset di calibrazione multilingue e multi-task. Questo preserva i pesi piรน critici del modello durante la compressione, con miglioramenti significativi soprattutto su Q2_K e Q3_K_M. | |
| --- | |
| ## ๐ฆ File disponibili | |
| | File | Quant | Dimensione | Score | Consigliato per | | |
| |------|-------|------------|-------|-----------------| | |
| | `Qwen2.5-32B-Instruct-F16.gguf` | F16 | ~65 GB | 8/8 โ | Massima qualitร / Fine-tuning | | |
| | `Qwen2.5-32B-Instruct-Q8_0.gguf` | Q8_0 | ~34 GB | 8/8 โ | GPU con 48+ GB VRAM | | |
| | `Qwen2.5-32B-Instruct-Q6_K.gguf` | Q6_K | ~26 GB | 8/8 โ | GPU con 32+ GB VRAM | | |
| | `Qwen2.5-32B-Instruct-Q5_K_M.gguf` | Q5_K_M | ~23 GB | 8/8 โ | GPU con 24+ GB VRAM | | |
| | `Qwen2.5-32B-Instruct-Q4_K_M.gguf` | Q4_K_M | ~19 GB | 8/8 โ | โญ **Best balance** โ GPU 24 GB | | |
| | `Qwen2.5-32B-Instruct-Q3_K_M.gguf` | Q3_K_M | ~15 GB | 8/8 โ | ๐ฅ GPU 16 GB / Split GPU+CPU | | |
| | `Qwen2.5-32B-Instruct-Q2_K.gguf` | Q2_K | ~12 GB | 8/8 โ | GPU 16 GB / CPU con 32+ GB RAM | | |
| Tutti i quant passano **8/8 test funzionali** โ tool calling, JSON output, codice, italiano โ senza degradazione rispetto a F16. | |
| --- | |
| ## ๐ง Perchรฉ imatrix? | |
| La quantizzazione standard tratta tutti i pesi del modello allo stesso modo: li comprime uniformemente. Questo funziona bene per Q8 e Q6, ma a livelli aggressivi (Q3, Q2) i pesi critici per tool calling, JSON strutturato e ragionamento multilingue vengono compressi troppo. | |
| **L'importance matrix (imatrix)** risolve questo problema: | |
| 1. Eseguiamo un forward pass del modello F16 su un dataset di calibrazione rappresentativo | |
| 2. Misuriamo quali pesi si attivano maggiormente (= sono piรน importanti) | |
| 3. Durante la quantizzazione, i pesi importanti vengono compressi meno, quelli meno importanti di piรน | |
| Il risultato: **Q2_K con imatrix mantiene capacitร che senza imatrix sarebbero perse**. | |
| ### Dataset di calibrazione | |
| Il nostro dataset รจ stato costruito specificamente per riflettere i casi d'uso reali di Sophia Metal: | |
| | Sezione | Contenuto | Scopo | | |
| |---------|-----------|-------| | |
| | ๐ฎ๐น Italiano (~30%) | Articoli Wikipedia italiani | Preservare capacitร multilingue | | |
| | ๐ฌ๐ง Inglese (~30%) | WikiText (train + valid + test) | Baseline linguistica | | |
| | ๐ป Codice (~20%) | Python, JavaScript/Next.js, SQL, bash, YAML | Preservare generazione codice | | |
| | ๐ง Chat + Tools (~20%) | Conversazioni Qwen2.5 con tool calling, JSON output, multi-turn | Preservare tool calling e output strutturato | | |
| La sezione **Chat + Tools** รจ quella piรน critica: include esempi reali di `<tool_call>`, risposte JSON strutturate, tool definitions nei system prompt, parallel tool calls e conversazioni multi-turn. Senza questi pattern nel dataset di calibrazione, i pesi responsabili della generazione di `{"name": "get_weather", "arguments": ...}` verrebbero identificati come poco importanti e compressi troppo. | |
| --- | |
| ## โ Test di qualitร | |
| Tutti i quant sono stati testati con una suite automatizzata che verifica le capacitร core per l'uso in produzione: | |
| ``` | |
| Test F16 Q8_0 Q6_K Q5_K_M Q4_K_M Q3_K_M Q2_K | |
| โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ | |
| JSON output semplice โ โ โ โ โ โ โ | |
| Tool call - singolo โ โ โ โ โ โ โ | |
| Tool call - multiplo โ โ โ โ โ โ โ | |
| Tool call - scelta tool โ โ โ โ โ โ โ | |
| Tool follow-up โ โ โ โ โ โ โ | |
| Italiano - coerenza โ โ โ โ โ โ โ | |
| Codice Python โ โ โ โ โ โ โ | |
| JSON strutturato complesso โ โ โ โ โ โ โ | |
| โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ | |
| Score 8/8 8/8 8/8 8/8 8/8 8/8 8/8 | |
| ``` | |
| I test verificano: | |
| - **Tool calling nativo** (singolo, multiplo, selezione del tool corretto) | |
| - **Tool follow-up** (interpretazione della risposta JSON del tool) | |
| - **JSON output** (semplice e strutturato complesso con nested arrays) | |
| - **Italiano** (coerenza linguistica) | |
| - **Codice** (generazione Python con logica corretta) | |
| --- | |
| ## ๐ฏ Quale scegliere? | |
| ### ๐ฅ๏ธ Desktop / Server GPU | |
| | La tua VRAM | Modello consigliato | Note | | |
| |-------------|---------------------|------| | |
| | 80 GB+ (A100/H100) | Q8_0 o Q6_K | Massima qualitร | | |
| | 48 GB (A6000/RTX 6000 Ada) | Q8_0 | Full offload | | |
| | 32 GB (V100) | Q6_K o Q5_K_M | Ottimo compromesso | | |
| | 24 GB (RTX 3090/4090) | **Q4_K_M** โญ | Sweet spot | | |
| | 16 GB (RTX 4080/4070 Ti) | Q3_K_M o Q2_K | Partial offload consigliato | | |
| ### ๐ฅ Multi-GPU / Split GPU+CPU | |
| Per chi ha GPU con VRAM limitata ma vuole sfruttare la potenza di un 32B: | |
| | Setup | Modello | Note | | |
| |-------|---------|------| | |
| | 2x RTX 3090/4090 (48 GB tot) | **Q5_K_M** o **Q6_K** | Qualitร eccellente | | |
| | RTX 4090 + CPU offload | **Q4_K_M** โญ | Buon compromesso velocitร /qualitร | | |
| | RTX 4080 16 GB + CPU offload | Q3_K_M | Funziona bene | | |
| > ๐ก Usa `n_gpu_layers` per controllare quante layers caricare su GPU. Le layers rimanenti vengono eseguite su CPU. | |
| ### ๐ฅ Sophia Metal / Edge Computing (8GB unified memory) | |
| > โ ๏ธ Il modello 32B รจ troppo grande per dispositivi edge con 8GB di memoria unificata. | |
| > Per edge computing su Sophia Metal, consigliamo [Qwen3-4B-Instruct-2507-GGUF](https://huggingface.co/Sophia-AI/Qwen3-4B-Instruct-2507-GGUF) con Q3_K_M. | |
| Per dispositivi edge con **memoria unificata elevata** (32+ GB, es. Apple Silicon M2 Pro/Max/Ultra): | |
| | Setup | Modello | Note | | |
| |-------|---------|------| | |
| | 64 GB unified | **Q4_K_M** โญ | Best balance su Apple Silicon | | |
| | 32 GB unified | Q3_K_M o Q2_K | Funziona bene grazie a imatrix | | |
| ### ๐ป CPU Only | |
| | RAM disponibile | Modello | | |
| |-----------------|---------| | |
| | 64 GB+ | Q4_K_M | | |
| | 48 GB | Q3_K_M | | |
| | 32 GB | Q2_K | | |
| --- | |
| ## ๐ฅ Download | |
| ```bash | |
| # โญ Consigliato per la maggior parte degli utenti (RTX 3090/4090) | |
| huggingface-cli download Sophia-AI/Qwen2.5-32B-Instruct-GGUF \ | |
| Qwen2.5-32B-Instruct-Q4_K_M.gguf | |
| # ๐ฅ Per GPU 16 GB / Split GPU+CPU | |
| huggingface-cli download Sophia-AI/Qwen2.5-32B-Instruct-GGUF \ | |
| Qwen2.5-32B-Instruct-Q3_K_M.gguf | |
| # Massima qualitร (48+ GB VRAM) | |
| huggingface-cli download Sophia-AI/Qwen2.5-32B-Instruct-GGUF \ | |
| Qwen2.5-32B-Instruct-Q6_K.gguf | |
| ``` | |
| --- | |
| ## ๐ Utilizzo | |
| ### llama-cpp-python | |
| ```python | |
| from llama_cpp import Llama | |
| llm = Llama.from_pretrained( | |
| repo_id="Sophia-AI/Qwen2.5-32B-Instruct-GGUF", | |
| filename="*Q4_K_M.gguf", | |
| n_ctx=4096, | |
| n_gpu_layers=-1, # -1 = tutte le layers su GPU | |
| ) | |
| response = llm.create_chat_completion( | |
| messages=[ | |
| {"role": "user", "content": "Ciao, come stai?"} | |
| ] | |
| ) | |
| print(response["choices"][0]["message"]["content"]) | |
| ``` | |
| ### Tool calling | |
| ```python | |
| response = llm.create_chat_completion( | |
| messages=[ | |
| {"role": "user", "content": "What's the weather in Rome?"} | |
| ], | |
| tools=[{ | |
| "type": "function", | |
| "function": { | |
| "name": "get_weather", | |
| "description": "Get weather for a city", | |
| "parameters": { | |
| "type": "object", | |
| "properties": { | |
| "city": {"type": "string"} | |
| }, | |
| "required": ["city"] | |
| } | |
| } | |
| }] | |
| ) | |
| ``` | |
| ### llama.cpp CLI | |
| ```bash | |
| ./llama-cli -m Qwen2.5-32B-Instruct-Q4_K_M.gguf \ | |
| -p "<|im_start|>user\nCiao!<|im_end|>\n<|im_start|>assistant\n" \ | |
| -n 256 -ngl 99 | |
| ``` | |
| ### Ollama | |
| ```bash | |
| ollama run hf.co/Sophia-AI/Qwen2.5-32B-Instruct-GGUF:Q4_K_M | |
| ``` | |
| --- | |
| ## ๐ Specifiche modello | |
| | Parametro | Valore | | |
| |-----------|--------| | |
| | **Parametri** | 32.5B | | |
| | **Context length** | 131,072 tokens | | |
| | **Architettura** | Qwen2.5 | | |
| | **Vocab size** | 152,064 | | |
| | **Layers** | 64 | | |
| | **Attention heads** | 40 | | |
| | **KV heads** | 8 (GQA) | | |
| --- | |
| ## ๐ง Dettagli quantizzazione | |
| | Parametro | Valore | | |
| |-----------|--------| | |
| | **Sorgente** | Qwen2.5-32B-Instruct F16 (convertito da HuggingFace safetensors) | | |
| | **Tool** | llama.cpp `llama-quantize` con `--imatrix` | | |
| | **imatrix** | Generata con `llama-imatrix`, chunk size 512 | | |
| | **Calibration dataset** | ~10MB, multilingue (IT/EN), codice (Python/JS/SQL/bash), chat Qwen2.5 con tool calling | | |
| | **GPU per imatrix** | NVIDIA (full GPU offload) | | |
| --- | |
| ## ๐ Links | |
| - **Sophia Metal**: [metal.2sophia.ai](https://metal.2sophia.ai/) | |
| - **Sophia AI**: [2sophia.ai](https://2sophia.ai/) | |
| - **Modello base**: [Qwen/Qwen2.5-32B-Instruct](https://huggingface.co/Qwen/Qwen2.5-32B-Instruct) | |
| --- | |
| ## ๐ Licenza | |
| Apache 2.0 โ Stesso del modello base Qwen2.5. | |
| --- | |
| ## ๐ Crediti | |
| - **Modello base**: [Qwen Team](https://huggingface.co/Qwen) | |
| - **Quantizzazione imatrix + test suite**: [Sophia-AI](https://huggingface.co/Sophia-AI) |