1 of 30

Tiny Machine Learning

Mahesh Chowdhary, Swapnil Sayan Saha

STMicroelectronics Inc. (AMS MEMS Division)

ST Restricted

2 of 30

Real-Time Inference

2

Autonomous Driving

Augmented Reality

Picosatellites

Smartphones and Wearables

Micro-UAVs

Underwater Sensing

Wildlife Tracking

Agricultural Robots

Several applications need to make “complex inferences” for “time-critical” and “remote” applications from “unstructured data”.

ST Restricted

3 of 30

Conventional AI Deployment

3

Conventionally, such inferences have been made using machine learning models running on edge servers, continuously trained using new data on the cloud.

ST Restricted

4 of 30

What is Tiny Machine Learning?

4

Hardware and software suites that enable always-on, ultra-low power, and on-device data analytics.

Microcontrollers

Field-Programmable

Gate Arrays

Intelligent Sensor Processing Units

Primary memory: 100 - 102 kB

Secondary memory: 103 kB

Power consumption:

µW to mW regime

Architecture: Single-core

ST Restricted

5 of 30

What is Tiny Machine Learning?

5

TensorFlow Lite

Micro

µTVM

Edge Impulse EON

STM32 Cube.AI

Hardware and software suites that enable always-on, ultra-low power, and on-device data analytics.

Code translation and generation

Operator optimizations

Inference engine optimizations

Model compression

ST Restricted

6 of 30

Tiny Machine Learning Workflow

6

ST Restricted

7 of 30

Agenda

7

1

Feature Projection

2

Lightweight Model Backbones

3

Neural Architecture Search

4

Compiler Suites and Model Compression

ST Restricted

8 of 30

Feature Projection

ST Restricted

9 of 30

Feature Extraction and Selection

9

ANOVA

AdaBoost

Recursive

Sequential

Random Forest

Statistical

Temporal

Spectral

Recursive

Windowing

Feature Extraction

Feature Selection

Model Training

Projected Data

Windowed Data

Final Model

Model Input (Selected Features)

Model Performance

ST Restricted

10 of 30

Feature Selection Techniques

  • ANOVA: Computes the F-statistic by using analysis of variance on all input features w.r.t the target labels. ANOVA ranks the significance of the target label by estimating the degree of linear dependency between random variables. Features with a higher f-statistic and low p-values rank highest.

  • AdaBoost: Uses a DT to fit the original dataset, and then fits additional copies of the classifier to the same datasets with weights applied to the incorrectly classified instances. The ranking of features is calculated by traversing each subsequent classifier and calculating the Gini importance across each tree.

  • Random Forest: Fits several DT classifiers on various sub-samples of the dataset, uses Adaboost ranking and averaging to improve the predictive accuracy and control over-fitting.

10

ST Restricted

11 of 30

Feature Selection Techniques

  • Sequential Feature Selection: Adds or removes features to form a feature subset greedily. At each stage, the estimator chooses the best feature to add or remove based on the cross-validation score of a DT. The ranking is calculated by assigning each feature a binary value to indicate whether it is an important feature or not.

  • Recursive Feature Elimination: Recursively considers smaller and smaller sets of features. First, a DT is trained on the initial set of features and the importance of each feature is obtained either through any specific attribute or callable. Then, the least important features are pruned from the current set of features. The procedure is recursively repeated on the pruned set until the desired number of features to select is eventually reached

11

ST Restricted

12 of 30

Feature Transformation: Matrix Factorization

12

 

ST Restricted

13 of 30

Lightweight Model Backbones

ST Restricted

14 of 30

Sparse Low-Dimensional Projection

14

Sparsely projecting data onto a low-dimensional manifold (prototypes) yields lightweight linear classifiers such as decision tree or kNN.

ST Restricted

15 of 30

Low-Rank, Sparse, and Quantized Recurrent Blocks

15

FastRNN and FastGRNN combines the lightweightness of vanilla recurrent networks (e.g., RNN and GRU) with stability of long short-term memory networks (e.g., LSTM)

ST Restricted

16 of 30

Temporal Convolution

16

Causality

Dilation

Residual Block

ST Restricted

17 of 30

Lightweight Spatial Convolution

17

ST Restricted

18 of 30

Neural Architecture Search

ST Restricted

19 of 30

What is Neural Architecture Search?

19

Automatically find the most performant neural network architecture from a hyperparameter space within some constraints.

Optimization Function

Search Space

Search Algorithm

Candidate

model

Score

Most performant model

*

ST Restricted

20 of 30

Hardware Constraint Profiling

20

Slowest but most accurate

Fastest but least accurate

ST Restricted

21 of 30

Optimization Function

21

NAS is a non-linear program with constraints.

Search space Ω contains neurosymbolic hyperparameters, trainable weights, neural operators, and symbolic program atoms.

Goal: construct a fault-free AI program such that latency and error are minimized, while the memory usage is maximized within device memory limits.

ST Restricted

22 of 30

Search Algorithms

22

ST Restricted

23 of 30

Evolutionary NAS

23

ST Restricted

24 of 30

NAS as Bayesian Optimization

24

Two components: Surrogate function and acquisition function

A surrogate function approximates an optimization function, e.g., Gaussian process.

An acquisition function selects the next promising set of points to sample.

Surrogate posterior mean

True objective plane

Sample

Uncertainty

Observed

points

Current

sample

Credits: BayesO

ST Restricted

25 of 30

Compiler Suites and Model Compression

ST Restricted

26 of 30

Compressing a Neural Network

26

ST Restricted

27 of 30

TinyML Compiler Optimizations

27

ST Restricted

28 of 30

Notable TinyML Compiler Suites

28

EdgeML

ST Restricted

29 of 30

TensorFlow Lite Micro

29

ST Restricted

30 of 30

Find out more at www.st.com

You can personalize this

last page with a short link

(ex. www.st.com/shortlink)

You can find a complete list of �st.com short links on this page:

http://seo.st.com/toolbox/shortcuts/

© STMicroelectronics - All rights reserved.�ST logo is a trademark or a registered trademark of STMicroelectronics International NV or its affiliates in the EU and/or other countries. For additional information about ST trademarks, please refer to www.st.com/trademarks. �All other product or service names are the property of their respective owners.

ST Restricted