Instructions to use steadyflow/Phi-4-reasoning-plus-AWQ with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use steadyflow/Phi-4-reasoning-plus-AWQ with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="steadyflow/Phi-4-reasoning-plus-AWQ") messages = [ {"role": "user", "content": "Who are you?"}, ] pipe(messages)# Load model directly from transformers import AutoTokenizer, AutoModelForCausalLM tokenizer = AutoTokenizer.from_pretrained("steadyflow/Phi-4-reasoning-plus-AWQ") model = AutoModelForCausalLM.from_pretrained("steadyflow/Phi-4-reasoning-plus-AWQ") 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
- vLLM
How to use steadyflow/Phi-4-reasoning-plus-AWQ with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "steadyflow/Phi-4-reasoning-plus-AWQ" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "steadyflow/Phi-4-reasoning-plus-AWQ", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }'Use Docker
docker model run hf.co/steadyflow/Phi-4-reasoning-plus-AWQ
- SGLang
How to use steadyflow/Phi-4-reasoning-plus-AWQ 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 "steadyflow/Phi-4-reasoning-plus-AWQ" \ --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": "steadyflow/Phi-4-reasoning-plus-AWQ", "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 "steadyflow/Phi-4-reasoning-plus-AWQ" \ --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": "steadyflow/Phi-4-reasoning-plus-AWQ", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }' - Docker Model Runner
How to use steadyflow/Phi-4-reasoning-plus-AWQ with Docker Model Runner:
docker model run hf.co/steadyflow/Phi-4-reasoning-plus-AWQ
Phi-4-Reasoning-Plus AWQ
AWQ INT4 quantization of microsoft/Phi-4-reasoning-plus (14B parameters).
Quantization Details
| Parameter | Value |
|---|---|
| Method | AWQ (Activation-Aware Weight Quantization) |
| Bit width | 4-bit weights, 16-bit activations (W4A16) |
| Group size | 128 |
| Zero point | Enabled |
| Kernel | GEMM |
| Calibration | 512 WikiText-2 samples |
| Source model | microsoft/Phi-4-reasoning-plus (~28GB FP16) |
| Quantized size | ~8.6GB |
Usage with vLLM
vllm serve steadyflow/Phi-4-reasoning-plus-AWQ \
--quantization awq \
--gpu-memory-utilization 0.90 \
--max-model-len 4096 \
--enable-reasoning \
--reasoning-parser deepseek_r1
The --enable-reasoning --reasoning-parser deepseek_r1 flags separate the chain-of-thought (reasoning field) from the final answer (content field) in the OpenAI-compatible API response.
Known issue: Some vLLM versions have bugs with Phi-4 reasoning output (infinite loops, missing
<think>tags). If you encounter this, try settingVLLM_USE_V1=0or omit the reasoning flags and parse<think>...</think>tags from the output yourself.
Fits on a single NVIDIA T4 GPU (16GB VRAM).
Recommended Inference Parameters
Per Microsoft's model card, use these parameters for best reasoning quality:
temperature = 0.8
top_p = 0.95
do_sample = True
max_new_tokens = 32768 # increase for complex reasoning chains
Required System Prompt
Phi-4 reasoning models require a specific system prompt to activate structured reasoning with <think> tags:
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:
Usage with Transformers
from awq import AutoAWQForCausalLM
from transformers import AutoTokenizer
model = AutoAWQForCausalLM.from_quantized("steadyflow/Phi-4-reasoning-plus-AWQ")
tokenizer = AutoTokenizer.from_pretrained("steadyflow/Phi-4-reasoning-plus-AWQ")
messages = [
{"role": "system", "content": "<system prompt above>"},
{"role": "user", "content": "Your question here"},
]
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]))
- Downloads last month
- 28