Skip to content

[Router][Bugfix]: parseBestMatch select best match from all KNN candidates#1762

Merged
rootfs merged 2 commits intovllm-project:mainfrom
drivebyer:fix-knn-best-result
Apr 10, 2026
Merged

[Router][Bugfix]: parseBestMatch select best match from all KNN candidates#1762
rootfs merged 2 commits intovllm-project:mainfrom
drivebyer:fix-knn-best-result

Conversation

@drivebyer
Copy link
Copy Markdown
Contributor

@drivebyer drivebyer commented Apr 10, 2026

parseBestMatch relies on Go map iteration order to pick the "best" KNN result, but Go maps have randomized iteration order. When Search.TopK > 1, this returns a random candidate instead of the closest match, causing false cache misses, non-deterministic behavior, and inaccurate similarity metrics.

Purpose

  • What does this PR change?
  • Why is this change needed?
  • Which module(s) does this affect? Router

Test Plan

  • What commands, checks, or manual steps should reviewers use?
  • Why is this validation sufficient for the affected module(s)?

Test Result

  • What were the actual results?
  • Any follow-up risks, gaps, or blockers?

Semantic Router PR Checklist
  • PR title uses module-aligned prefixes such as [Router], [CLI], [Dashboard], [Operator], [Fleet-Sim], [Bindings], [Training], [E2E], [Docs], or [CI/Build]
  • If the PR spans multiple modules, the title includes all relevant prefixes
  • Commits in this PR are signed off with git commit -s
  • The Purpose, Test Plan, and Test Result sections reflect the actual scope, commands, and blockers for this change

See CONTRIBUTING.md for the full contributor workflow and commit guidance.

@netlify
Copy link
Copy Markdown

netlify bot commented Apr 10, 2026

Deploy Preview for vllm-semantic-router ready!

Name Link
🔨 Latest commit de65275
🔍 Latest deploy log https://app.netlify.com/projects/vllm-semantic-router/deploys/69d8f4e71015a5000821e2f7
😎 Deploy Preview https://deploy-preview-1762--vllm-semantic-router.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify project configuration.

@github-actions
Copy link
Copy Markdown
Contributor

github-actions bot commented Apr 10, 2026

👥 vLLM Semantic Team Notification

The following members have been identified for the changed files in this PR and have been automatically assigned:

📁 src/semantic-router

Owners: @rootfs, @Xunzhuo, @szedan-rh, @yehuditkerido, @abdallahsamabd, @asaadbalum, @liavweiss, @noalimoy
Files changed:

  • src/semantic-router/pkg/cache/valkey_cache_helpers.go
  • src/semantic-router/pkg/cache/valkey_cache_helpers_test.go

vLLM

🎉 Thanks for your contributions!

This comment was automatically generated based on the OWNER files in the repository.

@github-actions
Copy link
Copy Markdown
Contributor

github-actions bot commented Apr 10, 2026

✅ Supply Chain Security Report — All Clear

Scanner Status Findings
AST Codebase Scan (Py, Go, JS/TS, Rust) 27 finding(s) — MEDIUM: 21 · LOW: 6
AST PR Diff Scan No issues detected
Regex Fallback Scan No issues detected

Scanned at 2026-04-10T13:03:00.477Z · View full workflow logs

@drivebyer drivebyer changed the title [Router]fix: parseBestMatch select best match from all KNN candidates [Router][Bugfix]: parseBestMatch select best match from all KNN candidates Apr 10, 2026
Signed-off-by: yangw <wuyangmuc@gmail.com>
@rootfs rootfs merged commit 7ac0f6f into vllm-project:main Apr 10, 2026
34 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.

9 participants