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

mudasobwa
I fully migrated to my own harness from Anthropic/Gemini and I think it’s time to share it. Welcome DSH, the DeepSeek Harness, fully writ...
New
kip
Localize is the next generation localisation library for Elixir. Think of it as ex_cldr version 3.0. The first version will be released ...
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
mcass19
ExRatatui lets you cook up rich terminal UIs in Elixir, powered by Rust’s ratatui via Rustler NIFs. Build interactive terminal applicatio...
New
danschultzer
I’ve moved the strategies out of PowAssent and created a multi-provider framework for Elixir. This way the strategies can be used in any ...
New
gtcode
Aloha gang, There’s a new class of AI model out from TypeSafe. Jev is their flagship model. You can learn about it here: ...
New
danschultzer
I needed something like premailer for rails, and after searching, I decided to make an easy-to-use library to handle inline styles and co...
New

Other Trending Topics Top

dominicletz
Hey there, I haven’t seen a list of useful Elixir specific skills for the popular AI tools yet so I’m starting one here with my first. ...
New
raa-ziq
Hi everyone :waving_hand: I wanted to share something I’ve been building — NowBlind, a random chat app designed to help people discover ...
New
KristerV
Hey. Is there anyone here who creates agents in their apps? Not talking about using agents, but creating them. I’m finding it pretty diff...
New
OndrejValenta
(I just needed to vent somewhere and LinkedIn is full of hope, or hype, I’m not sure which exactly) AI dream has many faces, but general...
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
AstonJ
With advancements in AI gathering pace and set to increasingly accelerate, perhaps it’s worth having an annual thread on the topic - feel...
New

We're in Beta

About us Mission Statement

Options

Thread Display Mode




Thread Preview

Skip Thread Previews