Skip to content

fix: keep the query weight at 1.0 for colliding miniCOIL OOV words - #1

Merged
joein merged 1 commit into
remote-controlled-man:codex/prflow-0b794484f406from
qdrant:minicoil-oov-query-weight
Dec 2, 2026
Merged

joein merged 1 commit into
remote-controlled-man:codex/prflow-0b794484f406from
qdrant:minicoil-oov-query-weight

Conversation

@joein

@joein joein commented Dec 2, 2026

Copy link
Copy Markdown

This PR targets the branch of qdrant#881 and changes how queries weight colliding out-of-vocabulary (OOV) words.

When two OOV words in a query hash to the same index, the query now keeps weight 1.0 there. qdrant#881 sums them to 2.0. Documents already sum the two words' tf at the shared index, so with 1.0 a query that has both words scores the same as it would without the collision. With 2.0 the shared index counts twice. Bm25.query_embed also gives 1.0 to an index that two tokens share.

An example with Qdrant/minicoil-v1: the document "bats screech token49516 at night token56101 token56101" has 1.6467 + 1.8836 = 3.5303 at index 1433372619. The query "token49516 token56101" scores 3.53 there with weight 1.0 and 7.06 with weight 2.0.

Other changes:

  • Renamed the test file to tests/test_sparse_vectors_converter.py to match the module name. fix: preserve miniCOIL inputs when merging normalized words qdrant/fastembed#878 adds a file with the same name, so the second of the two PRs to land has to merge its tests into that file.
  • Added a converter test that puts a vocabulary word, the colliding pair, and a non-colliding OOV word in one vector.
  • Added test_minicoil_colliding_oov_words to tests/test_sparse_embeddings.py. It checks documents and queries through SparseTextEmbedding("Qdrant/minicoil-v1").
  • Restored the # since miniCOIL IDs start with 1 comments and explained the merge in the OOV comments.

I also rebased qdrant#881 on the latest main. The rebase had no conflicts.

The converter tests and the miniCOIL tests in tests/test_sparse_embeddings.py pass locally. Ruff and mypy pass, and pyright reports nothing new.

@joein
joein merged commit 2c9f2ac into remote-controlled-man:codex/prflow-0b794484f406 Dec 2, 2026
@joein
joein deleted the minicoil-oov-query-weight branch December 2, 2026 15:19
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