Skip to content

The PRODUCT-quantization case of #10915 asserts the exact top-1 id of an approximate search and fails about one run in three #11035

Closed

Description

@ruispereira

SEVERITY: LOW

Summary aProductQuantizedIndexSizedOnItsFirstVectorBuildsItsCodebooksWithThatSize closes
with assertThat(nearestIds("emb", 1, ...)).containsExactly("d99"). A product-quantized index answers an
approximate nearest neighbour, and the codebooks are trained through JVector's parallel k-means, so
the top-1 id is not a function of the property under test. The property under test - that the index
sized on its first vector built its codebooks with that size - is already pinned deterministically on
the line above by assertThat(vectorIndex("emb").getDimensions()).isEqualTo(8).

Where (HEAD 21d2a0e)

  • engine/src/test/java/com/arcadedb/query/opencypher/Issue10915VectorIndexSizedOnFirstVectorTest.java:243

Repro

Twelve runs of that method alone, unmodified production, on this worktree:

8 x started=1 ok=1 failed=0 aborted=0
4 x started=1 ok=0 failed=1 aborted=0

with, on the failures:

Expecting actual:
  ["d91"]
to contain exactly (and in same order):
  ["d99"]

and ["d96"], ["d93"], ["d93"] on the other three. Five runs of the whole class gave 2 failures
out of 5, always this method. The four sibling vector classes added in the same window
(Issue10968BinaryCodeSearchTest, Issue11003FlatSearchCacheTest, FlatVectorCacheTest,
Issue10938ArrayOfFloatsScalarTest, Issue10921SelectiveWalkTest) were run three times each and were
stable, 0 failures in 15 class runs, so this is specific rather than environmental.

Refutation

attempted LSMVectorIndex.trainProductQuantization samples with a fixed seed (PQ_TRAINING_SAMPLE_SEED), so
the sample is stable; the variation comes from the library's own parallel k-means, which the
repository does not seed. The scalar-quantized sibling test in the same class
(aQuantizedIndexSizedOnItsFirstVectorBuildsItsGraphWithThatSize) uses the same shape and did not
fail once, which is consistent with scalar quantization being deterministic and PQ not.

Suggested fix, and then the guarantee

Drop the containsExactly on an approximate index, or replace it with recall over a set (the true
neighbour within the top k for a k that the recall measurement supports). The guarantee: an exact
oracle belongs on an exact answer. A test that asserts identity on an approximate index should have
to state its k and its expected recall, which makes the approximation visible at the assertion rather
than at 3am in CI.

Scope / confidence

Executed: 12 single-method runs and 5 class runs, through the JUnit Platform launcher
against engine/target/{classes,test-classes} from this worktree. The class is untagged, so it runs in
the unit-tests engine shard and gates a merge.

Dedup

#10993 (OPEN) asks for more tests of an LSM_VECTOR index sized on its first vector, under HA and with
PRODUCT quantization - it asks for coverage, this says the PQ oracle that shipped is nondeterministic.
#10514 (CLOSED) is about PQ recall in production, not the test. The flaky-test issues in the last
1000 titles (#10903, #10223, #10609, #10657, #10053, #10970) are other classes.


Activity

  1. added
    severity:minor
    vector
    on Oct 30, 2026
  2. added this to the 26.11.1 milestone on Oct 31, 2026
  3. ruispereira commented on Oct 31, 2026

    @ruispereira
    ContributorAuthor

    A note while this sits open, in case it is useful for triage: the test class this report names was not picked up by e5b00e907d ("green the red tests of main run 41108716748"), which touched six other test classes in the same pass.

    That may well be deliberate, since this one is a flakiness report rather than a deterministic failure and the two want different fixes. Flagging it only because the run that commit was greening is the same run where this class fails about one time in three.

  4. added
    in progress
    on Nov 2, 2026
  5. self-assigned this
    on Nov 2, 2026
  6. added 2 commits that reference this issue on Nov 2, 2026
  7. lvca commented on Nov 2, 2026

    @lvca
    Member

    Fixed in #11172.

    Confirmed: this was a test problem, not a product bug. A product-quantization codebook is trained with a randomized k-means that cannot be seeded. The vectors in the test sit very close together, so which one an approximate search ranks first changes between runs.

    The test now checks what it is meant to check: the index sized on its first vector trained its codebook with that size and encoded every vector. A search after a reopen still has to return a result. The index documentation no longer claims that the same data always trains the same codebook.


    ❤️ Thanks for helping make ArcadeDB better! ArcadeDB is free and open source, sustained by its community. If it's useful to you or your company, please consider becoming a sponsor to keep development going.

  8. removed
    in progress
    on Nov 2, 2026
  9. added a commit that references this issue on Nov 5, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

bugseverity:minorvector

Type

No type

Projects

No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions