NSML: A Machine Learning Platform That Enables You to Focus on Your Models

12/16/2017 ∙ by Nako Sung, et al. ∙ NAVER Corp. 0

Machine learning libraries such as TensorFlow and PyTorch simplify model implementation. However, researchers are still required to perform a non-trivial amount of manual tasks such as GPU allocation, training status tracking, and comparison of models with different hyperparameter settings. We propose a system to handle these tasks and help researchers focus on models. We present the requirements of the system based on a collection of discussions from an online study group comprising 25k members. These include automatic GPU allocation, learning status visualization, handling model parameter snapshots as well as hyperparameter modification during learning, and comparison of performance metrics between models via a leaderboard. We describe the system architecture that fulfills these requirements and present a proof-of-concept implementation, NAVER Smart Machine Learning (NSML). We test the system and confirm substantial efficiency improvements for model development.



There are no comments yet.


page 7

This week in AI

Get the week's most popular data science and artificial intelligence research sent straight to your inbox every Saturday.

1 Introduction

Deep learning lecun2015deep has recently enabled remarkable progress in diverse fields including as speech arik2017deep ; amodei2016deep

, computer vision

huang2016densely ; redmon2016yolo9000 , machine translation gehring2017convolutional

, and natural language processing

lin2017structured . In addition, multiple easy-to-use deep learning frameworks such as TensorFlow abadi2016tensorflow , PyTorch chintala2017overview and MXNet chen2015mxnet significantly reduce the barrier to implementing such deep learning models.

Still, performing experiments on deep learning architectures requires considerable time and computational resources, and becomes only feasible by leveraging multiple servers and GPUs. These requirements introduce a non-trivial amount of supporting tasks into a researchers’ workflow, such as GPU allocation and distribution of code and data to servers. As a result, researchers often spend large portions of their time on such incidental tasks.

Next to computational requirements, hyperparameter sensitivity of many deep learning models forces researchers to run their experiments using different hyperparameter combinations and keep track of the results, often in a manual fashion. To debug the training process and get better understanding of hyperparameter effects visualization packages such as TensorBoard zou2017understanding and Visdom 111https://github.com/facebookresearch/visdom can be used, but support to compare concurrently performed experiments on many models is lacking. Some machine learning platforms such as Google Cloud ML platform 222https://cloud.google.com/products/machine-learning/ aim to reduce these issues. However, vendor lock-in and support of a restricted set of deep learning libraries only pose their own challenges.

In this paper, we first collect requirements for enhancing research efficiency, and then describe a system architecture that fulfills the requirements. Based on the architectue design, we implement NAVER 333https://www.navercorp.com/en/index.nhn Smart Machine Learning (NSML). The requirements cover many incidental subtasks from automatic GPU allocation and releases to a leaderboard for comparing the model performances, which are not core but essential tasks conducted manually by many researchers. NSML automatically conducts these subsidiary subtasks instead of humans and provides web-based interfaces that are easy to use, thus enabling researchers to focus on their model implementation and data. Currently, NSML supports diverse deep learning libraries with Python APIs including TensorFlow, PyTorch, and MXNet, which are the most popular in deep learning research communities. In addition, NSML supports not only servers with single GPU but also GPU-clusters.

We implemented NSML on a server cluster equipped with 80 P40 GPUs as a prototype. We evaluate NSML based on alpha tests conducted by researchers at NAVER. They implemented models for three tasks: face emotion recognition, face generation, and movie rating prediction. Comments from NSML users indicate that NSML dramatically enhances the research efficiency.

The contributions of NSML are summarized as follows:

  • We define the requirements for efficient deep learning research.

  • We designed and implemented a new deep learning research platform that enhances the research efficiency.

  • We demonstrate the usages of NSML on three real-world applications.

2 Common Workflow Challenges in Machine Learning Research

We list challenges observed from an online community 444https://www.facebook.com/groups/TensorFlowKR comprising more than 25,000 global deep learning researchers and developers over a time frame of one year.

Difficulty in resource management: With increasingly deep and complex models, increasing computational requirements come along. However, it is often difficult to acquire sufficient resources for training models. For example, to train ResNet-152 he2016deep , eight GPUs are required to optimize the 152 layers in a timely fashion. Consider a case where the total number of GPUs in a cluster is sufficient, but due to bad scheduling no single server with eight idling GPUs is available, so that the model cannot be trained. It is therefore necessary to appropriately allocate each task to the server based on the amount of resources required. However, manual assignment is likely to cause inefficiency if multiple developers share the server.

Difficulty in data management:

Deep learning methods require large amounts of training data. Popular datasets such as ImageNet

russakovsky2015imagenet or YouTube-8M abu2016youtube have sizes of multiple gigabytes or more. Researchers must ensure that the datasets are available on each server on which their models should be trained, which so far has to be performed manually. Furthermore, it is inefficient to access the dataset every time separately or to duplicate the preprocessing for running multiple experiments with the same dataset.

Lack of integrated management tools: Researchers need to perform multiple experiments to compare the performances between different models and to find better hyperparameters. These experiments often run simultaneously on multiple servers in order to reduce training time. To manage and control each training task, it is so far necessary for researchers to manually access each of the servers for collecting and comparing results. These tasks are time-consuming and could be automatized.

Difficulty in tracking experiment environments over time: Over time researchers often change model structure or experiment hyperparameters in the quest for improved model performance. Without tedious and manual recordings, it can be difficult to reproduce past experiments as the information about the exact conditions under which an experiment was conducted may be lost.

3 NSML: NAVER Smart Machine Learning

3.1 Requirements of ML Platforms

We elicit the following requirements for practical large-scale ML systems based on the challenges identified in the previous section and the comments from the deep learning community.

Resource Management

  • Better computational resource management to improve utilization and job scheduling.

  • Automatic execution of the entire machine learning pipeline, beginning with data preprocessing to finding the best model, whenever e.g. the dataset is updated.

Data Management

  • Users should be able to post datasets once and reuse them for multiple models.

  • Users should be able to share datasets with others.

  • The systems should be capable of preprocessing large datasets.

Serverless Configuration

  • The systems should not require any configuration or (manual) installation from users.

  • The systems should not be limited to the use of specific libraries and should not depend on specific platforms.

  • The servers should be hidden from users, and users should be able to use the system in a serverless manner by just submitting a training or testing tasks to the platform.

Experiment Management and Visualization

  • The systems should handle parallel runs with different jobs priorities.

  • The systems should automatically visualize and summarize the learning progress.


  • The systems should provide a leaderboard which can compare various models and hyperparameters for each dataset.


  • The systems should be able to predict the performance of experiments based on previously run experiments.

  • The systems should be able to automatically optimize the hyperparameters based on the performance predictions.

  • The systems should save the model of best score.

3.2 NSML System Architecture

Figure 1: System Architecture of NSML

We described the system architecture of NSML as shown in Figure 1(a) in detail. NSML consists of three main parts: scheduler, containerized system, and user interface (UI).

Scheduler: NSML has a scheduler with a centralized scheduling model based on the master-slave structure for efficient allocation of computational resources such as CPUs and GPUs. In NSML, a single node (i.e., master node) is in charge of monitoring all computational resources and scheduling tasks for all clients. Other nodes (i.e., slave nodes) collect information about their computational resources and periodically report it to the master node. A centralized model often suffers from a single point of failure (SPOF) armbrust2010view . We handle this issue with the leader election process by electing new master node as in Zookeeper hunt2010zookeeper when the master node fails. To train models, clients have to submit a job to the scheduler for obtaining computational resources. Then, the scheduler first looks over the job queue. If the job queue is empty, the scheduler immediately selects an available slave node and informs the client about its address. Compared to first inserting the job into the queue, this approach allows the scheduler to avoid queue operation overhead. Otherwise, the job will be inserted in the job queue.

Containerized System: We separate containerized systems into two groups: storage containers and ML containers. Storage containers use minio 555https://www.minio.io/ to store and supply datasets to ML containers. They also store the performance of all models trained with the respectively provided dataset as well as display the results in a leaderboard to make clear which model performed best. Storage containers furthermore back up intermediate and final results of trained models and also store the source code associated with the experiments so that users can easily reproduce and improve both their own and other users’ models. ML containers can contain any type of systems and libraries. When a user sets up an environment, NSML automatically packages it into a ML container and copies the user’s codes and datasets from the respective storage containers. Then NSML runs the code, reports the learning status and backs up intermediate and final results of trained models.

Containerized ML system can solve many challenges that frequently appear during training deep learning models. For instance thanks to the containerized infrastructure different users can rely on different library versions for their machine learning environment via NSML. If one user wants to use PyTorch in python 2.7, he or she just needs to select the corresponding base docker image. Meanwhile other users can use TensorFlow in python 3.6 and their models can be run on the same machine thanks to the isolation provided by the containers. NSML also provides visualization of trained model via both TensorBoard and Visdom using the ML containers to simplify model evaluation.

User Interface: The user interface (UI) controls the input and output flow between users and NSML. The UI is separated into the command line interface NSML-CLI and the web UI. NSML-CLI runs on users’ local system and requires docker to prepare containers for NSML. NSML-CLI collects the model code in a container. Usage of NSML-CLI may be challenging for users that are not familiar with the command line. The web UI wraps NSML-CLI in a web application and is more intuitive and easy to use for these users. Furthermore the web UI provides visualizations such as graphs, logs, and demos.

3.3 Implementation Details

NSML is a decentralized cloud system except the scheduler. A user directly connects to a docker container via CLI once the container is scheduled. NSML-CLI is implemented in Python 3.

Research on machine learning consists of three main steps: preparation and preprocessing data, training models and testing models.

NSML supports data preparation and preprocessing steps with web storage such as minio. NSML-CLI communicates with a storage container via docker-cli and Python libraries.

For training models, we first implemented a scheduler to distribute physical resources including GPUs efficiently. After allocation of resources, NSML builds a docker image for ML environments and mounts a dataset from a storage container. These two steps are bottlenecks of training models in NSML. We removed the first bottleneck by reusing existing docker images if a user needs the same environment. The other can be solved by sharing dataset directories among all ML containers when they are physically located at the same host machine. Then NSML runs trains the model by running the user provided code. During training NSML stores intermediate trained models into the storage container. With these backup files, NSML supports reproducing the same model and tuning hyperparameters during training. We implemented both hyperparameter tuning in training time and model evaluation through python read-eval-print loop (REPL), which allows a user to evaluate one simple line and print the result. With this feature, NSML can achieve hyperparameter tuning in training time by pausing user-written codes, downloading a model from storage container, and resuming the code. We used this feature not only to test and resume models, but also to demonstrate models as a service through web UI.

Our web servers run with nginx 666https://nginx.org/en/ and the web UI translates a user’s input to NSML-CLI commands. For example the web UI allows testing trained models in real time by issuing the nsml infer command. For this command nsml-CLI creates new container with python REPL, and a user can run a demo of trained models through this new container.

Figure 2: Example of Web UI and NSML-CLI

3.4 Usage Examples

After installation, nsml commands can be invoked with nsml [OPTIONS] COMMAND [ARGS]... syntax. NSML has two main commands: nsml dataset and nsml run.
nsml dataset provides commands to examine and manage the list of datasets available in the NSML cloud environment as well as to add new datasets to the environment.
nsml run provides functionality to pack codes from the local workstation of the researcher and execute it in the cloud environment with access to a specified dataset that will be mounted at a predefined mounting point.

For example, nsml run main.py -d [name of dataset] would package the code in the current directory, send it to the NSML server, and then run main.py giving access to the specified dataset.

To ease the task of performing experiments, a client package that can be accessed from the experiment code is provided. It contains functions that allow experiment metrics to be logged via both TensorBoard and Visdom. These logs can be accessed in raw form with nsml logs [OPTIONS] SESSION and visualized nsml plot [OPTIONS] SESSION, where SESSION denotes a session identifier returned by nsml run.

Furthermore, NSML contains a kaggle-like leaderboard on which experiment results on a specific dataset can be recorded and compared. nsml dataset board [OPTIONS] DATASET command gives access to the NSML leaderboard. Figure 2 display an example of Web UI and NSML-CLI on the MNIST dataset.

4 Experiments via Alpha Tests

4.1 Details of alpha tests

We operated NSML in a phase of alpha tests with four different machine learning tasks including 1) MNIST classification, 2) GAN-based face generation, 3) BiLSTM-based movie rate prediction, and 4) CNN-based facial emotion recognition. Figure 3 illustrates the demonstration of the experiments on three datasets. As shown in Figure 3, users can conveniently develop their model and perform the experiments.In addition, Figure 4 depicts a web demonstration of real-time classification on the input a user draws using the model trained from the MNIST dataset. NSML supports interactive web demonstration using trained models, thus enabling researchers to easily visualize the results on user input and output of their models as shown in Figure 4.

Figure 3: Visualization of three real-world tasks
Figure 4:

Demonstration of immediate classification on interactive user input using a trained model from the MNIST dataset. Input in the lower figure was modified from the upper figure by adding some lines, and this causes the class label probability to be changed from 1 to 2.

4.2 Interviews of alpha testers

During the alpha tests, we collected reviews from the alpha testers and summarized them into following items.

  • The usage of NSML is more intuitive than other platforms. It is not hard to learn and understand the work flow of the system. And the NSML provides almost all the necessary functions such as multiple GPUs allocation and reproducing the past experiments. It makes it easier to focus on researching and developing the deep learning models.

  • The visualization and history logging of experiments make it more efficient. We don’t need to manually implement tedious jobs such as drawing a graph and saving a model.

  • Currently, the system is little bit unstable. Sometimes the system has no response and has been recovered after a few minutes. Maybe the system is not ready for public services.

5 Discussion and Concluding Remarks

We demonstrate a new machine learning platform that enhance the research efficiency, NSML. For designing NSML, we investigate the challenges in machine learning research from a deep learning community. Then, we define the detailed requirements with six categories. NSML provide the functionalities corresponding to the requirements, thus enabling the researchers to focus on their model implementation and data.

Current version of NSML has one main limitations. NSML only supports data-driven machine learning tasks. Machine learning tasks such as reinforcement learning require an environment for agents as well as a dataset. This issue will be addressed by treating an environment in a way similar to that NSML treats a dataset. More AutoML features will be added in future for dramatically reducing research time. Ultimately, we add a protocol that the best model for each task can be automatically copied to A/B test systems for NAVER and Clova

777https://clova.ai/en/research/research-areas.html services in order to seamlessly connect between research and services.

More detailed information will be available at https://clova.ai/en/research/research-area-detail.html?id=1.


The authors thank Hyunah Kim for data preparation, Doris Choi for discussion, and Miru Ryu for the web interface design. In particular, the authors appreciate all members of TensorFlow KR in Facebook for discussing diverse requirements.