ToolUp.VectorStores.Hnsw
0.40.1
Prefix Reserved
dotnet add package ToolUp.VectorStores.Hnsw --version 0.40.1
NuGet\Install-Package ToolUp.VectorStores.Hnsw -Version 0.40.1
<PackageReference Include="ToolUp.VectorStores.Hnsw" Version="0.40.1" />
<PackageVersion Include="ToolUp.VectorStores.Hnsw" Version="0.40.1" />
<PackageReference Include="ToolUp.VectorStores.Hnsw" />
paket add ToolUp.VectorStores.Hnsw --version 0.40.1
#r "nuget: ToolUp.VectorStores.Hnsw, 0.40.1"
#:package ToolUp.VectorStores.Hnsw@0.40.1
#addin nuget:?package=ToolUp.VectorStores.Hnsw&version=0.40.1
#tool nuget:?package=ToolUp.VectorStores.Hnsw&version=0.40.1
ToolUp.VectorStores.Hnsw
HNSW approximate-nearest-neighbour IVectorStore for the ToolUp.RAG companion: one in-process graph per scope, built on the scope's first search after a cold load and kept current incrementally after that — a write is added to the graph, a delete or overwrite retires the old node, and the scope rebuilds only when retired nodes pass HnswParameters.TombstoneRebuildFraction.
Its scale is measured, not assumed: read the RAG technical guide's "Measured scale" sections (Phases 970 and 1007) before choosing it over the default InMemoryVectorStore. On the measured machine the graph build grows faster than linearly in the scope's size (HnswParameters.fastBuild is the cheaper build), and at the shipped efSearch the query was not faster than the flat scan at any size measured.
Persists the index to IBlobStorage for warm restart. For multi-instance / horizontal scale, a distributed vector store (e.g. Qdrant, Weaviate, Pinecone) is the right target — out of scope for this companion.
Decision record — an alternative ANN implementation (Phase 1007)
Budget. A 500k-chunk scope must build in minutes, not hours. The cheaper fastBuild profile measured 12.2 ms per chunk at 50k and 100k chunks (1,221 s for 100k), so a 500k scope extrapolates to about 1.7 hours of single-threaded build: over budget, so one alternative ANN implementation was probed on the same benchmark.
Probed: IVF-flat — a spherical k-means coarse quantiser (2·√n lists, eight iterations) with exact rescoring inside the probed lists, the inverted-file index most vector databases offer beside HNSW. It needs no package: the probe was an in-process script over the benchmark's own corpus, padding and exact ground truth.
| BEIR SciFact, 5,183 chunks, local embedder | build | lists probed | recall@10 vs flat | p95 |
|---|---|---|---|---|
| IVF-flat | 3.3 s (0.63 ms/chunk) | 16 of 143 | 0.663 | 4 ms |
| 64 of 143 | 0.864 | 3 ms | ||
| 96 of 143 | 0.936 | 13 ms | ||
| 128 of 143 | 0.980 | 6 ms | ||
HNSW fastBuild, efSearch 800 |
48 s (9.3 ms/chunk) | — | 1.000 | 164 ms |
Decision: reject. IVF builds about fifteen times faster, but on the local embedder's sparse vectors (88 non-zero slots of 512) the clusters do not separate the neighbours: recall within 2 % of the flat scan needs 90 % of the lists probed, which is a flat scan with extra steps, so at 500k its query costs what the flat scan's does (p95 429 ms, Phase 970). It buys nothing the default InMemoryVectorStore does not already give. The probe says nothing about dense embeddings (an API embedder's 1,536 dense dimensions cluster far better); a deployment on those that needs the 500k rung is better served by the Pgvector companion's indexes than by a second in-process ANN here. No port phase follows from this decision.
Licensed under Apache-2.0.
Part of the ToolUp Platform SDK — see github.com/ToolUp-Forge/toolup-forge for full documentation.
| 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
- HNSW (>= 26.4.177)
- MessagePack (>= 3.1.12)
- ToolUp.Platform.Core (>= 0.43.0)
- ToolUp.Platform.Server (>= 0.43.0)
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 |
|---|---|---|
| 0.40.1 | 45 | 11/25/2026 |
| 0.40.0 | 151 | 11/16/2026 |
| 0.39.2 | 129 | 11/7/2026 |
| 0.39.1 | 145 | 11/6/2026 |
| 0.39.0 | 106 | 11/4/2026 |
| 0.38.1 | 139 | 11/1/2026 |
| 0.38.0 | 111 | 10/31/2026 |
| 0.37.0 | 129 | 10/29/2026 |
| 0.36.0 | 125 | 10/29/2026 |
| 0.35.0 | 103 | 10/28/2026 |
| 0.34.1 | 106 | 10/27/2026 |
| 0.34.0 | 113 | 10/26/2026 |
| 0.33.0 | 103 | 10/25/2026 |
| 0.32.0 | 103 | 10/24/2026 |
| 0.31.0 | 123 | 10/22/2026 |
| 0.30.0 | 137 | 10/20/2026 |
| 0.29.0 | 106 | 10/19/2026 |
| 0.28.0 | 112 | 10/19/2026 |
| 0.27.0 | 126 | 10/16/2026 |
| 0.26.0 | 118 | 10/12/2026 |