{}const=>[]async()letfn</>var
Development

Ethical AI and AI TRiSM: How to Manage AI Risks and Security in 2025

In 2025, managing the trust, risk, and security of artificial intelligence will become a key element of companies' technology strategy. In this article, we analyze the concept of AI TRiSM — from explainability and fairness to data protection and regulatory compliance. Learn how to build a reliable and transparent AI system that is trusted by users and laws.

К

Kodik

Author

3 min read

Introduction

AI TRiSM is a holistic approach to management trust, risks and safety in artificial intelligence systems. It integrates engineering practices, legal requirements, and ethical standards into MLOps and product development workflows.

🔥 100,000+ students already with us

Tired of reading theory?
Time to code!

Kodik — an app where you learn to code through practice. AI mentor, interactive lessons, real projects.

🤖 AI 24/7
🎓 Certificates
💰 Free
🚀 Start learning
Joined today

Component 1 — Trust.

Explainability

  • Add mechanisms for interpreting model decisions (local/global explanations).

  • Tools: SHAP, LIME, ELI5.

  • Log the factors that influenced the decision next to the decision itself.

import shap

# Explanation of the model's predictions
explainer = shap.TreeExplainer(model)
shap_values = explainer.shap_values(X_test)
shap.summary_plot(shap_values, X_test)

Fairness

  • Test the model by demographic subgroups.

  • Metrics: demographic parity, equal opportunity.

  • Tools: Fairlearn, AI Fairness 360.

from fairlearn.metrics import MetricFrame, selection_rate
from sklearn.metrics import accuracy_score

# Analysis of fairness by groups
metric_frame = MetricFrame(
    metrics={'accuracy': accuracy_score, 'selection_rate': selection_rate},
    y_true=y_test,
    y_pred=predictions,
    sensitive_features=sensitive_attributes
)

Transparency

  • Document architecture, datasets, constraints, and assumptions.

  • Release Model Cards and Datasheets.

  • Mark the areas of applicability and the "red buttons" to stop.

Component 2 — Risk Management

Risk identification.

  • Technical: retraining, data drift, adversarial attacks.

  • Ethical: discrimination, violation of privacy.

  • Operating: fault tolerance, vendor lock-in.

  • Reputational: incidents in the press, loss of trust.

  • Legal: non-compliance with GDPR, EU AI Act and industry standards.

Monitoring and mitigation.

# Data drift monitoring
from evidently import ColumnMapping
from evidently.metric_preset import DataDriftPreset
from evidently.report import Report

data_drift_report = Report(metrics=[DataDriftPreset()])
data_drift_report.run(
    reference_data=reference_df,
    current_data=current_df
)

if data_drift_report.as_dict()['metrics'][0]['result']['dataset_drift']:
    alert_team()
    trigger_retraining()

Versioning and rollback

  • Version models and datasets: DVC, MLflow.

  • Implement canary deployments and quick rollback strategies.

# Example of canary deployment configuration
apiVersion: v1
kind: Service
metadata:
  name: model-service
spec:
  strategy:
    canary:
      steps:
      - setWeight: 10
      - pause: {duration: 5m}
      - setWeight: 50
      - pause: {duration: 10m}
      - setWeight: 100

Component 3 — Security

Protection against adversarial attacks

from art.attacks.evasion import FastGradientMethod
from art.estimators.classification import SklearnClassifier
from sklearn.metrics import accuracy_score

# Model stability testing
classifier = SklearnClassifier(model=model)
attack = FastGradientMethod(estimator=classifier, eps=0.1)
x_test_adv = attack.generate(x=x_test)

# Sustainability assessment
original_accuracy = accuracy_score(y_test, model.predict(x_test))
adversarial_accuracy = accuracy_score(y_test, model.predict(x_test_adv))
robustness_score = adversarial_accuracy / original_accuracy

Privacy and data protection

  • Differential privacy (DP), federated learning.

  • Encryption "at rest" and "in transit", KMS, data segmentation.

from opacus import PrivacyEngine

# Differential privacy with PyTorch
privacy_engine = PrivacyEngine()
model, optimizer, data_loader = privacy_engine.make_private(
    module=model,
    optimizer=optimizer,
    data_loader=data_loader,
    noise_multiplier=1.1,
    max_grad_norm=1.0
)

Access audit and solution tracing

import logging
from datetime import datetime

class AIAuditLogger:
    def __init__(self):
        self.logger = logging.getLogger('ai_audit')
        
    def log_inference(self, user_id, model_version, input_data, output, confidence):
        self.logger.info({
            'timestamp': datetime.utcnow().isoformat(),
            'event': 'inference',
            'user_id': user_id,
            'model_version': model_version,
            'confidence': confidence,
            'input_hash': hash(str(input_data)),
            'output': output
        })
    
    def log_model_update(self, old_version, new_version, metrics):
        self.logger.info({
            'timestamp': datetime.utcnow().isoformat(),
            'event': 'model_update',
            'old_version': old_version,
            'new_version': new_version,
            'metrics': metrics
        }

Continuous Monitoring Pipeline

class AIMonitoringPipeline:
    def __init__(self):
        self.metrics_store = MetricsStore()
        self.alert_system = AlertSystem()
        self.threshold = 0.9  # threshold example

    def monitor_performance(self, predictions, ground_truth):
        """Quality monitoring in production"""
        from sklearn.metrics import accuracy_score
        accuracy = accuracy_score(ground_truth, predictions)
        if accuracy < self.threshold:
            self.alert_system.trigger('performance_degradation', accuracy)

    def monitor_fairness(self, predictions, sensitive_attrs):
        """Monitoring fairness"""
        disparate_impact = self.calculate_disparate_impact(predictions, sensitive_attrs)
        if disparate_impact < 0.8:  # 80% rule
            self.alert_system.trigger('fairness_violation', disparate_impact)

    def monitor_data_quality(self, input_data):
        """Monitoring the quality of input data"""
        missing_rate = input_data.isnull().sum() / len(input_data)
        if missing_rate > 0.05:
            self.alert_system.trigger('data_quality_issue', missing_rate)

Conclusion

Ethical AI and AI TRiSM are not a brake on innovation, but a support for scaling. Organizations that implement these practices reduce legal and reputational risks, strengthen user confidence, and create better products.

Start small: select a model, add basic monitoring, release a Model Card, and practice rollback. Then scale.

Responsible AI is not a project, but an ongoing process.

Code — an application for learning programming. Practical courses, projects, assignments and Telegram community support. Suitable for beginners and advanced learners: from basic Python to working mini-projects with ML and MLOps elements.

Why you need it: you will quickly understand the terminology, master the tools from the article and assemble the first prototype, observing the principles of AI TRiSM.

🎯Stop procrastinating

Liked the article?
Time to practice!

In Kodik, you don't just read — you write code immediately. Theory + practice = real skills.

Instant practice
🧠AI explains code
🏆Certificate

No registration • No card