Skip to main content
Version: Latest

Native Backends

Semantic Router uses native bindings for learned classifiers, embeddings, multimodal routing, and MLP model selection. The backend selected at build time determines which of those features are available at runtime.

Use the capability table below when choosing an image or custom build. A successful build does not imply that every native feature is available.

Backend selection

Build shapeBackend nameHow it is selected
Default CGo buildcandleBuild without onnx and with CGo enabled.
ONNX buildonnxBuild with the onnx tag and CGo enabled.
Non-CGo or Windows buildstubBuild with CGO_ENABLED=0 or on Windows.

Examples:

# Default Candle-backed Router build.
make build-router

# ONNX-backed Router build (builds the binding and uses go.onnx.mod).
make build-router-onnx

# Non-CGo stub build for environments where native bindings are unavailable.
cd src/semantic-router
CGO_ENABLED=0 go build ./cmd

Runtime capabilities

Capabilitycandleonnxstub
Unified batch classificationYesNoNo
LoRA batch classificationYesNoNo
Batched embeddingYesYesNo
Multimodal embeddingYesNoNo
Modality routingYesNoNo
MLP selectorYesNoNo
Local hallucination detectionYesNoNo
Local hallucination NLIYesNoNo
Explicit resetNoNoNo

The Router rejects a classifier configuration when the selected backend does not advertise the required capability. In particular, an ONNX or non-CGo build does not gain Candle-compatible classifier behavior merely because the Go package compiles.

Lifecycle expectations

Native model state is process-owned. Plan a process restart when changing the backend or replacing model families that require a clean native state:

  • prefer process restart for backend swaps or model-family changes that need a clean native state
  • consult the runtime capability output before enabling backend-specific features in a control plane
  • keep ONNX deployments to features that advertise support, primarily batched embedding