ANN

The following covers the available vector index configuration options.

backend

  1. backend: faiss|hnsw|annoy|numpy|torch|custom

Approximate Nearest Neighbor (ANN) index backend for storing generated sentence embeddings. Defaults to faiss. Additional backends require the similarity extras package to be installed. Add custom backends via setting this parameter to the fully resolvable class string.

Backend-specific settings are set with a corresponding configuration object having the same name as the backend (i.e. annoy, faiss, or hnsw). None of these are required and are set to defaults if omitted.

faiss

  1. faiss:
  2. components: comma separated list of components - defaults to "Flat" for small
  3. indices and "IVFx,Flat" for larger indexes where
  4. x = 4 * sqrt(embeddings count)
  5. nprobe: search probe setting (int) - defaults to x/16 (as defined above)
  6. for larger indexes
  7. quantize: store vectors with 8-bit precision vs 32-bit (boolean)
  8. defaults to false
  9. mmap: load as on-disk index (boolean) - trade query response time for a
  10. smaller RAM footprint, defaults to false
  11. sample: percent of data to use for model training (0.0 - 1.0)
  12. reduces indexing time for larger (>1M+ row) indexes, defaults to 1.0

See the following Faiss documentation links for more information.

hnsw

  1. hnsw:
  2. efconstruction: ef_construction param for init_index (int) - defaults to 200
  3. m: M param for init_index (int) - defaults to 16
  4. randomseed: random-seed param for init_index (int) - defaults to 100
  5. efsearch: ef search param (int) - defaults to None and not set

See Hnswlib documentation for more information on these parameters.

annoy

  1. annoy:
  2. ntrees: number of trees (int) - defaults to 10
  3. searchk: search_k search setting (int) - defaults to -1

See Annoy documentation for more information on these parameters. Note that annoy indexes can not be modified after creation, upserts/deletes and other modifications are not supported.