Skip to content
Merged
72 changes: 72 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -626,6 +626,16 @@ Options:

### Run Zvec from command line

HNSW remains the default. For both HNSW and DiskANN, the distance metric is determined by the selected dataset during task
assembly, not by a Zvec CLI option. For example, `Performance768D10M` uses COSINE.

In the run-test UI, select Zvec and choose HNSW or DISKANN in the case settings. Only parameters for the selected algorithm
are displayed. Load cases expose build parameters; performance and streaming cases also expose search parameters. Defaults
match the CLI. Use separate collection paths for HNSW and DiskANN, and keep DiskANN build parameters unchanged for search-only
runs.

Existing HNSW commands are unchanged:

```bash
vectordbbench zvec --path Performance768D10M --db-label 16c64g-v0.1 \
--case-type Performance768D10M --num-concurrency 12,14,16,18,20 \
Expand All @@ -645,6 +655,68 @@ To list the options for zvec, execute vectordbbench zvec --help
results
```

#### Zvec DiskANN

DiskANN requires `zvec>=0.7.0`, which provides `Collection.close()`. The SDK must also expose
`DiskAnnIndexParam` and `DiskAnnQueryParam`.
This adapter uses zvec's native C++ DiskANN, not the Microsoft Rust implementation.
From this updated checkout on Linux, install the adapter with its Zvec and test dependencies, then run the checks:

```bash
python -m pip install -e ".[zvec,test]"
vectordbbench zvec --help
python -m pytest tests/test_zvec.py -q
ZVEC_NATIVE_TESTS=1 python -m pytest tests/test_zvec.py -k native_diskann -v
```

The `zvec` extra enforces the SDK minimum. `--no-deps` bypasses dependency resolution; use it only after
independently verifying the installed SDK version and required APIs.

The native test builds 1,200 32-dimensional vectors in a temporary directory, checks insertion and index completion,
closes/reopens the collection, searches it, and exercises rebuilding. It is a functionality test, not a recall or
performance benchmark. It is skipped unless explicitly enabled on Linux. Run it successfully before a large benchmark.

| Option | Default | Meaning |
| --- | --- | --- |
| `--index-type` | hnsw | Select hnsw or diskann |
| `--max-degree` | 64 | DiskANN graph degree, 1-100 |
| `--build-list-size` | 100 | Construction candidate list, 10-100 |
| `--search-list-size` | 300 | Query candidate list, at least 1; the engine uses at least top-k |
| `--pq-chunk-num` | 0 | PQ bytes per vector; 0 is automatic, otherwise at most min(dimension, 1024) |

DiskANN stores FP32 vectors and uses internal PQ for graph traversal. HNSW options (`--m`, `--ef-construction`,
`--ef-search`, `--quantize-type`, `--is-using-refiner`) are rejected in DiskANN mode, and DiskANN options are rejected
in HNSW mode. PQ chunks are not equivalent to HNSW INT8 scalar quantization.

After the checks pass, build a separate DiskANN collection. The load stage includes `optimize()`, which builds the
target index; flushing alone does not establish that a DiskANN index was built. `--drop-old` replaces any existing
DiskANN collection at this path. The adapter refuses to use or delete an existing non-DiskANN collection.

```bash
export DATASET_LOCAL_DIR="$PWD/dataset"
vectordbbench zvec --index-type diskann --path Performance768D10M_DiskANN \
--case-type Performance768D10M \
--max-degree 64 --build-list-size 100 --pq-chunk-num 96 \
--drop-old --load --skip-search-serial --skip-search-concurrent
```

Then search the same index without reloading or rebuilding it:

```bash
vectordbbench zvec --index-type diskann --path Performance768D10M_DiskANN \
--case-type Performance768D10M \
--max-degree 64 --build-list-size 100 --pq-chunk-num 96 \
--search-list-size 300 --num-concurrency 12,14,16,18,20 \
--skip-drop-old --skip-load --search-serial --search-concurrent
```

Search-only runs validate the stored dimensions, metric, build parameters, positive document count and complete
indexing. Keep build parameters unchanged when reopening; sweep `--search-list-size` to compare QPS at matched recall.
These examples use the Cohere dataset's COSINE metric for both building and searching. For an HNSW/DiskANN
comparison, use the same dataset and separate collection paths; do not relabel an existing IP index as COSINE.
Multiple search processes can duplicate in-memory PQ codes and metadata, so measure total process memory as well
as QPS.

### Run Doris from command line

Doris supports ann index with type hnsw from version 4.0.x
Expand Down
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ alisql = [ "mysqlclient" ]
polardb = [ "PyMySQL" ]
doris = [ "doris-vector-search" ]
turbopuffer = [ "turbopuffer" ]
zvec = [ "zvec" ]
zvec = [ "zvec>=0.7.0" ]
endee = [ "endee==0.1.10" ]
lindorm = [ "opensearch-py" ]
seekdb = [ "mysql-connector-python" ]
Expand Down
Loading
Loading