Skip to content

Add WARM to the sparse track - #358

Open
dcondrey wants to merge 4 commits into
harsha-simhadri:mainfrom
dcondrey:sparse/warm
Open

dcondrey wants to merge 4 commits into
harsha-simhadri:mainfrom
dcondrey:sparse/warm

Conversation

@dcondrey

Copy link
Copy Markdown

Adds neurips23/sparse/warm (algorithm key warm): WARM's sparse inner-product index (writerslogic_warm, Rust). Source: https://github.com/writerslogic/warm (Apache-2.0), pinned by the single ARG WARM_COMMIT in neurips23/sparse/warm/Dockerfile (0f81061bb0bd45edb8c78793dd6162062c709055, WARM main; runs 1 and 2 below were taken at the earlier branch commit c1731145, which has the same index code, and run 3 at the submitted pin). The wheel is built with maturin build --release --features python on a pinned Rust 1.99.0 toolchain.

Files: Dockerfile, config.yaml (1 build configuration; 8 search configurations on sparse-full; one each on sparse-small and sparse-1M), warm.py (Warm(BaseSparseANN)), and the CI list entry in .github/workflows/neurips23.yml.

Algorithm

A blocked inverted index in the style of Seismic, with three additions.

  • Each term keeps its largest postings (static pruning). The kept list is split into blocks by assigning each document to the most similar of a random sample of the list's documents (block_fraction 0.25, about 4 documents per block).
  • Block summaries are columnar: for each list, the summary_coords (256) coordinates with the largest summed block maxima are kept as u8 columns, so the upper bound of every block of a list is computed in one AVX2 pass. The part of a document outside those columns is bounded by its L2 norm (Cauchy-Schwarz), scaled by the search parameter residual.
  • A query walks the lists of its query_cut largest terms. In each walked list the seed (2) blocks with the best bounds are scored first so the heap threshold rises early. Blocks whose bound is below the current k-th score divided by heap_factor are skipped. col_cut drops summary columns whose weighted scale is below that fraction of the list's largest.
  • Each document has a sketch of its 40 largest values (two cache lines) and the norm of the rest. A candidate is rejected when sketch score plus tail times the query norm times that tail norm is below the k-th score. Only survivors read the full forward row (u16 ids, u8 values, one f32 scale per row), in prefetched batches of batch documents.
  • A surviving candidate's score is its inner product with the query over its full forward row, whose values are stored as 8-bit codes with one scale per row (error at most half a quantization step per value).

Configuration

Build: {"block_fraction": 0.25, "summary_coords": 256, "sketch_len": 40}.

Search (sparse-full): eight configurations over query_cut 5 to 6, heap_factor 1.04 to 1.1, tail 0.25 to 0.28, col_cut 0.06 to 0.1, batch 16 or 24, all with residual 0.12 and seed 2. They are listed in config.yaml.

The search parameters were chosen on one half of the public queries (even rows) and checked on the other half; the two halves agreed within 0.002 recall and 3% QPS. The runs below used all 6,980 public queries.

Measured results (not the organisers' evaluation)

GCP n2-custom-8-16384 (Ice Lake, 8 vCPU, 16 GiB), Docker mode, image built by python install.py --neurips23track sparse --algorithm warm from this branch, then python run.py --neurips23track sparse --algorithm warm --dataset sparse-full. Recall is the harness value (benchmark.plotting.metrics.get_recall_values). This is not the organisers' Azure Standard_D8lds_v5, so these are not official results and not a leaderboard placement; QPS on the official VM is for the organisers to measure.

run search configuration QPS recall@10 build
1 query_cut 5, heap_factor 1.08, tail 0.25, col_cut 0.08, batch 16 28,130.8 0.9038 677 s
1 query_cut 5, heap_factor 1.08, tail 0.25, col_cut 0.08, batch 24 27,190.8 0.9056 677 s
2 (--force) query_cut 5, heap_factor 1.08, tail 0.25, col_cut 0.08, batch 16 27,327.8 0.9038 666 s
2 (--force) query_cut 5, heap_factor 1.08, tail 0.25, col_cut 0.08, batch 24 27,204.6 0.9056 666 s
3 (submitted pin) query_cut 5, heap_factor 1.08, tail 0.25, col_cut 0.08, batch 16 27,445.5 0.9038 658 s
3 (submitted pin) query_cut 5, heap_factor 1.08, tail 0.25, col_cut 0.08, batch 24 26,831.7 0.9056 658 s

In run 3 the other six configurations scored 25,738 to 27,104 QPS at recall 0.9037 to 0.9094. Run 3 built the image from this head with install.py (the build log shows the checkout of the pinned commit); the sparse-small configuration also ran with exit 0.

Memory, polled every 2 s during run 1 and run 2 (run 3 read the same within 0.5 GB):

  • Index size reported by the harness: 11.4 GB.
  • Process anonymous memory (RssAnon) peaked at 10.9 GiB.
  • Process VmRSS peaked at 15.40 GB. That figure includes about 9.1 GB of page cache from the memory-mapped source data file, which is reclaimable.
  • The container cgroup peak read 15.43 to 15.46 GB against the 15.41 GB limit that run.py set on this VM. No OOM kill occurred in either run.

Not checked

  • Any run on the Standard_D8lds_v5 evaluation VM.
  • The recall margin over 0.90 at the fastest configuration is 0.0038; the eight configurations are included so the organisers' run can pick the fastest one that clears the threshold on their hardware.
  • A CI run on this head.
  • data_export.py on this VM: it stopped on a missing ground-truth file of another dataset, so recall was computed from the result files with the harness's get_recall_values.

@dcondrey

Copy link
Copy Markdown
Author

Repinned WARM to the v0.7.4 tag (005c27d42450bc9f606061af0ee7fdc3dea09181). WARM's public history was rewritten, so the commit pinned before no longer resolves and the image build would fail at git checkout. The wrapper's calls and config parameters were checked against v0.7.4 and are unchanged. The numbers quoted above were measured at the earlier commit and have not been re-run at v0.7.4.

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant