blasphemetheus

blasphemetheus

Edifice - 92 neural network architectures for Nx/Axon

I’ve been working on an open-source framework for training bots for Super Smash Bros. Melee in Elixir (ExPhil). Along the way I got thoroughly distracted by the plethora of architectures to try, benchmarks to run, and optimizations to make.

What came out of that is Edifice – a library of 92 neural network architectures built on Nx and Axon, covering 16 families.

def deps do
[{:edifice, “~> 0.1.1”}]
end

The idea is simple: every architecture follows the same Module.build(opts) pattern and returns an Axon model. There’s also a unified registry so you can do things like:

model = Edifice.build(:mamba, embed_size: 256, hidden_size: 512, num_layers: 4)

Or compare architectures in a loop

for arch ← [:mamba, :retnet, :griffin, :gla] do
model = Edifice.build(arch, embed_size: 256, hidden_size: 512, num_layers: 4)
# … train and evaluate
end

Edifice.list_architectures()

# => [:attention, :bayesian, :capsule, :deep_sets, :densenet, :diffusion, …]

What’s in it:

  • State Space Models: Mamba, Mamba-2 (SSD), S4, S4D, S5, H3, Hyena, BiMamba, GatedSSM, Jamba, Zamba
  • Attention: Multi-Head, GQA, Perceiver, FNet, Linear Transformer, Nystromformer, Performer, RetNet, RWKV-7, GLA, HGRN-2, Griffin/Hawk
  • Recurrent: LSTM, GRU, xLSTM, MinGRU, MinLSTM, DeltaNet, TTT, Titans, Reservoir
  • Vision: ViT, DeiT, Swin, U-Net, ConvNeXt, MLP-Mixer
  • Convolutional: ResNet, DenseNet, TCN, MobileNet, EfficientNet
  • Generative: VAE, VQ-VAE, GAN, DDPM, DDIM, DiT, Latent Diffusion, Consistency Model, Score SDE, Flow Matching, Normalizing Flow
  • Contrastive: SimCLR, BYOL, Barlow Twins, MAE, VICReg
  • Graph: GCN, GAT, GIN, GraphSAGE, Graph Transformer, PNA, SchNet, DeepSets, PointNet
  • Energy/Probabilistic/Memory: EBM, Hopfield, Neural ODE, Bayesian NN, NTM, Memory Networks
  • Meta/Specialized: MoE, Switch MoE, Soft MoE, LoRA, Adapter, Hypernetwork, Capsule, Liquid NN, SNN, ANN2SNN
  • Building Blocks: RMSNorm, SwiGLU, RoPE, ALiBi, PatchEmbed, AdaptiveNorm, CrossAttention, FFN

Pure Elixir, no Python, no ONNX imports. GPU-ready with EXLA. Ships with 17 guides covering ML foundations through architecture theory, plus runnable examples.

Where it’s at:

This is v0.1.1. Every module has been audited against its canonical paper and is backed by 1660+ tests. The architectures I’ve actually used in ExPhil and tried to train on I’m most confident in. I’m sure there are problems I haven’t found yet – the goal is to iron them out and make this something people can reach for when they want to try out a neural net architecture in Elixir.

It’s also just useful as reference. If you want to see how a specific architecture works, the source is there. Point a coding agent at it and ask why you might use a given architecture for whatever you’re working on (I’ve used claude code on various versions of opus to make this jsyk). Or go through a reference implementation and see if you can recreate it: edifice/notebooks/training_mlp.livemd at main · blasphemetheus/edifice · GitHub is an example using the Multi Layer Perceptron (MLP) architecture (a starting point architecture).

PRs, issues, criticisms, praise, and all feedback welcome.

github.com/blasphemetheus/edifice

Most Liked

blasphemetheus

blasphemetheus

So this library is intended to just deal with different neural network architectures. You could implement various architectures to sort of intake gamestate and output controller output (so like what direction a stick is facing, whether buttons are pressed). A system like this can be trained to play a game, given the right training data. For melee, there is a pre-existing method of gathering large amounts of training data (slp files, which act as ways to replay a game after the fact). So if people create a similar replay system for PM or RoA, this library could be used for training models to interface with those games. I don’t know if other problems need to be solved to actually hook up the inputs you’d get from a model to the game itself. Probably.

The gold standard that I’m sort of hoping to replicate in elixir for the exphil library is GitHub - vladfi1/slippi-ai: Imitation learning from slippi replays. · GitHub And then the philip v2 bot you can just connect to online and play against via ! commands on twitch and Slippi Direct ( Twitch ). I think that is awesome, and if I can just build that capability in Elixir, the exphil library will be a roaring success.

Edifice exists because there’s a huge amount of variety in how to actually implement a neural net, and for elixir, there doesn’t appear to be a library that just implements many different kind of architectures. Or there are ones that sort of give you the building blocks where you can make those architectures (axon, nx, polaris, etc), but the math and theory of how neural nets actually work, and the incredible variation within types of them sort of warrants its own little scaffolding library.

It’s open source, so take a look if you’re trying to use Nx and Axon to do any of these architectures, or think the elixir ecosystem might give you benefits over Python.

manhvu

manhvu

Thank you for sharing—I’m trying to convert some models from Python to Axon/Nx, but it isn’t finished yet.

Where Next?

Popular in Announcing Top

danschultzer
None of the current solutions worked well for me, so I went ahead and built a user management system from scratch. This project took far...
548 29603 241
New
jakub-zawislak
Hi everyone, I’m coming from the Symfony (PHP) framework. I like Phoenix, but it has a one thing that was build much better in the Symfo...
New
josevalim
Hi everyone, We would like to announce that Plataformatec is working on a new MySQL driver called MyXQL. Our goal is to eventually integ...
New
oltarasenko
Dear Elixir community, After a year of development, bug fixes, and improvements, we are proudly ready to share the release of Crawly 0.1...
New
grych
Hi folks, Few months ago I have announced the proof-of-concept of the library to manipulate the browsers DOM objects directly from Elixi...
639 52673 488
New
Crowdhailer
Raxx is an alternative to Plug and is inspired by projects such as Rack(Ruby) and Ring(Clojure). 1.0-rc.1 is now available. To use it re...
New
archan937
It is a well-know topic within the Elixir community: “To mock or not to mock? :)” Every alchemist probably has his / her own opinion con...
New
alisinabh
Hey everyone i’ve developed a library for Jalaali calendar for elixir which supports converting Gregorian dates to Jalaali and vice vers...
New
mattludwigs
Grizzly is a library for working with Z-Wave devices. Z-Wave is a low-frequency radio protocol for controlling smart home devices on a me...
New
pkrawat1
Hey guyz We at @aviabird are working on a payment library in elixir/phoenix. We are targeting March 2018 to add 56 Gateways to it. Have...
New

Other popular topics Top

hariharasudhan94
lets say i have a sample like a = 20; b = 10; if (a > b) do {:ok, "a"} end if (a < b) do {:ok, b} end if (a == b) do {:ok, "equa...
New
senggen
Erlang/OTP 25 [erts-13.2.2] [source] [64-bit] [smp:8:8] [ds:8:8:10] [async-threads:1] 15:22:35.803 [error] gen_event {lager_file_backend...
New
chrismccord
As promised, the first release candidate of Phoenix 1.3.0 is out! This release focuses on code generators with improved project structure...
New
johnnyicon
Hi all, I’ve just started learning Elixir and Phoenix Framework, so please pardon my n00bness at this stage. I’m trying to use Postgres...
New
gausby
I asked this very same question on twitter and got some interesting feedback, but I thought it would be a good question to ask here as we...
1207 39467 209
New
aesmail
Hello guys, I have finally made it. I created an admin interface for a framework. It’s been on my todo list for years and with the curre...
New
SoCreat
i’m a new one to elixir which editor can i use vs code? or atom? Thanks! :smiley:
New
vonH
When I run the Plug and I recompile I wind up having to use Ctrl C to quit iex and start again. Witht the help of rlwrap I can use the cu...
New
jason.o
In the code below, if the create action is not set to accept “extra_key” as an input, it errors out with a message shown above. Is there ...
New
joaquinalcerro
Hi there, I am working with Ecto-Postgresql and I need to call all of the records from a specific table but the table has 40,000 records...
New

We're in Beta

About us Mission Statement