GenAIHub
Back to Technical
Multimodal Small Language Model

Microsoft Phi-4

Microsoft's latest small language model that punches well above its weight class. Phi-4 delivers exceptional performance with just 14B parameters, combining text, vision, and audio capabilities in a highly efficient package.

Local (Ollama) Azure AI Hugging Face

Key Features

High Efficiency

Exceptional performance with only 14B parameters, optimized for inference speed and memory usage.

Multimodal

Native support for text, images, and audio processing in a single unified model.

Code Generation

Strong coding capabilities across multiple programming languages and frameworks.

Fine-tuning Ready

Optimized for domain-specific adaptation and custom fine-tuning workflows.

Technical Specifications

Parameter Value
Parameters 14 billion
Context Length 128K tokens
Architecture Transformer-based with Mixture of Experts
Modalities Text, Vision, Audio
Training Data Up to June 2024

Performance Benchmarks

89.2%
MMLU
76.8%
HumanEval
82.4%
GSM8K

Common Use Cases

Conversational AI

Chatbots and virtual assistants with multimodal understanding

Code Assistant

Programming help, code generation, and debugging

Document Analysis

Text extraction, summarization, and document understanding

Educational Tools

Tutoring systems and learning assistance

Quick Start

# Using Ollama (Local)
ollama run phi4

# Using Hugging Face Transformers
from transformers import AutoTokenizer, AutoModelForCausalLM

tokenizer = AutoTokenizer.from_pretrained("microsoft/phi-4")
model = AutoModelForCausalLM.from_pretrained("microsoft/phi-4")

# Using Azure AI
from azure.ai.inference import ChatCompletionsClient
from azure.core.credentials import AzureKeyCredential

client = ChatCompletionsClient(
    endpoint="your-endpoint",
    credential=AzureKeyCredential("your-key")
)