Abstract
Machine Learning is transitioning from an art and science into a technology available to every developer. In the near future, every application on every platform will incorporate trained models to encode data-based decisions that would be impossible for developers to author. This presents a significant engineering challenge, since currently data science and modeling are largely decoupled from standard software development processes. This separation makes incorporating machine learning capabilities inside applications unnecessarily costly and difficult, and furthermore discourage developers from embracing ML in first place. In this paper we present ML.NET, a framework developed at Microsoft over the last decade in response to the challenge of making it easy to ship machine learning models in large software applications. We present its architecture, and illuminate the application demands that shaped it. Specifically, we introduce DataView, the core data abstraction of ML.NET which allows it to capture full predictive pipelines efficiently and consistently across training and inference lifecycles. We close the paper with a surprisingly favorable performance study of ML.NET compared to more recent entrants, and a discussion of some lessons learned.
Introduction
Traditionally, a significant barrier exists between data science experimentation and software engineering. While data scientists favor Python-based environments like Scikit-learn for research, these tools often struggle with production constraints. Key challenges include memory limits where datasets must fit entirely in RAM, performance bottlenecks due to Python's Global Interpreter Lock (GIL), and the "rewrite tax"—the necessity of porting research models to C++ or C# for production deployment to meet latency and reliability requirements. ML.NET was developed to bridge this gap, offering a model-agnostic framework capable of running across diverse environments, from large data centers to IoT devices.
Architecture and the DataView Abstraction
The cornerstone of ML.NET is the DataView, a schematized, immutable, and lazily evaluated data abstraction. Drawing inspiration from relational databases, DataView implements three critical concepts to handle large-scale data efficiently:
- Cursoring: Instead of loading entire datasets into memory, ML.NET uses an iterator model to stream data, enabling the processing of datasets far exceeding available RAM.
- Compositional Pipelines: Every stage, from featurization to classification, is integrated into a single Directed Acyclic Graph (DAG). This ensures identical code paths for training and inference, eliminating model skew.
- JIT-Compiled Getters: To optimize CPU efficiency, the framework utilizes lambda functions that are Just-In-Time (JIT) compiled by the .NET runtime, creating high-performance execution paths.
To support the Python ecosystem, Microsoft introduced NimbusML, a bridge that allows data scientists to leverage ML.NET’s high-performance components within a familiar Scikit-learn-style interface.
Evaluation and Performance
ML.NET was evaluated against three large-scale, real-world datasets: Criteo (45M records, ~10GB binary classification), Amazon Review (17M records, ~9GB text classification), and Flight Delay (1M records, ~1GB regression).
The results highlight ML.NET's efficiency in high-demand scenarios:
- Speed and Scalability: On the Criteo dataset, ML.NET’s streaming API (NimbusML-DV) completed training in approximately 10 minutes, whereas Scikit-learn required over two days. Furthermore, ML.NET successfully processed the Amazon Review dataset, which caused memory overflow errors in both Scikit-learn and H2O.
- Accuracy: ML.NET consistently matched or outperformed other frameworks, benefiting from efficient implementations of state-of-the-art algorithms like LightGBM.
- Multi-core Efficiency: Unlike many Python-based libraries limited by the GIL, ML.NET demonstrates superior scale-up performance by effectively utilizing multiple CPU cores.
Conclusion
ML.NET demonstrates that applying relational database principles—such as columnar access, lazy evaluation, and buffer sharing—to machine learning pipelines can yield significant performance gains. By unifying the training and prediction code paths, it mitigates common production errors and reduces the engineering overhead of deploying models. While the framework initially focused on classical ML, its extensibility and performance make it a robust solution for integrating data-driven decisions into large-scale software applications.
Summary updated