Constrained Optimization
Constrained optimization optimizes an objective while requiring the solution to satisfy equality or inequality constraints. It appears in regularized training, normalization, simplex probabilities, KL-constrained post-training, molecular geometry, and constrained generation.
A general problem is:
The objective says what should be improved. The constraints say what must remain valid.
Equality Constraints and Lagrangian
For equality constraints , the Lagrangian is:
At a local optimum under regularity conditions:
The multiplier measures how strongly the constraint affects the optimum.
Inequality Constraints and KKT Conditions
For inequality constraints , the Lagrangian is:
The Karush-Kuhn-Tucker conditions include:
The last condition is complementary slackness: an inactive inequality has zero multiplier.
Penalty and Barrier Forms
Many ML and molecular workflows do not solve constrained problems exactly. They turn constraints into penalties:
or use barriers that become large near invalid regions:
Penalties are easier to optimize, but they do not guarantee exact feasibility unless the protocol enforces it.
Projection View
Projected gradient descent takes an unconstrained step and projects back to the feasible set :
where:
This is useful for simplex constraints, norm balls, valid coordinate sets, and constrained decoding abstractions.
Common AI and Computational Biology Examples
| Setting | Constraint | Typical handling |
|---|---|---|
| probability vector | softmax or simplex projection | |
| KL-regularized policy | penalty, clipping, or trust region | |
| molecular coordinates | bond lengths, clashes, chirality, pocket geometry | force field, projection, filtering |
| graph generation | valence, connectivity, atom types | constrained decoder or validity filter |
| normalization | mean/variance or norm constraint | reparameterization or layer normalization |
| resource-aware training | memory, latency, token budget | constrained model selection |
Constraint vs Regularization
Hard constraint:
Soft regularization:
A regularizer encourages behavior; a constraint requires behavior. Many papers blur this distinction, so check whether invalid outputs are impossible, penalized, filtered, or silently removed.
Paper Reading Checks
- Is the constraint hard, soft, architectural, decoding-time, or post-hoc?
- Is feasibility guaranteed or only encouraged by a penalty?
- Are invalid samples counted in the denominator?
- Are constraint coefficients tuned on validation data?
- Does the constraint exist during deployment, or only during evaluation?
- Is the reported improvement from the model, projection, repair, or filtering?