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

bluzky
You may know https://ui.shadcn.com/, a UI component library for React. I really love it’s design style and components. I’ve built some co...
387 15136 120
New
woylie
Flop is an Elixir library that applies filtering, ordering and pagination parameters to your Ecto queries. offset-based pagination with...
New
restlessronin
The repo is at GitHub - cyberchitta/openai_ex: Community maintained Elixir library for OpenAI API · GitHub. Docs are at OpenaiEx User Gu...
152 11030 135
New
JesseHerrick
Hey, I’m Jesse and I’m the main contributor behind Dexter, a full-featured, lightning-fast Elixir LSP optimized for large codebases. It s...
New
shahryarjb
The Chelekom project is a library of Phoenix and LiveView components generated via Mix tasks to fit developer needs seamlessly. One of i...
New
woylie
Phoenix components for pagination, sortable tables and filter forms with Flop and (optionally) Ecto. pagination cursor pagination sorta...
New
kip
Please say hi to a new lib, Astro that aims to deliver easy-to-consume astronomy calculations of practical use. For now it only calculat...
New

Other Trending Topics Top

akoutmos
@hugobarauna and I (Alex Koutmos) have been hard at work on writing a book on Nerves that takes you from simply blinking LEDs to building...
New
spammy
I’m looking to build a personal workflow to quickly deploy web applications written in elixir/phoenix, for local consumption (ie not on t...
New
alexslade
Fly’s CEO posted this recently - Turn And Face The Strange · The Fly Blog It says that Fly is going all-in on sprites, which is a worry ...
New
bartblast
Hey folks, I just published a post about Hologram’s funding and where the project goes next - the short version: Curiosum as Main Spons...
New
Herve37
We’re evaluating API mocking tools for OpenAPI-based projects and would love to hear what other teams are using. We’re particularly inte...
New
mudasobwa
I am seeing a lot of aplications of Argumentum ad Vericundiam in software discussions. They do link some piece of writing and point us to...
New

We're in Beta

About us Mission Statement

Options

Thread Display Mode




Thread Preview

Skip Thread Previews