The Open-Source AI Stack
RSS

Grants · Project grant · US

Nx (Elixir machine learning)

Distributed machine-learning framework leveraging Elixir's concurrency and fault-tolerance properties as an alternative to Python-centric stacks.

Nx is the Numerical Elixir project, a tensor library and JIT-compiled numerical computing stack for the BEAM virtual machine. It originated when Elixir creator Jose Valim reached out to Sean Moriarity, author of Genetic Algorithms in Elixir, and the two co-developed a numerical foundation comparable in role to NumPy for Python. The project is maintained under the elixir-nx GitHub organization, with significant ongoing contribution from DockYard, the consultancy that employed Moriarity and that received the Mozilla award on the project's behalf.

Architecturally Nx defines a multi-dimensional Tensor type and a set of numerical definitions (`defn`) that are not interpreted as ordinary Elixir but compiled to an intermediate representation and lowered onto pluggable backends. The two production backends are EXLA, which targets Google's XLA compiler for CPU, GPU, and TPU acceleration, and Torchx, which targets LibTorch. The repository is roughly 94% Elixir and 6% C++, with the C++ being the bindings to the foreign compilers.

Above Nx sits a small set of higher-level libraries that together form the BEAM-native ML stack. Axon is Moriarity's neural-network library, designed with PyTorch-Ignite-style training loops. Bumblebee loads pretrained Hugging Face Transformers models directly into Elixir, lowering the barrier to use in production. Explorer wraps the Rust Polars library for DataFrame work. Livebook is the interactive notebook environment Valim built to host the whole stack and was the channel through which much of the early ML adoption happened. The elixir-nx organization now hosts roughly 18 projects.

The Mozilla Builders Accelerator selected Nx from nearly 200 applications in the September 23, 2024 cohort with funding of up to $100K. In the stack Nx sits at the training and runtime layers, with the broader thesis that a fault-tolerant, concurrency-first runtime (BEAM) can host serious numerical workloads when paired with appropriate compiler backends, and that Phoenix-class Elixir applications can serve ML inline rather than calling out to a Python service.

Recipient

Nx project / DockYard

Funder

Mozilla Foundation / Builders / Mozilla.ai · foundation · US

Open-source AI tooling, developer-facing AI applications, democratic AI. Three audience-segmented sites (Builders, Mozilla.ai, AI Guide).

Primary source

https://blog.mozilla.org/en/mozilla/14-ai-projects-to-watch-mozillas-first-builders-accelerator-cohort-kicks-off/

Additional sources

More from Mozilla Foundation / Builders / Mozilla.ai