Support Vector Machine (SVM)
A Support Vector Machine (SVM) is a supervised learning model that finds a hyperplane (a decision boundary) to separate data into classes with the largest possible margin. In practice, SVMs are used for classification and regression tasks, especially on smaller datasets where deep learning is overkill. Operators might encounter SVMs when fine-tuning a small classifier on extracted features from a local LLM, or when using scikit-learn to build a lightweight fallback model that runs on CPU without GPU acceleration.
Deeper dive
SVMs work by mapping input data into a high-dimensional space using a kernel function (e.g., linear, polynomial, RBF) and then finding the optimal hyperplane that maximizes the margin between classes. The points closest to the hyperplane are called support vectors and define the boundary. This makes SVMs memory-efficient for moderate-sized datasets (thousands of samples) but they scale poorly to millions of samples. In local AI workflows, SVMs are not used for generative tasks but can serve as classifiers on top of embeddings produced by a local LLM (e.g., using sentence-transformers to generate embeddings, then training an SVM on CPU to classify documents). The kernel trick allows SVMs to handle non-linear boundaries without explicitly transforming the data, which is useful when GPU VRAM is limited and a simpler model is preferred.
Practical example
An operator has 10,000 labeled customer support tickets and wants to classify them into 5 categories. Running a full LLM fine-tune would require a GPU with 24 GB VRAM and hours of training. Instead, they use a local sentence-transformer model (e.g., all-MiniLM-L6-v2) to generate 384-dimensional embeddings on CPU, then train an SVM with an RBF kernel using scikit-learn. Training takes under a minute on a Ryzen 9 CPU, and inference runs at ~10,000 classifications per second. The SVM model file is only ~500 KB, easily deployable alongside the embedding model.
Workflow example
In a typical workflow, an operator first runs python -c "from sentence_transformers import SentenceTransformer; model = SentenceTransformer('all-MiniLM-L6-v2'); embeddings = model.encode(tickets)" to generate embeddings. Then they train the SVM: from sklearn.svm import SVC; clf = SVC(kernel='rbf'); clf.fit(embeddings, labels). The trained SVM can be saved with joblib.dump(clf, 'svm_model.pkl') and loaded later for inference. This pipeline runs entirely on CPU, leaving the GPU free for other tasks like running a local LLM for generation.
Reviewed by Fredoline Eruo. See our editorial policy.