SuperAPIAI Directory

phi-2 2.7B

huggingface.co · AI developer platforms

Phi-2 is a 2.7 billion parameter Transformer text generation model released by Microsoft and hosted on Hugging Face. It uses the same data sources as Phi-1.5, with the addition of synthetic NLP text and filtered website data for training, and achieves near state-of-the-art performance among models with fewer than 13 billion parameters on commonsense, language understanding, and logical reasoning benchmarks. The model has not been fine-tuned with reinforcement learning from human feedback, is open-sourced under the MIT license, and is primarily aimed at the research community for exploring safety topics such as reducing toxicity, understanding social bias, and enhancing controllability. The model is suitable for question-answering, chat, and code-format prompts, but the official documentation explicitly states that its outputs should be treated as a starting point rather than a definitive solution, and it is not recommended to use it directly for production tasks without evaluation.

Open website Alternatives
PricingOpen source开源项目(可免费自部署)
PlatformsWeb

About this tool

Phi-2 is a text generation model released by Microsoft on Hugging Face, with 2.7B (2.7 billion) parameters, using a Transformer architecture and trained with a next-token prediction objective.

Purpose and positioning: The official documentation states that the model is intended to provide the research community with an unrestricted small model for exploring important safety challenges, such as reducing toxicity, understanding social bias, and enhancing controllability. It has not been fine-tuned with reinforcement learning from human feedback (RLHF).

Main capabilities: On commonsense, language understanding, and logical reasoning benchmarks, the model demonstrates near state-of-the-art performance among models with fewer than 13 billion parameters. It is suitable for prompts in question-answering (QA) format, chat format, and code format. The official documentation provides several prompt styles: a standalone question can be used directly as a prompt; the QA format "Instruct: <prompt>\nOutput:" can also be used to encourage more concise answers; in chat format, the model generates text after the first "Bob:"; in code format, the model generates content after a comment.

Usage: Phi-2 has been integrated into transformers version 4.37.0, and a transformers version no lower than that is required. If a version lower than 4.37.0 is used, the model should always be loaded with trust_remote_code=True to avoid side effects. The model is known to have an attention overflow issue under FP16; if encountered, autocast can be enabled or disabled on the PhiAttention.forward() function. The model uses the MIT license.

Training data and scale: The dataset size is 250B tokens, composed of synthetic NLP data created by AOAI GPT-3.5 and filtered web data from Falcon RefinedWeb and SlimPajama evaluated by AOAI GPT-4; training tokens are 1.4T; training used 96 A100-80G GPUs over 14 days; the context length is 2048 tokens.

Applicable scenarios: Text generation tasks related to question answering, chat, and code, especially suitable as a small open-source model for research purposes.

Limitations: The officially listed limitations include: it may generate inaccurate code and facts, and outputs should be treated as suggestions or starting points; the code scope is limited, with training data mostly based on Python and common packages such as typing, math, random, collections, datetime, and itertools; if generating scripts that use other packages or other languages, it is recommended to manually verify all API usage; it has not been instruction-tuned and may have difficulty following complex or nuanced instructions; it is primarily aimed at standard English, and informal English, slang, or other languages may cause comprehension difficulties; social bias may be present; it may still produce harmful content even with explicit prompts; as a base model, it often produces irrelevant or extraneous text after the first answer, exhibiting a textbook-style answering style. The official documentation explicitly states that directly using the model for production tasks without evaluation is outside the project's scope, and the model has not been tested to ensure suitability for any production-grade application.

Up/Down to navigate · Enter to open · ESC to closeBrowse all tools