Skip to content
@elixir-nx

Numerical Elixir (Nx)

Welcome to Numerical Elixir!

Numerical Elixir is an effort started in 2021 to bring the power of numerical computing to Elixir (and vice-versa). This organization hosts several projects that empowers Elixir in the areas of data, machine learning, AI, and more. Our beloved mascot is the Numbat.

Key projects

There are 5 key projects in our Numerical Elixir effort. We will briefly summarize them below and draw comparisons to other ecosystems to help developers familiarize with our work.

Nx

Nx stands for Numerical Elixir and it is the project that started it all. Nx is a multi-dimensional tensors library with multi-staged compilation to the CPU/GPU. It plays a similar role to Numpy in the Elixir community. It is inspired by Google's JAX and ships with its own Tensor Serving implementation that can run concurrently, distributed over multiple nodes, as well as partitioned across several GPUs.

Livebook

Livebook brings the next generation of open-source local-first notebooks to Elixir. With Livebook you can write interactive and collaborative notebooks, which are truly reproducible, all the way to package management. If you are not yet familiar with Elixir, Livebook and its smart cells are one of the best ways to get started, and it features a growing ecosystem of integrations for databases, messaging, visualization, and more.

Explorer

Explorer brings series (one-dimensional) and dataframes (two-dimensional) for fast and elegant data exploration to Elixir. It brings the power of Rust via the Polars library and it is inspired by dplyr (from the R community).

Axon

Axon is a Nx-powered Neural Network library. It splits out into three components: a Functional API of numerical functions, a high-level Model Creation API, and a Training API inspired by PyTorch Ignite.

Also check out the Bumblebee project, which provides several pre-trained Neural Networks with Hugging Face Models integration. Together with Livebook, it only takes 3 clicks to get your first Neural Network running in Elixir.

For integration with other platforms, see Ortex which provides full-blown compatibility for running ONNX models via ONNX Runtime bindings. Alternatively, see AxonONNX to convert ONNX models to Axon models whenever possible to achieve better integration with Nx.

Scholar

Scholar is the most recent addition to the Nx ecosystem and it focus on traditional machine learning techniques, such as classification, regression, clustering, dimensionality reduction, metrics, and preprocessing. Because Scholar is fully built on top of Nx, it is fully GPU-ready, vectorizable, distributable, and more.


Why Elixir?

The goal of the Nx project is to marry the power of numerical computing with the Erlang VM capabilities for building concurrent, scalable, and fault-tolerant systems.

Elixir is a functional programming language that runs on the Erlang VM. And, at this point, you might ask: is functional programming a good fit for numerical computing? One of the main concerns is that immutability can lead to high memory usage when working with large blobs of memory. And that's true!

However, it turns out that the most efficient way of executing numerical computations is by first building a graph of all computations, then compiling that graph to run on your CPUs/GPUs. This reduces the back-and-forth between the host language (Elixir, Python, etc) and the numerical core and it allows your code to be further optimized. At this point, your numerical computing code becomes a function:

input -> [compiled numerical computing graph] -> output

The input is an Elixir data-structure. Inside the function, the algorithm is highly optimized and free to mutate the data in any way it seems fit. Then we get an output that once again must obey Elixir semantics.

To build those graphs, immutability becomes an indispensable tool both in terms of implementation and reasoning. As an example, the JAX library for Python, which has been one of the inspirations for Nx, also promotes functional and immutable principles:

JAX is intended to be used with a functional style of programming

— JAX Docs

Unlike NumPy arrays, JAX arrays are always immutable

— JAX Docs

At the end of the day, Elixir provides the functional foundation and a powerful macro system that allows us to compile a subset of Elixir to the CPU/GPU.

With the addition of Nx.Serving, we started to marry the benefits of the Erlang VM with numerical computing. With Nx.Serving, you can batch numerical computing requests, as well as load balance requests over a cluster of machines (see the announcement). This makes it easy to embed and scale Nx code within your existing Elixir systems, both horizontally and vertically, and without a need for third-party services. Our goal is to apply those principles to our whole Numerical Elixir stack.

We also expect numerical computing to complement the Elixir ecosystem in different ways, such as:

  • running Machine Learning models in real-time within your Phoenix web application

  • deploying models, signal processing, and data modelling inside embedded systems via Nerves

  • incorporating data analysis and classification algorithms inside concurrent data pipelines powered by Broadway

  • adding audio and video processing and AI capabilities to media systems through Membrane

Resources

Here is a non-exhaustive list of resources put together by Numerical Elixir contributors.

Books

Videos

Articles

Pinned Loading

  1. nx nx Public

    Multi-dimensional arrays (tensors) and numerical definitions for Elixir

    Elixir 2.7k 199

  2. axon axon Public

    Nx-powered Neural Networks

    Elixir 1.6k 105

  3. scholar scholar Public

    Traditional machine learning on top of Nx

    Elixir 438 47

  4. bumblebee bumblebee Public

    Pre-trained Neural Network models in Axon (+ 🤗 Models integration)

    Elixir 1.4k 104

  5. ortex ortex Public

    ONNX Runtime bindings for Elixir

    Elixir 138 16

Repositories

Showing 10 of 19 repositories
  • nx Public

    Multi-dimensional arrays (tensors) and numerical definitions for Elixir

    elixir-nx/nx’s past year of commit activity
    Elixir 2,675 199 15 5 Updated Dec 12, 2024
  • emlx Public

    MLX Backend for Nx

    elixir-nx/emlx’s past year of commit activity
    Elixir 82 Apache-2.0 1 5 1 Updated Dec 12, 2024
  • axon Public

    Nx-powered Neural Networks

    elixir-nx/axon’s past year of commit activity
    Elixir 1,562 Apache-2.0 105 17 2 Updated Dec 6, 2024
  • bumblebee Public

    Pre-trained Neural Network models in Axon (+ 🤗 Models integration)

    elixir-nx/bumblebee’s past year of commit activity
    Elixir 1,388 Apache-2.0 104 23 5 Updated Dec 2, 2024
  • scholar Public

    Traditional machine learning on top of Nx

    elixir-nx/scholar’s past year of commit activity
    Elixir 438 Apache-2.0 47 12 (7 issues need help) 0 Updated Nov 28, 2024
  • ortex Public

    ONNX Runtime bindings for Elixir

    elixir-nx/ortex’s past year of commit activity
    Elixir 138 MIT 16 5 0 Updated Nov 19, 2024
  • xla Public

    Pre-compiled XLA extension

    elixir-nx/xla’s past year of commit activity
    Elixir 92 Apache-2.0 22 5 0 Updated Nov 13, 2024
  • nx_iree Public

    Elixir and Nx bindings for the IREE runtime and compiler

    elixir-nx/nx_iree’s past year of commit activity
    C 28 Apache-2.0 2 2 (1 issue needs help) 0 Updated Oct 19, 2024
  • stb_image Public

    A tiny image library using stb_image as the backend

    elixir-nx/stb_image’s past year of commit activity
    Elixir 46 Apache-2.0 5 0 0 Updated Oct 8, 2024
  • tokenizers Public

    Elixir bindings for 🤗 Tokenizers

    elixir-nx/tokenizers’s past year of commit activity
    Elixir 93 Apache-2.0 18 0 1 Updated Oct 2, 2024

Top languages

Loading…

Most used topics

Loading…