---
title: "onemodel"
url: https://recursiveai.org/onemodel/
description: "A neural-network runtime for .NET in pure managed C#, with no native binaries. Load ONNX models or its own format and run them on SIMD CPU kernels, with an exact mode that gives the same bits on every platform. A preview. MIT or Apache-2.0."
---

# 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.

```sh
dotnet add package RecursiveAI.OneModel --prerelease
```

- [Getting started](https://recursiveai.org/onemodel/docs/getting-started/)
- [Docs](https://recursiveai.org/onemodel/docs/)
- [Cookbook](https://recursiveai.org/onemodel/cookbook/)
- [GitHub](https://github.com/recursive-ai-oss/onemodel-csharp)
- [NuGet](https://www.nuget.org/packages/RecursiveAI.OneModel)

## 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](https://recursiveai.org/onemodel/docs/getting-started/)

*Program.cs · C#*

```
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);
```

### 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.

## 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.

- [Conformance](https://recursiveai.org/onemodel/docs/conformance/)
- [Golden hashes](https://recursiveai.org/onemodel/docs/golden-hashes/)

## The package

- **RecursiveAI.OneModel**: The runtime: ONNX import, the OneModel format, sessions, graph passes and the kernels. No dependency beyond the .NET base class library. Preview, 0.3.0-preview.1.
- **Modes**: Fast by default: deterministic on one machine whatever the thread count. Exact on request: the same bits everywhere, at some cost in speed.
- **Not yet**: Training is planned on the same kernels, and is not in the previews. Models run on the CPU.
- **.NET**: .NET 10, pure C#. NativeAOT, trimming and WebAssembly are supported. MIT or Apache-2.0.

## Go further

- [GitHub](https://github.com/recursive-ai-oss/onemodel-csharp)
- [NuGet](https://www.nuget.org/packages/RecursiveAI.OneModel)
- [Getting started](https://recursiveai.org/onemodel/docs/getting-started/)
- [All docs](https://recursiveai.org/onemodel/docs/)
- [Cookbook](https://recursiveai.org/onemodel/cookbook/)
- [Exact mode](https://recursiveai.org/onemodel/cookbook/exact-mode/)
- [The OneModel format](https://recursiveai.org/onemodel/cookbook/convert-to-onemodel-format/)
- [Changelog](https://github.com/recursive-ai-oss/onemodel-csharp/blob/v0.3.0-preview.1/CHANGELOG.md)
