Skip to content

Refactor: Modularize native router model bindings and runtime capability contracts - #2458

Open
Paramveersingh-S wants to merge 9 commits into
vllm-project:mainfrom
Paramveersingh-S:feature/native-router-bindings
Open

Refactor: Modularize native router model bindings and runtime capability contracts#2458
Paramveersingh-S wants to merge 9 commits into
vllm-project:mainfrom
Paramveersingh-S:feature/native-router-bindings

Conversation

@Paramveersingh-S

Copy link
Copy Markdown

Overview

This PR addresses Issue #2396 by introducing a binding-neutral native runtime contract for all router-owned model assets, completely decoupling the Go semantic router from the legacy CGO/Rust sprawl in candle-binding. It establishes the foundation for extensible backends (Candle, ONNX, OpenVINO) without hard-coding provider logic in the critical path.

Key Changes

  • Native Runtime Contract (pkg/modelruntime/native)
    • Introduced BackendAdapter, ModelHandle, LoadRequest, and InferenceRequest to establish a stable, backend-neutral API.
    • Locked down capability, family, modality, and artifact taxonomy in taxonomy.go to remove duplicated strings across Rust/Go.
  • Router Call Site Refactoring
    • router_runtime.go: Removed all direct legacy candle_binding.InitModel(...) calls; now initializes models natively through native.LoadModel(ctx, backend, request).
    • classification/unified_classifier.go: Removed manual CGO initialization, migrating dynamic labels and thresholding logic to standard LoadRequest parameters via the registry.
    • embedding/provider.go: The unified NewProvider now first queries the native AdapterRegistry before falling back to remote OpenAI configurations.
  • Centralized Rust Registry (candle-binding)
    • Migrated state_manager.rs from sprawling RwLock<Option<Arc<...>>> singletons to a centralized HashMap-based ModelRegistry in registry.rs to streamline dynamic model swaps.
  • Strict Configuration Validation
    • config/validator_native.go: Added validateNativeBackendContracts to explicitly catch invalid backend/capability configurations and reject them before serving API traffic.
  • API Model Info Endpoints
    • apiserver/route_model_info_embeddings.go: Refactored the /models endpoints to programmatically iterate over native.Registry.List() and expose capabilities, matching the normalized discovery schema.

Related Issues

Fixes #2396 - Modularize native router model bindings and runtime capability contracts.

@netlify

netlify Bot commented Jul 12, 2026

Copy link
Copy Markdown

Deploy Preview for vllm-semantic-router ready!

Name Link
🔨 Latest commit 9bca439
🔍 Latest deploy log https://app.netlify.com/projects/vllm-semantic-router/deploys/6a59d99d04ec7f000969f46b
😎 Deploy Preview https://deploy-preview-2458--vllm-semantic-router.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.
🤖 Make changes Run an agent on this branch

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

@github-actions

github-actions Bot commented Jul 12, 2026

Copy link
Copy Markdown
Contributor

👥 vLLM Semantic Team Notification

The following members have been identified for the changed files in this PR and have been automatically assigned when their GitHub accounts are assignable in this repository:

📁 candle-binding

Owners: @FAUST-BENCHOU, @shraderdm, @drivebyer, @ramkrishs, @WUKUNTAI-0211, @AayushSaini101, @siloteemu
Files changed:

  • candle-binding/src/ffi/memory_safety.rs
  • candle-binding/src/ffi/state_manager.rs
  • candle-binding/src/registry.rs
  • candle-binding/tests/layout_test.rs

📁 deploy

Owners: @FAUST-BENCHOU, @shraderdm, @drivebyer, @ramkrishs, @WUKUNTAI-0211, @AayushSaini101, @siloteemu
Files changed:

  • deploy/helm/semantic-router/templates/configmap.yaml
  • deploy/helm/semantic-router/templates/dashboard-deployment.yaml
  • deploy/helm/semantic-router/templates/deployment.yaml
  • deploy/helm/semantic-router/templates/service.yaml

📁 src/semantic-router

Owners: @FAUST-BENCHOU, @shraderdm, @drivebyer, @ramkrishs, @WUKUNTAI-0211, @AayushSaini101, @siloteemu
Files changed:

  • src/semantic-router/pkg/apiserver/route_model_info_embeddings.go
  • src/semantic-router/pkg/classification/unified_classifier.go
  • src/semantic-router/pkg/config/validator.go
  • src/semantic-router/pkg/config/validator_native.go
  • src/semantic-router/pkg/embedding/provider.go
  • src/semantic-router/pkg/modelruntime/native/adapter.go
  • src/semantic-router/pkg/modelruntime/native/candle/adapter.go
  • src/semantic-router/pkg/modelruntime/native/ffi_layout_test.go
  • src/semantic-router/pkg/modelruntime/native/onnx/adapter.go
  • src/semantic-router/pkg/modelruntime/native/openvino/adapter.go
  • src/semantic-router/pkg/modelruntime/native/registry.go
  • src/semantic-router/pkg/modelruntime/native/request.go
  • src/semantic-router/pkg/modelruntime/native/taxonomy.go
  • src/semantic-router/pkg/modelruntime/router_runtime.go

vLLM

🎉 Thanks for your contributions!

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

@github-actions

github-actions Bot commented Jul 12, 2026

Copy link
Copy Markdown
Contributor

✅ Supply Chain Security Report — All Clear

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

Scanned at 2026-07-17T07:43:16.728Z · View full workflow logs

@Paramveersingh-S
Paramveersingh-S force-pushed the feature/native-router-bindings branch from 5f44f7c to 57e70d2 Compare July 12, 2026 10:58
Signed-off-by: Param <param15.veer.singh@gmail.com>
Signed-off-by: Param <param15.veer.singh@gmail.com>
… errors

Signed-off-by: Param <param15.veer.singh@gmail.com>
Signed-off-by: Param <param15.veer.singh@gmail.com>
@Paramveersingh-S
Paramveersingh-S force-pushed the feature/native-router-bindings branch from 3f2a821 to 082b858 Compare July 12, 2026 11:43

@FAUST-BENCHOU FAUST-BENCHOU left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

make sure ci green

Signed-off-by: Param <param15.veer.singh@gmail.com>
@Paramveersingh-S
Paramveersingh-S force-pushed the feature/native-router-bindings branch from 5f6bd64 to a48dd94 Compare July 12, 2026 17:40
@github-actions github-actions Bot deleted a comment from codecov-commenter Jul 12, 2026

@Xunzhuo Xunzhuo left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for taking on this large refactor. The backend-neutral contract is a reasonable direction, but the current branch is not a behavior-preserving refactor and should be moved to draft while it is split up.

The main blockers are structural, not just the 12 failing CI jobs:

  • The Candle, ONNX, and OpenVINO adapters do not load a model; Infer returns an empty successful response, Unload is a no-op, and Info().IsLoaded is always true.
  • Nothing imports the adapter subpackages, so their init() registration does not run and the global registry remains empty.
  • classification/unified_classifier.go and embedding/provider.go are emptied, removing existing behavior before a working replacement exists.
  • The API advertises capabilities/load state that the adapters do not actually provide.

Please split this into staged PRs:

  1. Contract/registry types and tests only, while preserving every existing call site and runtime behavior.
  2. A real Candle adapter that delegates to the existing binding, with load/infer/unload lifecycle and parity tests.
  3. ONNX/OpenVINO adapters only when they perform real inference and have backend-specific tests.

For the first slice, restore the deleted implementations, remove placeholder adapters/capability claims, add deterministic registry-composition tests, use a module-prefixed PR title, and get the smallest harness gates green. Once that slice is small and behavior-preserving, it will be much easier to review and merge.

@Xunzhuo

Xunzhuo commented Jul 15, 2026

Copy link
Copy Markdown
Member

Thanks for splitting this work into #2530, #2532, #2533, and #2534 — that is a much easier shape to review. This original branch is now superseded and still contains the placeholder behavior called out in the review, so please close #2458 and focus first on getting #2530 to a stable additive contract.

After Phase 1 is addressed, please make the later PRs a real sequential stack (#2532 based on #2530, #2533 on #2532, and #2534 on #2533). There is no need to spend more effort repairing CI on this original branch; we can review each smaller phase as its base stabilizes.

@github-actions github-actions Bot deleted a comment from codecov-commenter Jul 15, 2026
@github-actions github-actions Bot deleted a comment from codecov-commenter Jul 16, 2026
@github-actions github-actions Bot deleted a comment from codecov-commenter Jul 17, 2026
Paramveersingh-S added a commit to Paramveersingh-S/semantic-router that referenced this pull request Aug 7, 2026
Overview
This is Phase 1 of splitting PR vllm-project#2458 into smaller, staged, and behavior-preserving pull requests.
Part of vllm-project#2396

Signed-off-by: Param <param15.veer.singh@gmail.com>
@github-actions

Copy link
Copy Markdown
Contributor

This pull request has had no activity from the submitter for 30 days and has been marked as stale. It will be closed in 30 days if no further activity occurs.

@github-actions github-actions Bot added the stale label Aug 16, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Modularize native router model bindings and runtime capability contracts

8 participants