TellWorldAI World Archive

Home›Models

Model

Phi-1

Phi-1 is a 1.3-billion-parameter Transformer language model for Python from Microsoft Research, which showed that filtered and synthetic "textbook quality" training data can partly substitute for model and data scale.

Status AvailableModality TextOpen weights Yes Era Generative AI for everyone

Parameters
1.3B
License
MIT
Access
Download
Release date
Developer
Microsoft

What it is

Phi-1 is a 1.3-billion-parameter Transformer language model built by Microsoft Research for writing Python code[1]. It was described in a paper titled "Textbooks Are All You Need" (arXiv:2306.11644), posted on 20 June 2023, and its weights were published on Hugging Face under the MIT licence[2]. Its scope is deliberately narrow: it is aimed at Python rather than at programming languages in general[2]. A model of just over a billion parameters is small next to general-purpose chat models; what made Phi-1 notable was its argument about how such a small model should be trained.

Where it came from: data as the variable

The paper's central claim is about training data rather than architecture. Code models of the time were typically trained on large web crawls — a mixture of documentation, forum threads, tutorials, half-finished snippets and noise. The authors argued instead for "textbook quality" data: text written like a careful lesson that introduces an idea and then exercises it. Their conclusion was that data quality can substitute for model and data scale[1], that is, a small model fed very clean material can compete with far larger models fed far more material.

The recipe mixed two sources. About 6 billion tokens came from filtered code-and-language web data, drawn from The Stack and from StackOverflow. About 1 billion tokens were synthetic: Python "textbooks" and exercises generated with GPT-3.5[1][2]. The synthetic part is what gives the paper its title — a larger model was used to write teaching material for a smaller one.

The token accounting is easy to misread, because two different numbers appear. The model card lists 54 billion training tokens in total, of which 7 billion are unique[2]: the model went over the same material several times, so the total counts repeated passes. Training took about 4 days on 8 A100 GPUs[1].

Results

The standard way to measure a code model on HumanEval is to give it a function signature and docstring and let it write the body; the generated code is then run against unit tests, and pass@1 is the share of problems solved by the first attempt. MBPP works similarly with short standalone problems. Phi-1 scored 50.6% pass@1 on HumanEval and 55.5% on MBPP[1]. The authors reported that it outperformed other open code models on both benchmarks, with only GPT-4 better overall[1].

A second result made the same point about scale. A 350-million-parameter variant, phi-1-small, trained with the same pipeline, reached 45% on HumanEval[1] — a quarter of the parameters, a score in the same range.

Limits

Microsoft's model card describes Phi-1 as best suited to code-format prompts and warns that generated code should be treated as a starting point rather than a definitive solution[2]. Direct adoption for production coding tasks was declared out of scope, and the model was not tested for production-level code[2]. The Python-only focus follows from the training data and narrows the range of tasks further.

Place in the Phi family

Phi-1 is the first model of the Phi family of small language models, and it was succeeded by phi-1.5 in September 2023[3]. It was integrated into version 4.37.0 of the transformers library[2], which put it in front of developers already using that library. The model's main legacy is the argument in its paper: that curating what a model reads, including generating teaching material for it, can matter as much as making the model bigger.

Version history

7
  1. 2023
    • Jun 20, 2023 Phi-1 · This page

      Phi-1 is a 1.3-billion-parameter Transformer language model for Python from Microsoft Research, which showed that filtered and synthetic "textbook quality" training data can partly substitute for model and data scale.

    • Sep 11, 2023 Phi-1.5

      Phi-1.5 is a 1.3-billion-parameter language model from Microsoft Research, trained on curated synthetic "textbook" text rather than web crawls; its report claims natural-language performance comparable to models five times larger.

    • Dec 12, 2023 Phi-2

      Phi-2 is a 2.7-billion-parameter base language model from Microsoft Research, announced on 12 December 2023. Microsoft reported that it matched or beat models up to 25 times larger on complex benchmarks, making it a reference point for small-model training.

  2. 2024
    • Apr 23, 2024 Phi-3

      Phi-3 is Microsoft's family of small language models, launched in April 2024 with Phi-3-mini, a 3.8-billion-parameter model small enough to run on a phone.

    • Aug 2024 Phi-3.5

      Phi-3.5 is Microsoft's August 2024 update to its small Phi models, released in three versions — mini, vision and the line's first mixture-of-experts model — under the MIT licence.

    • Dec 12, 2024 Phi-4

      Phi-4 is Microsoft's 14-billion-parameter dense decoder-only language model, built with a data-quality-first recipe heavy on synthetic data and released with full weights under the MIT licence in January 2025.

  3. 2025
    • Feb 26, 2025 Phi-4-mini and Phi-4-multimodal

      Phi-4-mini is a 3.8B-parameter text model and Phi-4-multimodal a 5.6B model that adds images and speech, both released by Microsoft in February 2025 as the small, efficiency-focused members of the Phi-4 family.

20231

  1. ReleaseMicrosoft Research publishes phi-1 and "Textbooks Are All You Need"

    On 20 June 2023 Microsoft Research posted the paper 'Textbooks Are All You Need' to arXiv, introducing phi-1, a 1.3-billion-parameter code model trained on textbook-quality data.

Developed by1

Microsoft

Succeeded by1

Phi-1.5

Notes and sources

  1. Textbooks Are All You Needhttps://arxiv.org/abs/2306.11644
  2. microsoft/phi-1 model cardhttps://huggingface.co/microsoft/phi-1
  3. Phi (language model)https://en.wikipedia.org/wiki/Phi_(language_model)

Cite this page: Phi-1. TellWorld, https://www.tellworld.net/models/phi-1. Updated 2026-11-08