6.2 Responsible AI, Explainable AI, Fairness Metrics and Model Governance
Key Takeaways
- Vertex Explainable AI provides feature attributions using three core algorithms: Sampled Shapley (game-theoretic attribution for tabular/tree models), Integrated Gradients (path integral of gradients for differentiable deep neural networks, image, and text), and XRAI (region-based segmentation attributions for computer vision).
- Local Feature Attribution explains the specific feature contributions for an individual prediction (essential for adverse action notices and regulatory audits), whereas Global Feature Attribution aggregates attributions across a dataset to reveal overall model behavior.
- Algorithmic fairness criteria evaluate distinct parity definitions: Demographic Parity enforces equal positive selection rates across protected groups, Equal Opportunity requires equal True Positive Rates (Recall), and Equalized Odds enforces equal True Positive and False Positive Rates.
- Model Cards in Vertex AI Model Registry provide structured, standardized enterprise documentation detailing intended use cases, training dataset demographics, evaluation performance across protected demographic slices, and known operational limitations.
- Enterprise ML governance and security on Google Cloud enforce perimeter security via VPC Service Controls (VPC-SC), data-at-rest encryption via Customer-Managed Encryption Keys (CMEK), and least-privilege access control via Cloud IAM role segregation.
6.2 Responsible AI, Explainable AI, Fairness Metrics and Model Governance
As artificial intelligence and machine learning systems increasingly influence critical decisions in healthcare, financial lending, criminal justice, hiring, and automated operations, technical performance metrics (such as high ROC-AUC or low RMSE) are no longer sufficient on their own. Machine learning engineers must design systems that are fair, interpretable, transparent, secure, and compliant with global regulatory frameworks (such as the EU AI Act, GDPR, and the US Equal Credit Opportunity Act).
Google Cloud provides a comprehensive suite of Responsible AI and Explainable AI (XAI) tools integrated directly into Vertex AI to help practitioners audit model behavior, mitigate algorithmic bias, generate human-interpretable feature attributions, document system capabilities via Model Cards, and enforce robust data governance perimeters.
1. Vertex Explainable AI: Feature Attribution Methods
Feature Attribution quantifies the relative positive or negative contribution of each input feature toward a model's final prediction score. Vertex Explainable AI natively supports three foundational attribution methods:
+---------------------------------------------------------------------------------------------------------+
| VERTEX EXPLAINABLE AI METHODS |
+------------------------------------+------------------------------------+-------------------------------+
| SAMPLED SHAPLEY | INTEGRATED GRADIENTS | XRAI |
+------------------------------------+------------------------------------+-------------------------------+
| * Model Type: Tabular, Tree-based | * Model Type: Differentiable Deep | * Model Type: Computer Vision |
| (XGBoost, Scikit-learn, BQML) | Neural Networks (TF, PyTorch) | (Deep CNNs, Vision Transf.) |
| * Mechanism: Game-theoretic | * Mechanism: Path integral of | * Mechanism: Combines Integ- |
| marginal contributions | gradients along baseline path | rated Gradients with region |
| * Data Modality: Tabular / Numeric | * Data Modality: Tabular, Text, Img| segmentation (superpixels) |
+------------------------------------+------------------------------------+-------------------------------+
1. Sampled Shapley
Rooted in cooperative game theory (Shapley values), Sampled Shapley treats each feature as a player in a collaborative game where the prediction is the total payout. It computes the marginal contribution of feature $i$ across all possible feature subsets (coalitions):
- Strengths: Model-agnostic; works seamlessly on non-differentiable models such as Gradient Boosted Decision Trees, Random Forests, and ensemble pipelines.
- Operational Consideration: Exact Shapley computation is exponential in the number of features ($O(2^{|N|})$). Vertex Explainable AI uses Monte Carlo sampling to approximate Shapley values efficiently.
2. Integrated Gradients
Integrated Gradients (IG) is an axiomatic feature attribution method designed for differentiable neural networks (TensorFlow, Keras, PyTorch, JAX). It calculates the integral of the model's gradients along a straight linear interpolation path from a specified baseline $x'$ to the input instance $x$:
- Axiomatic Guarantees:
- Completeness: The sum of attributions across all features equals the difference between the model output $F(x)$ and the baseline output $F(x')$: $\sum_i \text{Attribution}_i(x) = F(x) - F(x')$.
- Implementation Invariance: Two functionally identical neural networks produce identical attributions.
- Operational Consideration: Highly scalable and accelerated by GPUs/TPUs. It requires setting the number of Riemann approximation steps (e.g.,
step_count=50).
3. XRAI (eXplanation with Ranked Area Integrals)
Standard pixel-level Integrated Gradients on images often produce noisy, speckled attribution maps that are difficult for human reviewers to interpret. XRAI resolves this by combining Integrated Gradients with graph-based image segmentation (e.g., Felzenszwalb's algorithm):
- It over-segments the input image into contiguous, semantically meaningful regions (superpixels).
- It integrates gradient attributions across these geometric regions and iteratively ranks the patches that contribute most significantly to the predicted class label.
- Best Suited For: Computer vision models, medical radiology imaging, satellite imagery analysis.
Baseline Selection: The Critical Anchor
All feature attribution methods require comparing the input instance against a baseline (reference point) representing the absence of information:
- Tabular Data: Median or mode values of the training dataset, or domain-specific neutral baselines (e.g., zero account balance).
- Image Data: A solid black image, solid white image, or blurred/uniform noise image.
- Text / NLP Data: A sequence of unk tokens, padding tokens, or an empty string.
[!IMPORTANT] Baseline Selection Rule: The choice of baseline directly alters feature attribution scores. A poorly chosen baseline (e.g., an unrealistic all-zero vector for positive-only features) creates misleading attributions. Baselines should always represent a neutral, non-informative reference state.
2. Local vs. Global Feature Attribution
+---------------------------------------------------------------------------------------------------------+
| LOCAL VS. GLOBAL FEATURE EXPLANATIONS |
+------------------------------------+--------------------------------------------------------------------+
| LOCAL FEATURE ATTRIBUTION | GLOBAL FEATURE ATTRIBUTION |
+------------------------------------+--------------------------------------------------------------------+
| * Explains an INDIVIDUAL inference | * Explains OVERALL model behavior across the entire dataset |
| * "Why was Applicant A denied a | * "Across all 100,000 customers, which features drive predictions |
| mortgage loan?" | most heavily?" |
| * Primary Use Case: Adverse action | * Primary Use Case: Model auditing, detecting proxy bias, |
| notices, customer recourse, | regulatory compliance reports, feature selection sanity checks |
| clinical diagnostic reasoning | |
+------------------------------------+--------------------------------------------------------------------+
- Local Explanations in Production: When deploying an endpoint with Explainable AI enabled, invoking the
:explainAPI endpoint returns both the predicted probability and the local feature attribution dictionary for that specific transaction:
{
"predictions": [{"churn_probability": 0.82}],
"explanations": [{
"attributions": [{
"baselineOutputValue": 0.15,
"instanceOutputValue": 0.82,
"featureAttributions": {
"monthly_charges": 0.42,
"contract_type_month_to_month": 0.21,
"customer_tenure_months": -0.15,
"support_tickets_count": 0.19
}
}]
}]
}
3. Algorithmic Fairness Metrics & Bias Mitigation
Machine learning models trained on historical data can inadvertently learn, amplify, and perpetuate systemic societal biases against protected demographic groups (defined by attributes such as gender, race, age, religion, disability status, or geographic zip code).
+---------------------------------------------------------------------------------------------------------+
| CORE ALGORITHMIC FAIRNESS METRICS |
+------------------------------------+------------------------------------+-------------------------------+
| FAIRNESS CRITERION | MATHEMATICAL FORMULATION | OPERATIONAL MEANING |
+------------------------------------+------------------------------------+-------------------------------+
| Demographic Parity | P(Y_hat=1 | A=0) = P(Y_hat=1 | A=1)| Equal acceptance rate across |
| (Statistical Parity) | | groups regardless of base rate|
+------------------------------------+------------------------------------+-------------------------------+
| Equal Opportunity | P(Y_hat=1 | Y=1, A=0) = | Equal True Positive Rate (TPR)|
| (True Positive Rate Parity) | P(Y_hat=1 | Y=1, A=1) | / Recall for qualified cohort |
+------------------------------------+------------------------------------+-------------------------------+
| Equalized Odds | P(Y_hat=1 | Y=y, A=0) = | Equal TPR AND equal False |
| (Separation) | P(Y_hat=1 | Y=y, A=1) for y in {0,1}| Positive Rate (FPR) |
+------------------------------------+------------------------------------+-------------------------------+
| Disparate Impact (4/5ths Rule) | P(Y_hat=1 | A=0) / P(Y_hat=1 | A=1)| Ratio of selection rates must |
| | >= 0.80 | exceed 80% under US EEOC law |
+------------------------------------+------------------------------------+-------------------------------+
Fairness Metric Decision Guide
- Demographic Parity: Assumes historical base rate differences are entirely due to systemic historical bias and demands equal positive outcomes across all demographic slices. (Trade-off: May penalize overall model accuracy if underlying true label rates differ legitimately).
- Equal Opportunity: Preferred when the primary goal is ensuring that qualified individuals (where true label $Y=1$, such as loan applicants who will repay) have an equal probability of being approved regardless of demographic group $A$.
- What-If Tool & Fairness Indicators: Integrated into Vertex AI and TensorFlow Extended (TFX) to visualize sliced performance, test counterfactual scenarios (e.g., "What if this applicant's zip code changed?"), and adjust decision thresholds per demographic group to enforce selected fairness criteria.
4. Model Governance: Model Cards in Vertex AI
To establish transparent organizational governance and comply with AI audit regulations, the Vertex AI Model Registry supports structured Model Cards based on Google's published Model Card framework.
+---------------------------------------------------------------------------------------------------------+
| VERTEX AI MODEL CARD STRUCTURE |
+------------------------------------+--------------------------------------------------------------------+
| SECTION | CORE CONTENTS |
+------------------------------------+--------------------------------------------------------------------+
| 1. Model Details | Model name, version, architecture, owner, date, license |
| 2. Intended Use & Limitations | Intended primary use cases, out-of-scope tasks, known failure modes|
| 3. Training & Evaluation Data | Demographics, data sources, preprocessing, slice distributions |
| 4. Sliced Quantitative Analyses | Metrics (F1, AUC, PR) broken down across sensitive demographic subgroups|
| 5. Ethical Considerations & Safety | Mitigations applied, fairness criteria evaluated, privacy controls |
+------------------------------------+--------------------------------------------------------------------+
Model Cards transform models from "black boxes" into auditable enterprise assets, ensuring compliance teams and external regulators can verify model limitations before production deployment.
5. Enterprise Security, Privacy & Data Governance on GCP
Production ML systems must operate within strict enterprise security and data privacy boundaries:
+---------------------------------------------------------------------------------------------------------+
| GCP ML SECURITY & GOVERNANCE PERIMETER |
+---------------------------------------------------------------------------------------------------------+
| |
| +-------------------------------------------------------------------------------------------------+ |
| | VPC Service Controls (VPC-SC) Perimeter | |
| | | |
| | +-----------------------+ Private Google Access +----------------------------------+ | |
| | | Cloud Storage Data | ===========================> | Vertex AI Custom Training / | | |
| | | & BigQuery Warehouse | (Zero Public Internet) | Online Prediction Endpoints | | |
| | +-----------------------+ +----------------------------------+ | |
| | | | | |
| | +-----------------------------+------------------------------+ | |
| | | | |
| | v | |
| | +---------------------------------------------+ | |
| | | Cloud KMS (Customer-Managed Encryption Keys)| | |
| | | - Encrypts training data, pipeline artifacts| | |
| | | - Encrypts model weights at rest | | |
| | +---------------------------------------------+ | |
| +-------------------------------------------------------------------------------------------------+ |
| |
| +-------------------------------------------------------------------------------------------------+ |
| | Cloud IAM Role Segregation: Least-Privilege Access | |
| | - `roles/aiplatform.viewer`: Read-only inspection of Model Registry and Experiments | |
| | - `roles/aiplatform.user`: Submit custom jobs and run batch predictions | |
| | - `roles/aiplatform.admin`: Full administrative control over endpoints, models, and metadata | |
| +-------------------------------------------------------------------------------------------------+ |
+---------------------------------------------------------------------------------------------------------+
- VPC Service Controls (VPC-SC): Establishes a security perimeter around Vertex AI, Cloud Storage, and BigQuery to prevent data exfiltration by malicious insiders or compromised service accounts.
- Customer-Managed Encryption Keys (CMEK): Integrates Cloud Key Management Service (Cloud KMS) to ensure that all training datasets, pipeline intermediate artifacts, and exported model binaries are encrypted with enterprise-managed cryptographic keys.
- Cloud IAM Role Segregation: Adheres to the principle of least privilege, preventing unauthorized model deployment or metadata tampering.
A financial lending institution is deploying a deep neural network on Vertex AI Prediction to score personal loan applications. Under consumer lending protection regulations (such as the Equal Credit Opportunity Act), if an applicant is denied credit, the institution must issue an Adverse Action Notice specifying the top three individual reasons for the rejection. Which Vertex Explainable AI configuration satisfies this legal requirement?
A healthcare radiology team trains a convolutional neural network (CNN) on Vertex AI to classify chest X-ray images for pulmonary nodules. The radiologists require visual heatmaps that highlight coherent anatomical regions responsible for positive classifications rather than noisy, uninterpretable single-pixel highlights. Which Explainable AI method should the team configure?
An enterprise hiring tech firm is deploying an ML screening tool to evaluate job applicants. Company leadership wants to guarantee that qualified candidates from historically underrepresented groups have the exact same probability of passing the automated screening as qualified candidates from majority groups. Which algorithmic fairness metric must the data science team optimize for?
A multinational financial enterprise is building a centralized machine learning platform on Vertex AI. The enterprise security team mandates three compliance controls: (1) training data and model artifacts must never leave the enterprise network perimeter, (2) all model weights at rest must be encrypted with enterprise-managed cryptographic keys, and (3) data scientists must be restricted from modifying production endpoint traffic splits. Which combination of GCP security controls satisfies all three requirements?