Local query_points_groups changes the top weighted RRF hit by expanding prefetch limits

Open
#1,723 1 comment 0 reactions 0 assignees View on GitHub

Maintainers usually reply within 6 days

@LittleChenLiya is already working on this.

Since Nov 28, 2026.

  • #1724 by @LittleChenLiya — open

Assessment

Difficulty
4/5
Estimated time
3-5 days
Newbie friendliness
52/100
Issue type
Bug
Clarity
Clearly specified
Activity status
Active
Tech stack
python

Research direction

Start with LocalCollection.query_groups and trace how it expands prefetch limits before fusion; compare that path with the server behavior described in the reproduction. Run the supplied Python fixture against local mode and Qdrant 1.20.2 over REST. Done means grouped and ungrouped queries return the same first result for the unique-group fixture while preserving grouping behavior with smaller limits or repeated group keys.

Written by the indexing model from the issue text.

Description

What happens

For the same weighted RRF query, a one-hit group per point changes which document is ranked first in Python local mode. A Qdrant 1.20.2 server over REST returns the same first document for grouped and ungrouped queries.

Checked against client dev commit d6d93e899a425c5f9ebd6c9f35ff6db77cc6b871, with Python 3.14 and a disposable server. The results below were identical across three fresh collections.

Reproduce

Point the URL argument at a disposable Qdrant 1.20.2 server (port 16333 here).

"""Run with a disposable Qdrant 1.20.2 server on port 16333."""
from uuid import uuid4

from qdrant_client import QdrantClient, models

name = f"weighted_rrf_{uuid4().hex[:8]}"
for mode, client in [
    ("local", QdrantClient(":memory:")),
    ("REST", QdrantClient(url="http://127.0.0.1:16333", check_compatibility=False, trust_env=False)),
]:
    client.create_collection(
        name,
        vectors_config={
            key: models.VectorParams(size=2, distance=models.Distance.DOT) for key in ("a", "b")
        },
    )
    try:
        client.upsert(
            name,
            [
                models.PointStruct(id=i, vector={"a": [a, 0.0], "b": [b, 0.0]},
                                   payload={"group": str(i)})
                for i, (a, b) in enumerate([(1.0, 5.0), (5.0, 0.0), (4.0, 4.0), (2.0, 3.0)])
            ],
        )
        prefetch = [models.Prefetch(query=[1.0, 0.0], using=k, limit=3) for k in ("a", "b")]
        query = models.RrfQuery(rrf=models.Rrf(weights=[1.0, 0.75]))
        point = client.query_points(name, query=query, prefetch=prefetch, limit=1).points[0]
        group = client.query_points_groups(
            name, query=query, prefetch=prefetch, group_by="group", group_size=1, limit=1
        ).groups[0].hits[0]
        print(mode, "points:", (point.id, round(point.score, 6)),
              "groups:", (group.id, round(group.score, 6)))
    finally:
        client.delete_collection(name)
        client.close()
Mode First ungrouped hit (ID, score) First grouped hit (ID, score)
Python local (2, 0.606061) (1, 0.657895)
Server via REST (2, 0.606061) (2, 0.606061)

Each point owns a distinct group and neither top result is tied. Point 1 ranks first in source A and last in source B, so source B's limit=3 normally excludes it. In the grouped local path, LocalCollection.query_groups raises each prefetch limit to the collection size before fusion. With the fixture above that includes point 1 in source B and raises it to the top.

Expected

With a unique group per point and a single group requested, this fixture should return the same top group in local mode and on the server. This is a grouped ranking difference, not just floating-point precision. I haven't proposed that all per-source limit expansion be removed: with smaller limits or repeated group keys the server can make additional grouping passes, so a fix needs to preserve that behavior.

AI disclosure: OpenAI Codex built and ran the local/REST reproduction and drafted this report.

Dominant language
Python
Stars
1.4k
Forks
409
Avg merge
11d 14h
Merged PRs (30d)
11

Getting set up

  • No Dockerfile or Docker Compose file
  • Has a pull request template
  • No contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from qdrant/qdrant-client

All issues in qdrant/qdrant-client

Similar issues

More Python issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.