Inferensys

Glossary

Decision Boundary

The hypersurface in a feature space that partitions it into distinct regions, each associated with a different predicted class by a classification model.
Data engineer managing feature store on laptop, feature definitions visible, casual data engineering session.
CLASSIFICATION GEOMETRY

What is a Decision Boundary?

The decision boundary is the fundamental geometric construct that partitions a model's feature space into distinct prediction regions, defining the precise threshold where an algorithm's output flips from one class to another.

A decision boundary is the hypersurface in a feature space that separates different prediction classes, formally defined as the set of points where a classifier's scoring function is exactly equal between two or more competing outcomes. In a binary linear classifier, this manifests as a simple hyperplane; in deep neural networks, it becomes a highly complex, non-linear manifold. Counterfactual algorithms must identify and cross this boundary to generate a valid flip in the model's output.

The geometry of the decision boundary directly dictates the difficulty of generating actionable recourse. A boundary that is highly tortuous or lies far from the training data manifold can produce counterfactuals that are unrealistic or require infeasible changes. Understanding the local curvature and proximity of this separating surface is essential for evaluating a model's recourse feasibility and ensuring that generated explanations represent minimal, plausible changes to the input.

GEOMETRIC FOUNDATIONS

Key Properties of Decision Boundaries

The decision boundary is the hypersurface partitioning the feature space into distinct prediction regions. Counterfactual algorithms must navigate this geometry to find the minimal crossing point.

01

Hypersurface Topology

In an n-dimensional feature space, the decision boundary is an (n-1)-dimensional manifold. For a linear classifier, this is a simple hyperplane defined by w·x + b = 0. For neural networks, the boundary is a highly non-linear, piecewise surface whose complexity grows with depth and width. The topological complexity directly impacts counterfactual search difficulty—smooth, convex boundaries yield easy recourse, while jagged, disconnected regions trap search algorithms in local minima.

02

Distance to the Boundary

The signed distance from an instance to the decision boundary quantifies the model's confidence and the effort required for recourse. For a linear SVM, this is |w·x + b| / ||w||. Counterfactual algorithms like Growing Spheres exploit this by expanding a hypersphere until it intersects the boundary. Key metrics:

  • L1 distance: Encourages sparse feature changes
  • L2 distance: Penalizes large individual perturbations
  • Mahalanobis distance: Accounts for feature covariance, generating more plausible counterfactuals by following the data manifold
n-1
Boundary Dimensionality
03

Linear vs. Non-Linear Boundaries

Linear boundaries (logistic regression, linear SVM) partition space with a single flat hyperplane. Counterfactuals are trivially found via orthogonal projection. Non-linear boundaries (kernel SVM, neural networks) create complex, often disconnected regions. A neural network with ReLU activations produces a piecewise linear boundary—the feature space is carved into convex polytopes, each assigned to a class. This fragmentation means multiple valid counterfactuals may exist, but some may lie in low-density, implausible regions far from the training data manifold.

04

Voronoi Tessellation Analogy

For 1-nearest neighbor classifiers, the decision boundary is exactly the Voronoi diagram of the training points. Each training instance defines a convex cell; the boundary is the union of cell edges. This provides intuition for more complex models: the boundary is fundamentally a partition of space into regions of influence. Counterfactual search in this framework is equivalent to finding the nearest training point of the target class—a discrete optimization problem that guarantees validity but not necessarily proximity or plausibility.

05

Boundary Crossing and Recourse Validity

A counterfactual is valid if and only if it lies on the opposite side of the decision boundary from the original instance. However, validity alone is insufficient. The counterfactual must also satisfy:

  • Feasibility constraints: Immutable features (age, birthplace) must remain unchanged
  • Plausibility: The point must lie in a high-density region of P(X)
  • Robustness: A small retraining of the model should not invalidate the counterfactual Algorithms that ignore the boundary's local geometry often generate adversarial examples rather than actionable recourse.
06

Gradient-Based Boundary Navigation

For differentiable models, the gradient of the loss with respect to the input points directly toward the decision boundary. Gradient-based counterfactual methods iteratively update x' = x - η · ∇_x L(f(x'), y_target) until the prediction flips. This follows the path of steepest descent in the model's output space. However, this naive approach often produces out-of-distribution points. Regularization terms—penalizing distance from the original point or encouraging proximity to the training manifold—are essential to keep the trajectory crossing the boundary at a plausible location.

GEOMETRIC SEPARABILITY ANALYSIS

Decision Boundary Complexity by Model Type

Comparison of the inherent complexity and shape of decision boundaries learned by different model architectures, directly impacting counterfactual generation difficulty.

Model TypeBoundary ShapeInterpretabilityCounterfactual DifficultySusceptibility to Adversarial Artifacts

Linear / Logistic Regression

Linear Hyperplane

Low

Decision Tree

Axis-Aligned Rectangles

Low

Support Vector Machine (RBF Kernel)

Smooth Nonlinear Hypersurface

Medium

k-Nearest Neighbors (k-NN)

Voronoi Tessellation

Medium

Random Forest / Gradient Boosted Trees

Piecewise Constant Polygons

Medium

Shallow Neural Network

Smooth Nonlinear Manifold

High

Deep Neural Network

Highly Convoluted Manifold

High

Gaussian Naive Bayes

Quadratic / Ellipsoidal

Low

DECISION BOUNDARY CLARIFIED

Frequently Asked Questions

A decision boundary is the geometric hypersurface that partitions a model's feature space into distinct prediction regions. Understanding its topology is essential for generating valid counterfactual explanations and providing actionable recourse.

A decision boundary is the hypersurface in the feature space that separates different prediction classes. For a binary classifier, it is the set of points where the model's output probability equals 0.5. In linear models like logistic regression, this boundary is a simple hyperplane defined by the equation w·x + b = 0. In non-linear models such as deep neural networks, the boundary becomes a highly complex, non-convex manifold. The boundary's topology directly determines which input perturbations will flip a prediction. Counterfactual algorithms operate by finding the minimal vector that crosses this surface, moving an instance from one side to the other. The distance to the boundary, often called the margin, quantifies a prediction's robustness.

Prasad Kumkar

About the author

Prasad Kumkar

CEO & MD, Inference Systems

Prasad Kumkar is the CEO & MD of Inference Systems and writes about AI systems architecture, LLM infrastructure, model serving, evaluation, and production deployment. Over 5+ years, he has worked across computer vision models, L5 autonomous vehicle systems, and LLM research, with a focus on taking complex AI ideas into real-world engineering systems.

His work and writing cover AI systems, large language models, AI agents, multimodal systems, autonomous systems, inference optimization, RAG, evaluation, and production AI engineering.