{"slug": "neuro-a-language-that-compiles-training-code-to-a-native-binary", "title": "Neuro: a language that compiles training code to a native binary", "summary": "Developer PanzerPeter released Neuro, an ahead-of-time compiled programming language that compiles model, training-loop and GPU code into a single native binary that runs without Python installed, after about a year of work. Neuro makes tensor shapes part of the type so mismatches fail at build time, generates backward passes at compile time via @grad, and compiles @gpu functions to NVIDIA or AMD kernels on Linux only, but PyTorch remains faster on the GPU — beating Neuro on all four GPU benchmarks, from roughly even on matmul to about 10x on reductions — while a Neuro program starts in about 220 ms versus about 1100 ms for PyTorch's import and CUDA setup. The alpha has no neural network library, multithreading or Python extension modules, requires building from source against LLVM and MLIR 23, and ships under a shared-source rather than open-source license.", "body_md": "I’ve spent about a year building Neuro, a programming language for AI work. You write the model, the training loop and the GPU code in one language, and the compiler produces a single native program. Whoever runs it doesn’t need Python installed.\n\nThis small program trains on the CPU, then predicts on the GPU:\n\n``` php\n@grad\nfunc loss(w: &mut Tensor<f32, [2, 1]>) -> Tensor<f32, []> {\n    val x: Tensor<f32, [4, 2]> = [[1.0, 2.0], [2.0, 0.0], [0.0, 1.0], [3.0, 1.0]]\n    val y: Tensor<f32, [4, 1]> = [[5.0], [2.0], [2.0], [5.0]]\n    val miss = x @ w - y\n    return Tensor::scalar((&miss * &miss).mean())\n}\n\n@gpu\nfunc predict(x: &Tensor<f32, [1, 2]>, w: &Tensor<f32, [2, 1]>) -> Tensor<f32, [1, 1]> {\n    x @ w\n}\n\nfunc main() -> i32 {\n    mut w: Tensor<f32, [2, 1]> = [[0.0], [0.0]]\n    for step in 0..61 {\n        val error = loss(&mut w)\n        error.backward()\n        w -= 0.05f32 * w.grad()\n        w.zero_grad()\n    }\n    val x: Tensor<f32, [1, 2]> = [[1.0, 1.0]]\n    val w_gpu = w.clone().to(Device::GPU(0))\n    val y = predict(&x, &w_gpu).to(Device::CPU)\n    println(\"predicted on the GPU: {y[0, 0]:.2}\")\n    return 0\n}\n```\n\nThe training loop should look familiar if you use PyTorch. Three things work differently.\n\nTensor shapes are part of the type, so a shape mismatch stops the build instead of crashing a run hours in. Swapping the product in `loss` to `w @ x` gives:\n\n```\nerror: the operands of `@` do not multiply: &mut Tensor<f32, [2, 1]> against Tensor<f32, [4, 2]>\n```\n\n`@grad` generates the backward pass when you compile, so nothing records a graph while the program runs.\n\n`@gpu` functions compile to NVIDIA or AMD kernels, on Linux only.\n\nPyTorch is still faster on the GPU. Timed warm, it beats Neuro on all four GPU benchmarks, from about even on matmul to roughly 10x on reductions. Neuro has no shared-memory staging, and it stays off tensor cores because they would change the results in the last bits. A Neuro program does start faster, at about 220 ms against about 1100 ms for PyTorch’s import and CUDA setup. Full tables are in the README, and the benchmark script refuses to report timings if the implementations disagree on output.\n\nIt’s alpha, so please don’t expect to port a real model today. There’s no neural network library yet, so you write layers and optimizers by hand. Layers, attention, optimizers, a `DataLoader` and `.safetensors` weights are all planned, which means you can’t load a model from the Hub yet. Multithreading and Python extension modules are missing too, and you have to build from source against LLVM and MLIR 23.\n\nThe license is shared source, not open source. You can use and modify the compiler, use it at work, and sell whatever you build with it. Shipping the compiler itself in a commercial product needs a commercial license or a renamed, source-available fork.\n\nIf you write training code, what would stop you from trying this? I’m designing the neural network library next, so that answer would change what I build.\n\nSource: [GitHub - PanzerPeter/Neuro: An AOT compiled programming language using LLVM · GitHub](https://github.com/PanzerPeter/Neuro)\n\nDocs: [https://neuro-lang.netlify.app](https://neuro-lang.netlify.app)", "url": "https://wpnews.pro/news/neuro-a-language-that-compiles-training-code-to-a-native-binary", "canonical_source": "https://discuss.huggingface.co/t/neuro-a-language-that-compiles-training-code-to-a-native-binary/191515#post_1", "published_at": "2026-11-06 14:51:44+00:00", "updated_at": "2026-11-06 15:21:06.420598+00:00", "lang": "en", "topics": ["artificial-intelligence", "machine-learning", "developer-tools", "ai-infrastructure"], "entities": ["Neuro", "PanzerPeter", "PyTorch", "LLVM", "MLIR", "NVIDIA", "AMD", "GitHub"], "also_reported_by": [], "alternates": {"html": "https://wpnews.pro/news/neuro-a-language-that-compiles-training-code-to-a-native-binary", "markdown": "https://wpnews.pro/news/neuro-a-language-that-compiles-training-code-to-a-native-binary.md", "text": "https://wpnews.pro/news/neuro-a-language-that-compiles-training-code-to-a-native-binary.txt", "jsonld": "https://wpnews.pro/news/neuro-a-language-that-compiles-training-code-to-a-native-binary.jsonld"}}