Faiss.NET.Native
1.0.0-preview.1
See the version list below for details.
dotnet add package Faiss.NET.Native --version 1.0.0-preview.1
NuGet\Install-Package Faiss.NET.Native -Version 1.0.0-preview.1
<PackageReference Include="Faiss.NET.Native" Version="1.0.0-preview.1" />
<PackageVersion Include="Faiss.NET.Native" Version="1.0.0-preview.1" />
<PackageReference Include="Faiss.NET.Native" />
paket add Faiss.NET.Native --version 1.0.0-preview.1
#r "nuget: Faiss.NET.Native, 1.0.0-preview.1"
#:package Faiss.NET.Native@1.0.0-preview.1
#addin nuget:?package=Faiss.NET.Native&version=1.0.0-preview.1&prerelease
#tool nuget:?package=Faiss.NET.Native&version=1.0.0-preview.1&prerelease
Faiss.NET
C# bindings for Faiss.
- Faiss v1.14.1
- .NET 9.0
This library is under active construction and currently not usable yet.
Implemented Indexes
- IndexFlatIP
- IndexFlatL2
- IndexHNSW
Also, a generic Index factory is implemented which can be used to instantiate all other Faiss supported indexes.
This library aims to be as "bare metal" as possible while being straightforward to work with.
Additionally, Index serialization/deserialization and GPU Indexes + sharding is supported.
Supported Platforms:
| Platform | x64 | arm64 |
|---|---|---|
| Windows | ✅ | ✅ |
| Linux | ✅ | ✅ |
| MacOS | ✅ | ✅ |
GPU Acceleration:
| Platform | x64 | arm64 |
|---|---|---|
| CUDA (Linux) | ✅ | ✅ |
| ROCm (Linux) | ✅ | ❌ |
Installation
Prerequisites
Windows
You need a C++ redistributable installed. E.g.
$ winget install --id Microsoft.VCRedist.2015+.x64 --silent
Linux
OpenBLAS, OpenMP and Fortran runtimes must be installed. E.g.
$ sudo apt-get install -y libopenblas0 libgomp1 libgfortran5
MacOS
An OpenMP runtime is required. E.g.
$ brew install libomp
NuGet
Get the base NuGet:
$ dotnet add package Faiss.NET
Then pick a native package:
Either cpu only or with additional gpu support.
CPU only
$ dotnet add package Faiss.NET.Native
CPU+GPU
$ dotnet add package Faiss.NET.Gpu.Cuda # Linux only
$ dotnet add package Faiss.NET.Windows
$ dotnet add package Faiss.NET.MacOS
or
$ dotnet add package Faiss.NET.Native.Gpu.Rocm # Linux x64 only
$ dotnet add package Faiss.NET.Windows
$ dotnet add package Faiss.NET.MacOS
Usage
Basic
using Faiss.NET;
int dimensions = 4;
using var index = new FaissIndex<FaissIndexFlatL2>(new FaissIndexFlatL2(dimensions));
float[] vectors = { 1.0f, 2.0f, 3.0f, 4.0f };
index.Add(vectors);
using var searchResult = index.Search(vectors, 1);
float distance = searchResult.Distances[0]; // 0.0f
long label = searchResult.Labels[0]; // 0
Examples
Low-Level index usage
using Faiss.NET;
int dimensions = 2;
using var index = new FaissIndexFlatIP(dimensions);
float[] vectors = { 2.0f, 3.0f };
index.Add(1, vectors);
float[] distances = new float[1];
long[] labels = new long[1];
index.Search(1, vectors, 1, distances, labels);
long foundLabel = labels[0]; // 0
float foundDistance = distances[0]; // 13
Learn more about Target Frameworks and .NET Standard.
-
net9.0
- Faiss.NET (>= 1.0.0-preview.1)
- Faiss.NET.Native.Linux (>= 1.0.0-preview.1)
- Faiss.NET.Native.MacOS (>= 1.0.0-preview.1)
- Faiss.NET.Native.Windows (>= 1.0.0-preview.1)
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.
| Version | Downloads | Last Updated |
|---|---|---|
| 1.0.0-preview.3 | 28 | 3/31/2026 |
| 1.0.0-preview.2 | 40 | 3/30/2026 |
| 1.0.0-preview.1 | 43 | 3/27/2026 |