Skip to content

feat: implement ONNX and OpenVINO native adapters (Phase 3)#2533

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

feat: implement ONNX and OpenVINO native adapters (Phase 3)#2533
Paramveersingh-S wants to merge 13 commits into
vllm-project:mainfrom
Paramveersingh-S:feature/native-router-phase3

Conversation

@Paramveersingh-S

Copy link
Copy Markdown

Overview

This is Phase 3 of the staged rollout for Issue #2396. This PR expands the native contract to explicitly encompass the remaining native backends: ONNX Runtime and OpenVINO.

Key Additions

  • ONNX Adapter (native/onnx/adapter.go): Implemented the BackendAdapter for ONNX. Explicitly declared its hardware capability set (provider_selection via CPU/CUDA/ROCm) and unique features like matryoshka_2d extraction.
  • OpenVINO Adapter (native/openvino/adapter.go): Implemented the BackendAdapter for OpenVINO, explicitly restricting its supported families to FamilyModernBERT to fail-fast during config validation if mismatched.

Fixes #2396
part of it

@netlify

netlify Bot commented Jul 14, 2026

Copy link
Copy Markdown

Deploy Preview for vllm-semantic-router ready!

Name Link
🔨 Latest commit 6358991
🔍 Latest deploy log https://app.netlify.com/projects/vllm-semantic-router/deploys/6a57b7b37901c10008abaea1
😎 Deploy Preview https://deploy-preview-2533--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 14, 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/semantic-router_mock.go
  • candle-binding/src/ffi/classify.rs
  • candle-binding/src/ffi/embedding.rs
  • candle-binding/src/ffi/generative_classifier.rs
  • candle-binding/src/ffi/generative_guard.rs
  • candle-binding/src/ffi/init.rs
  • candle-binding/src/ffi/similarity.rs
  • candle-binding/src/ffi/state_manager.rs
  • candle-binding/src/ffi/tokenization.rs
  • candle-binding/src/lib.rs
  • candle-binding/src/model_architectures/traditional/bert.rs
  • candle-binding/src/model_architectures/traditional/deberta_v3.rs
  • candle-binding/src/model_architectures/traditional/modernbert.rs
  • candle-binding/src/registry.rs

📁 src/semantic-router

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

  • src/semantic-router/pkg/modelruntime/native/adapter.go
  • src/semantic-router/pkg/modelruntime/native/candle/adapter.go
  • src/semantic-router/pkg/modelruntime/native/onnx/adapter.go
  • src/semantic-router/pkg/modelruntime/native/onnx/adapter_test.go
  • src/semantic-router/pkg/modelruntime/native/openvino/adapter.go
  • src/semantic-router/pkg/modelruntime/native/openvino/adapter_test.go
  • src/semantic-router/pkg/modelruntime/native/registry.go
  • src/semantic-router/pkg/modelruntime/native/registry_test.go
  • src/semantic-router/pkg/modelruntime/native/request.go
  • src/semantic-router/pkg/modelruntime/native/taxonomy.go

vLLM

🎉 Thanks for your contributions!

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

Signed-off-by: Param <param15.veer.singh@gmail.com>
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-phase3 branch from 8d4484a to e74cdca Compare July 14, 2026 13:30
@Paramveersingh-S Paramveersingh-S changed the title Feature/native router phase3 feat: implement ONNX and OpenVINO native adapters (Phase 3) Jul 14, 2026
Signed-off-by: Param <param15.veer.singh@gmail.com>
@github-actions

github-actions Bot commented Jul 14, 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-15T16:46:57.229Z · View full workflow logs

@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.

Requesting changes because Phase 3 still exposes placeholder adapters as real backends. This repeats the main concern from #2458: a backend should enter the native layer only when it performs real inference and has backend-specific lifecycle/inference tests. This PR also inherits the Candle compile failure (fmt imported and unused), adds no ONNX/OpenVINO tests, is based on main instead of Phase 2, and says Fixes #2396 even though later acceptance phases remain. Please make this a true stack (base: Phase 2), use Part of #2396, and land only truthful, executable backend support.

func (a *Adapter) LoadModel(ctx context.Context, req native.LoadRequest) (native.ModelHandle, error) {
// For Phase 3, this implements the contract but delegates down.
// In the future this calls the actual onnx-binding init logic.
return &onnxHandle{id: req.ModelRef}, nil

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.

This returns a successful handle without loading an ONNX session, validating the artifact/provider, or allocating anything that UnloadModel can release. Callers therefore cannot distinguish a usable model from a placeholder. Please wire this to the actual ONNX runtime binding (including provider selection), return explicit unsupported/unavailable errors where necessary, and add backend tests that exercise load, inference, dimensions, and unload.


func (a *Adapter) LoadModel(ctx context.Context, req native.LoadRequest) (native.ModelHandle, error) {
// For Phase 3, this implements the contract but delegates down.
return &openvinoHandle{id: req.ModelRef}, nil

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.

OpenVINO has the same false-success behavior: every model reference is reported as loaded even though no compiled model exists and UnloadModel is a no-op. This needs a real OpenVINO lifecycle and inference path, plus backend-specific tests; otherwise the adapter should not be registered or advertise these capabilities.

}

func init() {
native.Registry.Register(NewAdapter())

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.

Registration through package init() is ineffective unless some production package imports this adapter, and there are currently no such imports. It also advertises ONNX/CUDA/ROCm capabilities unconditionally, irrespective of build tags or runtime/provider availability. Please compose available adapters explicitly at the runtime assembly seam and make capability reporting reflect what this binary/runtime can actually execute; apply the same fix to OpenVINO.

Paramveersingh-S and others added 8 commits July 15, 2026 21:02
Signed-off-by: Param <param15.veer.singh@gmail.com>
Signed-off-by: Param <param15.veer.singh@gmail.com>
Signed-off-by: Param <param15.veer.singh@gmail.com>
Signed-off-by: Param <param15.veer.singh@gmail.com>
Signed-off-by: Param <param15.veer.singh@gmail.com>
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-phase3 branch from 20daac4 to 021ced9 Compare July 15, 2026 16:33
Signed-off-by: Param <param15.veer.singh@gmail.com>
@Paramveersingh-S

Copy link
Copy Markdown
Author

You're completely right about the placeholder adapters. I've updated the branch:

  1. Rebased: This branch is now based directly on Phase 2, which resolves the inherited fmt import error and other Phase 2 review points. I've also updated the PR description to "Part of Modularize native router model bindings and runtime capability contracts #2396".
  2. Explicit Errors: LoadModel, UnloadModel, and Inference in both the ONNX and OpenVINO adapters now explicitly return "not yet wired (Phase 3)" errors instead of returning empty handles.
  3. Removed Auto-Registration: The side-effect init() functions have been removed from both adapters to ensure explicit composition at the runtime assembly layer.
  4. Added Backend Tests: Added adapter_test.go for both ONNX and OpenVINO that explicitly tests the lifecycle methods to verify they return the expected unsupported errors rather than succeeding silently.

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.

Modularize native router model bindings and runtime capability contracts

8 participants