Recursive AI
LibraryC#AvailablePreview

onemodel

A neural-network runtime for .NET in pure managed C#. Load an ONNX model and run it on the CPU, with no native binaries and nothing beyond the .NET base class library.

A preview, 0.3.0-preview.1: the API and the model format may change before 1.0.

dotnet add package RecursiveAI.OneModel --prerelease

A quick look

One call loads a model and one runs it. Names and shapes come from the file; for several inputs, tensors or exact mode, use a Session.

Getting started
Program.csC#
using RecursiveAI.OneModel;
using RecursiveAI.OneModel.Graph;
using var model = Model.Load("classifier.onnx");
float[] probs = model.Run([5.1f, 3.5f, 1.4f, 0.2f]);
var exact = new SessionOptions { Mode = ExecutionMode.Exact };
using var same = Model.Load("classifier.onnx", exact);
What it does

What it does

ONNX in, no native code

Loads ONNX models, external weight files included, and runs them on its own SIMD kernels for AVX2, AVX-512, NEON and portable vectors. Works under NativeAOT and in WebAssembly.

An exact mode

Opt in and every result is the same bits on Windows, Linux and macOS, x64 and arm64, JIT and NativeAOT, browser WebAssembly and any thread count.

Its own model format

Convert once to a file whose 64-byte-aligned weights load as memory-mapped views. Outputs are bit-identical to the ONNX file’s.

fp32, fp16 and int8

Float32 models, float16 and bfloat16 weights and values, the int8 operators and QDQ models. Large float32 weights can be stored in 16 bits to halve their memory.

Graph optimizations

Constant folding, packed matrix weights, fused activations, Conv and BatchNormalization folding, and Gelu and attention fusion. Passes that would change rounding are skipped in exact mode.

Clear failures

A model that needs an operator OneModel lacks fails to load with one exception listing every missing operator. A damaged file names the field that is wrong.

How it’s checked

The ONNX backend tests, and ONNX Runtime

Of the 1,905 onnx/backend/test cases, 1,580 pass in fast mode and 1,382 in exact mode, none fail, and every gap is listed with its cause. Seven reference models, from ResNet-50 to the Whisper-small encoder and decoder, match ONNX Runtime within 1e-4 scaled error, with outputs that don’t depend on the thread count.

The package

Go further