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

Product Quantization on HNSW(HNSW+PQ) in FAISS Engine #1064

Closed
jmazanec15 opened this issue Aug 24, 2023 · 2 comments
Closed

Product Quantization on HNSW(HNSW+PQ) in FAISS Engine #1064

jmazanec15 opened this issue Aug 24, 2023 · 2 comments
Assignees
Labels
bug Something isn't working k-NN v2.10.0 Issues targeting release v2.10.0

Comments

@jmazanec15
Copy link
Member

Coming from https://forum.opensearch.org/t/cannot-create-index-with-hnsw-pq/15634/1 (@tomekcejner-cloudinary).

{
    "training_index": "training-data-index",
    "training_field": "embedding_vector",
    "dimension": 512,
    "description": "HNSW with PQ",
    "method": {
        "name": "hnsw",
        "engine": "faiss",
        "space_type": "l2",
        "parameters": {
            "encoder": {
                "name": "pq",
                "parameters": {
                    "code_size": 8,
                     "m": 8
                }
            }
        }
    }
}

[2023-08-23T21:17:09,996][ERROR][o.o.k.t.TrainingJob      ] [fa696978b96b] Failed to run training job for model "hnsw_pq_m8": Error in std::unique_ptr<faiss::Index> faiss::{anonymous}::index_factory_sub(int, std::string, faiss::MetricType) at /tmp/tmpzmr1s8yb/k-NN/jni/external/faiss/faiss/index_factory.cpp:781: Error: 'index' failed: could not parse HNSW code description PQ8x8 in HNSW16,PQ8x8

HNSWPQ does not work in OpenSearch because the faiss index factory description constructed for HNSW is "HNSW16,PQ1x8", which is not valid due to nbits not being parametrizable for HNSW in faiss. See facebookresearch/faiss#3027. Will follow up on discussion there. To fix in short term, we need to change https://github.com/opensearch-project/k-NN/blob/main/src/main/java/org/opensearch/knn/index/util/Faiss.java#L104 to format selectively based on base index type

@jmazanec15 jmazanec15 added bug Something isn't working untriaged and removed untriaged labels Aug 24, 2023
@vamshin vamshin added the v2.10.0 Issues targeting release v2.10.0 label Aug 29, 2023
@vamshin vamshin moved this from Backlog to 2.10 (September 11th, 2023) in Vector Search RoadMap Aug 29, 2023
@vamshin vamshin changed the title [BUG] Cannot create index with HNSW + PQ Support HNSW + PQ in FAISS Engine Aug 29, 2023
@vamshin vamshin added the k-NN label Aug 29, 2023
@vamshin vamshin changed the title Support HNSW + PQ in FAISS Engine Product Quantization on HNSW in FAISS Engine Aug 29, 2023
@vamshin vamshin changed the title Product Quantization on HNSW in FAISS Engine Product Quantization on HNSW(HNSW+PQ) in FAISS Engine Aug 30, 2023
@DarshitChanpura
Copy link
Member

@jmazanec15 Should this be labelled to 2.11?

@navneet1v
Copy link
Collaborator

@DarshitChanpura this is already merged in 2.10 and will be released with 2.10

@github-project-automation github-project-automation bot moved this from 2.10 (September 11th, 2023) to ✅ Done in Vector Search RoadMap Sep 13, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working k-NN v2.10.0 Issues targeting release v2.10.0
Projects
Status: Done
Development

No branches or pull requests

4 participants