Karush-Kuhn-Tucker conditions

Also known as: KKT · KKT conditions

On this page 8

The Karush-Kuhn-Tucker conditions, usually shortened to KKT conditions, are the first-order necessary conditions that a point must satisfy to be a local optimum of a nonlinear program with inequality and equality constraints. Optimization theory uses them as the generalization of Lagrange multipliers to inequalities, and in artificial intelligence they underpin support vector machines, constrained training, fairness constraints and many solvers.

The conditions combine four requirements: stationarity of the Lagrangian, primal feasibility, dual feasibility and complementary slackness. For convex problems that satisfy a mild regularity condition, the KKT conditions are not only necessary but also sufficient for global optimality, which is why they serve as the standard certificate that an algorithm has found the right answer.

How the KKT conditions are stated

The KKT conditions describe the optimum of the problem minimize f(x) subject to g_i(x) ≤ 0 and h_j(x) = 0. One introduces a multiplier μ_i for each inequality and a multiplier λ_j for each equality, and forms the Lagrangian L(x, μ, λ) = f(x) + Σ μ_i g_i(x) + Σ λ_j h_j(x).

A point x* with multipliers μ* and λ* is a KKT point when all four conditions below hold at the same time. The multipliers are often called dual variables, and they measure how much the optimal objective would change if a constraint were relaxed slightly.

ConditionMathematical formMeaning
Stationarity∇f(x*) + Σ μ_i ∇g_i(x*) + Σ λ_j ∇h_j(x*) = 0No feasible descent direction remains
Primal feasibilityg_i(x*) ≤ 0, h_j(x*) = 0The point respects every constraint
Dual feasibilityμ_i ≥ 0Inequality forces push only outward
Complementary slacknessμ_i g_i(x*) = 0Inactive constraints carry zero multiplier
The four KKT conditions

The geometric intuition behind stationarity

Stationarity states that at the optimum the negative gradient of the objective lies in the cone spanned by the gradients of the active constraints. In other words, any direction that would lower the objective would immediately leave the feasible region, so the boundary holds the solution in place like a wall.

Complementary slackness sorts constraints into two groups. An active constraint satisfies g_i(x*) = 0 and may have a positive multiplier, while an inactive constraint with g_i(x*) < 0 must have μ_i = 0, because it does not influence the solution locally. Identifying the active set is the combinatorial heart of solving inequality-constrained problems.

The sign requirement μ_i ≥ 0 has a clear interpretation: tightening a binding inequality can only make the objective worse or equal, never better. A negative multiplier signals that releasing the constraint would improve the objective, so the candidate point is not optimal.

Constraint qualifications and when KKT is sufficient

The KKT conditions are necessary for optimality only when a constraint qualification holds at the solution. Without one, a genuine minimum may exist where no valid multipliers can be found, typically at cusps or where constraint gradients are degenerate.

The table below compares the most common qualifications used in nonlinear programming and convex analysis.

QualificationRequirementTypical use
LICQActive constraint gradients are linearly independentGeneral nonlinear programs, unique multipliers
MFCQA direction strictly decreases all active inequalitiesNonlinear programs, bounded multiplier set
Slater conditionA strictly feasible point existsConvex problems, strong duality
LinearityAll constraints are affineLinear and quadratic programming
Common constraint qualifications

Sufficiency requires more structure. If f and every g_i are convex and every h_j is affine, then any KKT point is a global minimum. For non-convex problems, a KKT point may be a local minimum, a saddle point or even a local maximum, and second-order conditions on the Hessian of the Lagrangian are needed to classify it.

Relationship to Lagrange multipliers and duality

The KKT framework extends the classical method of Lagrange multipliers, which handles only equality constraints, to the much broader class of inequality-constrained problems. It also connects directly to Lagrangian duality, where the multipliers become the variables of the dual problem.

ConceptConstraints handledRelation to KKT
Lagrange multipliersEqualities onlySpecial case without inequalities
Fritz John conditionsEqualities and inequalitiesWeaker form valid without qualification
Lagrangian dualityEqualities and inequalitiesKKT links primal and dual optima
Second-order conditionsEqualities and inequalitiesRefine KKT to classify stationary points
KKT compared with neighboring concepts

Under strong duality, which Slater’s condition guarantees for convex problems, a primal-dual pair is optimal if and only if it satisfies the KKT conditions. The duality gap is then zero, and the multipliers can be read as shadow prices of the constraints.

Where KKT conditions appear in artificial intelligence

Many machine learning models are trained by solving constrained convex programs, and the KKT conditions explain both their structure and the algorithms that solve them. The support vector machine is the clearest case: complementary slackness implies that only training points on or inside the margin receive nonzero multipliers, and these are exactly the support vectors.

ApplicationRole of KKTPractical consequence
Support vector machinesDefines support vectors via slacknessSparse models, SMO stopping rule
Lasso regressionSubgradient optimality on the L1 penaltyExplains exact zero coefficients
Interior-point solversSolve perturbed KKT systemsPolynomial-time convex optimization
Fair or safe trainingMultipliers weight constraint violationsPrimal-dual training loops
Differentiable optimization layersImplicit differentiation of KKT systemGradients through solver outputs
Selected uses in AI and machine learning

Interior-point methods solve a sequence of KKT systems in which complementary slackness is relaxed to μ_i g_i(x) = −t and the parameter t is driven toward zero. Sequential quadratic programming and active-set methods likewise use KKT residuals as their convergence criterion.

Limitations and common mistakes

The KKT conditions are a local, first-order test, and several errors recur when practitioners apply them. Knowing these pitfalls prevents false claims of optimality.

  • Treating a KKT point as a global optimum in a non-convex problem, such as training a deep network with constraints.
  • Ignoring the constraint qualification, which can leave a true optimum without valid multipliers.
  • Forgetting the sign condition on inequality multipliers, which separates minima from points where relaxation would help.
  • Applying smooth gradients to nonsmooth objectives; the L1 norm needs subgradients instead.
  • Reporting convergence on small KKT residuals without scaling, which hides poor conditioning.

Put simply

Imagine you want the lowest point in a valley, but fences block parts of it. The KKT conditions are a checklist for the best spot inside the fences. Either the best spot is in the open, where the ground is flat. Or it sits against a fence, which stops you from going further downhill.

Each fence gets a number that shows how hard it pushes back. A fence you are not touching pushes with zero force. A fence you lean on pushes outward, never inward. If every item on the checklist holds, you have found a spot that cannot be improved nearby. When the valley has one simple bowl shape, that spot is the true lowest point.

In practice

A data scientist at a regional bank trains a linear support vector machine to flag suspicious card transactions using about 200,000 labeled records and 40 features. The dual solver, an SMO-style algorithm, stops when every training point satisfies the KKT conditions within a tolerance of 0.001.

After training, the team inspects the multipliers. Complementary slackness shows that only about 6,000 points have nonzero multipliers, so the decision boundary depends on roughly 3 percent of the data. Points far from the margin have zero multipliers and could be removed without changing the model.

The team also uses the multipliers for diagnostics. Several support vectors sit at the upper bound C, which indicates misclassified or noisy records, and a review finds a batch of mislabeled transactions. Correcting them reduces false alerts by a noticeable margin in the next validation run.