Fix #463: apply nested index_params and default-valued config keys#497
Conversation
|
MLCommons CLA bot All contributors have signed the MLCommons CLA ✍️ ✅ |
|
@idevasena the fix looks good to me, consider updating diskann indexing parameters in |
ram-sangle
left a comment
There was a problem hiding this comment.
Please check any possibility of key collision as _flatten_config() walks all sections. If in future database.batch_size and dataset.batch_size both exist, the last value will be retained. Recursing within a specific section might work here.
@ram-sangle Good catch. Done. Both in both files. Added |
Agreed, and this turned out to be live rather than hypothetical — Reworked per your suggestion to flatten per section rather than across the whole document: Cross-section duplicate leaves now keep the first occurrence in document order (so dataset wins over benchmark for the shared Added |
Fix #463: vdb_benchmark config index params (nested + default-valued) not applied:
Root cause 1 — nested index_params: is silently dropped.
merge_config_with_argsloops for section, params in config.items() then for key, value in params.items(), i.e. exactly two levels. When tuning params are nested as index: { index_params: { M, ef_construction } }, the inner loop sees key="index_params" with a dict value. index_params is not an argparse destination, so the whole block is skipped and M/ef_construction stay at their argparse defaults (16/200). That is precisely the log line in the issue: index_type updates to HNSW (it sits one level up, so it merges), but M/efConstruction revert to 16/200.Root cause 2 — config values equal to the argparse default are ignored. The merge only writes a config value when the arg is None or is_default[key] is True. It can't distinguish "user typed --M 16" from "config asked for 16," and a config value that happens to equal the default is treated as still-default and dropped. This bites flat configs too.
Note main's flat configs (M/ef_construction directly under index:) merge correctly today because they aren't nested — so the bug surfaces whenever someone uses the index_params: nesting shown in the issue, or sets a value matching a default.
Fix
In
vdb_benchmark/vdbbench/config_loader.py:_flatten_config()that recursively lifts every leaf key to the top level, so index_params.M becomes M.Reworked precedence to: explicit CLI flag > YAML config > argparse default. A YAML value is now always applied unless the user explicitly set that flag on the CLI (detected via the existing args.is_default map). Unknown config keys (e.g. max_receive_message_length) are ignored exactly as before, and callers that consume those directly from the config dict are unaffected.
This single change fixes every caller (
load_vdb,simple_bench,enhanced_bench,mpi_wrapper,compact_and_watch), since they all share this function. Added 8 regression tests in 1tests/tests/test_issue_463_nested_index_params.py`.