feat(backend): add GPU FlashLib IVF backend (flashlib_ivf) + IVF-vs-I…#348
Open
andy-yang-1 wants to merge 1 commit into
Open
feat(backend): add GPU FlashLib IVF backend (flashlib_ivf) + IVF-vs-I…#348andy-yang-1 wants to merge 1 commit into
andy-yang-1 wants to merge 1 commit into
Conversation
…VF benchmark Add leann-backend-flashlib-ivf, a GPU IVF-Flat (inverted file) approximate-NN backend built on FlashLib's flash_ivf_flat (Triton/CuteDSL) - the GPU counterpart of the FAISS `ivf` backend, sharing its nlist/nprobe recall knobs so the two are drop-in comparable. The built index (centroids/data/ids/CSR offsets) is persisted with torch.save and reloaded to the GPU at search time (no k-means re-train). mips/cosine L2-normalize (FlashLib IVF ranks by squared L2). Also add benchmarks/flashlib_ivf_vs_faiss_ivf.py (flashlib_ivf GPU vs ivf CPU at a matched nlist across an nprobe sweep: build, latency, throughput, recall@k vs exact GT), a CUDA-guarded correctness test, the flashlib-ivf extra + uv source wiring, and a flashlib_ivf section in the backend guide. On an H200 at 1M x 768 (nlist=4096, 8 CPU threads, cosine): ~13x faster build and, at nprobe=32, ~6.5x lower single-query latency / ~75x higher batched throughput at comparable recall (GPU latency ~flat vs CPU linear in nprobe).
Collaborator
|
Nice PR to support a user who has an advanced GPU w/o recompute, nice work @andy-yang-1 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
…VF benchmark
Add leann-backend-flashlib-ivf, a GPU IVF-Flat (inverted file) approximate-NN backend built on FlashLib's flash_ivf_flat (Triton/CuteDSL) - the GPU counterpart of the FAISS
ivfbackend, sharing its nlist/nprobe recall knobs so the two are drop-in comparable. The built index (centroids/data/ids/CSR offsets) is persisted with torch.save and reloaded to the GPU at search time (no k-means re-train). mips/cosine L2-normalize (FlashLib IVF ranks by squared L2).Also add benchmarks/flashlib_ivf_vs_faiss_ivf.py (flashlib_ivf GPU vs ivf CPU at a matched nlist across an nprobe sweep: build, latency, throughput, recall@k vs exact GT), a CUDA-guarded correctness test, the flashlib-ivf extra + uv source wiring, and a flashlib_ivf section in the backend guide.
On an H200 at 1M x 768 (nlist=4096, 8 CPU threads, cosine): ~13x faster build and, at nprobe=32, ~6.5x lower single-query latency / ~75x higher batched throughput at comparable recall (GPU latency ~flat vs CPU linear in nprobe).
What does this PR do?
Related Issues
Fixes #
Checklist
uv run pytest)ruff formatandruff check)pre-commit run --all-files)