* feat: add hnsw-rabitq * undefine transform * support config rotator type * support sample_count * fix ut * refactor: update interface * refactor: update interface * update rabitq index params * fix interface update * fix searcher test * fix streamer test * streamer support bf and add more ut * rm env check * add collection ut * add schema check * add rabitq query param binding * add integration test * fix local_builder * cleanup dist calculator * add RaBitQ-Library submodule * cleanup rabitq converter/reformer * add files * disable build on mac * disable Feature_Optimize_HNSW_RABITQ * disable python/tests/test_collection_hnsw_rabitq.py:13 * check avx2/avx512 * fix refine * fix mac ci * add dimension check * fix mac ci * fix ci * add missing lib * fix centroids selection for Cosine/InnerProduct * rename hnsw-rabitq to hnsw_rabitq * address comments * fix compile * fix rabitqlib name * fix mac compile * check avx2/avx512 support * runtime check again compile-time * check AUTO_DETECT_ARCH * rm debug log * fix * rabitq use avx2 by default * add missing file * fix search_bf/group_by dist * address comments * fix typo * address comments * rabitq support disable id_map * address comments |
||
|---|---|---|
| .. | ||
| CMakeLists.txt | ||
| README.md | ||
| bench.cc | ||
| bench_original.cc | ||
| bench_result.h | ||
| convert_cohere_parquet.py | ||
| filter_result_cache.h | ||
| flow.h | ||
| helper.h | ||
| index_meta_helper.h | ||
| local_builder.cc | ||
| local_builder_original.cc | ||
| meta_segment_common.h | ||
| recall.cc | ||
| recall_original.cc | ||
| txt2vecs.cc | ||
| txt_input_reader.h | ||
| vecs_common.h | ||
| vecs_index_holder.h | ||
| vecs_reader.h | ||
README.md
Benchmarking scripts
This directory contains benchmarking scripts and reproducing steps.
COHERE experiments
Getting COHERE Data
Please download the COHERE 10M dataset to cohere_large_10m as follows:
... ...
neighbors.parquet
shuffle_train-00-of-10.parquet
shuffle_train-01-of-10.parquet
shuffle_train-02-of-10.parquet
shuffle_train-03-of-10.parquet
shuffle_train-04-of-10.parquet
shuffle_train-05-of-10.parquet
shuffle_train-06-of-10.parquet
shuffle_train-07-of-10.parquet
shuffle_train-08-of-10.parquet
shuffle_train-09-of-10.parquet
scalar_labels.parquet
test.parquet
For convenience, we prepared a docker image with cohere bench datasets: registry.cn-hongkong.cr.aliyuncs.com/zvec/cohere-bench-data.
You can run a container as follows:
docker run -it --net=host -d -e DEBUG_MODE=true --user root --cap-add=SYS_PTRACE --security-opt seccomp=unconfined -v /home/zvec/:/home/zvec/ -w /home/zvec --name=cohere_bench zvec-registry.cn-hongkong.cr.aliyuncs.com/zvec/cohere-bench-data:0.0.1 bash
docker exec -it cohere_bench bash
The datasets locate at /tmp/cohere/
Preparing Environment
Clone code and init:
$ git clone git@github.com:alibaba/zvec.git
$ cd zvec
$ git submodule update --init
Build source code:
$ cd /home/zvec/workspace/zvec
$ mkdir build
$ cd build
$ cmake -DENABLE_SKYLAKE=ON -DCMAKE_BUILD_TYPE=Release ..
Converting Dataset
Export vector data using python script:
$ mkdir 10m.output
$ python3 convert_cohere_parquet.py
Convert vector data to binary formatted file.
/home/zvec/workspace/zvec/bin/txt2vecs -input=cohere_train_vector_10m.txt --output=cohere_train_vector_10m.zvec.vecs --dimension=768
We've also prepared preprocessed binary formatted files, which can be found in the container below:
root@iZj6caifjouj5yu8xgsiysZ:/home/zvec# ls -al /tmp/cohere/*zvec
/tmp/cohere/cohere_large_10m_zvec:
total 30204572
drwxr-xr-x 2 root root 4096 Feb 5 13:12 .
drwxr-xr-x 6 root root 4096 Feb 6 03:38 ..
-rw-r--r-- 1 root root 8664837 Feb 5 13:06 cohere_test_vector_10m.1000.new.txt
-rw-r--r-- 1 root root 30920004295 Feb 5 13:04 cohere_train_vector_10m.new.zvec.vecs
-rw-r--r-- 1 root root 792835 Feb 5 13:05 neighbors.txt
/tmp/cohere/cohere_medium_1m_zvec:
total 3028688
drwxr-xr-x 2 root root 4096 Feb 5 13:14 .
drwxr-xr-x 6 root root 4096 Feb 6 03:38 ..
-rw-r--r-- 1 root root 8661108 Feb 5 13:07 cohere_test_vector_1m.1000.new.txt
-rw-r--r-- 1 root root 3092004295 Feb 5 13:08 cohere_train_vector_1m.new.zvec.vecs
-rw-r--r-- 1 root root 692969 Feb 5 13:08 neighbors.txt
Preparing Bench Config
Prepare Build Config
BuilderCommon:
BuilderClass: HnswStreamer
BuildFile: /tmp/cohere/cohere_large_10m_zvec/cohere_train_vector_10m.zvec.vecs
NeedTrain: true
TrainFile: /tmp/cohere/cohere_large_10m_zvec/cohere_train_vector_10m.zvec.vecs
DumpPath: /home/zvec/bench/config/cohere_train_vector_10m.dump.index
IndexPath: /home/zvec/bench/config/cohere_train_vector_10m.index
ConverterName: CosineInt8Converter
MetricName: Cosine
ThreadCount: 16
BuilderParams:
proxima.general.builder.thread_count: !!int 16
proxima.hnsw.builder.thread_count: !!int 16
Prepare Search Config
SearcherCommon:
SearcherClass: HnswStreamer
IndexPath: /home/zvec/bench/config/cohere_train_vector_10m.index
TopK: 1,10,50,100
QueryFile: /tmp/cohere/cohere_large_10m_zvec/cohere_test_vector_1000.new.txt
QueryType: float
QueryFirstSep: ";"
QuerySecondSep: " "
GroundTruthFile: /tmp/cohere/cohere_large_10m_zvec/neighbors.txt
RecallThreadCount: 1
BenchThreadCount: 16
BenchIterCount: 1000000000
CompareById: true
SearcherParams:
proxima.hnsw.streamer.ef: !!int 250
Building Index
Conduct Build
$ /home/zvec/workspace/zvec/build/bin/local_build_original ./build.yaml
Performing Bench
Conduct Recall
$ /home/zvec/workspace/zvec/build/bin/recall_original ./search.yaml
Conduct Bench
$ /home/zvec/workspace/zvec/build/bin/bench_original ./search.yaml