ausimian

ausimian

Emily is an Elixir library that runs Nx computations on Apple’s MLX. Install it as the default Nx backend and Nx, defn, Axon, Nx.Serving, and Bumblebee all dispatch to the Metal GPU on Apple Silicon with no further integration work.

Highlights:

  • Nx.Backend with transparent fallback for uncovered ops
  • Nx.Defn.Compiler that threads Bumblebee and Nx.Serving through MLX
  • Fused transformer kernels (rms_norm, layer_norm, rope, scaled-dot-product attention), optionally applied to any Bumblebee model via a shim
  • Affine group-wise int2 / int4 / int8 quantisation
  • bf16 mixed-precision training
  • Per-process Metal command queues for concurrent inference on a shared model
  • Runnable Livebooks for DistilBERT QA, Qwen3 quantized generation, MNIST training, Whisper transcription,
    and the fused kernels

MLX is vendored in (for now) because the recent command queue threading-related features have not yet been released. The first compile will compile MLX, which can be a bit slow (> 1 min).

macOS / Apple Silicon. Requires Xcode with the Metal toolchain;

https://github.com/ausimian/emily

Showing Posts 1 to 10

kip

kip

ex_cldr Core Team

Amazing work, that’s such a great contribution and I can’t wait to give it a spin.

LostKobrakai

LostKobrakai

ausimian

ausimian OP

Roughly:

  • emily exposes the concurrency model now available in mlx, I assume emlx can’t do this because of the version it uses.
  • emily has features I don’t believe emlx advertises. Fused kernels, quantisation, mixed precision training (might be wrong about this one), maybe also zero-copy to_binary/1.
  • emily vendors mlx at a specific commit (for reasons outlined above and in more details in the docs), emlx uses a relatively old binary
  • There’s quite a few conformance tests in emily that use real open-source models, but I mostly did that for my own sanity
borodark

borodark

Can’t wait to get my hands on Apple M hardware to integrate this with my eXMC.

ausimian

ausimian OP

Also Emily allows you to control whether MLX’s kernels are compiled AOT or JIT. The latter significantly reduces the size of the final application, at some small trade-off for start-up time. The CI tests, including conformance, run in both modes.

christhekeele

christhekeele

Nice! Does this mean that there’s a backend for Nx that now Just Works™️ in Livebooks run on OSX that is actually GPU accellerated?

ausimian

ausimian OP

Yes, there a few livebooks in the docs that demonstrate usage - it’s really just setting the default backend in the Mix.install config e.g:

polvalente

polvalente

Nx Core Team

We’re open to bringing in any features to EMLX you feel are missing (and also you as a maintainer) if you wanna join efforts!

polvalente

polvalente

Nx Core Team

I will say it would have been nice to acknowledge EMLX in the README as a source of inspiration, since the PLAN.md committed to main references it quite a bit.

ausimian

ausimian OP

Yes of course, thx for pointing this out. I’ll address this today.

Where Next? Top

Trending in Announcing Top

woylie
Flop is an Elixir library that applies filtering, ordering and pagination parameters to your Ecto queries. offset-based pagination with...
New
MRdotB
I needed to reuse React components from my Chrome extension in my Phoenix/LiveView backend. I noticed that for Svelte/Vue, there are live...
New
woylie
I released Doggo, a collection of unstyled Phoenix components. https://github.com/woylie/doggo Features Unstyled Phoenix components....
New
marciok
Hi there! We created Gust: A task orchestrator inspired by Airflow. For those who have never heard about Aiflow, it’s a Python-based wor...
New
anuaralfetahe
Hello Published a new library - ProcessHub! ProcessHub is a library designed to manage process distribution within the Elixir cluster. ...
New
jimsynz
Beam Bots (or just BB for short) is a framework for building fault-tolerant robotics applications in Elixir using familiar OTP patterns. ...
New
Dmk
Xamal is a deployment tool for Elixir apps that deploys native releases to bare metal servers over SSH. It’s a port of GitHub - basecamp/...
New

Other Trending Topics Top

mudasobwa
I am happy to introduce the very α version of the new programming language compiled to BEAM. Welcome Cure. It has literally three kille...
New
webofbits
With AI doing more of the implementation work, I’ve been wondering how much coding I should deliberately keep doing myself. My main conc...
#ai
New
sergio
It’s not that it’s vocabulary is too advanced. It’s something worse. I get lost trying to follow even a paragraph written by Claude. It’...
New
AstonJ
This showed up on my feed.. anyone heard of it? Just hype? Ox Alpha is a reasoning model designed for coding, sustained ag...
New
sorenone
Today we’re releasing Oban for Python. Not an Oban client in Python. Not a pythonx wrapper embedded in Elixir. Nope, it’s a fully operati...
New
akoutmos
@hugobarauna, Dr. Dimitrios Koutmos (my brother) and I (Alex Koutmos) have been hard at work on writing a book on how you can use Elixir ...
New

We're in Beta

About us Mission Statement

Options

Thread Display Mode




Thread Preview

Skip Thread Previews