Tuning Parameters
This section applies to both C++ and Python APIs.
Constructor
Parameter |
Value Range |
Recommended Value |
Tuning Description |
|---|---|---|---|
R |
[11, 499] |
50 |
Number of neighboring nodes, which affects the graph build time and final index quality. The value 50 is recommended. If the value is too large, the build time may be too long and the search performance may deteriorate. If the value is too small, the search precision may be affected. |
L |
[11, 1999] |
100 and 200 |
Size of the candidate node list during graph build, which affects the graph build time and final index quality. The value 100 is recommended. If the value is too large, the build time may be too long. |
A |
[1, 360] |
60 and 120 |
Angle threshold during the pruning of graph build. For the IP dataset, the value 120 is used, while for the L2 dataset, 60. |
graph_opt_iter |
[0, 30] |
29 |
Number of rounds for graph index self-iteration. If the value is too large, the build may take a long time. |
Add
Parameter |
Value Range |
Recommended Value |
Tuning Description |
|---|---|---|---|
level |
[0, 3] |
1 and 2 |
Quantization level. Level 1 indicates SQ8U quantization and level 2 indicates SQ4U quantization. For the IP dataset, the value 1 is used, while for the L2 dataset, 2. |
SetEf
Parameter |
Value Range |
Recommended Value |
Tuning Description |
|---|---|---|---|
ef |
[1, n], where n indicates the data volume. |
- |
Size of the candidate node list during search. For small-scale datasets, the recommended value range is [10, 500]. A larger ef value leads to higher search precision but lowers search performance. It is advised to set ef to a smaller value when the precision meets the requirement. |
SetEarlyStoppingParams
Parameter |
Value Range |
Recommended Value |
Tuning Description |
|---|---|---|---|
adding_pref |
≥ 1. |
- |
Candidate node insertion position for retrieval early stopping. During retrieval, if a node is inserted in the candidate set at a position beyond adding_pref, the node is too distant from the query node to likely contain the correct answer in subsequent search steps. A smaller adding_pref value boosts retrieval speed at the expense of reduced accuracy. |
patience |
≥ 1. |
- |
Patience value for retrieval early stopping, indicating late insertion position or insertion failure. If a node is repeatedly inserted at positions beyond the adding_pref threshold, and the number of such insertions is greater than the patience value, the retrieval ends. A smaller patience value boosts retrieval speed at the expense of reduced accuracy. |