初始化项目,由ModelHub XC社区提供模型

Model: Mungert/Phi-4-reasoning-GGUF
Source: Original Platform
This commit is contained in:
ModelHub XC
2026-05-30 09:19:16 +08:00
commit 455e4fe4c1
33 changed files with 646 additions and 0 deletions

80
.gitattributes vendored Normal file
View File

@@ -0,0 +1,80 @@
*.7z filter=lfs diff=lfs merge=lfs -text
*.arrow filter=lfs diff=lfs merge=lfs -text
*.bin filter=lfs diff=lfs merge=lfs -text
*.bz2 filter=lfs diff=lfs merge=lfs -text
*.ckpt filter=lfs diff=lfs merge=lfs -text
*.ftz filter=lfs diff=lfs merge=lfs -text
*.gz filter=lfs diff=lfs merge=lfs -text
*.h5 filter=lfs diff=lfs merge=lfs -text
*.joblib filter=lfs diff=lfs merge=lfs -text
*.lfs.* filter=lfs diff=lfs merge=lfs -text
*.mlmodel filter=lfs diff=lfs merge=lfs -text
*.model filter=lfs diff=lfs merge=lfs -text
*.msgpack filter=lfs diff=lfs merge=lfs -text
*.npy filter=lfs diff=lfs merge=lfs -text
*.npz filter=lfs diff=lfs merge=lfs -text
*.onnx filter=lfs diff=lfs merge=lfs -text
*.ot filter=lfs diff=lfs merge=lfs -text
*.parquet filter=lfs diff=lfs merge=lfs -text
*.pb filter=lfs diff=lfs merge=lfs -text
*.pickle filter=lfs diff=lfs merge=lfs -text
*.pkl filter=lfs diff=lfs merge=lfs -text
*.pt filter=lfs diff=lfs merge=lfs -text
*.pth filter=lfs diff=lfs merge=lfs -text
*.rar filter=lfs diff=lfs merge=lfs -text
*.safetensors filter=lfs diff=lfs merge=lfs -text
saved_model/**/* filter=lfs diff=lfs merge=lfs -text
*.tar.* filter=lfs diff=lfs merge=lfs -text
*.tar filter=lfs diff=lfs merge=lfs -text
*.tflite filter=lfs diff=lfs merge=lfs -text
*.tgz filter=lfs diff=lfs merge=lfs -text
*.wasm filter=lfs diff=lfs merge=lfs -text
*.xz filter=lfs diff=lfs merge=lfs -text
*.zip filter=lfs diff=lfs merge=lfs -text
*.zst filter=lfs diff=lfs merge=lfs -text
*tfevents* filter=lfs diff=lfs merge=lfs -text
Phi-4-reasoning-f16_q8_0.gguf filter=lfs diff=lfs merge=lfs -text
Phi-4-reasoning-bf16_q8_0.gguf filter=lfs diff=lfs merge=lfs -text
Phi-4-reasoning-f16_q6_k.gguf filter=lfs diff=lfs merge=lfs -text
Phi-4-reasoning-bf16_q6_k.gguf filter=lfs diff=lfs merge=lfs -text
Phi-4-reasoning-f16_q4_k.gguf filter=lfs diff=lfs merge=lfs -text
Phi-4-reasoning-bf16_q4_k.gguf filter=lfs diff=lfs merge=lfs -text
Phi-4-reasoning-q2_k_l.gguf filter=lfs diff=lfs merge=lfs -text
Phi-4-reasoning-q3_k_l.gguf filter=lfs diff=lfs merge=lfs -text
Phi-4-reasoning-q4_k_l.gguf filter=lfs diff=lfs merge=lfs -text
Phi-4-reasoning-q5_k_l.gguf filter=lfs diff=lfs merge=lfs -text
Phi-4-reasoning-q6_k_l.gguf filter=lfs diff=lfs merge=lfs -text
Phi-4-reasoning-q2_k_s.gguf filter=lfs diff=lfs merge=lfs -text
Phi-4-reasoning-q3_k_m.gguf filter=lfs diff=lfs merge=lfs -text
Phi-4-reasoning-q3_k_s.gguf filter=lfs diff=lfs merge=lfs -text
Phi-4-reasoning-q4_k_m.gguf filter=lfs diff=lfs merge=lfs -text
Phi-4-reasoning-q4_k_s.gguf filter=lfs diff=lfs merge=lfs -text
Phi-4-reasoning-q5_k_m.gguf filter=lfs diff=lfs merge=lfs -text
Phi-4-reasoning-q5_k_s.gguf filter=lfs diff=lfs merge=lfs -text
Phi-4-reasoning-q6_k_m.gguf filter=lfs diff=lfs merge=lfs -text
Phi-4-reasoning-q8_0.gguf filter=lfs diff=lfs merge=lfs -text
Phi-4-reasoning-q4_0.gguf filter=lfs diff=lfs merge=lfs -text
Phi-4-reasoning-q4_1.gguf filter=lfs diff=lfs merge=lfs -text
Phi-4-reasoning-q4_0_l.gguf filter=lfs diff=lfs merge=lfs -text
Phi-4-reasoning-q4_1_l.gguf filter=lfs diff=lfs merge=lfs -text
Phi-4-reasoning-q5_0.gguf filter=lfs diff=lfs merge=lfs -text
Phi-4-reasoning-q5_1.gguf filter=lfs diff=lfs merge=lfs -text
Phi-4-reasoning-q5_0_l.gguf filter=lfs diff=lfs merge=lfs -text
Phi-4-reasoning-q5_1_l.gguf filter=lfs diff=lfs merge=lfs -text
Phi-4-reasoning-iq1_s.gguf filter=lfs diff=lfs merge=lfs -text
Phi-4-reasoning-iq1_m.gguf filter=lfs diff=lfs merge=lfs -text
Phi-4-reasoning-iq2_xs.gguf filter=lfs diff=lfs merge=lfs -text
Phi-4-reasoning-iq2_xxs.gguf filter=lfs diff=lfs merge=lfs -text
Phi-4-reasoning-iq2_s.gguf filter=lfs diff=lfs merge=lfs -text
Phi-4-reasoning-iq2_m.gguf filter=lfs diff=lfs merge=lfs -text
Phi-4-reasoning-iq3_xs.gguf filter=lfs diff=lfs merge=lfs -text
Phi-4-reasoning-iq3_xxs.gguf filter=lfs diff=lfs merge=lfs -text
Phi-4-reasoning-iq3_s.gguf filter=lfs diff=lfs merge=lfs -text
Phi-4-reasoning-iq3_m.gguf filter=lfs diff=lfs merge=lfs -text
Phi-4-reasoning-iq4_xs.gguf filter=lfs diff=lfs merge=lfs -text
Phi-4-reasoning-iq4_nl.gguf filter=lfs diff=lfs merge=lfs -text
Phi-4-reasoning-tq1_0.gguf filter=lfs diff=lfs merge=lfs -text
Phi-4-reasoning-tq2_0.gguf filter=lfs diff=lfs merge=lfs -text
Phi-4-reasoning.imatrix filter=lfs diff=lfs merge=lfs -text
Phi-4-reasoning-f16.gguf filter=lfs diff=lfs merge=lfs -text
Phi-4-reasoning-bf16.gguf filter=lfs diff=lfs merge=lfs -text

View File

@@ -0,0 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:0b02df0e636a1f7f992046410ffeb328e6d2db54035b6066af2947f6189f2c56
size 29323400992

View File

@@ -0,0 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:a70d2860b71287302e93a474fccf13d783d9ed181edf2d1bbfa4c1f97d063bdc
size 16543880992

View File

@@ -0,0 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:f456808a41762cc6e7c344de1d9a7b5c14438060ccf0438d3b5b6466d1d25a54
size 16543880992

View File

@@ -0,0 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:8c55f91c1274d52e530b0b175bf0be166bbe2e66bad40bd7a95e02225eb277c6
size 4193294368

View File

@@ -0,0 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:f0c4f9426f07ffc2274a9fe5ad534c75e863233a5dfefdba3d1c9ad24dc37cbf
size 3984398368

View File

@@ -0,0 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:3a4643ad66ed994ec6e5cf6efc5e1e07fe4338c704c047825f828cf8e802ca75
size 5780494368

View File

@@ -0,0 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:16d3c77fafc5b31bc84296976fe89d7dedb32a67ade19afbfe2be6aa4604b9ed
size 5501966368

View File

@@ -0,0 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:b23c6732c75e80ebbbd8a555fb0c38435af41e7484092ffcb3017458978b8173
size 4852750368

View File

@@ -0,0 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:d84be010e1495f4da1de930cc110656484701629f9ba6b9156fcf09ccfbd8ee4
size 4541454368

View File

@@ -0,0 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:915211e72149d9d14b1470d12d3bc3ce14b1383ac443b64510dfe23c8d00f204
size 6978062368

View File

@@ -0,0 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:afb1598f5cf457eeb71ee795034333334caf055e6b3f9d5b69c8011d2e893932
size 6568974368

View File

@@ -0,0 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:3ffb989272622e15d716ae84f6e156aabed925c96f986ca4da486056f2d547a2
size 6310926368

View File

@@ -0,0 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:607b2b7c6141dda1ad354abc431d9b39c3cadd1c0898563d6604e91a646352c9
size 5979150368

View File

@@ -0,0 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:7fe9d09fce47a28e340ec8e76982d2c6a797432efeda4225783b897d5f1f86cb
size 8383420448

View File

@@ -0,0 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:6c9831c6ac7d1a73a44118e5b7ed90582093c7b3351e6a6cd366421ac7921063
size 7941380128

View File

@@ -0,0 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:73ede04b57375cb5f1aba4a56fb28ba683ea5c00b59e1ba1010d40211a0c43d1
size 5292046368

View File

@@ -0,0 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:aa50d9ff9466acb6882a892698eb46f2a41500376bd994d01d6087223bf9b4b5
size 7563974688

View File

@@ -0,0 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:230b22889fc3fc816c0eaf1b9f557eb858c008d4c27bd08a422db61a106c5bc2
size 6568974368

View File

@@ -0,0 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:0f4fab109db7f38d58d793ef6ac08644f8c79e650a5b908628200e9b16936cd3
size 8250955808

View File

@@ -0,0 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:33ad01a25a444ed51abecaa5050d7332d3d15060a9f8016654653b836f7a331a
size 9167149088

View File

@@ -0,0 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:7bc49391f9ef049143c5296bc4305e317012ac110abda535b95e3e3108905fff
size 9185581088

View File

@@ -0,0 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:2ddee44f376fd34ef50f0b2adf10addb7a70da458e8d335d743c83872b477239
size 8573229088

View File

@@ -0,0 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:af3d3b2fd25f2810e1d83a546853c3dd50a5e5e44c9837fc6191a839e75611b1
size 10083342368

View File

@@ -0,0 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:5ee86e0cf947a2a581a2f01a319e33fa8f8b79153512481f9c5364dd8656eff1
size 10999535648

View File

@@ -0,0 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:e41abe21a4038844e9763a5b7b94479326f2004be3f401cf44739cb1edcae35b
size 10672429088

View File

@@ -0,0 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:58e10d716c50cccaa5240f814c527ef2230d317b27715cad7bc7072ba5fd1642
size 10219821088

View File

@@ -0,0 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:a784e0674d9b4b0fc0929d804d58f3d454745ac36e361fccec91785e0d43de9e
size 12030253088

View File

@@ -0,0 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:5d5691085e796e380085dc059afffb586d682060f970db1f918346c06846de84
size 15580501792

View File

@@ -0,0 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:406b0af95d857aa68f810e5048e227b88e503be74ccae4f50b0e018b4b188681
size 3591100448

View File

@@ -0,0 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:edb63517cd3ab254687a9bd0411bbf918e53a44728bf90a03c7b1a2aaed8de6f
size 4230076448

3
Phi-4-reasoning.imatrix Normal file
View File

@@ -0,0 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:21eff9ba02390b6daee1b5d74ba8ca4123e1e2a3bb24b00b17af22971a2cf6e3
size 5330288

473
README.md Normal file
View File

@@ -0,0 +1,473 @@
---
license: mit
license_link: https://huggingface.co/microsoft/Phi-4-reasoning/resolve/main/LICENSE
language:
- en
base_model:
- microsoft/phi-4
pipeline_tag: text-generation
tags:
- phi
- nlp
- math
- code
- chat
- conversational
- reasoning
inference:
parameters:
temperature: 0
widget:
- messages:
- role: user
content: What is the derivative of x^2?
library_name: transformers
---
# <span style="color: #7FFF7F;">Phi-4-reasoning GGUF Models</span>
## <span style="color: #7F7FFF;">Model Generation Details</span>
This model was generated using [llama.cpp](https://github.com/ggerganov/llama.cpp) at commit [`19e899c`](https://github.com/ggerganov/llama.cpp/commit/19e899ce21a7c9ffcf8bb2b22269a75f6e078f8f).
## <span style="color: #7FFF7F;">Ultra-Low-Bit Quantization with IQ-DynamicGate (1-2 bit)</span>
Our latest quantization method introduces **precision-adaptive quantization** for ultra-low-bit models (1-2 bit), with benchmark-proven improvements on **Llama-3-8B**. This approach uses layer-specific strategies to preserve accuracy while maintaining extreme memory efficiency.
### **Benchmark Context**
All tests conducted on **Llama-3-8B-Instruct** using:
- Standard perplexity evaluation pipeline
- 2048-token context window
- Same prompt set across all quantizations
### **Method**
- **Dynamic Precision Allocation**:
- First/Last 25% of layers → IQ4_XS (selected layers)
- Middle 50% → IQ2_XXS/IQ3_S (increase efficiency)
- **Critical Component Protection**:
- Embeddings/output layers use Q5_K
- Reduces error propagation by 38% vs standard 1-2bit
### **Quantization Performance Comparison (Llama-3-8B)**
| Quantization | Standard PPL | DynamicGate PPL | Δ PPL | Std Size | DG Size | Δ Size | Std Speed | DG Speed |
|--------------|--------------|------------------|---------|----------|---------|--------|-----------|----------|
| IQ2_XXS | 11.30 | 9.84 | -12.9% | 2.5G | 2.6G | +0.1G | 234s | 246s |
| IQ2_XS | 11.72 | 11.63 | -0.8% | 2.7G | 2.8G | +0.1G | 242s | 246s |
| IQ2_S | 14.31 | 9.02 | -36.9% | 2.7G | 2.9G | +0.2G | 238s | 244s |
| IQ1_M | 27.46 | 15.41 | -43.9% | 2.2G | 2.5G | +0.3G | 206s | 212s |
| IQ1_S | 53.07 | 32.00 | -39.7% | 2.1G | 2.4G | +0.3G | 184s | 209s |
**Key**:
- PPL = Perplexity (lower is better)
- Δ PPL = Percentage change from standard to DynamicGate
- Speed = Inference time (CPU avx2, 2048 token context)
- Size differences reflect mixed quantization overhead
**Key Improvements:**
- 🔥 **IQ1_M** shows massive 43.9% perplexity reduction (27.46 → 15.41)
- 🚀 **IQ2_S** cuts perplexity by 36.9% while adding only 0.2GB
-**IQ1_S** maintains 39.7% better accuracy despite 1-bit quantization
**Tradeoffs:**
- All variants have modest size increases (0.1-0.3GB)
- Inference speeds remain comparable (<5% difference)
### **When to Use These Models**
📌 **Fitting models into GPU VRAM**
**Memory-constrained deployments**
**Cpu and Edge Devices** where 1-2bit errors can be tolerated
**Research** into ultra-low-bit quantization
## **Choosing the Right Model Format**
Selecting the correct model format depends on your **hardware capabilities** and **memory constraints**.
### **BF16 (Brain Float 16) Use if BF16 acceleration is available**
- A 16-bit floating-point format designed for **faster computation** while retaining good precision.
- Provides **similar dynamic range** as FP32 but with **lower memory usage**.
- Recommended if your hardware supports **BF16 acceleration** (check your device's specs).
- Ideal for **high-performance inference** with **reduced memory footprint** compared to FP32.
📌 **Use BF16 if:**
Your hardware has native **BF16 support** (e.g., newer GPUs, TPUs).
You want **higher precision** while saving memory.
You plan to **requantize** the model into another format.
📌 **Avoid BF16 if:**
Your hardware does **not** support BF16 (it may fall back to FP32 and run slower).
You need compatibility with older devices that lack BF16 optimization.
---
### **F16 (Float 16) More widely supported than BF16**
- A 16-bit floating-point **high precision** but with less of range of values than BF16.
- Works on most devices with **FP16 acceleration support** (including many GPUs and some CPUs).
- Slightly lower numerical precision than BF16 but generally sufficient for inference.
📌 **Use F16 if:**
Your hardware supports **FP16** but **not BF16**.
You need a **balance between speed, memory usage, and accuracy**.
You are running on a **GPU** or another device optimized for FP16 computations.
📌 **Avoid F16 if:**
Your device lacks **native FP16 support** (it may run slower than expected).
You have memory limitations.
---
### **Quantized Models (Q4_K, Q6_K, Q8, etc.) For CPU & Low-VRAM Inference**
Quantization reduces model size and memory usage while maintaining as much accuracy as possible.
- **Lower-bit models (Q4_K)** **Best for minimal memory usage**, may have lower precision.
- **Higher-bit models (Q6_K, Q8_0)** **Better accuracy**, requires more memory.
📌 **Use Quantized Models if:**
You are running inference on a **CPU** and need an optimized model.
Your device has **low VRAM** and cannot load full-precision models.
You want to reduce **memory footprint** while keeping reasonable accuracy.
📌 **Avoid Quantized Models if:**
You need **maximum accuracy** (full-precision models are better for this).
Your hardware has enough VRAM for higher-precision formats (BF16/F16).
---
### **Very Low-Bit Quantization (IQ3_XS, IQ3_S, IQ3_M, Q4_K, Q4_0)**
These models are optimized for **extreme memory efficiency**, making them ideal for **low-power devices** or **large-scale deployments** where memory is a critical constraint.
- **IQ3_XS**: Ultra-low-bit quantization (3-bit) with **extreme memory efficiency**.
- **Use case**: Best for **ultra-low-memory devices** where even Q4_K is too large.
- **Trade-off**: Lower accuracy compared to higher-bit quantizations.
- **IQ3_S**: Small block size for **maximum memory efficiency**.
- **Use case**: Best for **low-memory devices** where **IQ3_XS** is too aggressive.
- **IQ3_M**: Medium block size for better accuracy than **IQ3_S**.
- **Use case**: Suitable for **low-memory devices** where **IQ3_S** is too limiting.
- **Q4_K**: 4-bit quantization with **block-wise optimization** for better accuracy.
- **Use case**: Best for **low-memory devices** where **Q6_K** is too large.
- **Q4_0**: Pure 4-bit quantization, optimized for **ARM devices**.
- **Use case**: Best for **ARM-based devices** or **low-memory environments**.
---
### **Summary Table: Model Format Selection**
| Model Format | Precision | Memory Usage | Device Requirements | Best Use Case |
|--------------|------------|---------------|----------------------|---------------|
| **BF16** | Highest | High | BF16-supported GPU/CPUs | High-speed inference with reduced memory |
| **F16** | High | High | FP16-supported devices | GPU inference when BF16 isn't available |
| **Q4_K** | Medium Low | Low | CPU or Low-VRAM devices | Best for memory-constrained environments |
| **Q6_K** | Medium | Moderate | CPU with more memory | Better accuracy while still being quantized |
| **Q8_0** | High | Moderate | CPU or GPU with enough VRAM | Best accuracy among quantized models |
| **IQ3_XS** | Very Low | Very Low | Ultra-low-memory devices | Extreme memory efficiency and low accuracy |
| **Q4_0** | Low | Low | ARM or low-memory devices | llama.cpp can optimize for ARM devices |
---
## **Included Files & Details**
### `Phi-4-reasoning-bf16.gguf`
- Model weights preserved in **BF16**.
- Use this if you want to **requantize** the model into a different format.
- Best if your device supports **BF16 acceleration**.
### `Phi-4-reasoning-f16.gguf`
- Model weights stored in **F16**.
- Use if your device supports **FP16**, especially if BF16 is not available.
### `Phi-4-reasoning-bf16-q8_0.gguf`
- **Output & embeddings** remain in **BF16**.
- All other layers quantized to **Q8_0**.
- Use if your device supports **BF16** and you want a quantized version.
### `Phi-4-reasoning-f16-q8_0.gguf`
- **Output & embeddings** remain in **F16**.
- All other layers quantized to **Q8_0**.
### `Phi-4-reasoning-q4_k.gguf`
- **Output & embeddings** quantized to **Q8_0**.
- All other layers quantized to **Q4_K**.
- Good for **CPU inference** with limited memory.
### `Phi-4-reasoning-q4_k_s.gguf`
- Smallest **Q4_K** variant, using less memory at the cost of accuracy.
- Best for **very low-memory setups**.
### `Phi-4-reasoning-q6_k.gguf`
- **Output & embeddings** quantized to **Q8_0**.
- All other layers quantized to **Q6_K** .
### `Phi-4-reasoning-q8_0.gguf`
- Fully **Q8** quantized model for better accuracy.
- Requires **more memory** but offers higher precision.
### `Phi-4-reasoning-iq3_xs.gguf`
- **IQ3_XS** quantization, optimized for **extreme memory efficiency**.
- Best for **ultra-low-memory devices**.
### `Phi-4-reasoning-iq3_m.gguf`
- **IQ3_M** quantization, offering a **medium block size** for better accuracy.
- Suitable for **low-memory devices**.
### `Phi-4-reasoning-q4_0.gguf`
- Pure **Q4_0** quantization, optimized for **ARM devices**.
- Best for **low-memory environments**.
- Prefer IQ4_NL for better accuracy.
# <span id="testllm" style="color: #7F7FFF;">🚀 If you find these models useful</span>
**Please click "Like" if you find this useful!**
Help me test my **AI-Powered Network Monitor Assistant** with **quantum-ready security checks**:
👉 [Quantum Network Monitor](https://readyforquantum.com/dashboard/?assistant=open&utm_source=huggingface&utm_medium=referral&utm_campaign=huggingface_repo_readme)
💬 **How to test**:
Choose an **AI assistant type**:
- `TurboLLM` (GPT-4o-mini)
- `HugLLM` (Hugginface Open-source)
- `TestLLM` (Experimental CPU-only)
### **What Im Testing**
Im pushing the limits of **small open-source models for AI network monitoring**, specifically:
- **Function calling** against live network services
- **How small can a model go** while still handling:
- Automated **Nmap scans**
- **Quantum-readiness checks**
- **Network Monitoring tasks**
🟡 **TestLLM** Current experimental model (llama.cpp on 2 CPU threads):
- **Zero-configuration setup**
- 30s load time (slow inference but **no API costs**)
- 🔧 **Help wanted!** If youre into **edge-device AI**, lets collaborate!
### **Other Assistants**
🟢 **TurboLLM** Uses **gpt-4o-mini** for:
- **Create custom cmd processors to run .net code on Quantum Network Monitor Agents**
- **Real-time network diagnostics and monitoring**
- **Security Audits**
- **Penetration testing** (Nmap/Metasploit)
🔵 **HugLLM** Latest Open-source models:
- 🌐 Runs on Hugging Face Inference API
### 💡 **Example commands to you could test**:
1. `"Give me info on my websites SSL certificate"`
2. `"Check if my server is using quantum safe encyption for communication"`
3. `"Run a comprehensive security audit on my server"`
4. '"Create a cmd processor to .. (what ever you want)" Note you need to install a Quantum Network Monitor Agent to run the .net code from. This is a very flexible and powerful feature. Use with caution!
### Final Word
I fund the servers used to create these model files, run the Quantum Network Monitor service, and pay for inference from Novita and OpenAIall out of my own pocket. All the code behind the model creation and the Quantum Network Monitor project is [open source](https://github.com/Mungert69). Feel free to use whatever you find helpful.
If you appreciate the work, please consider [buying me a coffee](https://www.buymeacoffee.com/mahadeva) ☕. Your support helps cover service costs and allows me to raise token limits for everyone.
I'm also open to job opportunities or sponsorship.
Thank you! 😊
# Phi-4-reasoning Model Card
[Phi-4-reasoning Technical Report](https://aka.ms/phi-reasoning/techreport)
## Model Summary
| | |
|-------------------------|-------------------------------------------------------------------------------|
| **Developers** | Microsoft Research |
| **Description** | Phi-4-reasoning is a state-of-the-art open-weight reasoning model finetuned from Phi-4 using supervised fine-tuning on a dataset of chain-of-thought traces and reinforcement learning. The supervised fine-tuning dataset includes a blend of synthetic prompts and high-quality filtered data from public domain websites, focused on math, science, and coding skills as well as alignment data for safety and Responsible AI. The goal of this approach was to ensure that small capable models were trained with data focused on high quality and advanced reasoning. |
| **Architecture** | Base model same as previously released Phi-4, 14B parameters, dense decoder-only Transformer model |
| **Inputs** | Text, best suited for prompts in the chat format |
| **Context length** | 32k tokens |
| **GPUs** | 32 H100-80G |
| **Training time** | 2.5 days |
| **Training data** | 16B tokens, ~8.3B unique tokens |
| **Outputs** | Generated text in response to the input. Model responses have two sections, namely, a reasoning chain-of-thought block followed by a summarization block |
| **Dates** | January 2025 April 2025 |
| **Status** | Static model trained on an offline dataset with cutoff dates of March 2025 and earlier for publicly available data |
| **Release date** | April 30, 2025 |
| **License** | MIT |
## Intended Use
| | |
|-------------------------------|-------------------------------------------------------------------------|
| **Primary Use Cases** | Our model is designed to accelerate research on language models, for use as a building block for generative AI powered features. It provides uses for general purpose AI systems and applications (primarily in English) which require:<br><br>1. Memory/compute constrained environments.<br>2. Latency bound scenarios.<br>3. Reasoning and logic. |
| **Out-of-Scope Use Cases** | This model is designed and tested for math reasoning only. Our models are not specifically designed or evaluated for all downstream purposes. Developers should consider common limitations of language models as they select use cases, and evaluate and mitigate for accuracy, safety, and fairness before using within a specific downstream use case, particularly for high-risk scenarios. Developers should be aware of and adhere to applicable laws or regulations (including privacy, trade compliance laws, etc.) that are relevant to their use case, including the models focus on English. Review the Responsible AI Considerations section below for further guidance when choosing a use case. Nothing contained in this Model Card should be interpreted as or deemed a restriction or modification to the license the model is released under. |
## Usage
### Inference Parameters
Inference is better with `temperature=0.8`, `top_p=0.95`, and `do_sample=True`. For more complex queries, set the maximum number of tokens to 32k to allow for longer chain-of-thought (CoT).
### Input Formats
Given the nature of the training data, always use ChatML template with the following system prompt for inference:
```bash
<|im_start|>system<|im_sep|>
Your role as an assistant involves thoroughly exploring questions through a systematic thinking process before providing the final precise and accurate solutions. This requires engaging in a comprehensive cycle of analysis, summarizing, exploration, reassessment, reflection, backtracing, and iteration to develop well-considered thinking process. Please structure your response into two main sections: Thought and Solution using the specified format: <think> {Thought section} <\think> {Solution section}. In the Thought section, detail your reasoning process in steps. Each step should include detailed considerations such as analysing questions, summarizing relevant findings, brainstorming new ideas, verifying the accuracy of the current steps, refining any errors, and revisiting previous steps. In the Solution section, based on various attempts, explorations, and reflections from the Thought section, systematically present the final solution that you deem correct. The Solution section should be logical, accurate, and concise and detail necessary steps needed to reach the conclusion. Now, try to solve the following question through the above guidelines:<|im_end|>
<|im_start|>user<|im_sep|>
What is the derivative of x^2?<|im_end|>
<|im_start|>assistant<|im_sep|>
```
### With `transformers`
```python
from transformers import AutoTokenizer, AutoModelForCausalLM
tokenizer = AutoTokenizer.from_pretrained("microsoft/Phi-4-reasoning")
model = AutoModelForCausalLM.from_pretrained("microsoft/Phi-4-reasoning", device_map="auto", torch_dtype="auto")
messages = [
{"role": "system", "content": "You are Phi, a language model trained by Microsoft to help users. Your role as an assistant involves thoroughly exploring questions through a systematic thinking process before providing the final precise and accurate solutions. This requires engaging in a comprehensive cycle of analysis, summarizing, exploration, reassessment, reflection, backtracing, and iteration to develop well-considered thinking process. Please structure your response into two main sections: Thought and Solution using the specified format: <think> {Thought section} </think> {Solution section}. In the Thought section, detail your reasoning process in steps. Each step should include detailed considerations such as analysing questions, summarizing relevant findings, brainstorming new ideas, verifying the accuracy of the current steps, refining any errors, and revisiting previous steps. In the Solution section, based on various attempts, explorations, and reflections from the Thought section, systematically present the final solution that you deem correct. The Solution section should be logical, accurate, and concise and detail necessary steps needed to reach the conclusion. Now, try to solve the following question through the above guidelines:"},
{"role": "user", "content": "What is the derivative of x^2?"},
]
inputs = tokenizer.apply_chat_template(messages, tokenize=True, add_generation_prompt=True, return_tensors="pt")
outputs = model.generate(
inputs.to(model.device),
max_new_tokens=4096,
temperature=0.8,
top_p=0.95,
do_sample=True,
)
print(tokenizer.decode(outputs[0]))
```
### With `vllm`
```bash
vllm serve microsoft/Phi-4-reasoning --enable-reasoning --reasoning-parser deepseek_r1
```
*Phi-4-reasoning is also supported out-of-the-box by Ollama, llama.cpp, and any Phi-4 compatible framework.*
## Data Overview
### Training Datasets
Our training data is a mixture of Q&A, chat format data in math, science, and coding. The chat prompts are sourced from filtered high-quality web data and optionally rewritten and processed through a synthetic data generation pipeline. We further include data to improve truthfulness and safety.
### Benchmark Datasets
We evaluated Phi-4-reasoning using the open-source [Eureka](https://github.com/microsoft/eureka-ml-insights) evaluation suite and our own internal benchmarks to understand the model's capabilities. More specifically, we evaluate our model on:
Reasoning tasks:
* **AIME 2025, 2024, 2023, and 2022:** Math olympiad questions.
* **GPQA-Diamond:** Complex, graduate-level science questions.
* **OmniMath:** Collection of over 4000 olympiad-level math problems with human annotation.
* **LiveCodeBench:** Code generation benchmark gathered from competitive coding contests.
* **3SAT (3-literal Satisfiability Problem) and TSP (Traveling Salesman Problem):** Algorithmic problem solving.
* **BA Calendar:** Planning.
* **Maze and SpatialMap:** Spatial understanding.
General-purpose benchmarks:
* **Kitab:** Information retrieval.
* **IFEval and ArenaHard:** Instruction following.
* **PhiBench:** Internal benchmark.
* **FlenQA:** Impact of prompt length on model performance.
* **HumanEvalPlus:** Functional code generation.
* **MMLU-Pro:** Popular aggregated dataset for multitask language understanding.
## Safety
### Approach
Phi-4-reasoning has adopted a robust safety post-training approach via supervised fine-tuning (SFT). This approach leverages a variety of both open-source and in-house generated synthetic prompts, with LLM-generated responses that adhere to rigorous Microsoft safety guidelines, e.g., User Understanding and Clarity, Security and Ethical Guidelines, Limitations, Disclaimers and Knowledge Scope, Handling Complex and Sensitive Topics, Safety and Respectful Engagement, Confidentiality of Guidelines and Confidentiality of Chain-of-Thoughts.
### Safety Evaluation and Red-Teaming
Prior to release, Phi-4-reasoning followed a multi-faceted evaluation approach. Quantitative evaluation was conducted with multiple open-source safety benchmarks and in-house tools utilizing adversarial conversation simulation. For qualitative safety evaluation, we collaborated with the independent AI Red Team (AIRT) at Microsoft to assess safety risks posed by Phi-4-reasoning in both average and adversarial user scenarios. In the average user scenario, AIRT emulated typical single-turn and multi-turn interactions to identify potentially risky behaviors. The adversarial user scenario tested a wide range of techniques aimed at intentionally subverting the model's safety training including grounded-ness, jailbreaks, harmful content like hate and unfairness, violence, sexual content, or self-harm, and copyright violations for protected material. We further evaluate models on Toxigen, a benchmark designed to measure bias and toxicity targeted towards minority groups.
Please refer to the technical report for more details on safety alignment.
## Model Quality
At the high-level overview of the model quality on representative benchmarks. For the tables below, higher numbers indicate better performance:
| | AIME 24 | AIME 25 | OmniMath | GPQA-D | LiveCodeBench (8/1/242/1/25) |
|-----------------------------|-------------|-------------|-------------|------------|-------------------------------|
| Phi-4-reasoning | 75.3 | 62.9 | 76.6 | 65.8 | 53.8 |
| Phi-4-reasoning-plus | 81.3 | 78.0 | 81.9 | 68.9 | 53.1 |
| OpenThinker2-32B | 58.0 | 58.0 | — | 64.1 | — |
| QwQ 32B | 79.5 | 65.8 | — | 59.5 | 63.4 |
| EXAONE-Deep-32B | 72.1 | 65.8 | — | 66.1 | 59.5 |
| DeepSeek-R1-Distill-70B | 69.3 | 51.5 | 63.4 | 66.2 | 57.5 |
| DeepSeek-R1 | 78.7 | 70.4 | 85.0 | 73.0 | 62.8 |
| o1-mini | 63.6 | 54.8 | — | 60.0 | 53.8 |
| o1 | 74.6 | 75.3 | 67.5 | 76.7 | 71.0 |
| o3-mini | 88.0 | 78.0 | 74.6 | 77.7 | 69.5 |
| Claude-3.7-Sonnet | 55.3 | 58.7 | 54.6 | 76.8 | — |
| Gemini-2.5-Pro | 92.0 | 86.7 | 61.1 | 84.0 | 69.2 |
| | Phi-4 | Phi-4-reasoning | Phi-4-reasoning-plus | o3-mini | GPT-4o |
|----------------------------------------|-------|------------------|-------------------|---------|--------|
| FlenQA [3K-token subset] | 82.0 | 97.7 | 97.9 | 96.8 | 90.8 |
| IFEval Strict | 62.3 | 83.4 | 84.9 | 91.5 | 81.8 |
| ArenaHard | 68.1 | 73.3 | 79.0 | 81.9 | 75.6 |
| HumanEvalPlus | 83.5 | 92.9 | 92.3 | 94.0| 88.0 |
| MMLUPro | 71.5 | 74.3 | 76.0 | 79.4 | 73.0 |
| Kitab<br><small>No Context - Precision<br>With Context - Precision<br>No Context - Recall<br>With Context - Recall</small> | <br>19.3<br>88.5<br>8.2<br>68.1 | <br>23.2<br>91.5<br>4.9<br>74.8 | <br>27.6<br>93.6<br>6.3<br>75.4 | <br>37.9<br>94.0<br>4.2<br>76.1 | <br>53.7<br>84.7<br>20.3<br>69.2 |
| Toxigen Discriminative<br><small>Toxic category<br>Neutral category</small> | <br>72.6<br>90.0 | <br>86.7<br>84.7 | <br>77.3<br>90.5 | <br>85.4<br>88.7 | <br>87.6<br>85.1 |
| PhiBench 2.21 | 58.2 | 70.6 | 74.2 | 78.0| 72.4 |
Overall, Phi-4-reasoning, with only 14B parameters, performs well across a wide range of reasoning tasks, outperforming significantly larger open-weight models such as DeepSeek-R1 distilled 70B model and approaching the performance levels of full DeepSeek R1 model. We also test the models on multiple new reasoning benchmarks for algorithmic problem solving and planning, including 3SAT, TSP, and BA-Calendar. These new tasks are nominally out-of-domain for the models as the training process did not intentionally target these skills, but the models still show strong generalization to these tasks. Furthermore, when evaluating performance against standard general abilities benchmarks such as instruction following or non-reasoning tasks, we find that our new models improve significantly from Phi-4, despite the post-training being focused on reasoning skills in specific domains.
## Responsible AI Considerations
Like other language models, Phi-4-reasoning can potentially behave in ways that are unfair, unreliable, or offensive. Some of the limiting behaviors to be aware of include:
* **Quality of Service:** The model is trained primarily on English text. Languages other than English will experience worse performance. English language varieties with less representation in the training data might experience worse performance than standard American English. Phi-4-reasoning is not intended to support multilingual use.
* **Representation of Harms & Perpetuation of Stereotypes:** These models can over- or under-represent groups of people, erase representation of some groups, or reinforce demeaning or negative stereotypes. Despite safety post-training, these limitations may still be present due to differing levels of representation of different groups or prevalence of examples of negative stereotypes in training data that reflect real-world patterns and societal biases.
* **Inappropriate or Offensive Content:** These models may produce other types of inappropriate or offensive content, which may make it inappropriate to deploy for sensitive contexts without additional mitigations that are specific to the use case.
* **Information Reliability:** Language models can generate nonsensical content or fabricate content that might sound reasonable but is inaccurate or outdated.
* **Election Information Reliability:** The model has an elevated defect rate when responding to election-critical queries, which may result in incorrect or unauthoritative election critical information being presented. We are working to improve the model's performance in this area. Users should verify information related to elections with the election authority in their region.
* **Limited Scope for Code:** Majority of Phi-4-reasoning training data is based in Python and uses common packages such as `typing`, `math`, `random`, `collections`, `datetime`, `itertools`. If the model generates Python scripts that utilize other packages or scripts in other languages, we strongly recommend users manually verify all API uses.
Developers should apply responsible AI best practices and are responsible for ensuring that a specific use case complies with relevant laws and regulations (e.g. privacy, trade, etc.). Using safety services like [Azure AI Content Safety](https://azure.microsoft.com/en-us/products/ai-services/ai-content-safety) that have advanced guardrails is highly recommended. Important areas for consideration include:
* **Allocation:** Models may not be suitable for scenarios that could have consequential impact on legal status or the allocation of resources or life opportunities (ex: housing, employment, credit, etc.) without further assessments and additional debiasing techniques.
* **High-Risk Scenarios:** Developers should assess suitability of using models in high-risk scenarios where unfair, unreliable or offensive outputs might be extremely costly or lead to harm. This includes providing advice in sensitive or expert domains where accuracy and reliability are critical (ex: legal or health advice). Additional safeguards should be implemented at the application level according to the deployment context.
* **Misinformation:** Models may produce inaccurate information. Developers should follow transparency best practices and inform end-users they are interacting with an AI system. At the application level, developers can build feedback mechanisms and pipelines to ground responses in use-case specific, contextual information, a technique known as Retrieval Augmented Generation (RAG).
* **Generation of Harmful Content:** Developers should assess outputs for their context and use available safety classifiers or custom solutions appropriate for their use case.
* **Misuse:** Other forms of misuse such as fraud, spam, or malware production may be possible, and developers should ensure that their applications do not violate applicable laws and regulations.