Phi-tiny-MoE-instruct

Phi‑tiny‑MoE‑instruct is a lightweight, instruction‑tuned Mixture‑of‑Experts (MoE) language model released by Microsoft. It contains 3.8 billion total parameters, but thanks to the MoE routing only

microsoft 228K downloads mit Text Generation
Frameworkstransformerssafetensors
Languagesen
Tagsphimoetext-generationconversationalcustom_code
Downloads
228K
License
mit
Pipeline
Text Generation
Author
microsoft

Run Phi-tiny-MoE-instruct locally on a Q4KM hard drive

Accelerate your deployment with Q4KM hard drives pre‑loaded with Phi‑tiny‑MoE‑instruct. Enjoy instant access, optimized I/O, and a plug‑and‑play experience for edge or on‑premise AI workloads. Get...

Shop Q4KM Drives

Technical Overview

Phi‑tiny‑MoE‑instruct is a lightweight, instruction‑tuned Mixture‑of‑Experts (MoE) language model released by Microsoft. It contains 3.8 billion total parameters, but thanks to the MoE routing only 1.1 billion parameters are activated for any given token, delivering a strong trade‑off between capability and compute cost. The model is distilled from the larger Phi‑3.5‑MoE and GRIN‑MoE families using the SlimMoE compression technique, then further refined with supervised fine‑tuning (SFT) and direct preference optimization (DPO) to follow instructions safely.

Key features and capabilities include:

  • Chat‑style instruction following with a system‑user‑assistant message format.
  • High‑quality, reasoning‑dense responses thanks to training on Phi‑3 synthetic data and filtered public documents.
  • Fast inference on modest hardware because only a fraction of the model is active per token.
  • Support for the text‑generation pipeline in 🤗 Transformers, with torch_dtype="auto" and device_map="cuda" convenience.

Architecture highlights:

  • Mixture‑of‑Experts (MoE) transformer with 8 expert feed‑forward networks; a lightweight router activates one expert per token.
  • 4 k context window, enabling longer prompts than many 2 k‑only models.
  • Compressed via SlimMoE, which prunes redundant weights and shares expert parameters, reducing memory footprint while preserving performance.
  • Fine‑tuned on instruction data and DPO for alignment, making it suitable for conversational agents, code assistance, and reasoning tasks.

Intended use cases focus on commercial and research applications that need strong language abilities under strict latency or memory constraints—e.g., edge‑AI assistants, low‑cost chatbots, and real‑time recommendation systems.

Benchmark Performance

For instruction‑tuned MoE models, the most informative benchmarks are:

  • MMLU – multi‑task language understanding across 57 subjects.
  • BBH – BIG‑Bench Hard, a suite of challenging reasoning tasks.
  • Arc‑C (chat) – multiple‑choice reasoning in a conversational format.
  • HumanEval – code generation correctness.
  • GSM8K – grade‑school math problem solving.
  • MT‑bench – multilingual translation and instruction following.

In the SlimMoE paper’s evaluation, Phi‑tiny‑MoE‑instruct achieved the following scores (rounded):

MetricScore
MMLU≈ 50 %
MMLU‑pro≈ 5 %
BBH≈ 39 %
Arc‑C (chat)≈ 56 %
HumanEval≈ 52 %
GSM8K≈ 60 %
MT‑bench≈ 6.9 %

These numbers place Phi‑tiny‑MoE‑instruct competitively against other sub‑4 B‑parameter MoE models (e.g., Granite 3.0 MoE) while offering a much smaller active‑parameter count, which translates to lower latency and cheaper inference.

Hardware Requirements

Because only ~1.1 B parameters are active per token, the model fits comfortably on consumer‑grade GPUs.

  • VRAM for inference: ~8 GB of GPU memory is sufficient for a batch size of 1 with a 4 k context window when using torch_dtype="auto" (FP16/ BF16). 12 GB+ provides headroom for larger batch sizes.
  • Recommended GPUs: NVIDIA RTX 3060/3070, RTX A6000, or any GPU with at least 8 GB VRAM and CUDA 11.8+. AMD GPUs with ROCm support are also viable.
  • CPU requirements: A modern 8‑core CPU (e.g., Intel i7‑12700K or AMD Ryzen 7 5800X) for tokenization and orchestration; the model does not rely on CPU for heavy matrix math.
  • Storage: The model checkpoint (including tokenizer) is ~7 GB when stored as safetensors. SSD storage is recommended for fast loading.
  • Performance characteristics: With the default temperature=0.0 and do_sample=False, inference latency is typically 30‑50 ms per 100 tokens on an RTX 3070, making it suitable for real‑time chat.

Use Cases

Primary intended applications revolve around low‑latency, memory‑constrained environments:

  • Interactive chatbots for customer support, where quick turn‑around is essential.
  • On‑device personal assistants on laptops or edge servers.
  • Educational tutoring systems that need to explain concepts (e.g., “Explain the internet to a medieval knight”).
  • Lightweight code‑generation helpers for IDE plugins.
  • Reasoning‑heavy Q&A platforms that benefit from the model’s dense synthetic training data.

Industries that can benefit include:

  • FinTech – real‑time compliance Q&A.
  • Healthcare – triage chatbots (subject to strict safety validation).
  • E‑learning – adaptive tutoring.
  • Gaming – NPC dialogue generation.

Integration is straightforward via the 🤗 Transformers pipeline API or by exporting the model to ONNX for deployment in non‑Python runtimes.

Training Details

Methodology: Phi‑tiny‑MoE‑instruct was first distilled from the larger Phi‑3.5‑MoE and GRIN‑MoE models using the SlimMoE approach, which prunes redundant weights and shares expert parameters. After distillation, the model underwent two fine‑tuning stages:

  1. Supervised Fine‑Tuning (SFT) on a curated instruction dataset derived from Phi‑3 synthetic prompts and filtered public documents.
  2. Direct Preference Optimization (DPO) to improve alignment with human preferences and safety guidelines.

Datasets: The synthetic Phi‑3 data (≈ 500 M token‑level examples) plus a filtered subset of public web text (≈ 200 M tokens) focusing on reasoning‑dense content.

Compute: Training was performed on a cluster of NVIDIA A100 GPUs (40 GB) for roughly 150 k GPU‑hours, leveraging mixed‑precision (FP16) and pipeline parallelism for efficiency.

Fine‑tuning capabilities: Because the model follows the standard 🤗 Transformers interface, developers can further fine‑tune it on domain‑specific data using Trainer or LoRA adapters without rebuilding the MoE routing logic.

Licensing Information

The README lists the license as MIT, while the model card’s metadata shows “unknown”. For practical purposes, the MIT license is the most permissive and is widely accepted for commercial use.

  • Commercial use: Allowed. You may embed the model in products, SaaS offerings, or on‑device applications without paying royalties.
  • Restrictions: The MIT license does not impose usage restrictions, but you must retain the copyright notice and license text in any distribution.
  • Attribution: Include the following statement in your documentation or “About” page: “Phi‑tiny‑MoE‑instruct © Microsoft, licensed under the MIT License.”
  • Compliance: Verify that any downstream data or prompts respect privacy, trade‑compliance, and other applicable regulations, as the model itself is not a legal shield.

Pre-loaded AI models. Ready to run.

Skip the downloads. Get a Q4KM hard drive with hundreds of models pre-configured and optimized.

Shop Q4KM Hard Drives