Skip to content

Make namedVector compose with multivector in ann-benchmark#102

Merged
rlmanrique merged 1 commit into
mainfrom
fix/named-vector-multivector-compose
Jun 29, 2026
Merged

Make namedVector compose with multivector in ann-benchmark#102
rlmanrique merged 1 commit into
mainfrom
fix/named-vector-multivector-compose

Conversation

@rlmanrique

Copy link
Copy Markdown
Contributor

Summary

Running the benchmarker with both --namedVector and -m (multivector/Colbert) failed at import time:

go run main.go ann-benchmark -v lotte-recreation-reduced-vl-10000.hdf5 \
  -m 128 --indexType hnsw -d cosine --namedVector vector1
...
INFO[0000] Error for index 0: inconsistent vector lengths: 2432 != 2560
INFO[0000] Error for index 1: inconsistent vector lengths: 1664 != 2560
INFO[0000] Error for index 5: inconsistent vector lengths: 1920 != 2560

Root cause

The cfg.NamedVector != "" branches in both the ingestion and query paths unconditionally overwrote any multivector payload with a single flat encodeVector(vec). For a Colbert dataset with variable token counts (19/13/15/16/20 × 128), each document encoded to a different length and Weaviate rejected every doc whose length differed from the first object in the batch.

The schema-creation branch had the matching gap: when NamedVector != "", the multivector / muvera block was never added, so Weaviate created a plain single-vector HNSW index regardless of -m.

Changes

File Function Fix
cmd/ann_benchmark.go writeChunk Emit MULTI_FP32 under cfg.NamedVector when both flags set, instead of clobbering
cmd/ann_benchmark.go createSchema Inject the multivector / muvera block into the named vector index config when -m > 0
cmd/random_vectors.go nearVectorQueryGrpc Query path sends MULTI_FP32 with Targets.TargetVectors=[cfg.NamedVector] when both are set
cmd/ann_benchmark.go enableCompression Check NamedVector before MultiVectorDimensions so compression updates land on the right VectorConfig key

Single-vector + namedVector and multivector-only paths are unchanged.

Test plan

  • CGO_ENABLED=1 go build ./...
  • CGO_ENABLED=1 go test ./cmd/...
  • Repro that originally failed: go run main.go ann-benchmark -v lotte-recreation-reduced-vl-10000.hdf5 -m 128 --indexType hnsw -d cosine --namedVector vector1 — ingest completes, queries return non-zero recall
  • Regression: ann-benchmark with only -m (no --namedVector) still works
  • Regression: ann-benchmark with only --namedVector (no -m) still works

Passing --namedVector together with -m (multivector/Colbert) failed with
"inconsistent vector lengths" because the namedVector branches in both
the ingestion and query paths unconditionally overwrote the multivector
payload with a single flat vector. The schema branch likewise omitted
the multivector/muvera config.

- writeChunk: emit MULTI_FP32 under cfg.NamedVector when both flags set
- createSchema: inject multivector/muvera block into named vector config
- nearVectorQueryGrpc: target the named vector with the multi payload
- enableCompression: check NamedVector before MultiVectorDimensions so
  config updates land on the right VectorConfig key

@orca-security-eu orca-security-eu Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Orca Security Scan Summary

Status Check Issues by priority
Passed Passed Infrastructure as Code high 0   medium 0   low 0   info 0 View in Orca
Passed Passed SAST high 0   medium 0   low 0   info 0 View in Orca
Passed Passed Secrets high 0   medium 0   low 0   info 0 View in Orca
Passed Passed Vulnerabilities high 0   medium 0   low 0   info 0 View in Orca

@rlmanrique
rlmanrique merged commit 18d29eb into main Jun 29, 2026
6 checks passed
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.

1 participant