Uploaded on May 4, 2021
PPT on Facebook AI's Flashlight Fast and flexible ML Library.
Facebook AI's Flashlight Fast and flexible ML Library.
FACEBOOK AI'S
FLASHLIGHT FAST AND
FLEXIBLE ML LIBRARY
IN C++.
Introduction
• Flashlight is a new open source
machine learning (ML) library
developed by FAIR to allow teams to
quickly and easily change deep and ML
frameworks to better suit their needs.
It is written entirely in C++.
• Flashlight would make it easier for the
AI community to tinker with the low-
level code that underpins deep and ML
frameworks, allowing them to better Source: Twitter
exploit the hardware available and
push performance limits.
2
Purpose
• Deep and machine learning systems
are excellent at what they do, but
changing their internals has proven
challenging in the past.
• Since low-level internals may be
accidentally obfuscated, closed-
source, or hand-tuned for specific
purposes, finding the correct code to
modify is time-consuming and error-
prone.
• Recompiling the framework after Source: Facebook Engineering
you've made improvements is both
time and compute-intensive.
3
Why C++
• Since modern C++ is a powerful tool
for doing research in high-performance
computing environments, we built
Flashlight from the ground up in that
language.
• Since modern C++ allows for first-
class parallelism and out-of-the-box
speed, Flashlight has a very low
system overhead.
• Flashlight also includes easy-to-use
interfaces for integrating code from Source: Medium
low-level domain-specific languages
and libraries.
4
What is does?
• Flashlight is designed on top of a shallow
stack of modular and easy-to-use
abstractions.
• We began with the ArrayFire tensor library,
which supports dynamic tensor shapes and
types without the use of compile-time
specifications or C++ templates.
• With an effective just-in-time compiler,
ArrayFire also optimizes operations on the Source: ArrayFire
fly.
5
Deep Learning
• Although standard deep learning primitives
are implemented using well-optimized kernels
from hardware-specific vendor libraries,
writing custom high-performance code can be
difficult to quickly integrate and iterate on.
• Building new low-level computational
abstractions is simple with Flashlight.
• With minimal effort, you can cleanly integrate
CUDA or OpenCL kernels, Halide AOT
pipelines, or other custom C/C++ code. Source: Levitty
6
Why it Matters?
• As deep and machine learning models
become more complex, progress is
dependent on optimization.
• Advanced AI research and models
necessitate high-performance code that
makes the most of available hardware.
• Flashlight's fast rebuilds make it easier to
do research on the library itself, which can
then be extended to other frameworks
later.
• Flashlight opens the door to research that
stretches the boundaries of success by
making it easier to rapidly iterate on
custom low-level code. Source: Altabel
7
Why Machine Learning Libraries
• Our machine learning group is fortunate
in that many solutions are already
available in the form of libraries and
packages.
• These machine learning libraries are fast
and effective, and they've been
thoroughly tested for a variety of
scenarios.
• Our learning is fueled by these libraries,
which make writing code, whether in C+ Source: Medium
+ or Python, much easier and intuitive.
8
SHARK C++ Library
• Shark is a lightweight modular library
with extensive support for supervised
learning algorithms including linear
regression, neural networks,
clustering, and k-means.
• It also contains linear algebra and
numerical optimization capabilities.
• There are important mathematical
functions or areas to know when
Source: Medium
doing machine learning tasks.
9
MLPACK C++
• mlpack is a C++ machine learning
library that is fast and versatile.
• Its aim is to make cutting-edge machine
learning algorithms available in a quick
and extensible manner.
• These algorithms are provided by
mlpack as simple command-line
programs, Python bindings, Julia
bindings, and C++ classes, which can
then be used in larger-scale machine
learning solutions. Source: TechLeer
10
K-Means Application
• K-means is essentially an iterative
method for segmenting data into
different clusters.
• We begin by assigning some initial
centroids, which are completely
random.
• After that, we find the nearest centroid
for each data point. The data point
would then be assigned to that
centroid.
• As a result, each centroid represents a
distinct class. We'll compute the mean
of those centroids once we've assigned Source: Towards Data Science
all of the data points to each centroid.
11
Comments