Named Tensors for Legible Deep Learning in JAX
Maintained. Last release today, commits in 1 of the last 26 weeks. Weaker on commit activity.
pip install marin-haliaxREADME as published on PyPI with version 0.2.400.dev46792983433.
Haliax
Though you don’t seem to be much for listening, it’s best to be careful. If you managed to catch hold of even just a piece of my name, you’d have all manner of power over me.
— Patrick Rothfuss, The Name of the Wind
Haliax is a JAX library for building neural networks with named tensors, in the tradition of Alexander Rush's Tensor Considered Harmful. Named tensors improve the legibility and compositionality of tensor programs by using named axes instead of positional indices as typically used in NumPy, PyTorch, etc.
Despite the focus on legibility, Haliax is also fast, typically about as fast as "pure" JAX code. Haliax is also built to be scalable: it can support Fully-Sharded Data Parallelism (FSDP) and Tensor Parallelism with just a few lines of code. Haliax powers Levanter, our companion library for training large language models and other foundation models, with scale proven up to 70B parameters and up to TPU v4-2048.
Example: Attention
Here's a minimal attention module implementation in Haliax. For a more detailed introduction, please see the . (We use the excellent library for its module system and tree transformations.)