alexklibisz / elastiknn

Elasticsearch plugin for nearest neighbor search. Store vectors and run similarity search using exact and approximate algorithms.
https://alexklibisz.github.io/elastiknn
Apache License 2.0
370 stars 48 forks source link

Try removing the L2LSH bias (b) parameter to see what happens #666

Closed alexklibisz closed 6 months ago

alexklibisz commented 6 months ago

Related Issue

https://github.com/alexklibisz/elastiknn/discussions/303

Changes

What changed?

Testing and Validation

How was it validated?

alexklibisz commented 6 months ago

The test pass, but when I run the fashion mnist benchmark, I get this:

Built index in 57.78045845031738
Index size:  13104.0
Running query argument group 1 of 4...
Run 1/3...
Process Process-1:
Traceback (most recent call last):
  File "/home/ubuntu/.asdf/installs/python/3.10.8/lib/python3.10/multiprocessing/process.py", line 314, in _bootstrap
    self.run()
  File "/home/ubuntu/.asdf/installs/python/3.10.8/lib/python3.10/multiprocessing/process.py", line 108, in run
    self._target(*self._args, **self._kwargs)
  File "/home/ubuntu/elastiknn/ann-benchmarks/ann-benchmarks/ann_benchmarks/main.py", line 70, in run_worker
    run(definition, args.dataset, args.count, args.runs, args.batch)
  File "/home/ubuntu/elastiknn/ann-benchmarks/ann-benchmarks/ann_benchmarks/runner.py", line 221, in run
    descriptor, results = run_individual_query(algo, X_train, X_test, distance, count, run_count, batch)
  File "/home/ubuntu/elastiknn/ann-benchmarks/ann-benchmarks/ann_benchmarks/runner.py", line 117, in run_individual_query
    results = [single_query(x) for x in X_test]
  File "/home/ubuntu/elastiknn/ann-benchmarks/ann-benchmarks/ann_benchmarks/runner.py", line 117, in <listcomp>
    results = [single_query(x) for x in X_test]
  File "/home/ubuntu/elastiknn/ann-benchmarks/ann-benchmarks/ann_benchmarks/runner.py", line 67, in single_query
    candidates = algo.query(v, count)
  File "/home/ubuntu/elastiknn/ann-benchmarks/ann-benchmarks/ann_benchmarks/algorithms/elastiknn/module.py", line 121, in query
    raise Exception(
Exception: Throughput after 500 queries is less than 50 q/s. Giving up to avoid wasteful computation.

That means the latency has increased substantially, around 4x, since the slowest parameter setting for this benchmark is about 200 qps. So this might removing the random bias parameter causes more false-positive matches which then need to be processed.