Phi-3-medium-128k-instruct is the Medium version in Microsoft's Phi-3 series, with a parameter scale of 14 billion, and is a dense decoder-only Transformer model. The model supports a context length of 128K tokens, and the same series also has a 4K context variant. The model has undergone a post-training process of supervised fine-tuning (SFT) and direct preference optimization (DPO) to improve instruction-following ability and safety.
In terms of main capabilities, the model performs well on benchmarks such as commonsense, language understanding, mathematics, code, long context, and logical reasoning, and is competitive among models of the same size and larger sizes. Its training data contains approximately 4.8 trillion tokens, covering rigorously quality-filtered public documents, selected educational data and code, as well as newly created synthetic "textbook-style" data for teaching mathematics, coding, commonsense reasoning, and world knowledge, and also includes high-quality chat-format supervised data. About 10% of the training data is multilingual data, but the model is mainly trained for English, and performance in non-English languages may degrade.
In terms of usage, the model is best suited to prompts in chat format. Users can load the model through Hugging Face Transformers; note that the model has been integrated into the development version of transformers (4.40.2), and before the official version is released via pip, trust_remote_code=True should be passed when loading, or the development version of transformers should be installed. The model supports a vocabulary size of up to 32064 tokens, and the tokenizer file has provided placeholder tokens for downstream fine-tuning. In addition, the model is also available in ONNX format and can run on CPU, GPU, and mobile devices through ONNX Runtime, supporting optimized configurations such as int4 DML, fp16 CUDA, int4 CUDA, int4 CPU, and mobile. The model uses flash attention by default and requires specific types of GPU hardware.
Applicable scenarios include: memory- or compute-constrained environments, latency-sensitive scenarios, general AI systems and applications requiring strong reasoning capabilities (especially code, mathematics, and logic), and use as a research foundation module for generative AI features. The model is intended for a wide range of commercial and research uses, mainly targeting English.
In terms of limitations, the model is not designed and evaluated for all downstream uses, and developers need to consider the common limitations of language models and evaluate and mitigate accuracy, safety, and fairness issues in specific downstream use cases (especiallyhigh-risk scenarios). The model may produce unfair, unreliable, or offensive outputs; may over- or under-represent certain groups and reinforce negative stereotypes; may generate nonsensical or fabricated content; in terms of code, the training data is mainly based on Python and commonly used packages, and when using other packages or other languages, it is recommended to manually verify all API calls. The model's training data cutoff date is October 2023, the training period was February to April 2024, and the weights were released on May 21, 2024. The model is released under the MIT license.