How Microsoft Built the Mai Code Flash Model for Copilot
Visual Studio Codego watch the original →
the gist
Microsoft developed Mai Code Flash, a 5B active parameter Mixture-of-Experts model, by training specifically on real GitHub Copilot developer workflows rather than generic coding benchmarks.
Training for Real-World Developer Workflows
Instead of adapting a general-purpose model, the team built Mai Code Flash from the ground up specifically for the GitHub Copilot and VS Code environment. The training pipeline utilizes a multi-stage approach: starting with supervised fine-tuning to align the model with user instructions and formatting, followed by incremental training on increasingly complex coding tasks. The final stage employs reinforcement learning within a simulated environment that mirrors actual product usage, allowing the model to learn how to interact with tools, perform unit tests, and execute targeted edits based on real developer prompts.
Architecture and Performance
The model utilizes a Mixture-of-Experts (MoE) architecture with a total capacity of 137 billion parameters, while maintaining only 5 billion active parameters per inference. This design allows the model to achieve a balance between intelligence, speed, and cost, enabling it to handle daily coding tasks with high token efficiency and low latency. The team emphasizes that this smaller, purpose-built model often outperforms larger, generic models in specific IDE-based tasks because it is optimized for the actual harness and environment where developers spend their time.
Evaluation and Future Directions
Evaluation relies on a combination of broad benchmarks and online A/B testing to measure user engagement and task completion rates within the product. The researchers note that while the model is highly effective for backend and frontend development, it is not optimized for creative writing tasks like poetry. Future iterations will focus on scaling intelligence and integrating multiple specialized models, such as voice and transcription models, to power more complex, agentic coding workflows.