Inferensys

Glossary

Immutable Feature

A protected input attribute, such as age or place of birth, that cannot be changed and must be held constant when generating counterfactual explanations.
Data engineer managing feature store on laptop, feature definitions visible, casual data engineering session.
COUNTERFACTUAL EXPLANATIONS

What is Immutable Feature?

An immutable feature is a protected input attribute that cannot be changed and must be held constant when generating counterfactual explanations.

An immutable feature is a protected input attribute, such as age, place of birth, or a protected class characteristic, that is logically or legally impossible for an individual to change. In the context of counterfactual explanations and algorithmic recourse, these features must be held constant during generation to ensure that the recommended changes are realistic and do not violate fundamental constraints of the real world.

Enforcing immutability is a critical feasibility constraint within recourse systems. If a counterfactual algorithm suggests altering an immutable feature to achieve a favorable outcome, the resulting explanation is not actionable. Therefore, formal action sets explicitly define immutable features to restrict the search space, ensuring that generated counterfactuals only propose modifications to mutable attributes, thereby providing legally defensible and practically useful guidance to end-users.

CONSTRAINTS IN COUNTERFACTUAL REASONING

Key Characteristics of Immutable Features

Immutable features are protected input attributes that cannot be altered by an end-user and must be held constant during counterfactual generation to ensure algorithmic recourse is realistic and non-discriminatory.

01

Definition and Core Principle

An immutable feature is an input attribute whose value is fixed by nature, law, or logic and cannot be changed through user action. In counterfactual explanation systems, these features act as hard constraints—the algorithm is forbidden from suggesting changes to them. Classic examples include date of birth, place of birth, genetic markers, and historical events. The core principle is that a counterfactual that says 'you would have been approved if you were 10 years younger' is not actionable and therefore provides no meaningful recourse.

Hard Constraint
Constraint Type
02

Distinction from Protected Attributes

While overlapping, immutable features and protected attributes (under fairness law) are not identical sets:

  • Immutable features: Cannot be changed physically or logically (e.g., birth year, native language)
  • Protected attributes: Legally shielded from discrimination (e.g., race, gender, religion)
  • Key difference: Some protected attributes may be mutable (e.g., marital status, religion), while some immutable features may not be legally protected (e.g., astrological sign). Counterfactual systems must respect both categories, but immutability is a physical/logical constraint, not a legal one.
03

Role in Algorithmic Recourse

Immutable features define the boundary of an action set—the space of permissible feature modifications available to a user. When generating counterfactuals:

  • The algorithm must mask out immutable features from perturbation
  • The search for a counterfactual occurs only in the subspace of mutable features
  • If no valid counterfactual exists without altering an immutable feature, the system should report no feasible recourse rather than suggesting an impossible change. This constraint is critical for recourse feasibility and distinguishes actionable explanations from purely diagnostic ones.
04

Causal Dependencies and Downstream Effects

Immutable features often serve as root nodes in causal graphs, exerting downstream influence on mutable features. For example, age (immutable) causally affects years of experience (mutable). A naive counterfactual system might suggest increasing experience without recognizing that age constrains the maximum plausible value. Advanced systems encode these dependencies through structural causal models (SCMs) and feasibility constraints that prevent counterfactuals from violating causal monotonicity—ensuring the recommended change respects the immutable feature's causal influence on other variables.

05

Implementation in Counterfactual Algorithms

Immutable features are enforced through several technical mechanisms:

  • Feature masking: Zeroing out gradients for immutable dimensions during gradient-based generation
  • Constraint optimization: Adding hard equality constraints to the objective function (e.g., x_immutable == x_original)
  • Action set specification: Defining a binary mask vector where 1 indicates mutable and 0 indicates immutable
  • Post-hoc filtering: Generating candidates freely, then discarding any that modify immutable features. The masking approach is preferred as it is computationally efficient and guarantees constraint satisfaction during the search process.
06

Evaluation and Fairness Implications

The handling of immutable features directly impacts counterfactual fairness. A model is counterfactually fair if its prediction for an individual is identical to its prediction in a counterfactual world where only a sensitive, immutable attribute (e.g., race) is changed. Violations indicate the model relies on protected immutable features. Evaluation metrics include:

  • Constraint violation rate: Percentage of generated counterfactuals that improperly alter immutable features
  • Recourse rate by group: Whether protected groups have systematically lower access to actionable recourse due to immutable feature constraints
  • Causal fairness gap: Difference in predictions between actual and counterfactual selves
IMMUTABLE FEATURES IN COUNTERFACTUAL EXPLANATIONS

Frequently Asked Questions

Explore the critical role of immutable features—protected attributes that cannot be altered—in generating realistic and actionable counterfactual explanations for algorithmic recourse and fairness auditing.

An immutable feature is a protected input attribute that represents a fixed, unchangeable characteristic of an individual or entity and must be held constant when generating counterfactual explanations. Unlike actionable features such as income or loan amount, immutable features like age, place of birth, race, or gender cannot be modified in the real world. In the context of algorithmic recourse, counterfactual generation algorithms must explicitly encode these features as hard constraints to prevent the system from recommending impossible changes—for example, suggesting a loan applicant 'be younger' to qualify. The formal specification of immutable features is typically defined within an action set, which partitions the feature space into mutable and non-mutable dimensions. Violating immutability constraints produces infeasible recourse that undermines user trust and may violate anti-discrimination regulations such as the Equal Credit Opportunity Act.

PROTECTED ATTRIBUTES

Examples of Immutable Features by Domain

Immutable features are input attributes that cannot be changed in the real world and must be held constant during counterfactual generation. The following examples illustrate how these protected fields manifest across different industries.

01

Financial Lending

In credit decisioning, immutable features form the backbone of regulatory compliance. Age and date of birth are classic immutable attributes that cannot be altered in a recourse recommendation—you cannot tell an applicant to be older to qualify for a loan. Similarly, country of origin and historical bankruptcy filings are temporally fixed. A valid counterfactual for a denied loan must hold these constant while suggesting changes to mutable features like credit utilization ratio or number of open accounts.

02

Healthcare Diagnostics

Medical counterfactuals must respect biological immutability. Genetic markers such as BRCA1/BRCA2 mutation status are fixed at birth and cannot be modified. Family medical history is a temporally immutable record—a patient cannot retroactively change their parents' health outcomes. When generating explanations for a disease risk prediction, the system must hold these features constant and instead explore changes to BMI, smoking status, or medication adherence to flip the prediction.

03

Employment & Hiring

Algorithmic hiring tools must treat several features as immutable to avoid discriminatory recourse. Race, gender, and ethnicity are legally protected and biologically fixed. Educational pedigree—the specific institution attended—is temporally immutable once a degree is conferred. A counterfactual explaining why a candidate was rejected must not suggest changing their alma mater. Instead, it should focus on actionable features like years of experience, certification status, or skill endorsements.

04

Criminal Justice & Recidivism

Recidivism prediction models operate under strict immutability constraints. Prior conviction count and age at first offense are historical facts that cannot be altered. Place of birth and juvenile record status are similarly fixed. Counterfactual explanations for a high-risk classification must hold these constant while identifying mutable pathways such as employment status, substance abuse treatment completion, or housing stability to demonstrate what would change the assessment.

05

Insurance Underwriting

Actuarial models rely on several immutable features that counterfactuals must preserve. Date of first license issuance is a fixed historical timestamp. Congenital conditions present from birth cannot be reversed. Natural disaster zone classification for a property is geographically immutable. When explaining a premium denial, the system must not suggest relocating a house. Valid recourse focuses on installing safety systems, bundling policies, or increasing deductibles.

06

Education & Admissions

University admission models must respect temporal immutability. High school GPA is a sealed record that cannot be retroactively improved. Standardized test scores from past sittings are fixed data points. Socioeconomic background and first-generation student status are immutable demographic facts. Counterfactual explanations for a rejection must hold these constant and instead highlight changes to personal statement quality, extracurricular depth, or interview performance as actionable recourse paths.

FEATURE MODIFIABILITY COMPARISON

Immutable vs. Mutable Features in Recourse

A comparison of how immutable and mutable features are treated during counterfactual generation and their impact on actionable recourse.

CharacteristicImmutable FeaturesMutable Features

Definition

Attributes that cannot be changed by the individual or system

Attributes that can be realistically modified by the individual

Modification in Counterfactuals

Examples

Age, place of birth, ethnicity, gender (in many jurisdictions)

Income, savings amount, number of prior claims, education level

Role in Recourse

Held constant as hard constraints during generation

Perturbed to find minimal changes that flip the prediction

Constraint Type

Feasibility constraint (hard, inviolable)

Actionable within defined action set bounds

Violation Consequence

Generates infeasible, legally non-compliant recourse

May produce unrealistic recommendations if unconstrained

Causal Relationship

Often root nodes in causal graphs with no incoming edges

May have causal parents that must be respected during perturbation

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.