LMSupply.Reranker
0.74.0
dotnet add package LMSupply.Reranker --version 0.74.0
NuGet\Install-Package LMSupply.Reranker -Version 0.74.0
<PackageReference Include="LMSupply.Reranker" Version="0.74.0" />
<PackageVersion Include="LMSupply.Reranker" Version="0.74.0" />
<PackageReference Include="LMSupply.Reranker" />
paket add LMSupply.Reranker --version 0.74.0
#r "nuget: LMSupply.Reranker, 0.74.0"
#:package LMSupply.Reranker@0.74.0
#addin nuget:?package=LMSupply.Reranker&version=0.74.0
#tool nuget:?package=LMSupply.Reranker&version=0.74.0
LMSupply.Reranker
Local semantic reranking for .NET with cross-encoder models.
Features
- Zero-config: Models download automatically from HuggingFace
- GPU Acceleration: CUDA, DirectML (Windows), CoreML (macOS)
- Cross-platform: Windows, Linux, macOS
- RAG Integration: Perfect for improving retrieval quality
- Multi-Tokenizer Support: Automatic detection of WordPiece, Unigram, BPE tokenizers
Quick Start
using LMSupply.Reranker;
// Load the default model
await using var reranker = await LocalReranker.LoadAsync("default");
// Rerank documents
var results = await reranker.RerankAsync(
query: "What is machine learning?",
documents: ["ML is a branch of AI...", "The weather is nice..."],
topK: 5);
foreach (var result in results)
Console.WriteLine($"{result.Index}: {result.Score:F3}");
Available Models
| Alias | Model | Size | Tokenizer | Description |
|---|---|---|---|---|
default |
MS MARCO MiniLM L6 | ~90MB | WordPiece | Best speed/quality balance |
fast |
MS MARCO TinyBERT | ~18MB | WordPiece | Ultra-fast, latency-critical |
quality |
BGE Reranker Base | ~1.1GB | Unigram | Higher accuracy; trained on English and Chinese |
large |
BGE Reranker Large | ~2.2GB | Unigram | Highest accuracy; trained on English and Chinese |
multilingual |
BGE Reranker v2-m3 | ~2.3GB | Unigram | 8K context, 100+ languages |
multilingual-fast |
BGE Reranker v2-m3, GGUF Q4_K_M | ~440MB | (llama-server) | Same model as multilingual, quantized: a fraction of the download and CPU latency. Runs a llama-server process |
Sizes are what a load downloads (the ONNX exports are fp32). multilingual-fast additionally fetches the
llama-server binary on first use. Scores are on the same 0..1 scale on both routes, and
LocalReranker.IsModelDownloaded / DownloadModelAsync work for every alias above.
For languages other than English and Chinese use multilingual or multilingual-fast: quality and large
tokenize any language but were not trained on it, and on a Korean corpus quality can rank worse than no
reranking at all.
Tokenizer Auto-Detection
The reranker automatically detects the correct tokenizer type:
| Type | Detection | Example Models |
|---|---|---|
| WordPiece | vocab.txt |
MS MARCO MiniLM, TinyBERT |
| Unigram | tokenizer.json (type: Unigram) |
bge-reranker-base, XLM-RoBERTa |
| BPE | tokenizer.json (type: BPE) |
Some multilingual models |
This ensures compatibility with virtually any cross-encoder model from HuggingFace.
GPU Acceleration
# NVIDIA GPU
dotnet add package Microsoft.ML.OnnxRuntime.Gpu
# Windows (AMD/Intel/NVIDIA)
dotnet add package Microsoft.ML.OnnxRuntime.DirectML
Configuration
var options = new RerankerOptions
{
Provider = ExecutionProvider.Auto, // GPU auto-detection
MaxSequenceLength = 512,
BatchSize = 32
};
var reranker = await LocalReranker.LoadAsync("default", options);
Version History
v0.8.9
- Fixed JSON parsing error for Unigram vocab Array format (tuple-like arrays
["token", score])
v0.8.7
- Added automatic tokenizer type detection (WordPiece, Unigram, BPE)
- Fixed compatibility with bge-reranker-base and other Unigram-based models
v0.8.6
- Fixed vocab parsing for Array vs Object format
| Product | Versions Compatible and additional computed target framework versions. |
|---|---|
| .NET | net10.0 is compatible. net10.0-android was computed. net10.0-browser was computed. net10.0-ios was computed. net10.0-maccatalyst was computed. net10.0-macos was computed. net10.0-tvos was computed. net10.0-windows was computed. |
-
net10.0
- LMSupply.Core (>= 0.74.0)
- LMSupply.Llama (>= 0.74.0)
- LMSupply.Text.Core (>= 0.74.0)
NuGet packages (4)
Showing the top 4 NuGet packages that depend on LMSupply.Reranker:
| Package | Downloads |
|---|---|
|
FluxIndex.Providers.LMSupply
LMSupply local AI embedding, reranking, and text completion provider for FluxIndex |
|
|
IronHive.Host
IronHive Host - reusable AI agent host SDK (agent loop, tools, session, provider integrations) for CLI, server, and embedded surfaces |
|
|
IronHive.Cli.Core
IronHive CLI Core - Agent loop, tools, session management, and provider integrations for building AI-powered CLI tools |
|
|
IronHive.Host.Core
IronHive Host Core - Agent loop, tools, session management, and provider integrations for building reusable AI agent hosts (CLI, server, embedded) |
GitHub repositories
This package is not used by any popular GitHub repositories.
| Version | Downloads | Last Updated |
|---|---|---|
| 0.74.0 | 0 | 9/24/2026 |
| 0.73.0 | 0 | 9/23/2026 |
| 0.72.1 | 50 | 9/23/2026 |
| 0.72.0 | 85 | 9/22/2026 |
| 0.71.0 | 87 | 9/22/2026 |
| 0.70.0 | 94 | 9/21/2026 |
| 0.69.0 | 79 | 9/21/2026 |
| 0.68.3 | 343 | 9/18/2026 |
| 0.68.2 | 98 | 9/18/2026 |
| 0.68.1 | 121 | 9/18/2026 |
| 0.68.0 | 154 | 9/17/2026 |
| 0.67.1 | 66 | 9/17/2026 |
| 0.67.0 | 88 | 9/17/2026 |
| 0.66.1 | 156 | 9/16/2026 |
| 0.66.0 | 123 | 9/16/2026 |
| 0.65.1 | 323 | 9/13/2026 |
| 0.65.0 | 204 | 9/12/2026 |
| 0.64.0 | 117 | 9/11/2026 |
| 0.63.0 | 129 | 9/11/2026 |
| 0.62.0 | 161 | 9/10/2026 |