# Apache SINGA

Apache SINGA is an Apache top-level project for developing an open source machine learning library. It provides a flexible architecture for scalable distributed training, is extensible to run over a wide range of hardware, and has a focus on health-care applications.
Apache SINGA has won the 2024 SIGMOD Systems Award for the development of a distributed, efficient, scalable, and easy-to-use deep learning platform for large scale data analytics.

## History

The SINGA project was initiated by the DB System Group at National University of Singapore in 2014, in collaboration with the database group of Zhejiang University, in order to support complex analytics at scale, and make database systems more intelligent and autonomic. It focused on distributed deep learning by partitioning the model and data onto nodes in a cluster and parallelize the training. The prototype was accepted by Apache Incubator in March 2015, and graduated as a top-level project in October 2019. The table below captures information about different types of versions, e.g., the latest version, the latest preview version, older versions which are still maintained, and old versions.
| Version | Original release date | Latest version | Release date |
| Current stable version: 4.3.0 | 2024-09-07 | 4.3.0 | 2024-09-07 |
| Old version, yet still maintained: 4.2.0 | 2024-03-15 | 4.2.0 | 2024-03-15 |
| Old version, yet still maintained: 4.1.0 | 2023-11-05 | 4.1.0 | 2023-11-05 |
| Old version, yet still maintained: 4.0.0 | 2023-04-07 | 4.0.0 | 2023-04-07 |
| Old version, yet still maintained: 3.3.0 | 2022-06-07 | 3.3.0 | 2022-06-07 |
| Old version, yet still maintained: 3.2.0 | 2021-08-15 | 3.2.0 | 2021-08-15 |
| Old version, yet still maintained: 3.1.0 | 2020-10-30 | 3.1.0 | 2020-10-30 |
| Old version, yet still maintained: 3.0.0 | 2020-04-20 | 3.0.0 | 2020-04-20 |
| Old version, no longer maintained: 2.0.0 | 2019-04-20 | 2.0.0 | 2019-04-20 |
| Old version, no longer maintained: 1.2.0 | 2018-06-06 | 1.2.0 | 2018-06-06 |
| Old version, no longer maintained: 1.1.0 | 2017-02-12 | 1.1.0 | 2017-02-12 |
| Old version, no longer maintained: 1.0.0 | 2016-09-08 | 1.0.0 | 2016-09-08 |
| Old version, no longer maintained: 0.3.0 | 2016-04-20 | 0.1.0 | 2016-04-20 |
| Old version, no longer maintained: 0.2.0 | 2016-01-14 | 0.2.0 | 2016-01-14 |
| Old version, no longer maintained: 0.1.0 | 2015-10-08 | 0.1.0 | 2015-10-08 |
| Legend:Old version, not maintainedOld version, still maintainedLatest versionLatest preview versionFuture release ||||

## Software Stack

SINGA's software stack includes three major components, namely, core, IO and model. The following figure illustrates these components together with the hardware. The core component provides memory management and tensor operations; IO has classes for reading (and writing) data from (to) disk and network; The model component provides data structures and algorithms for machine learning models, e.g., layers for neural network models, optimizers/initializer/metric/loss for general machine learning models.

## SINGA-Auto

SINGA-Auto (aka. Rafiki in VLDB2018) is a subsystem of Apache SINGA to provide the training and inference service of machine learning models. SINGA-Auto frees users from constructing the machine learning models, tuning the hyper-parameters, and optimizing the prediction accuracy and speed. Users can simply upload their datasets, configure the service to conduct training, and then deploy the model for inference. As a cloud service system, SINGA-Auto manages the hardware resources, failure recovery, etc. For ease of use, it provides a model zoo, which is a set of built-in machine-learning models for popular tasks such as structured data (e.g., EMR data) analytics, image recognition, and text processing.
In the training service, a general framework for distributed hyper-parameter tuning is proposed and a collaborative tuning scheme is designed specifically for deep learning models. In the inference service, a scheduling algorithm is proposed based on reinforcement learning to optimize the overall accuracy and reduce latency. It can adapt to the changes of request rates.

## SINGA-Easy

SINGA-Easy(ACM Multimedia 2021) is an easy-to-use deep learning framework built as a component of Apache SINGA to facilitate the adoption of deep learning algorithms and inference services by domain-specific domain application users (e.g., multimedia, medical image analysis). It provides distributed hyper-parameter tuning at the training stage, dynamic computational cost control at the inference stage, and intuitive user interactions with multimedia content facilitated by model explanation. To improve accuracy, it supports regularization methods for image and structured data regularizations (ACM SIGMOD 2023). To support the acceptance of domain users on the training results, SINGA-Easy provides an option for users to evaluate model performance from the model explanation perspective based on LIME and Grad-CAM.

## MLCask

MLCask(IEEE ICDE 2021) is a pipeline management subsystem that manages machine learning pipelines, from data cleaning to data analytics, to ease the maintenance of evolving and versioning of machine learning pipelines for collaborative analytics. It serves to reduce the cost and facilitate adoption. MLCask supports a Git-like end-to-end ML life-cycle management. By leveraging the version history of pipeline components and workspace, MLCask can skip unchanged preprocessing steps to address the frequent retraining challenges. Its non-linear version control semantics and merge operation facilitate effective collaborative development of the pipeline.

## In-Database Model Selection

Starting from version 4.1.0, Apache SINGA provides support for in-database model selection and inference in PostgreSQL. The system implements a resource-efficient two-phase model selection algorithm that incorporates both training-free and training-based model selection techniques. This model selection algorithm is integrated non-intrusively into PostgreSQL via stored procedures with optimizations on execution latency and memory consumption. The inclusion of in-database model selection empowers users to obtain high-performing models within their specified response time requirements.

## Applications

Apache SINGA is in use at organizations such as NetEase, Carnegie Technologies, CBRE, Citigroup, JurongHealth Hospital, National University of Singapore, National University Hospital, Noblis, Shentilium Technologies, Singapore General Hospital, Tan Tock Seng Hospital, YZBigData, and others. Apache SINGA is used across applications in banking, education, finance, healthcare, real estate, software development, and other categories.

## Apache SINGA and Social Good

The Ng Teng Fong General Hospital collaborated with the Apache SINGA team to develop an application for people diagnosed with pre-diabetes, a condition where blood glucose levels are higher than normal, but not high enough to be classified as diabetes.
The application called JurongHealth Food Log (JHFoodLg) app, uses Apache SINGA to match photos of food to a database of local dishes - including nasi padang, laksa and char siew rice - and utilises nutrition data from the Health Promotion Board, JurongHealth Campus, and the Australian Food and Nutrient Database. After comprehensive data cleaning (e.g., consistent formatting, deduplication, foodness classification, human calibration), the database contains 209, 861 images, covering 13 food groups and 233 food categories.
The app allows users from the hospital's Lifestyle Intervention (Liven) programme to set weight loss and exercise goals. A six-month study shows that almost all 20 patients who used the app lost between 4 and 5 percent of their initial bodyweight.