Microsoft 推出的 Phi-4 是一款支持私有云服务器自托管、微调与完全数据主权的开源权重基础大模型,具备 16K 上下文窗口、135 Token/秒生成速度与 80/100 综合智能指数(免费开源权重)。
Technical Specifications
- Provider
- Microsoft
- Category
- open-source
- Release Date
- 2024-12
- Batch API Discount
- Standard rate
- Consumer Subscription
- Free / Self-Hosted
- Reasoning Effort Control
- Fixed
- Structured Outputs
- Yes
- Output Modalities
- text
- Official Documentation
- Visit Official Docs ↗
Data Privacy, Licensing & Deployment Governance
Official Provider Release Intelligence, API Quotas & Agentic Specs
- Official API Model ID (SDK String)
- phi-4
- Supported SDK & API Protocol
- OpenAI-Compatible REST / vLLM / SGLang / HuggingFace TGI
- Lifecycle & Deprecation Status
- Legacy Stable (Upgrade path available in Microsoft lineup)
- Production Rate Limits (RPM & TPM)
- Unlimited (Hardware-bound on self-hosted GPU) / 10,000 RPM Cloud · Unlimited local throughput / 10M+ TPM Managed Cloud
- Long-Context Pricing Tier (>128K / >200K)
- Free across full context window (only KV-cache VRAM scales)
- Prompt Cache Write & TTL Policy
- Automatic prefix KV-caching in vLLM / SGLang (0 cost)
- Computer Use & Browser GUI Agent
- API / CLI Tool-Use & DOM Agent ready (no raw pixel desktop click loop)
- MCP & Parallel Tool Calling
- Native MCP Client/Server ready · Parallel function calling · 100% Strict JSON Schema
- Web Search Grounding & Code Sandbox
- Supported via external Tavily/Exa Search & E2B/Docker Sandbox tools
- Fine-Tuning & Distillation Support
- Full Weights SFT, LoRA, QLoRA, DPO & GRPO RL (Unsloth / Axolotl / Llama-Factory)
- Multimodal Tokenization Billing
- Text BPE (~4 chars/token)
- Weights Precision & Quantization
- BF16 / FP16, FP8 Dynamic, INT4 AWQ / GPTQ, GGUF (Q4_K_M / Q8_0)
- Minimum GPU VRAM Requirement
- 9 GB VRAM (4-bit Quantized) · 30 GB VRAM (Native BF16)
- Supported Inference Engines
- vLLM, SGLang, Ollama, llama.cpp, TensorRT-LLM, HuggingFace TGI
- System Card & Safety Framework
- Open-Weights System Card + Customizable Guardrail Layer (Llama Guard / ShieldGemma)
- Enterprise Compliance (SOC2 / HIPAA / ZDR)
- 100% Air-Gapped On-Premises / Private VPC · Full HIPAA, GDPR & SOC2 Control
Phi-4 Cost, Context, Hardware & API Integration
Open-weights or free-tier model: $0 API license cost when self-hosted.
Same Monthly Workload Cost Across Popular Reference Models
Live Prompt Paste Tokenizer & Cost Counter
Paste real system instructions, JSON schemas, or code to measure BPE token counts across tokenizers.
Hybrid Prompt Routing Cascade Simulator
Route routine queries to a fast lightweight model ($0.15/1M) and escalate only complex reasoning turns to Phi-4:
Benchmark Scores & 6-Axis Capability Radar
- GPQA Diamond
- 55%
- MMLU-Pro
- 78.5%
- HumanEval
- 88%
- Chatbot Arena Elo
- 1305pts
Strengths
- 提供 16K 上下文窗口与最高 4K 输出容量,核心基准表现优异(GPQA Diamond 55% · MMLU-Pro 78.5%)
- 高达 135 Token/秒的生成吞吐量,首字延迟 (TTFT) 仅约 270 毫秒
- 开放模型权重 (14B),支持通过 vLLM、SGLang 或 Ollama 在私有 GPU 集群上本地部署与微调
Limitations & Trade-offs
- 在本地以满血精度运行需要较高的 GPU 显存 (VRAM) 与运维基础设施
- 在超长链路的前沿科研推导任务上,深度略逊于顶配重型旗舰推理模型
Editorial Assessment
Phi-4 凭借 80/100 的智能得分、16K 上下文容量与 135 Token/秒的响应速度,在 Microsoft 模型矩阵中提供了极佳的性能与成本平衡。
Best for: 支持私有云服务器自托管、微调与完全数据主权的开源权重基础任务、企业级 RAG 检索增强生成、自动化智能体工作流与高可靠 API 集成。
Compare Phi-4
Frequently Asked Questions about Phi-4
How much does the Phi-4 API cost per 1M tokens?+
Phi-4 by Microsoft is priced at $0 per 1M input tokens and $0 per 1M output tokens. With prompt caching enabled, cached input tokens cost $0 per 1M tokens, and asynchronous Batch API requests receive a 0% discount.
Should I use a $20/month subscription or the Phi-4 pay-as-you-go API?+
A flat $20/month consumer subscription is predictable for daily interactive chat and manual coding. However, if you are building software, running automated workflows, or sending low-to-moderate volume with prompt caching enabled, the pay-as-you-go API is typically far more cost-effective and offers higher rate limits without manual UI caps.
How many words and pages fit in Phi-4's context window?+
Phi-4 features a 16K tokens context window, which equals approximately 12,288 English words or ~33 standard single-spaced pages in a single prompt. Its maximum output generation per turn is 4,096 tokens.
Can I run Phi-4 locally on my own GPU (Open Weights)?+
Yes, Phi-4 (14B) releases open weights that can be self-hosted locally or on private cloud GPUs using vLLM, Ollama, SGLang, or llama.cpp.
Does Microsoft train on data sent to the Phi-4 API, and is commercial use allowed?+
100% Isolated when self-hosted on private GPUs or VPC. License tier: Open-Weights Research & Commercial License. Full commercial ownership of generated outputs. Supported deployment channels include: Self-Hosted GPU (vLLM / Ollama), Private VPC, or Managed Serverless API.
How does Phi-4 perform on coding and reasoning benchmarks?+
Phi-4 achieves a composite Intelligence Index of 80/100, scoring N/A% on SWE-bench Verified, 55% on GPQA Diamond, 78.5% on MMLU-Pro, and 1305 pts on Chatbot Arena Elo.
What is Phi-4 best used for?+
Phi-4 is best suited for: 支持私有云服务器自托管、微调与完全数据主权的开源权重基础任务、企业级 RAG 检索增强生成、自动化智能体工作流与高可靠 API 集成。. Assessment: Phi-4 凭借 80/100 的智能得分、16K 上下文容量与 135 Token/秒的响应速度,在 Microsoft 模型矩阵中提供了极佳的性能与成本平衡。
Microsoft Family Lineage, Routing Tiers & Upgrade Path
Step down to a lighter sibling for high-volume routing or step up to Microsoft's flagship reasoning tier:
AI Glossary & Architecture Concepts
View full glossary →Key machine learning concepts and benchmarks relevant to Phi-4:
The basic unit of text that a language model processes, typically representing about 3 to 4 English characters or roughly 0.75 words. For example, the sentence "Artificial intelligence is fast" breaks down into about 5 tokens.
A standardized evaluation suite used to objectively measure and rank an AI model's capabilities across specific tasks — such as SWE-bench Verified for software engineering, AIME for competitive math, or MMLU for general knowledge.
The maximum number of tokens a model can consider at once — both the input it reads and the output it writes. A 1,000,000-token context window can hold roughly 750,000 English words in a single request.
An AI model trained via reinforcement learning to spend dynamic compute thinking through complex logic, math, and architectural problems before outputting a solution. Examples include OpenAI o1, o3, and DeepSeek R1.
A step-by-step reasoning technique where an AI model generates intermediate problem-solving thoughts before arriving at a final answer. Native reasoning models like OpenAI o3 and DeepSeek R1 use CoT to solve complex math and coding challenges.
The ability of a language model to recognize when an external capability is needed and output structured JSON arguments to invoke external APIs, databases, or terminal commands. The runtime executes the tool and passes results back to the model.
Benchmark scores, token prices, and rate limits evolve rapidly as AI labs release model updates. Always verify current specifications and pricing on the official provider documentation.
数据来源: Microsoft Research Phi-4 Technical Report & Hugging Face↗