phi

Phi-2: a 2.7B language model by Microsoft Research that demonstrates outstanding reasoning and language understanding capabilities.

2.7b
Hızlı Kurulum (Ollama kuruluysa)
ollama run phi

Ollama kurulu değil mi? ollama.com/download — Windows, macOS ve Linux için ücretsiz. İlk çalıştırmada model indirilir, sonrası tamamen çevrimdışıdır.

Varyantlar

Boyut büyüdükçe kalite artar, donanım ihtiyacı yükselir. Başlangıç için küçük varyantı deneyin.

EtiketBoyutBağlamGirdiKomut
latest 1.6GB 2K Text ollama run phi:latest
chat 1.6GB 2K Text ollama run phi:chat
2.7b 1.6GB 2K Text ollama run phi:2.7b
2.7b-chat-v2-q2_K 1.2GB 2K Text ollama run phi:2.7b-chat-v2-q2_K
2.7b-chat-v2-q3_K_S 1.3GB 2K Text ollama run phi:2.7b-chat-v2-q3_K_S
2.7b-chat-v2-q3_K_M 1.5GB 2K Text ollama run phi:2.7b-chat-v2-q3_K_M
2.7b-chat-v2-q3_K_L 1.6GB 2K Text ollama run phi:2.7b-chat-v2-q3_K_L
2.7b-chat-v2-q4_0 1.6GB 2K Text ollama run phi:2.7b-chat-v2-q4_0
2.7b-chat-v2-q4_1 1.8GB 2K Text ollama run phi:2.7b-chat-v2-q4_1
2.7b-chat-v2-q4_K_S 1.6GB 2K Text ollama run phi:2.7b-chat-v2-q4_K_S
2.7b-chat-v2-q4_K_M 1.8GB 2K Text ollama run phi:2.7b-chat-v2-q4_K_M
2.7b-chat-v2-q5_0 1.9GB 2K Text ollama run phi:2.7b-chat-v2-q5_0
2.7b-chat-v2-q5_1 2.1GB 2K Text ollama run phi:2.7b-chat-v2-q5_1
2.7b-chat-v2-q5_K_S 1.9GB 2K Text ollama run phi:2.7b-chat-v2-q5_K_S
2.7b-chat-v2-q5_K_M 2.1GB 2K Text ollama run phi:2.7b-chat-v2-q5_K_M
2.7b-chat-v2-q6_K 2.3GB 2K Text ollama run phi:2.7b-chat-v2-q6_K
2.7b-chat-v2-q8_0 3.0GB 2K Text ollama run phi:2.7b-chat-v2-q8_0
2.7b-chat-v2-fp16 5.6GB 2K Text ollama run phi:2.7b-chat-v2-fp16

Model Detayları ve Benchmarklar (kaynak: ollama.com)

Phi-2 is a small language model capable of common-sense reasoning and language understanding. It showcases “state-of-the-art performance” among language models with less than 13 billion parameters.

Example prompt

By default, phi includes a chat prompt template designed for multi-turn conversations:

% ollama run phi
>>> Hello, can you help me find my way to Toronto?
 Certainly! What is the exact location in Toronto that you are looking for?

>>> Yonge & Bloor
 Sure, Yonge and Bloor is a busy intersection in downtown Toronto. Would you like to take public transportation or drive there?

>>> Public transportation
 Great! The easiest way to get there is by taking the TTC subway. You can take Line 1, which runs along Yonge Street and passes through downtown Toronto.

Using Ollama’s API:

curl http://localhost:11434/api/chat -d '{
  "model": "phi",
  "messages": [
    { "role": "user", "content": "why is the sky blue?" }
  ]
}'

Example prompts (raw mode)

Phi also responds well to a wide variety of prompt formats when using raw mode in Ollama’s API, which bypasses all default prompt templating:

Instruct

curl http://localhost:11434/api/generate -d '{
  "model": "phi",
  "prompt": "Instruct: Write a detailed analogy between mathematics and a lighthouse.\nOutput:",
  "options": {
    "stop": ["Instruct:", "Output:"]
  },
  "raw": true,
  "stream": false
}'

Code Completion

curl http://localhost:11434/api/generate -d '{
  "model": "phi",
  "prompt": "def print_prime(n):\n  ",
  "raw": true,
  "stream": false
}'

Text completion

curl http://localhost:11434/api/generate -d '{
  "model": "phi",
  "prompt": "There once was a mouse named",
  "raw": true,
  "stream": false
}'

References

HuggingFace

Blog Post