Keyboard shortcuts

Press or to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

Index Parameters

This page summarises the commonly used parameters for every VSAG index type. For the full enumeration, consult the source:

  • Build parameter keys: src/constants.cpp
  • Public constants: include/vsag/constants.h
  • Per-index examples: examples/cpp/101_index_hnsw.cpp and friends.

Common Fields

Every index requires these top-level fields at build time:

FieldValuesDescription
dimpositive integerVector dimensionality; cannot change after build
dtypefloat32 / fp16 / bf16 / int8Vector data type; determines internal representation
metric_typel2 / ip / cosineDistance metric

HNSW

HNSW uses the hnsw sub-object for build parameters. It does not accept HGraph-only keys such as base_quantization_type.

{
    "dim": 128,
    "dtype": "float32",
    "metric_type": "l2",
    "hnsw": {
        "max_degree": 32,
        "ef_construction": 400,
        "use_conjugate_graph": false
    }
}
FieldTypicalDescription
max_degree16–48Maximum out-degree per node
ef_construction200–500Candidate set size during build; larger = higher recall, slower build
use_conjugate_graphboolBuild the conjugate graph

At search time:

{"hnsw": {"ef_search": 100, "use_conjugate_graph_search": false}}

HGraph

HGraph places its build parameters under the generic index_param key (see examples/cpp/103_index_hgraph.cpp); the hgraph key is reserved for search-time parameters.

{
    "dim": 128,
    "dtype": "float32",
    "metric_type": "l2",
    "index_param": {
        "base_quantization_type": "fp32",
        "max_degree": 32,
        "ef_construction": 400
    }
}
FieldTypicalDescription
max_degree16–48Maximum out-degree per node
ef_construction200–500Candidate set size during build; larger = higher recall, slower build
base_quantization_typefp32 / fp16 / bf16 / sq8 / sq4 / pqQuantization of the base storage — see the Quantization chapter for all supported values

At search time:

{"hgraph": {"ef_search": 100}}

The hgraph search-param object also accepts brute_force_threshold (a float in [0.0, 1.0], default 0.0). When set above zero and the request carries a filter whose ValidRatio() is at most this threshold, HGraph skips the graph traversal and runs an exact scan over the surviving ids. See the HGraph index page for details.

DiskANN

{
    "diskann": {
        "max_degree": 32,
        "ef_construction": 400,
        "pq_sample_rate": 0.1,
        "pq_dims": 32,
        "use_async_io": true
    }
}

IVF

{
    "ivf": {
        "nlist": 4096,
        "base_quantization_type": "sq8",
        "nprobe": 32
    }
}

Brute Force

{"brute_force": {}}

No extra parameters.

Pyramid

Pyramid supports organising multiple subgraphs by tag:

{
    "pyramid": {
        "tag_dim": 1,
        "max_degree": 24,
        "ef_construction": 300
    }
}

SINDI (sparse vectors)

{
    "sindi": {
        "top_k": 32,
        "doc_prune_ratio": 0.1
    }
}

Runtime Parameters

Beyond build-time parameters, Index::Tune and SearchParam tweak runtime settings such as ef_search and nprobe. See Optimizer and the examples/cpp/3xx_feature_*.cpp examples.