High-performance C#/.NET bindings for Faiss.
Faiss.NET gives you near-native performance with clean, idiomatic C# wrappers while staying as close as possible to the original Faiss API.
- Faiss v1.14.1
- .NET 9.0
Important
This library is under active development. Core indexes and functionality are usable, but the API may still evolve and not every feature is complete yet.
- Thin, "bare-metal" bindings with minimal overhead
- Extensions on top bindings for excellent DX
- Cross-platform support (Windows, Linux, macOS all x64 & arm64)
- Strongly-typed wrappers + generic factory for all Faiss indexes
- GPU acceleration (CUDA & ROCm)
- It just works™
Windows
winget install --id Microsoft.VCRedist.2015+.x64 --silentLinux
sudo apt-get install -y libopenblas0 libgomp1 libgfortran5macOS
brew install libompPick either the CPU only or the CPU + GPU support NuGet, do not mix on the same platform, it would cause undefined behavior.
dotnet add package Faiss.NET.Nativedotnet add package Faiss.NET.Native.Gpu.Cuda # Linux only
dotnet add package Faiss.NET.Native.Windows
dotnet add package Faiss.NET.Native.MacOSdotnet add package Faiss.NET.Native.Gpu.Rocm # Linux x64 only
dotnet add package Faiss.NET.Native.Windows
dotnet add package Faiss.NET.Native.MacOSusing Faiss.NET;
int dimensions = 4;
using var index = new IndexFlatL2(dimensions);
float[] vector = [1.0f, 2.0f, 3.0f, 4.0f];
index.Add(vector);
using var result = index.Search(vector, k: 1);
float distance = result.Distances[0]; // 0.0f
long label = result.Labels[0]; // 0| Platform | x64 | arm64 |
|---|---|---|
| Windows | ✅ | ✅ |
| Linux | ✅ | ✅ |
| macOS | ✅ | ✅ |
| Backend | Platform | x64 | arm64 |
|---|---|---|---|
| CUDA | Linux | ✅ | ✅ |
| ROCm | Linux | ✅ | ❌ |
| Compute Capability | Architecture | Example GPUs |
|---|---|---|
| 75 | Turing | RTX 20-series, Tesla T4 |
| 80 | Ampere | A100 |
| 86 | Ampere | RTX 30-series, A40, A10, A16, A30 |
| 89 | Ada Lovelace | RTX 40-series, L40, L40S, L4 |
| 90 | Hopper | H100, H200 |
| 120 | Blackwell | RTX 50-series, B100, B200, GB200 |
| GFX Architecture | Architecture | Example GPUs |
|---|---|---|
| gfx90a | CDNA2 | AMD Instinct MI210, MI250, MI250X |
| gfx942 | CDNA3 | AMD Instinct MI300A, MI300X, MI325X |
| gfx950 | CDNA4 | AMD Instinct MI355X, MI350 series |
| gfx1030 / 1031 / 1032 | RDNA2 | Radeon RX 6600–6900 series |
| gfx1100 / 1101 / 1102 | RDNA3 | Radeon RX 7700–7900 series |
| gfx1200 / 1201 | RDNA4 | Radeon RX 9060 series and RX 9070 series |
See the LICENSE file for details.
Faiss.NET is not affiliated with Meta or the original Faiss project.