--- library_name: pytorch license: other tags: - llm - generative_ai - android pipeline_tag: text-generation --- ![](https://qaihub-public-assets.s3.us-west-2.amazonaws.com/qai-hub-models/models/phi_3_5_mini_instruct/web-assets/model_demo.png) # Phi-3.5-mini-instruct: Optimized for Mobile Deployment ## State-of-the-art large language model useful on a variety of language understanding and generation tasks Phi-3.5-mini is a lightweight, state-of-the-art open model built upon datasets used for Phi-3 - synthetic data and filtered publicly available websites - with a focus on very high-quality, reasoning dense data. The model belongs to the Phi-3 model family and supports 128K token context length. The model underwent a rigorous enhancement process, incorporating both supervised fine-tuning, proximal policy optimization, and direct preference optimization to ensure precise instruction adherence and robust safety measures. This model is an implementation of Phi-3.5-mini-instruct found [here](https://huggingface.co/microsoft/Phi-3.5-mini-instruct). More details on model performance across various devices, can be found [here](https://aihub.qualcomm.com/models/phi_3_5_mini_instruct). ### Model Details - **Model Type:** Model_use_case.text_generation - **Model Stats:** - Input sequence length for Prompt Processor: 128 - Context length: 4096 - Number of parameters: 3.8B - Precision: w4a16 + w8a16 (few layers) - Num of key-value heads: 8 - Information about the model parts: Prompt Processor and Token Generator are split into 4 parts each. Each corresponding Prompt Processor and Token Generator part share weights. - Prompt processor model size: 2.16 GB - Token generator model size: 2.16 GB - Use: Initiate conversation with prompt-processor and then token generator for subsequent iterations. - Supported languages: English, Arabic, Chinese, Dutch, French, German, Italian, Russian, Spanish, Ukranian - Minimum QNN SDK version required: 2.28.2 - TTFT: Time To First Token is the time it takes to generate the first response token. This is expressed as a range because it varies based on the length of the prompt. The lower bound is for a short prompt (up to 128 tokens, i.e., one iteration of the prompt processor) and the upper bound is for a prompt using the full context length (4096 tokens). - Response Rate: Rate of response generation after the first response token. | Model | Precision | Device | Chipset | Target Runtime | Response Rate (tokens per second) | Time To First Token (range, seconds) |---|---|---|---|---|---| | Phi-3.5-Mini-Instruct | w4a16 | Samsung Galaxy S24 | Snapdragon® 8 Gen 3 Mobile | QNN_CONTEXT_BINARY | 13.01 | 0.1469056 - 4.7009792 | -- | Use Export Script | | Phi-3.5-Mini-Instruct | w4a16 | Snapdragon X Elite CRD | Snapdragon® X Elite | QNN_CONTEXT_BINARY | 6.2 | 0.185833 - 5.946656 | -- | Use Export Script | | Phi-3.5-Mini-Instruct | w4a16 | Snapdragon 8 Elite QRD | Snapdragon® 8 Elite Mobile | QNN_CONTEXT_BINARY | 14.73 | 0.1195948 - 3.8270336 | -- | Use Export Script | ## Deploying Phi-3.5-mini-instruct on-device Please follow the [LLM on-device deployment](https://github.com/quic/ai-hub-apps/tree/main/tutorials/llm_on_genie) tutorial. ## License * The license for the original implementation of Phi-3.5-mini-instruct can be found [here](https://huggingface.co/microsoft/Phi-3.5-mini-instruct/blob/main/LICENSE). * The license for the compiled assets for on-device deployment can be found [here](https://qaihub-public-assets.s3.us-west-2.amazonaws.com/qai-hub-models/Qualcomm+AI+Hub+Proprietary+License.pdf) ## References * [Phi-3 Technical Report: A Highly Capable Language Model Locally on Your Phone](https://arxiv.org/abs/2404.14219) * [Source Model Implementation](https://huggingface.co/microsoft/Phi-3.5-mini-instruct) ## Community * Join [our AI Hub Slack community](https://qualcomm-ai-hub.slack.com/join/shared_invite/zt-2d5zsmas3-Sj0Q9TzslueCjS31eXG2UA#/shared-invite/email) to collaborate, post questions and learn more about on-device AI. * For questions or feedback please [reach out to us](mailto:ai-hub-support@qti.qualcomm.com). ## Usage and Limitations Model may not be used for or in connection with any of the following applications: - Accessing essential private and public services and benefits; - Administration of justice and democratic processes; - Assessing or recognizing the emotional state of a person; - Biometric and biometrics-based systems, including categorization of persons based on sensitive characteristics; - Education and vocational training; - Employment and workers management; - Exploitation of the vulnerabilities of persons resulting in harmful behavior; - General purpose social scoring; - Law enforcement; - Management and operation of critical infrastructure; - Migration, asylum and border control management; - Predictive policing; - Real-time remote biometric identification in public spaces; - Recommender systems of social media platforms; - Scraping of facial images (from the internet or otherwise); and/or - Subliminal manipulation