SVM (Support Vector Machine)
Overview
svm uses a trained linear or RBF support-vector classifier to map request
features to a candidate model.
Implementation: Rust via Linfa (linfa-svm).
Key Advantages
- Learns explicit decision boundaries — interpretable via support vectors.
- RBF kernel captures non-linear patterns in query-to-model mapping.
- Lightweight inference compared to neural network approaches.
- Well-understood theoretical guarantees (maximum margin).
Algorithm Principle
SVM finds the hyperplane that maximizes the margin between different model classes:
With the RBF (Radial Basis Function) kernel:
The loaded RBF artifact contains the gamma used by its classifiers. Training also determines the support vectors, coefficients, and regularization.
Multi-class selection (more than 2 candidates) uses one-vs-rest classification.
Select Flow
What Problem Does It Solve?
Some workloads need a lightweight learned classifier with clearer decision boundaries than heuristic routing but less operational cost than deeper neural selectors. svm addresses that by learning margin-maximizing query-to-model boundaries over the routing features.
When to Use
- You have an SVM-based selector artifact for the route.
- Lightweight learned classification is enough for model choice.
- You want learned selection with interpretable decision boundaries.
- The query-to-model mapping has clear non-linear patterns.
Known Limitations
- Requires pre-training from historical query-to-model assignment data.
- RBF hyperparameters must be tuned while building the artifact; the Router does not retune them at request time.
- Multi-class SVM uses one-vs-rest, which can be suboptimal for many candidates.
- Does not support online learning — must be retrained for new patterns.
Configuration
algorithm:
type: svm
Global ML Settings
global:
router:
model_selection:
ml:
models_path: ".cache/ml-models"
embedding_dim: 768
svm:
kernel: rbf
pretrained_path: .cache/ml-models/svm_model.json
Parameters
| Parameter | Type | Default | Description |
|---|---|---|---|
kernel | string | rbf | Empty-selector kernel: rbf (or gaussian) and linear are supported; other values fall back to linear |
gamma | float | 1.0 | Accepted compatibility field; loading an artifact uses the gamma stored in that artifact rather than this value |
pretrained_path | string | — | Path to pre-trained SVM model (JSON format) |
Training
See ML Model Selection README for the training pipeline. SVM models are trained on labeled query-to-model assignment data using Linfa's SVM implementation.
Training examples and labels can contain sensitive request data; govern them
and the derived artifact accordingly. See a complete example:
config/fragments/algorithm/selection/svm.yaml.