---
title: "OneModel"
url: https://recursiveai.org/onemodel/docs/overview/
description: "A neural-network runtime for .NET in pure managed C#, with no native binaries and no dependency beyond the shared framework. It loads ONNX models and our…"
version: "0.3.0-preview.1"
source: https://github.com/recursive-ai-oss/onemodel-csharp/blob/a603a81de3ac7eb2fe4ef4a5961c59822c93ae8c/README.md
---

# OneModel

A neural-network runtime for .NET in pure managed C#, with no native binaries and no dependency beyond the shared framework. It loads ONNX models and our own format and runs them on SIMD CPU kernels, with training to follow on the same kernels. The name is provisional.

**Status:** preview, 0.3.0-preview.1. ONNX models and the OneModel format load and run through `Model.Load(...).Run(...)` or a `Session`, in fast mode or an exact mode that gives the same bits on every platform. Of the 1905 `onnx/backend/test` cases, 1580 pass in fast mode and 1382 in exact mode, none fail, and the rest are listed gaps ([docs/conformance.md](https://recursiveai.org/onemodel/docs/conformance/)). Training is not in the previews yet. See [CHANGELOG.md](https://recursiveai.org/onemodel/docs/changelog/).

## Layout

| Path | Holds |
|---|---|
| `src/OneModel` | the library, package `RecursiveAI.OneModel` |
| `tests/OneModel.Tests` | unit tests (xUnit v3) |
| `tests/AotSmoke`, `tests/WasmSmoke` | NativeAOT and browser-wasm smoke apps |
| `bench/Micro` | BenchmarkDotNet micro-benchmarks and kernel timing |
| `bench/Bar` | side-by-side timing against ONNX Runtime (the only place it is referenced) |
| `tools/` | scripts that fetch and export reference models, produce reference outputs and compare output hashes across machines |
| `fuzz/` | SharpFuzz targets |
| `docs/` | normative notes; see [docs/README.md](https://recursiveai.org/onemodel/docs/docs-map/) |

## Running a model

    using var m = Model.Load("model.onnx");
    float[] v = m.Run(tokens);          // float[], long[] or int[] in; names and shapes come from the model

For several inputs or outputs, tensors, exact mode (`new SessionOptions { Mode = ExecutionMode.Exact }`) or a thread limit, use `m.Session` or `Session.Load` directly. A model with an operator the library does not implement fails to load with an exception that lists every missing one; which operators pass the ONNX backend tests is in [docs/conformance.md](https://recursiveai.org/onemodel/docs/conformance/). How graphs are planned and run: [docs/graph-runtime.md](https://recursiveai.org/onemodel/docs/graph-runtime/).

### NativeAOT users: set `IlcInstructionSet`

A NativeAOT binary targets the x86-64 baseline unless told otherwise, and the library then silently runs its 4-lane kernels instead of the AVX2 or AVX-512 ones. Results are the same, but slower. Publish with the instruction set you target, for example:

    dotnet publish -c Release -p:IlcInstructionSet=x86-64-v3     # AVX2 and FMA machines (2013 and later)
    dotnet publish -c Release -p:IlcInstructionSet=native         # the machine you publish on

`Session.KernelPath` reports which kernels a session chose (`Avx2`, `Avx512`, `Neon`, `Portable128`, `Scalar`). `tests/AotSmoke` publishes with `x86-64-v3` and fails if an x64 machine does not pick AVX2 or AVX-512. The ordinary JIT build needs nothing: it checks the hardware at start-up.

## Building

The .NET SDK in `global.json` is required. Build output goes to `$ONEMODEL_ARTIFACTS` (default: a folder in the temp directory), never into the checkout.

    dotnet build -c Release
    dotnet test --solution OneModel.slnx -c Release

`-c Checked` builds optimized code with the `CHECKED` symbol, which enables bounds assertions at kernel entry points and poisons freed buffers. Tests and fuzzing run in `Checked`.

## Licence

`MIT OR Apache-2.0`, see [LICENSE-MIT](https://github.com/recursive-ai-oss/onemodel-csharp/tree/a603a81de3ac7eb2fe4ef4a5961c59822c93ae8c/LICENSE-MIT) and [LICENSE-APACHE](https://github.com/recursive-ai-oss/onemodel-csharp/tree/a603a81de3ac7eb2fe4ef4a5961c59822c93ae8c/LICENSE-APACHE). Third-party material is listed in [THIRD-PARTY-NOTICES.md](https://github.com/recursive-ai-oss/onemodel-csharp/blob/a603a81de3ac7eb2fe4ef4a5961c59822c93ae8c/THIRD-PARTY-NOTICES.md).
