Improve: organize retrievers.py around per-path stripe runners
Ash Vardanian
0a78817
Extract _DenseStripeRunner and _MaxSimStripeRunner classes that own the
resident query stripe, double-buffered H2D candidate tiles, FP32 scratch
buffers, and running top-k state — replacing the 340-line gt_stripe_maxsim
function with a class whose hot loop is one method call deep. Group the
file into `# region:` sections (Common utilities, GPU kernels, Top-k
primitives, Dense path, MaxSim path) so each path's runner, stripe entry
point, corpus loader, and consumer retriever cluster together. Promote
load_dense_corpus / load_maxsim_corpus to public names since they are
imported externally; rename q_*/cand_*/seg_*_kernel/pt_max_view to spelled
out forms; drop noqa F401 lies on used torch imports.
Docs: HF classifiers & pulling from Nebius
Ash Vardanian
a270f9b
Add: gte-moderncolbert-v1 section token bank
Ash Vardanian
5cc4722
Per-shard `.body.sections.f16bin` (concatenated FP16 token vectors,
128d) and `.body.sections.offsets.ibin` (cumulative section→token
offsets) for the 60M-section ColBERT collection. These are the source
multi-vectors that the ground truth committed earlier indexes into;
without them the GT neighbor IDs are unresolvable.
Add: gte-moderncolbert-v1 MaxSim ground truth (k=100)
Ash Vardanian
de1e21a
Per-shard `.body.ground_truth.{ibin,fbin}` files for the 60M-section
ColBERT collection: 100 nearest section IDs and FP32 MaxSim similarity
scores per query, computed exhaustively all-vs-all on 8x H100 in ~26h.
Section IDs are global (canonical shard-walk order, same scheme as the
dense ground truth). Self-match excluded.
Add: GPU MaxSim retrievers and ground-truth pipeline
Ash Vardanian
25c9427
- retrievers.py with shared CuPy kernels (segment_max + segment_sum
RawKernels) and DenseRetriever / MaxSimRetriever classes; same kernels
drive ground_truth.py via gt_stripe_{dense,maxsim} per-GPU workers.
- ground_truth.py gains --mode {dense,maxsim}; both modes write per-shard
.body.ground_truth.{ibin,fbin} files with global row IDs (article IDs
for dense, section IDs for maxsim).
- build_index.py absorbs sweep_matryoshka.py via --no-save +
--ef-search-sweep flags; default behavior unchanged.
- embed_sections.py is now the unified pool scheduler (the per-wiki
variant is gone).
- wikiverse.py renamed to usearchwiki.py.
Validated end-to-end against NumPy on non-degenerate synthetic data
(top-10 sets match exactly, max score diff 2e-4) and cross-checked
against NumKong CPU MaxSim (rankings agree exactly; scores differ only
because NumKong returns angular distance while the GPU returns cosine).
Improve: Rename to USearchWiki + new pipelines + pyproject
Ash Vardanian
5ccbf36
Rename WikiVerse -> USearchWiki throughout (GitHub + HuggingFace at
unum-cloud/USearchWiki, Nebius bucket at s3://usearch-wiki). The
Python module wikiverse.py is kept under its old name so consumer
imports keep working.
Adds three new pipelines:
- embed_sections.py: section-pooled ColBERT via pylate, with
late-chunking margins so attention flows across section boundaries
- build_index.py: USearch HNSW build from per-shard f16bin via
memmap, f16 quantization matching the storage dtype
- eval_recall.py: self-recall@k against the precomputed ground
truth, with an ef_search sweep
Plus:
- late_chunking.py with section-aware windowing primitives (greedy
pack into core <= context_limit - 2*margin, fragments for
oversized sections, weighted-mean recombination)
- wikiverse.py grows resolve_lfs_pointer / discover_collection /
CollectionShard, dedup'ing logic that used to live in ground_truth
- embed.py renamed to embed_articles.py (parallel to embed_sections)
- pyproject.toml with…
Add: Per-shard ground-truth k-NN files and Git LFS tracking
Ash Vardanian
a4c0c2c
Adds top-100 nearest-neighbor indices and cosine scores for every article
across the three dense models (nomic-embed-text-v1.5, qwen3-embedding-0.6b,
snowflake-arctic-embed-l-v2.0), one .ibin / .fbin pair per source .f16bin
shard, row-aligned with the corresponding embeddings.
Indices reference the global flat row id derived from the deterministic
shard walk (sorted wikiname, then sorted stem). Consumers reproduce the same
walk to map a global id back to (wiki, stem, local_row).
Tracks .ibin and .fbin via Git LFS to mirror the existing .f16bin policy.
Add: Ground truth k-NN computation script
Ash Vardanian
d309c96
Computes exact global top-k nearest neighbors per article for an embedding
collection using tiled FP16xFP16->FP32 GEMMs on multiple GPUs. Streams the
whole corpus past per-GPU resident query stripes, double-buffers candidate
tiles, uses torch.topk for the per-tile partial sort (~150x faster than
cupy.argpartition), and writes per-shard `.body.ground_truth.{ibin,fbin}`
files row-aligned with the source `.body.f16bin` shards.
Sanitizes stray non-finite rows at load time (a few embeddings in the
collections have a single NaN among otherwise-zero entries; left alone they
poison every query's top-k).
Includes a synthetic end-to-end test under tests/.
Improve: Document multi-mirror fetch paths and add HF metadata
Ash Vardanian
f550ce9
Add: Git LFS tracking for .f16bin embedding files
Ash Vardanian
9c9f4cb
Improve: Consolidate scripts and package into single-file modules