Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

integrate quantized data to storages #1311

Merged
merged 59 commits into from
Mar 3, 2023
Merged

integrate quantized data to storages #1311

merged 59 commits into from
Mar 3, 2023

Conversation

IvanPleshkov
Copy link
Contributor

@IvanPleshkov IvanPleshkov commented Jan 3, 2023

This PR is an integration of the quantization library into Qdrant:
https://github.com/qdrant/quantization

Quantization is a simplifying of vector data. It's helpful for reducing memory usage and scoring performance.

Quantization is enabled while segment creation uses a separate quantization config. For now, the config has only an enable flag.

curl -X PUT "http://$QDRANT_HOST/collections/test_collection" \
  -H 'Content-Type: application/json' \
  --data-raw '{
      "vectors": { ... },
      "quantization_config": {
        "enable": true
      }
    }' | jq

Quantized data is contained in RAM only, no mmap for quantized data for now. Quantized data is used for HNSW indexing and for HNSW search. Any search without HNSW index (plain search, exact search, etc) doesn't use quantized data.

For increasing accuracy, the user can disable quantized data using the ignore_quantization flag in search parameters. Because HNSW index is built using quantized data, ignore_quantization can just increase accuracy but not fix it to the original data accuracy.

If the search uses quantized data, final scores will be recalculated using the original data.

For memmap storage, there is RAM copy for deleted flags if quantization is enabled. Quantization on RAM is not effective when deleted flags are memmapped.

Perf and acc tests on real and random datasets are reported here:
https://www.notion.so/qdrant/7bit-quantization-in-hnsw-9f0467b5010849dcb359d0da93d844e0

All Submissions:

  • Have you followed the guidelines in our Contributing document?
  • Have you checked to ensure there aren't other open Pull Requests for the same update/change?

New Feature Submissions:

  1. Does your submission pass tests?
  2. Have you lint your code locally using cargo fmt command prior to submission?
  3. Have you checked your code using cargo clippy command?

Changes to Core Features:

  • Have you added an explanation of what your changes do and why you'd like us to include them?
  • Have you written new tests for your core changes, as applicable?
  • Have you successfully ran tests with your changes locally?

@generall generall merged commit 5174388 into dev Mar 3, 2023
generall added a commit that referenced this pull request Mar 15, 2023
* integrate quantized data to storages

* revert gitignore

* are you happy clippy

* quantize in optimizer

* provide flag

* fix segfault

* skip quantization flag, update scores

* use quantization flag

* are you happy fmt

* use quantization flag

* quantized search test

* are you happy fmt

* refactor test, refactor scorer choosing

* are you happy fmt

* run quantization on segment builder

* decrease testing parameters

* simplify segment

* update version

* remove use_quantization flag

* provide quantization config

* quantization version up

* euclid dist

* add euclid test

* saveload

* fix initialization bugs

* quantization lib version up

* fix arm build

* refactor scorer selecting

* quant lib version up

* are you happy fmt

* are you happy fmt

* are you happy clippy

* add save/load test for simple storage

* add comments

* quantiles

* quantization mmap

* remove f32

* mmap test

* fix mmap slice

* fix mmap test

* use chunks for quantization storage

* fix build

* are you happy fmt

* update quantization library

* update quantization lib

* update quantization lib

* integrate api changes

* are you happy fmt

* change quantization api

* additional checks in tests

* update quantization version

* fix unit tests

* add quantization to storage config

* use quantization for all cardinality search cases

* Integrate quantization suggestions 2 (#1520)

* review api

* wip: refactor quantization integrations

* wip: refactor quantization integrations

* wip: fmt

* include quantization into snapshot

* fmt

---------

Co-authored-by: Andrey Vasnetsov <andrey@vasnetsov.com>
@generall generall mentioned this pull request Apr 19, 2023
8 tasks
@agourlay agourlay deleted the integrate-quantization branch July 12, 2023 15:46
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.

2 participants