All models

Phi-1.5

A small decoder-only Transformer language model from the Phi series, trained on textbook-quality data.

Language · 1,366 operations Checked

100%

Showing the top corner; full diagram not loaded yetShowing a small copy; full diagram not loaded yetLarge diagram, not loaded yet

Open SVG

Loading diagram (54 KB)

Open in a new tab

Click or tap a spot to read it up close. Scroll or drag inside the diagram to move through it. Zoom with + and − or Ctrl and scroll. Press 0 for the whole graph. Swipe inside the diagram to move through it. Use + and − to zoom.

At a glance

Family
Phi
Parameters
1.4B
Operations
1,366
Framework
PyTorch
Recurrent
No
Published
2023
Cited by
1,485 (as of 29 November 2026)
Authors
Suriya Gunasekar, Yi Zhang, Jyoti Aneja and others
License
Apache-2.0
Checked
Passed: the trace was replayed operation by operation and matched the model's own output for this input.

Files

The diagram is a drawing of a TorchLens trace of the source code. It contains no code or weights.

Details
Stable ID
m12816
Graph hash
86db067a1d86638b03b982689ffa87ff3e75372d809ffe58f41138f49442ae6a
Skeleton hash
1b449cf4b7e63f718760618d526765dd7fe5084f49f94263af9a5966cc6c557d
Architecture hash
97881ae4b7773d69bc28c77c0666553085fb3a4c73032b4e1229477a594b2136
Diagram SHA-256
180ab0836cf6c128089611fcd0b14fc32a3c905d0140062d10380b8a33f0158f
TorchLens version
2.36.0
Renderer
graphviz 2.43.0+pyvips 3.2.0+libvips 8.18.7+render-opts@06c1f0d3
Check
Forward pass replayed in PyTorch

What it is

This model is Phi-1.5, which its card describes as a Transformer with 1.3 billion parameters. The card lists a dataset of 30B tokens and 150B training tokens.

About this model's family

The Phi models are a series of small Transformer language models from the Machine Learning Foundations team at Microsoft Research. Their shared premise is that the quality of the training data plays a critical role, so the data is selected or generated to read like a textbook. The first, phi-1, is a model for code that its paper describes as having 1.3B parameters and being trained for 4 days on 8 A100s. The paper reports pass at 1 accuracy of 50.6% on HumanEval and 55.5% on MBPP.

Architecturally, phi-1 is a decoder-only Transformer in which the attention and MLP layers run in parallel, following models such as CodeGen. It has 24 layers, a hidden dimension of 2048 and 32 attention heads of dimension 64. The next model, phi-1.5, keeps exactly the same architecture as phi-1. What changes is the data: roughly 20B tokens of newly generated textbook-like text meant to teach common sense reasoning and general knowledge.

Phi-2 is larger; its card describes a Transformer with 2.7 billion parameters, trained on the data sources of Phi-1.5 plus synthetic NLP texts and filtered websites. Its announcement says training covered 1.4T tokens and took 14 days on 96 A100 GPUs. Phi-2 is a base model: the announcement notes that it has not been aligned through reinforcement learning from human feedback and has not been instruct fine-tuned.

Key idea. The phi-1 paper showed that a 1.3B-parameter Transformer trained on filtered and synthetically generated textbook-quality data reaches 50.6% pass at 1 accuracy on HumanEval.

  • Phi
  • phi-1
  • phi-1.5
  • Phi-2
  • small language model
  • SLM
  • Textbooks Are All You Need
  • text generation
  • code generation
  • Microsoft Phi

AI-written summary, based on the paper and checked automatically against it; not reviewed by a person. Corrections welcome.

Cite the paper

@misc{gunasekar2023textbooksneed,
      title={Textbooks Are All You Need}, 
      author={Suriya Gunasekar and Yi Zhang and Jyoti Aneja and Caio César Teodoro Mendes and Allie Del Giorno and Sivakanth Gopi and Mojan Javaheripi and Piero Kauffmann and Gustavo de Rosa and Olli Saarikivi and Adil Salim and Shital Shah and Harkirat Singh Behl and Xin Wang and Sébastien Bubeck and Ronen Eldan and Adam Tauman Kalai and Yin Tat Lee and Yuanzhi Li},
      year={2023},
      eprint={2306.11644},
      archivePrefix={arXiv},
      primaryClass={cs.CL},
      url={https://arxiv.org/abs/2306.11644}, 
}