Repository navigation
Conversation
… truth Adds vectordb_bench/backend/filtered_dataset, a generator for filtered-search fixtures (Stanford catalog V01). A spec sets vector shape, metric, seed, label and int metadata distributions (uniform or Zipf), how strongly the metadata follows vector position, and target selectivities for label-equality and int-range filters. It writes the custom-dataset layout (train, test, scalar_labels, one neighbors file per case) plus a manifest with each case's actual selectivity, matching rows, short or empty ground truth, boundary ties and how often unfiltered neighbors already pass the filter. Ground truth is an exact float64 top-k ranked by (distance, id). A verify command re-checks a fixture against an independent exact reference. issue: zilliztech#881 Signed-off-by: yejonz <yejonz@gmail.com>
Cap num_train * dim (50M elements, about 1.3 GB peak and below Arrow's int32 list offsets) and the int domain width. Say that only the base files load through CustomDataset today and per-case ground truth needs V02. Qualify the reproducibility claim and record numpy/pyarrow versions in the manifest. Accept an empty --config with --seed, and reword --overwrite. Signed-off-by: yejonz <yejonz@gmail.com>
…ately Signed-off-by: yejonz <yejonz@gmail.com>
Adds FilteredFixtureCase, which runs one case of a fixture generated by
vectordb_bench.backend.filtered_dataset (V01):
vectordbbench milvushnsw ... --case-type FilteredFixtureCase \
--fixture-dir ./fixture --fixture-case 00_label_equal_0.01
Label cases become a label-equality filter with the manifest's value, so
every client with label support runs them unchanged. Int-range cases use
a new NumRange filter type; Milvus supports it with an INT64 column and
an STL_SORT index, like its id field for NumGE. A client that cannot run
a case's filter type skips that case with a warning instead of failing
the run; other cases keep the existing error.
Recall and NDCG are scored over min(K, rows the filter matches), and the
reader requires ground truth that wide, so a fixture generated with a
smaller K is rejected rather than scored as perfect. Range cases get
their own load reuse key. Each result records the case, expression,
target and actual selectivity and the fixture's distributions in
additional_parameters, and stores the manifest entries it needs so it
loads after the fixture moves.
issue: zilliztech#882
Signed-off-by: yejonz <yejonz@gmail.com>
|
/assign @XuanYang-cn |
jamesgao-jpg
left a comment
There was a problem hiding this comment.
Thanks for working on this integration! The generated filtered datasets look useful, and the changes for integer-range filters and short ground truth address real capability gaps.
Could we extend the existing PerformanceCustomDataset case instead of introducing a separate public FilteredFixtureCase? The new case already constructs the same CustomDataset and dataset manager, so the main difference seems to be how the filter, ground-truth file, and dataset metadata are configured.
A possible approach would be to let the custom case accept an explicit filter and associated ground-truth file, with the generated manifest acting as a convenience input that populates those settings. That could support both these synthetic fixtures and other user-provided filtered datasets through the same case.
The range-filter support, handling of fewer than k matching rows, and result metadata would still be needed; this suggestion is about reusing the existing public case and configuration path. Is there a reason the separate case is preferable?
…endence baseline Count an int range from the first row tied at its lower bound, so a run of ties at the start no longer pushes the upper bound past the closest match. In verify, report neighbor ids outside 0..N-1 before indexing (NumPy reads -1 as the last row) and check each ground-truth file's query ids against the test file. Compute the expected queries with no unfiltered match by sampling without replacement from the observed matching rows (hypergeometric) instead of (1 - selectivity) ** k. Signed-off-by: yejonz <yejonz@gmail.com>
|
Thanks, that makes sense, no strong reason for a separate case. I'll fold it into |
Signed-off-by: yejonz <yejonz@gmail.com> # Conflicts: # vectordb_bench/backend/task_runner.py
Per review, drop the separate FilteredFixtureCase. PerformanceCustomDataset now takes an optional filter_config (a label_equal value or an int_range, with its own ground-truth file and matching row count), and --fixture-dir/--fixture-case fill in the dataset settings and that filter from the fixture's manifest. Any custom dataset can pass filter_config directly. The custom_case holds everything the case needs, so saved results load without the manifest. Results record the fixture's metadata under additional_parameters["filter_metadata"]; unsupported explicit filters are still skipped with a warning. Signed-off-by: yejonz <yejonz@gmail.com>
|
Done in f18af25. |
|
[APPROVALNOTIFIER] This PR is NOT APPROVED This pull-request has been approved by: yejonz The full list of commands accepted by this bot can be found here. DetailsNeeds approval from an approver in each of these files:Approvers can indicate their approval by writing |
Fixes #882.
Builds on #903 (V01). Until that merges, this branch also contains its commits; the V02 changes are 14d6b38 and f18af25 (the merges bring in the #903 review fix and main).
What changed
#903 generates filtered fixtures, but VectorDBBench could not run them. A fixture's label values and ground-truth files don't follow the
label_{p}pnaming, there was no int-range filter, the reader rejects ground truth narrower than K (which a fixture has whenever fewer rows match), recall was scored out of K even when fewer than K neighbors exist, and a client that doesn't support a filter type failed the whole run.Following the review, this runs through the existing
PerformanceCustomDatasetcase instead of a new one. The custom case takes an optionalfilter_configwith an explicit filter and its ground-truth file, and--fixture-dir/--fixture-casefill that in, along with the dataset settings, from the fixture's manifest:vectordbbench milvushnsw --uri http://localhost:19530 \ --case-type PerformanceCustomDataset --fixture-dir ./fixture --fixture-case 00_label_equal_0.01filter_configis alabel_equalvalue or anint_range(low <= field < high_exclusive), plusgt_nameandmatching_rows. Any custom dataset can pass it directly; the manifest is only a convenience input. Without it,PerformanceCustomDatasetbehaves as before, and setting it together withuse_filteris rejected.ExplicitLabelFilter), so every client that supports label filters runs them unchanged.FilterOp.NumRange(IntRangeFilter). Milvus supports it with an INT64int_attrfield and anSTL_SORTindex, the same index its id field gets forNumGE; the insert runner passes the column asint_data. Range cases get their own load reuse key, so they never reuse a collection loaded without that field.FilterNotSupportedError.additional_parameters["filter_metadata"]. The savedcustom_caseholds the absolute dataset path and the filter, so saved results load without the manifest.Example
Against Milvus 2.6.27 (standalone in Docker), FLAT index, on a 5,000 x 32 fixture with 100 queries:
The case is
int_attr >= 4 and int_attr < 113, which matches 51 rows, so each query has 51 true neighbors. Before this change the same exact answers would score 0.51. The saved result includes:Verification
tests/test_filtered_fixture_case.py, 15 tests: label and range cases built from a manifest; an explicit filter on a custom dataset without a manifest; invalid filter configs andfilter_configwithuse_filterrejected; unknown case ids and format versions rejected; the CLI options; short ground truth loads for explicit filters but is still rejected for an ordinary label filter; K above the ground truth's K rejected; recall and NDCG scored out of the available neighbors; insert batches carryingint_attr; the Milvus range expression; the assembler skipping unsupported explicit filters while still failing ordinary cases; label and range cases getting different load reuse keys; a saved result loading after the fixture is deleted.make lintpasses.test_custom_dataset_filter.py,test_milvus.py,test_case_runner_reuse.pyandtest_concurrent_runner.py) give the same results as on main. The download tests intest_dataset.pyandtest_data_source.pyfail or time out offline on both.vectordbbench testwith each case skips it with a warning, e.g.Skipping Filtered fixture 03_int_range_0.01 - filtered_synthetic on test: NumRange filters (int_attr >= 4 and int_attr < 113) are not supported by this client;--fixture-dirwithout--fixture-caseis a usage error;PerformanceCustomDatasetwithout a fixture still requires the--custom-dataset-*options.labels == "label_20", 50 matching rows) and the range case above both had recall 1.0 and about 1,200 QPS at concurrency 2. One run with both cases dropped and reloaded the collection for the range case, and both had recall 1.0.Not tested here
NumRangeon other clients; they skip range cases until they add it.recall_atis empty when fewer rows match than the smallest cutoff, since the existing code skips cutoffs above the number of true neighbors.