Elixir and Machine Learning: Nx v0.1 released
dashbit.co
dashbit.co
I was learning Elixir through advent of code, and this was an invaluable resource for getting my head around an more functional (or Elixir-y?) style of problem-solving.
PHP ~3x in performance from 5.x to 7.x. LuaJIT is even faster over vanilla Lua.
There were multiple attempts at creating an Erlang JIT for well over a decade now and last year BeamAsm was released but in everyday use it seems to net about a 10-15% boast.
I ask because it'd be great if we didn't have to create so many Rust NIFs in order to address Erlang raw slowness.
Curious what your take is on speeding up raw Erlang (please note, I'm not talking about concurrency & I do truly love Exilir/Erlang/OTP)
Although your estimates for JIT improvements seem low on my experience. Compilation times are consistently half of what they were before and test suites range between 33% to 50% faster. Even Whatsapp reported server efficiency increased by 25% and many other factors are likely at play there (source: https://twitter.com/wcathcart/status/1385253969522413568).
I _assume_ we will continue seeing improvements on this front, especially if at some point we start doing cross module optimizations!
Also, I love livebook! I keep a tab with it open and it has replaced my use of iex. Can you talk a little bit about how you decided to embark on building that, too? An ML library and framework is a big enough job already, how did you decide to add Livebook to the list?
---
Curiously, I had two ideas for the name Livebook:
1. An interactive book to teach LiveView. LiveView is a new approach for developing web apps and I thought it could be worth exploring different non-traditional ways of teaching it too!
2. Livebook as code notebooks (what we got!)
It just feels a great fit for the platform, considering Phoenix, LiveView, Distributed Erlang, etc. So why not? :) And I am curious to see if and how we can contribute new ideas to the already extensive ecosystem of code notebooks!
Personally I think this is a great move from Elixir community and especially coming directly from the creator. Some people may be dismissive ( as with at least half of HN ) But I see this with Ruby where there is a chicken and egg problem. The community stuck with Web or Rails Development only. And no one has incentive to kickstart the languages ecosystem in different directions.
So instead of Elixir being another language for Web / Phoenix, it could now ( or in the future ) be used as ML with some level of official support.
I was particularly delighted to see how you built `defn` on top of existing metaprogramming functionality. This kind of thing has lead me to think of Elixir as a Lisp in Ruby's clothing running on the BEAM. :) I hope that's not too inaccurate. Were there any delightful "aha!" moments you got while building this?
defmodule Foo, do: (def foo(bar), do: bar; def bar(baz), do: baz)I don't know how this is emerging. If I take a stab at it, BEAM/OTP/Erlang/Elixir is very good at coordinating among many concurrent processes as well as handling failures that come with it. There really isn't any other language platform that does that as well, including Python. (Although there is interest in recreating those advantages in Rust). The distributed computing is built on top of those concurrency primitives. So when one thinks about adding numerical computing into the mix, I think of:
- Broadway (an Elixir library) that handles workflows from unreliable data sources. It is already in production use to handle massive, distributed web scraping operations, so embedding a data transform in there with numeric computing will have good synergies
- IoT applications, both at the edge with Nerves, and with the command/control for IoT. Each of the IoT devices are unreliable (power and network), and OTP already has great facility for that. Being able to do numeric computing at the edge is a thing.
We are not trying to make Elixir the new AI language, but one possible language for AI. @hosh covered some of the use cases in his reply and I can add two more insights:
* Lately we have seen functional ideas brought into Python through projects like JAX and Thinc.ai and I think exploring those concepts within a functional language is both interesting and exciting (and we are not the only ones doing so!)
* Besides IoT and data pipelines, there is potential in mixing some of the current ML trends, such as Distributed and Federated Learning, with the capabilities of the platform
We likely aren't much attractive to Python developers right now, unless you are interested in contributing/designing ML tooling (for learning, hobby, or professional reasons) or you have a use case that suits one of the mentioned strengths of the platform.
* pandas - explorer
* numpy - nx
* statsmodel - Not sure this exists yet
The article answers this pretty well.
However, our goals are also to:
* make Elixir a suitable platform for new Machine Learning developments
* fully leverage the power provided by the platform Elixir runs on, the Erlang VM
* provide consistency and stability, especially when working on a domain that is still actively evolving
For those reasons, we chose to invest on Nx as its own foundation, agnostic to any particular framework. The road is definitely longer but we also believe the pay-off will be higher too!
Give elixir a shot. I used to use python (though not as much as I used ruby) and I will never go back to python.
After learning other languages though, I cannot see the point behind using Python aside from broad adoption. Couldn't imagine choosing it for any problem I needed to solve.
I was actually really looking forward to it after hearing for years about how Python would have "one way to do everything" but there's a gazillion different ways just to run Python on your machine, different versions of it to choose from.
Should I be running the local system version, PyPy, Stackless, Anaconda, Miniconda? Is PyEnv the weapon of choice for multiple Python codebases or is it one of the many others? The Python 2 vs 3 migration stuff I expected to be a little wonky but all of the stuff on top of it was just weird for a community that had so long been advertised as having agreed on solutions.
I did finally get why a lot of experienced developers call it "The Okayest" language.
any idea on M1 gpu support? (know it's mostly an upstream issue)
excited about "real"/intensive ML workflows locally..
https://www.thoughtworks.com/radar/tools/nx
I know for a fact it has already confused elixir developers who were looking for an elixir plugin for Nx (the monorepo tool).
[1]https://web.archive.org/web/20190501153325/https://nx.dev/
the nx.dev site is just what I'm pointing to, dunno what url it was before that.
no idea if there was an elixir plugin for nx (easy enough to integrate https://www.youtube.com/watch?v=IRIXPTIKTmA&t=6s) but I'd have no hope of finding it now .
it's totally not the worst thing that nx was also the name Valim chose (I have no investment in to tool or company myself), but it is bad for both projects.