Phi2-2.7B logo

Phi2-2.7B

Free

Small model, big performance: 2.7B parameters, state-of-the-art among sub-13B models

FreeFree tier
Inputs: textOutputs: text
Type
Open Source
Company
Microsoft

About Phi2-2.7B

Phi-2 is a 2.7 billion parameter Transformer language model developed by Microsoft. It was trained using a combination of synthetic NLP texts and carefully filtered websites, building upon the data sources of Phi-1.5. Despite its relatively small size, Phi-2 achieves state-of-the-art performance among models under 13 billion parameters on benchmarks testing common sense, language understanding, and logical reasoning. The model is open-source under the MIT license and is designed to facilitate research into safety challenges such as toxicity reduction, bias understanding, and controllability. It has not been fine-tuned with reinforcement learning from human feedback. Phi-2 is integrated in the Hugging Face Transformers library (version 4.37.0 or higher) and is best used with prompts in QA, chat, or code formats. Known issue: attention overflow with FP16, which can be mitigated by adjusting autocast settings.

Key Features

2.7 billion parameter Transformer architecture
Trained on synthetic NLP texts and filtered web data
State-of-the-art results on common sense, language understanding, and logical reasoning benchmarks
Open-source under MIT license for research community
Optimized for QA, chat, and code generation formats
Integrated with Hugging Face Transformers (v4.37.0+)
Supports safetensors and sharded weights

Pros & Cons

Pros
  • Exceptional performance for its parameter count, rivaling much larger models
  • Open-source and freely available under MIT license
  • Lightweight (2.7B) enabling faster inference and easier deployment
  • Designed with safety research in mind, providing a sandbox for exploring AI alignment
  • Active community support on Hugging Face with over 3,400 likes and millions of downloads
Cons
  • Known attention overflow issue when using FP16 precision
  • Not fine-tuned with RLHF, which may affect instruction-following in certain contexts
  • Limited to English language
  • Best performance relies on specific prompt formats (QA, chat, code)

Best For

Academic research on AI safety, toxicity reduction, and bias mitigationQuestion answering and conversational agentsCode generation and understandingExploring controllability and alignment in language modelsEducational projects requiring a compact yet capable language model

FAQ

What is Phi-2?
Phi-2 is a 2.7 billion parameter Transformer language model developed by Microsoft, open-sourced under the MIT license. It achieves state-of-the-art performance among models under 13 billion parameters on common sense, language understanding, and logical reasoning tasks.
How can I use Phi-2?
Phi-2 is integrated in the Hugging Face Transformers library version 4.37.0 or higher. It is best used with prompts in QA format (e.g., 'Write a detailed analogy...'), chat format, or code format. Ensure you have the correct transformers version installed.
What are the known issues with Phi-2?
Phi-2 has a known attention overflow issue when using FP16 precision. This can be addressed by enabling or disabling autocast on the PhiAttention.forward() function.
Is Phi-2 fine-tuned with RLHF?
No, Phi-2 has not been fine-tuned through reinforcement learning from human feedback. It is intentionally provided as a base model for the research community to explore safety challenges.
What license does Phi-2 use?
Phi-2 is released under the MIT license.