Skip to content

feat: server-side hybrid retrieval fusion (vector.fuse with RRF/DBSF/LINEAR) #4066

Closed

Description

@lvca

Feature Request: Server-side Hybrid Fusion (vector.fuse)

Originated from discussion #4044 (Qdrant to ArcadeDB migration).

Overview

Add a server-side multi-source fusion operator so a single SQL statement can combine ranked results from multiple indexes (dense vector + sparse vector + full-text + payload-based) and reduce them with a fusion strategy.

Today, hybrid retrieval requires two roundtrips and client-side reranking. After this issue, it is one query, fully composable with the rest of SQL.

The design generalizes Qdrant's Query API prefetch + FusionQuery to any source that yields ranked rows. The generic shape ("fuse N ranked sub-pipelines into one ranked output") is intentional, so it is not tied to dense+sparse hybrid alone.

Design

SQL surface

A new SQL function vector.fuse taking:

  1. An array of sub-pipelines, each a sub-SELECT yielding @rid plus $score.
  2. An options map with the fusion strategy and parameters.
SELECT * FROM `vector.fuse`(
  [
    (SELECT @rid, $score FROM `vector.neighbors`('Doc[dense_emb]', $denseVec, 50)),
    (SELECT @rid, $score FROM `vector.sparseNeighbors`('Doc[tokens,weights]', $qIdx, $qVal, 50)),
    (SELECT @rid, $score FROM Doc WHERE SEARCH_INDEX('Doc[content]', $queryText) = true)
  ],
  { fusion: 'RRF', k: 60, weights: [1.0, 1.0, 0.5], groupBy: 'source_file', groupSize: 1 }
) LIMIT 10

The fused output is itself a ResultSet, so it composes with outer WHERE, ORDER BY, LIMIT, joins, and projections.

Fusion strategies

  • RRF (Reciprocal Rank Fusion). score = Σ_i weight_i / (k + rank_i) with default k = 60 and default per-source weight 1.0. This is the default.
  • DBSF (Distribution-Based Score Fusion, Qdrant v1.11+). Per-source score normalization to [mean - 3σ, mean + 3σ], then weighted sum. Useful when sources produce comparable score distributions.
  • LINEAR. score = Σ_i weight_i · score_i after per-source min-max normalization. Covers the existing vector.hybridScore use case wrapped in the fusion shape.

The fusion key dispatches; per-strategy parameters live in the same options map.

Source contract

Any sub-pipeline yielding (@rid, $score) rows in ranked order is a valid source. This covers:

If $score is missing, sources are treated as rank-only (RRF still works, DBSF and LINEAR do not).

Group-by integration

groupBy and groupSize in the fuse options apply after fusion (matching Qdrant's query_points_groups semantics, where grouping is the outermost step). Per-source groupBy remains available via each source's own options, so callers can diversify before fusion (per source) or after fusion (across sources), as needed.

Implementation notes

  • Fusion is an executor step that consumes its child result sets, builds a RID -> per-source-rank/score table, computes the fused score, and emits a sorted result set.
  • Sub-pipelines run in parallel by default; parallel: false option to force sequential execution if a source has side effects.
  • Score-only sources (no @rid) are rejected at planning time with a clear error.

Acceptance criteria

  • New SQL function vector.fuse(sources, options) accepting ≥2 sub-pipelines.
  • Each source must yield rows with @rid and $score.
  • Fusion strategies: RRF (with k, weights), DBSF, LINEAR.
  • Composable with vector.neighbors, vector.sparseNeighbors, SEARCH_INDEX, plain SELECT ... ORDER BY.
  • groupBy + groupSize options applied after fusion.
  • Outer SQL can wrap the fuse with WHERE, LIMIT, ORDER BY, projections.
  • Tests: dense+sparse, dense+fulltext, three-way, weighted RRF, DBSF, LINEAR.
  • Doc page with worked examples covering each strategy.

Out of scope (future work)

  • Nested fusion (fusion of fusions). Qdrant supports nested prefetches; this would be a follow-up.
  • Cross-type / cross-collection fusion (joining ranked results across multiple types in one fuse). Possible today via UNION-style sources but not optimized.
  • Auto-tuning of weights from labeled data.

Related

cc @astarso

Activity

  1. added
    enhancement
    on May 3, 2026
  2. self-assigned this
    on May 3, 2026
  3. added theissue type on May 3, 2026
  4. added this to the 26.5.1 milestone on May 4, 2026
  5. lvca commented on May 4, 2026

    @lvca
    MemberAuthor

    All functional criteria + 9 strategy tests;

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

Metadata

Metadata

Assignees

Labels

enhancementfeaturesql

Projects

No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions