Skip to content

[python] Execute hybrid search routes concurrently - #9797

Open
TheR1sing3un wants to merge 1 commit into
apache:masterfrom
TheR1sing3un:codex/hybrid-search-route-parallelism
Open

TheR1sing3un wants to merge 1 commit into
apache:masterfrom
TheR1sing3un:codex/hybrid-search-route-parallelism

Conversation

@TheR1sing3un

Copy link
Copy Markdown
Member

Purpose

Hybrid search executes independent vector and full-text routes sequentially before ranking their results. Execute multiple routes concurrently with a bounded four-worker pool, then convert results in route order so RRF, weighted-score, and MRR ranking semantics remain unchanged.

Empty and single-route searches keep the direct path. On failure, pending work is cancelled, started routes are allowed to clean up, and the original route exception is propagated.

Tests

  • python -m pytest -q pypaimon/tests/hybrid_search_execution_test.py pypaimon/tests/hybrid_search_ranker_test.py: 10 passed.
  • Tests verify concurrent execution, stable route order, the single-route fast path, the worker cap, and cleanup before exception propagation.
  • Flake8 and git diff --check passed.

Benchmark

macOS arm64, Python 3.9.6. Each route uses a simulated I/O delay; values are medians of 12 runs. This isolates route scheduling from index implementation and ranking cost.

Routes Serial Concurrent Speedup
2 x 20 ms 47.238 ms 24.278 ms 1.95x
10 ms + 40 ms 55.602 ms 44.120 ms 1.26x
4 x 20 ms 93.787 ms 24.859 ms 3.77x
5/10/20/40 ms 85.271 ms 44.742 ms 1.91x

Results remained in route order in every run. Real query gains depend on route latency distribution and nested native-index parallelism. The temporary benchmark driver is not included in the change.

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