P

Phi 3: Definition and Examples

Phi 3 is a family of small language models (SLMs) developed by Microsoft Research, designed to deliver performance close to large models while being compact enough to run on local devices.

Full definition

Phi 3 is the third generation of Microsoft's Phi series, a family of Small Language Models (SLMs) that pushes the boundaries of what compact models can achieve. Launched in April 2024, this family includes several variants — Phi-3-mini (3.8 billion parameters), Phi-3-small (7 billion), and Phi-3-medium (14 billion) — each optimized for a different balance between performance and efficiency.

The particularity of Phi 3 lies in its training methodology. Rather than simply increasing model size, Microsoft focused on the quality of training data by using carefully filtered datasets and synthetic data generated by larger models. This approach, inspired by the principle 'textbooks are all you need', allows Phi 3 to achieve performance comparable to much larger models on many benchmarks.

Phi-3-mini, the flagship model of the family, can run directly on a smartphone or laptop thanks to its small size. It supports a context window of up to 128,000 tokens and particularly excels in logical reasoning, mathematics, and code generation. This ability to run locally makes it a preferred choice for applications requiring data privacy or offline operation.

Available as open source under the MIT license, Phi 3 integrates easily into existing pipelines via platforms like Hugging Face, Ollama, or Azure AI. Its performance-to-size ratio makes it particularly relevant for developers and companies looking to deploy generative AI solutions without the infrastructure costs associated with large models.

Etymology

The name 'Phi' (φ) refers to the Greek letter often associated in mathematics with the golden ratio and the idea of optimal proportion, reflecting Microsoft's ambition to find the ideal ratio between model size and performance. The '3' indicates the third iteration of this family, after Phi-1 (specialized in code) and Phi-2.

Concrete examples

Deploying a local AI assistant for a mobile application without internet connection

You are an onboard assistant running on Phi 3 Mini. Respond concisely and in a structured manner. The user asks you questions about cooking. Give recipes in a maximum of 5 steps with the necessary ingredients.

Using Phi 3 to analyze confidential documents locally in a legal context

Analyze the following contract and identify potentially problematic clauses. List each clause with its number, quote the exact passage, and explain the risk in one sentence. Document: {CONTRACT_CONTENT}

Integrating Phi 3 into a code generation pipeline for real-time suggestions

Complete the following Python function while respecting the style of the existing code. Generate only the missing code, without explanation. Function: {INCOMPLETE_CODE}

Practical usage

In prompt engineering, Phi 3 is mainly used for targeted tasks where data privacy or latency are priorities. Favor concise and structured prompts, as compact models respond better to precise instructions than to vague queries. For complex tasks, decompose your prompt into sequential steps (chain-of-thought) to compensate for the more limited reasoning capacity compared to large models.

Related concepts

Small Language Model (SLM)Open source modelLocal inferenceFine-tuning

FAQ

What is the difference between Phi 3 and GPT-4?
Phi 3 is a small language model (3.8 to 14 billion parameters) designed to run locally, while GPT-4 is a very large model accessible only via API. Phi 3 excels at targeted tasks with near-zero inference cost, but GPT-4 remains superior for complex tasks requiring deep reasoning or extensive context understanding.
Can Phi 3 run on a personal computer?
Yes, that is one of its main advantages. Phi-3-mini (3.8B parameters) can run on a standard laptop with 8 GB of RAM, or even on a recent smartphone. Tools like Ollama or LM Studio allow you to install and use it in minutes without complex configuration.
Is Phi 3 suitable for prompt engineering in French?
Phi 3 was primarily trained on English data, meaning its performance in French is inferior to English, especially for nuanced tasks. To get better results in French, it is recommended to use clear and simple prompts, or consider fine-tuning on a French corpus if the use case requires it.

See also

How to use this prompt

  1. Copy the prompt with the button above.
  2. Paste it into ChatGPT, Claude or your favorite AI assistant.
  3. Replace the bracketed variables with your details, then refine the result.

About Prompt Guide

Prompt Guide is a free library of 2500+ ready-to-use prompts for ChatGPT, Claude and other AIs, with guides to learn prompting and tools to build and optimize your own prompts.

More definitions

Get new prompts every week

Join our newsletter.