LMSupply.Reranker
0.115.1
dotnet add package LMSupply.Reranker --version 0.115.1
NuGet\Install-Package LMSupply.Reranker -Version 0.115.1
<PackageReference Include="LMSupply.Reranker" Version="0.115.1" />
<PackageVersion Include="LMSupply.Reranker" Version="0.115.1" />
<PackageReference Include="LMSupply.Reranker" />
paket add LMSupply.Reranker --version 0.115.1
#r "nuget: LMSupply.Reranker, 0.115.1"
#:package LMSupply.Reranker@0.115.1
#addin nuget:?package=LMSupply.Reranker&version=0.115.1
#tool nuget:?package=LMSupply.Reranker&version=0.115.1
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.OriginalIndex}: {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
Do not add ONNX Runtime packages (Microsoft.ML.OnnxRuntime*): LMSupply provisions the runtime itself, and a
second copy conflicts with it. ExecutionProvider.Auto uses CUDA when the CUDA 12 runtime and cuDNN 9 are
installed on the machine, CoreML on macOS, and the CPU otherwise. On Windows with an AMD or Intel GPU, ONNX
sessions run on the CPU (DirectML was removed in 0.67.0). See
GPU acceleration.
Configuration
using LMSupply; // ExecutionProvider
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.115.1)
- LMSupply.Llama (>= 0.115.1)
- LMSupply.Text.Core (>= 0.115.1)
NuGet packages (3)
Showing the top 3 NuGet packages that depend on LMSupply.Reranker:
| Package | Downloads |
|---|---|
|
FluxIndex.Providers.LMSupply
LMSupply local AI embedding, reranking, and text completion provider for FluxIndex |
|
|
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.115.1 | 0 | 10/8/2026 |
| 0.115.0 | 0 | 10/8/2026 |
| 0.114.0 | 46 | 10/8/2026 |
| 0.113.0 | 60 | 10/8/2026 |
| 0.112.1 | 53 | 10/7/2026 |
| 0.112.0 | 67 | 10/7/2026 |
| 0.111.0 | 128 | 10/7/2026 |
| 0.110.1 | 77 | 10/7/2026 |
| 0.110.0 | 82 | 10/7/2026 |
| 0.109.1 | 74 | 10/7/2026 |
| 0.109.0 | 177 | 10/7/2026 |
| 0.108.0 | 214 | 10/6/2026 |
| 0.107.0 | 177 | 10/6/2026 |
| 0.106.1 | 111 | 10/5/2026 |
| 0.106.0 | 276 | 10/5/2026 |
| 0.105.2 | 201 | 10/4/2026 |
| 0.105.1 | 154 | 10/4/2026 |
| 0.105.0 | 179 | 10/4/2026 |
| 0.104.0 | 188 | 10/3/2026 |
| 0.103.0 | 132 | 10/3/2026 |