Skip to content

Fix: Preserve supplied vector rows during recall sampling - #848

Open
HuaTNA wants to merge 1 commit into
unum-cloud:mainfrom
HuaTNA:fix-recall-sample-vectors
Open

HuaTNA wants to merge 1 commit into
unum-cloud:mainfrom
HuaTNA:fix-recall-sample-vectors

Conversation

@HuaTNA

@HuaTNA HuaTNA commented Nov 14, 2026

Copy link
Copy Markdown

Closes #847.

When self_recall() samples keys but receives an explicit vector matrix, the vectors retain their original rows. Search results are then compared with different sampled identities, so a correct index can report recall 0.0 instead of 1.0.

Select the same vector rows as the keys. Normalize supplied vectors to two dimensions before indexing to preserve single-vector inputs.

Validation on 3.0 main 840374af:

  • Both new regression cases (fractional sample and integer count) fail before the fix and pass afterward.
  • All 16 native recall tests pass, including the existing metric/quantization cases.
  • The real 128-vector benchmark from the issue returns recall 1.0 for both supplied and fetched sampled vectors after the fix. Local controls also cover list inputs, single-vector shapes and unchanged caller arrays.
  • Ruff lint/format, normal commit hooks, the repository's commit-range check and git diff --check pass. Its hook self-test reports 534 passed / 0 failed.

Python 3.13.13 / NumPy 2.5.4 on macOS arm64, with the 3.0 CPU SDK and its pinned NumKong 8.0.0-rc.1 dependency built from source. The full Python, other-language and GPU test matrices were not run.

Apply sampled offsets to both keys and caller-provided vectors.
Keep one-dimensional vector input valid before selecting rows.

Closes unum-cloud#847.

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Bug: self_recall samples keys but not supplied vectors

1 participant