Inferensys

Glossary

Feasibility Constraint

A hard rule encoded into a counterfactual generation algorithm that prevents the modification of immutable features or enforces causal monotonicity to ensure realistic, actionable explanations.
Data engineer managing feature store on laptop, feature definitions visible, casual data engineering session.
RECOURSE ENGINEERING

What is a Feasibility Constraint?

A feasibility constraint is a hard logical rule encoded into a counterfactual generation algorithm that prevents the modification of immutable features or enforces causal monotonicity.

A feasibility constraint is a hard logical rule encoded into a counterfactual generation algorithm that prevents the modification of immutable features or enforces causal monotonicity. It defines the boundary of an action set, ensuring that generated explanations do not suggest impossible changes like decreasing a person's age or reversing a prior transaction.

These constraints are critical for generating actionable recourse. By integrating a causal graph or domain-specific rules, the algorithm respects real-world dependencies, such as preventing an increase in 'education level' without a corresponding increase in 'age.' This ensures the resulting counterfactual is not only valid but also executable by the end-user.

HARD RULES FOR COUNTERFACTUAL GENERATION

Core Characteristics of Feasibility Constraints

Feasibility constraints are the non-negotiable logical and physical rules encoded into counterfactual algorithms to ensure generated explanations are executable in the real world, not just mathematical artifacts.

01

Immutable Feature Masking

The most fundamental constraint prevents the algorithm from altering protected attributes that cannot be changed in reality. This includes:

  • Demographic anchors: Age, birthplace, and ethnicity are held constant
  • Temporal fixed points: Historical events or prior application dates remain static
  • Genetic markers: Inherent biological characteristics are locked

The constraint is implemented as a binary mask vector that zeroes out gradients for immutable dimensions during the counterfactual search, ensuring the optimization path never traverses these axes.

0%
Permitted Change on Immutable Features
02

Causal Monotonicity Enforcement

This constraint encodes the directional logic of real-world relationships to prevent nonsensical recommendations. It ensures that changes respect causal arrows defined in a structural causal model (SCM).

  • Income cannot decrease when education increases: The constraint enforces a positive correlation
  • Loan amount cannot exceed collateral value: A hard ceiling derived from business logic
  • Age only moves forward: Temporal monotonicity prevents reversing time

Violating causal monotonicity produces implausible counterfactuals that destroy user trust and fail the actionable recourse test.

03

Action Set Boundary Definition

The action set formally specifies the permissible range and granularity of modifications for each mutable feature. This constraint transforms an unbounded optimization problem into a constrained search within a realistic manifold.

  • Discrete constraints: Education level can only move between categories (High School → Bachelor's), not continuous values
  • Budget constraints: Total feature change cost cannot exceed a user-defined threshold
  • Legal ceilings: Interest rates capped at statutory maximums

The action set is the mathematical boundary between algorithmic recourse and useless fantasy.

04

Data Manifold Adherence

This constraint forces generated counterfactuals to lie within the high-density region of the training data distribution, preventing the algorithm from exploiting adversarial blind spots. It is operationalized through:

  • Mahalanobis distance penalties: Weighting changes by the inverse covariance matrix to respect feature correlations
  • Autoencoder reconstruction error: Rejecting instances that cannot be faithfully reconstructed by a model of the data manifold
  • Density-based filtering: Using kernel density estimation to discard low-probability counterfactuals

Without this constraint, the algorithm may generate a plausible-looking but impossible individual that the model has never seen and cannot reliably classify.

05

Recourse Robustness Margin

A forward-looking constraint that requires counterfactuals to not just cross the decision boundary but to clear it by a specified margin. This hedges against model retraining drift.

  • Prediction confidence threshold: The counterfactual must achieve a target probability (e.g., >0.7), not just >0.5
  • Neighborhood stability check: Perturbations around the counterfactual must also yield the desired outcome
  • Version-agnostic validity: Testing against an ensemble of retrained models to ensure the recourse remains actionable

This constraint directly addresses the CTO's concern that a recourse recommendation becomes invalid after the next model update cycle.

06

Sparsity as a Hard Constraint

While often treated as a soft objective, sparsity can be elevated to a hard feasibility constraint when cognitive load is a primary concern. The algorithm is restricted to modifying at most k features.

  • k=3 for consumer-facing explanations: Humans struggle to process more than three simultaneous changes
  • L0-norm penalty with Lagrangian multipliers: Enforcing exact sparsity through combinatorial optimization
  • Feature grouping: Treating related features (e.g., all debt ratios) as a single change unit

This constraint acknowledges that an explanation requiring 15 simultaneous life changes is not a feasible plan—it is an overwhelming and useless directive.

FEASIBILITY CONSTRAINTS

Frequently Asked Questions

Explore the critical role of feasibility constraints in ensuring counterfactual explanations are not just mathematically valid, but also actionable and compliant with real-world logic.

A feasibility constraint is a hard, encoded rule within a counterfactual generation algorithm that restricts the search space to only realistic and actionable changes. It prevents the algorithm from suggesting modifications to immutable features (like age or birthplace) or violating known causal relationships (causal monotonicity). By defining the boundary of an action set, these constraints ensure that the generated explanation provides actionable recourse rather than a mathematically minimal but practically useless hypothetical scenario. They are the mechanism that bridges the gap between a theoretical data point and a real-world decision a human can execute.

CONSTRAINT TAXONOMY

Feasibility Constraints vs. Other Counterfactual Properties

How feasibility constraints differ from other properties enforced during counterfactual generation

PropertyFeasibility ConstraintActionable RecoursePlausible CounterfactualSparse Counterfactual

Primary Objective

Enforce real-world immutability and causal monotonicity

Ensure changes are within user capability

Ensure instance lies in high-density data region

Minimize number of altered features

Immutable Feature Handling

Causal Graph Required

Distance Metric Used

Causal distance or constrained L1/L2

L1/L2 within action set

Mahalanobis distance

L0 norm

Violation Consequence

Invalid counterfactual rejected

User cannot execute recourse

Adversarial or unrealistic instance

Harder to interpret

Typical Enforcement Mechanism

Hard constraint in optimization

Action set definition

Density penalty in loss function

L0 regularization term

Evaluated By

Constraint satisfaction rate

Action set coverage

Proximity to training manifold

Feature change count

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.