ai infrastructure · max

MAX — a math-native language for neural runtimes.

A self-hosting compiler whose syntax is mathematics. Unicode operators, matrix-state primitives, deterministic builds, CUDA and HIP back-ends. Used in-lab to ship real neural workloads — LLM forward and backward passes, agents, OS-level substrates.

What MAX is

MAX is a programming language whose syntax is mathematics — not as a library but as the language itself. Definitions are written with , returns with, ranges with ⟳ i ∈ 0..N, conditions with ⊃ / ⊅, matrix multiply with @, Hadamard product with , Frobenius norm with ‖·‖_F.

It is designed for the workloads the lab actually runs — neural-network training and inference, ML inference kernels, matrix-state dynamics, agent runtimes, OS-level substrates. The compiler emits portable C and direct GPU code (CUDA, HIP), with cross paths for Apple Metal, ARM and RISC-V bare-metal, and — via hardware-verified RTL accelerators next to a bare-metal port — an FPGA fabric target (Zynq-7020).

It is also small. The full bare-metal MAX-OS kernel image for the Raspberry Pi measures 203,200 bytes — about 198 KB — versus a typical Python + PyTorch + CUDA-runtime install, which runs into multiple gigabytes before a single model loads. There is no interpreter, no package manager, and no runtime dependency tree underneath a MAX binary — the compiler is the whole stack.

Why a custom language

Mainstream stacks bury the math inside library calls. The math the lab works with — matrix-state evolution, Genesis dynamics, neural ODE / closed-form continuous-time networks, oscillator coupling — is far cleaner when the operators are part of the language. MAX programs read like the paper they came from.

Owning the compiler also lets the lab control reproducibility end-to-end. Every research artifact published from the lab can be rebuilt byte-for-byte from source — there is no hidden randomness in the toolchain.

Triple-bootstrap, fixed-point

MAX compiles itself in three stages: seed → stage 1 → stage 2 → stage 3. The compiled outputs of stage 2 and stage 3 are byte-identical (sha-256 equality is checked in CI). That fixed-point invariant means the compiler describes its own behaviour completely — any code-generation change that breaks the invariant is rejected.

Standard library

1237 stdlib modules cover the math the lab leans on — DCT, RSVD, dense linear algebra, statistics and probability, BPE / SentencePiece tokenization, autograd primitives, optimizer steps (Adam / SGD), Kuramoto oscillator dynamics, closed-form continuous-time (CfC) networks, safetensors I/O, GGUF loader, paged KV-cache, FlashAttention-2, RoPE, RMSNorm, SwiGLU, quantization (Q3/Q4/Q5/Q6 K-block, W4A16), and a native cryptography layer (TLS 1.3, Ed25519, ChaCha20-Poly1305, Argon2id, BLAKE2b). Every module header cites the source paper or internal theorem it realizes — the language currently carries 982 machine-checked theorems in its own registry, each with a falsifier gate.

Direct matrix-multiply into the hardware

A matrix multiply written in MAX does not call a driver, a runtime library, or a vendor toolchain — the compiler lowers it straight to real hardware instructions. On GPU that means emitting an actual CUDA kernel with no cuBLAS or cuDNN in the path; measured bit-exact against a CPU reference on a real Jetson Orin GPU (see the hardware silicon page). The same principle carries to the FPGA target, where a hand-written RTL accelerator is verified byte-identical to its MAX/C software counterpart before it is trusted to replace it in the fabric.

Concrete artifacts shipped on MAX

  • Qwen3-32B from-scratch GPU forward passexercised in-house on the lab's vendor-neutral mixed fleet of datacenter and local GPUs, with a full GPU backward pass and a parity-validated CPU reference (rel-L2 < 1e-5).
  • Layer-streaming forward — runs a 64-layer 32B-parameter model at ≈4.4 GB peak RSS by holding one layer at a time. Lossless, byte-identical to bulk forward.
  • Native HTTP server for chat APIs (OpenAI-compatible), no Python in the serving path.
  • Falcon-H1-7B chat runtime with on-the-fly Wikipedia ingestion when confidence is low — built on Sadalsuud-style routing primitives in stdlib.
  • OS substrate work — MAX OS boots in QEMU with userspace, ext2-rw, and an EL0 loader, with page-replace policy driven by Genesis math, and the same driver-as-matrix design runs on real silicon across four boards.

What is not public

The compiler engineering — syntax, bootstrap, backends, stdlib API — is openly documented. The math behind specific theorems wired into the language (Genesis dynamics, Sadalsuud routing, substrate decompositions) is patent-pending and stays inside the lab. Engineering partners receive the engineering. Co-development partners receive more under NDA.