Errors at your line, before the GPU
Every diagnostic has a code, your line, the shapes it expected and got, and the fix. Agents read it as JSON. check →
The ML framework built for agents
Your agent writes one Lisp file. The compiler checks every shape in milliseconds on a laptop, so mistakes die before they reach a GPU. Then it trains faster than PyTorch on NVIDIA GPUs.*
$ curl -fsSL https://sx.041.io/install.sh | shmacOS · Linux · one binary, no Python · Agents: curl /llms.txt
The loop, in milliseconds.
One file holds the data, the model, the objective, the optimizer and the run. Nothing else: the compiler owns the training loop.
(require "sexpgpu/nn" cross-entropy gpt)
(require "sexpgpu/optim" sgd)
(defvar train-loader
(loader :sources [(files ["data/tiny-train.jsonl.gz"] :encoding "jsonl.gz")]
:fields [(field :tokens :from "input_ids" :dtype :i32 :shape [17])]
:batch-size 4
:infinite true))
(defun prepare (batch)
(let ((tokens (field batch :tokens)))
(list :inputs (slice tokens 1 0 16) :targets (slice tokens 1 1 17))))
(defvar model (gpt :vocab 32 :layers 2 :dim 32 :heads 2))
(defun objective (prediction targets) (cross-entropy prediction targets))
(defvar optimizer (sgd :lr 0.5))
(defrun :steps 20 :microbatches 2 :precision :f32 :seed 1)$ sexpgpu new minimal.sx --example minimal wrote minimal.sx and data/tiny-train.jsonl.gz from the `minimal` example: 32 parameters, 20 steps
Every shape of every graph, in milliseconds, with no GPU and no data. A mistake names your line, the shapes and the fix, and --json hands it to an agent.
$ sexpgpu check minimal.sx ok: 32 parameters, 38 graphs, 20 steps $ sexpgpu check bad-shape.sx error[E-DIM-001]: matmul: inner dims differ: [2, 16] x [32, 8] --> bad-shape.sx:7:15 | 7 | (lambda (x) (matmul x weight))) | ^^^^^^^^^^^^^^^^^ note: operands: `x` [2, 16] f32, `weight` [32, 8] f32
explain reads back what will run. Train here on the CPU or Metal, then bundle the same run and send it to the cheapest cloud GPU with rrun by 041.
$ sexpgpu run minimal.sx done: 20 steps, train/loss 2.6462 $ sexpgpu bundle minimal.sx -o ~/.sexpgpu/bundles/minimal \ --binary ~/.sexpgpu/linux-x86_64/sexpgpu $ cd ~/.sexpgpu/bundles/minimal $ o41-rrun run --gpu RTX3090,L4,A100 --spot --cuda 13.0 \ --image nvidia/cuda:13.0.3-cudnn-runtime-ubuntu24.04 \ --env SEXPGPU_DEVICE=cuda -f -- ./run.sh lowering: cuda compute_86 NVIDIA GeForce RTX 3090, patterns on done: 20 steps, train/loss 2.6462 [rrun] j-qp6j3k9cpk succeeded exit 0 after 8s
One file is the experiment. The compiler owns the rest.
Every diagnostic has a code, your line, the shapes it expected and got, and the fix. Agents read it as JSON. check →
explain states every knob and where its value came from, the optimizer groups and the memory. diff shows what changed between two runs, and nothing else. explain →
Autodiff, accumulation, evaluation, checkpoints, precision and kernels belong to the compiler, so none of it is subtly wrong in your file. the run file →
Closures and macros at compile time: one macro writes the ablation grid. One binary, no Python: bundle a run once, and on rrun a preempted spot run continues on the next GPU. macros →
And on NVIDIA GPUs it trains faster than PyTorch.*
SexpGPU compiles the whole training step for the device it runs on, with no Python anywhere in the loop; on an NVIDIA GPU that is fused kernels, cuBLAS and cuDNN attention. Each tab times the same models against torch.compile on that device.
On every one of the 14 models we measure on the NVIDIA A100 80GB it takes less time per step than the same model under torch.compile.
Same model, same data, on an NVIDIA A100-SXM4-80GB and an NVIDIA A100 80GB PCIe: SexpGPU's CUDA device against torch.compile. Lower is faster: a shorter bar takes less time per step. The line is torch.compile.
| model | SexpGPU s/step | torch.compile s/step | step time |
|---|---|---|---|
| Diffusion denoiser, f32 | 0.000775 | 0.002238 | 0.35× |
| Tiny Mamba, f32 | 0.1042 | 0.2494 | 0.42× |
| Tiny hyperbolic (Lorentz) GPT, f32 | 0.01698 | 0.03598 | 0.47× |
| Two-tower InfoNCE, f32 | 0.000758 | 0.001595 | 0.48× |
| Tiny GPT, Muon, f32 | 0.07043 | 0.1425 | 0.49× |
| Tiny RetNet, f32 | 0.07296 | 0.1432 | 0.51× |
| Tiny GPT, AdamW, f32 | 0.07141 | 0.1203 | 0.59× |
| Tiny GPT, AdamW, bf16 | 0.01883 | 0.02787 | 0.68× |
| Tiny nGPT, bf16 | 0.0243 | 0.03517 | 0.69× |
| Geometric transformer, Riemannian Adam, f32, 512 sequences a step | 44.52 | 63.26 | 0.70× |
| MLP-Mixer, f32 | 0.001424 | 0.001845 | 0.77× |
| ResNet-9, CIFAR-10, bf16 | 0.009966 | 0.01231 | 0.81× |
| Tiny GPT, 8 experts, bf16, top-2 | 0.02416 | 0.02981 | 0.81× |
| GPT-2 small, 124M, bf16 | 2.524 | 3.017 | 0.84× |
* Limited benchmark. 14 training runs on an NVIDIA A100-SXM4-80GB and an NVIDIA A100 80GB PCIe (drivers 595.91.07 to 620.70.06, CUDA 13.0), each timed against the same model under torch.compile 2.14.0+cu130, on the same data, with SexpGPU 0.2.0. Step time is the mean of run medians over steady-state steps, measured on 5 November 2026. Both sides of a row ran one after the other on one card; rows ran on different cards of that type, and the public table records each card's driver and versions. A row timed in several jobs shows the one least favourable to SexpGPU: on the smallest models torch.compile's step is bound by the host's CPU, which differs from machine to machine. No listed model is slower than torch.compile today. Every model not listed here is unmeasured on this device. We treat any model where we are slower as a bug.
On every one of the 14 models we measure on the NVIDIA H100 it takes less time per step than the same model under torch.compile.
Same model, same data, on an NVIDIA H100 PCIe, an NVIDIA H100 80GB HBM3 and an NVIDIA H100 NVL: SexpGPU's CUDA device against torch.compile. Lower is faster: a shorter bar takes less time per step. The line is torch.compile.
| model | SexpGPU s/step | torch.compile s/step | step time |
|---|---|---|---|
| Diffusion denoiser, f32 | 0.000603 | 0.004778 | 0.13× |
| Two-tower InfoNCE, f32 | 0.00046 | 0.00181 | 0.25× |
| MLP-Mixer, f32 | 0.000782 | 0.001948 | 0.40× |
| Tiny hyperbolic (Lorentz) GPT, f32 | 0.01004 | 0.023 | 0.44× |
| Tiny Mamba, f32 | 0.05655 | 0.1274 | 0.44× |
| Tiny nGPT, bf16 | 0.01252 | 0.02215 | 0.57× |
| Tiny GPT, AdamW, bf16 | 0.01141 | 0.01737 | 0.66× |
| Tiny GPT, AdamW, f32 | 0.03531 | 0.05306 | 0.67× |
| Tiny GPT, Muon, f32 | 0.04997 | 0.07305 | 0.68× |
| Tiny RetNet, f32 | 0.05665 | 0.0794 | 0.71× |
| Tiny GPT, 8 experts, bf16, top-2 | 0.01365 | 0.01858 | 0.73× |
| GPT-2 small, 124M, bf16 | 1.099 | 1.282 | 0.86× |
| Geometric transformer, Riemannian Adam, f32, 512 sequences a step | 25.72 | 29.7 | 0.87× |
| ResNet-9, CIFAR-10, bf16 | 0.005945 | 0.006193 | 0.96× |
* Limited benchmark. 14 training runs on an NVIDIA H100 PCIe, an NVIDIA H100 80GB HBM3 and an NVIDIA H100 NVL (drivers 580.159.03 to 610.57.04, CUDA 13.0), each timed against the same model under torch.compile 2.14.0+cu130, on the same data, with SexpGPU 0.2.0. Step time is the mean of run medians over steady-state steps, measured on 5 November 2026. Both sides of a row ran one after the other on one card; rows ran on different cards of that type, and the public table records each card's driver and versions. A row timed in several jobs shows the one least favourable to SexpGPU: on the smallest models torch.compile's step is bound by the host's CPU, which differs from machine to machine. No listed model is slower than torch.compile today. Every model not listed here is unmeasured on this device. We treat any model where we are slower as a bug.
On 4 of the 7 models we measure on the Apple M1 Pro it takes less time per step than the same model under torch.compile, on 2 it is within 2% of it and on 1 it takes longer.
Same model, same data, on an Apple M1 Pro: SexpGPU's Metal device against torch.compile on MPS. Lower is faster: a shorter bar takes less time per step. The line is torch.compile.
| model | SexpGPU s/step | torch.compile s/step | step time |
|---|---|---|---|
| Tiny Mamba, f32 | 3.031 | 10.33 | 0.29× |
| Diffusion denoiser, f32 | 0.004794 | 0.006203 | 0.77× |
| Tiny hyperbolic (Lorentz) GPT, f32 | 0.5409 | 0.6958 | 0.78× |
| Two-tower InfoNCE, f32 | 0.004711 | 0.005891 | 0.80× |
| MLP-Mixer, f32 | 0.0134 | 0.01344 | 1.00× |
| Tiny RetNet, f32 | 2.343 | 2.336 | 1.00× |
| Tiny GPT, AdamW, f32 | 2.355 | 2.299 | 1.02× |
* Limited benchmark. 7 training runs on an Apple M1 Pro (macOS 27.2), each timed against the same model under torch.compile 2.14.0 on MPS, on the same data, with SexpGPU 0.2.0. Step time is the mean of run medians over steady-state steps, measured on 5 November 2026. Both sides of a row ran one after the other on one machine, each checked first against a float64 reference. Tiny GPT, AdamW (1.02×) takes longer than under torch.compile today, as a multiple of torch.compile's step time. Every model not listed here is unmeasured on this device. We treat any model where we are slower as a bug.
On 5 of the 7 models we measure on the AMD MI300X it takes less time per step than the same model under torch.compile and on 2 it takes longer.
Same model, same data, on an AMD Instinct MI300X VF: SexpGPU's ROCm device against torch.compile. Lower is faster: a shorter bar takes less time per step. The line is torch.compile.
| model | SexpGPU s/step | torch.compile s/step | step time |
|---|---|---|---|
| MLP-Mixer, f32 | 0.001332 | 0.002516 | 0.53× |
| Tiny GPT, Muon, f32 | 0.03331 | 0.06241 | 0.53× |
| Tiny GPT, AdamW, f32 | 0.03155 | 0.03944 | 0.80× |
| Tiny RetNet, f32 | 0.03316 | 0.03591 | 0.92× |
| Tiny nGPT, bf16 | 0.02372 | 0.02553 | 0.93× |
| Tiny GPT, 8 experts, bf16, top-2 | 0.02501 | 0.02323 | 1.08× |
| ResNet-9, CIFAR-10, bf16 | 0.02184 | 0.007822 | 2.79× |
* Limited benchmark. 7 training runs on an AMD Instinct MI300X VF (driver 6.16.13, ROCm 7.2.0), each timed against the same model under torch.compile 2.14.0+rocm7.2, on the same data, with SexpGPU 0.1.4-nightly.20261104.9da269e. Step time is the mean of run medians over steady-state steps, measured on 4 November 2026. Both sides of a row ran one after the other on one card; rows ran on different cards of that type, and the public table records each card's driver and versions. ResNet-9, CIFAR-10 (2.79×) and Tiny GPT, 8 experts (1.08×) take longer than under torch.compile today, as a multiple of torch.compile's step time. GPT-2 small, 124M and Geometric transformer, Riemannian Adam are not listed: torch.compile crashes on ROCm. Every other model is unmeasured on this device. We treat any model where we are slower as a bug.
On every one of the 4 models we measure on the Linux CPU it takes longer per step than the same model under torch.compile: 1.20× to 1.48× its step time.
Same model, same data, on an Intel Xeon Platinum 8488C, 8 cores, 16 threads: SexpGPU's CPU device against torch.compile on the CPU. Lower is faster: a shorter bar takes less time per step. The line is torch.compile.
| model | SexpGPU s/step | torch.compile s/step | step time |
|---|---|---|---|
| Two-tower InfoNCE, f32 | 0.01155 | 0.009635 | 1.20× |
| Diffusion denoiser, f32 | 0.01182 | 0.009544 | 1.24× |
| MLP-Mixer, f32 | 0.02913 | 0.02318 | 1.26× |
| Tiny GPT, AdamW, f32 | 3.768 | 2.546 | 1.48× |
* Limited benchmark. 4 training runs on an Intel Xeon Platinum 8488C, 8 cores, 16 threads (Ubuntu 22.04.5 LTS), each timed against the same model under torch.compile 2.14.0+cu130 on the CPU, on the same data, with SexpGPU 0.2.0. Step time is the mean of run medians over steady-state steps, measured on 5 November 2026. Both sides of a row ran one after the other on one machine, each checked first against a float64 reference. A row timed on several machines of that type shows the one least favourable to SexpGPU. Tiny GPT, AdamW (1.48×), MLP-Mixer (1.26×), Diffusion denoiser (1.24×) and Two-tower InfoNCE (1.20×) take longer than under torch.compile today, as a multiple of torch.compile's step time. Every model not listed here is unmeasured on this device. We treat any model where we are slower as a bug.
Every page of this site answers in markdown, short and dense, one question per page, so an agent reads only what it needs.
$ curl https://sx.041.io/llms.txt