إن تطوير النظام السيبراني-الفيزيائي (CPS) وتطويره وتشغيله عملية شاملة عابرة للمجالات تغطي الحوسبة والبرمجيات والواجهات الفيزيائية والتفاعل البشري وهندسة السلامة والأمن — ويجب أن تضمن التكامل المفاهيمي عبر جميع العناصر. ومع ذلك ففي كل مرحلة يمكن أن تتسرب ثغرات إلى النظام بسبب الإهمال أو الأخطاء أو نقص المهارة أو الأعمال الخبيثة [6–8]، وقد تسبب هذه العيوب الكامنة إخفاقات وقت التشغيل وأضرارًا وخسائر في الأرواح وحوادث سلامة أو حوادث أمنية. ومن سبل التخفيف الواعدة كشف الشذوذ وقت التشغيل بالذكاء الاصطناعي/تعلم الآلة. يقدم هذا الدرس التعليمي المفاهيم الأساسية لكشف الشذوذ بالذكاء الاصطناعي وآليات التدخل المقابلة — وهي دفاعات آلية أخيرة ضد الإخفاقات والأعطال والأنشطة الخبيثة. ويبقى في المستوى المفاهيمي مخاطبًا طلاب الدراسات العليا والباحثين الداخلين إلى هذا المجال.
تربط الأنظمة السيبرانية-الفيزيائية الحوسبة بالعمليات الفيزيائية بإحكام، وتغطي الأسس الراسخة مبادئها [1] ومنهجيات تصميمها [2] وسلامة الأنظمة وأمنها [3، 9–11] والظهور [4]. وتبقى المقاربات الشاملة لأمن هذه الأنظمة اتجاهًا بحثيًا مفتوحًا [5]. ويكمل هذا الدرس أعمال المؤلف السابقة في سلامة الأنظمة [10، 12] وبنى السلامة والأمن [49] بمنظور وقت التشغيل: فمهما بلغ الحرص في التطوير، تبلغ ثغرات متبقية مرحلة النشر، فيحتاج النظام إلى خط دفاع أخير يكشف السلوك الشاذ مباشرة ويتدخل لحظيًا قبل وقوع الضرر.
تبدأ قصة السلامة والأمن من 'عبارة الاستحالة' (مقتبسة من [13]): إذ يستحيل إزالة كل ثغرة أثناء التطوير والتطور، فيحتوي النظام المنشور حتمًا على عيوب غير مُخففة قد تُشعل حوادث. والنتيجة معمارية — يجب أن يكون خط الدفاع الأخير مراقبة وقت التشغيل مع تدخل آلي ولحظي ما أمكن. وكشف الشذوذ، خاصة بالذكاء الاصطناعي/تعلم الآلة، هو التقنية الممكّنة: فالشذوذ المكتشف ملاحظة تنحرف جوهريًا عن السلوك الطبيعي المتعلم، وتُوسم كغير معتادة مقارنة بأغلبية البيانات فتستوجب التدخل.
ينقسم سلوك النظام وقت التشغيل إلى فئتين: مرغوب (آمن ومأمون ومطابق للمواصفات وملتزم بالقوانين ومنضبط زمنيًا ومتحمل للأخطاء وجدير بالثقة) مقابل غير مرغوب (غير آمن وغير مأمون وغير مفهوم وغير جدير بالثقة ومضطرب). وبعد بذل كل جهد تطويري معقول لإزالة الثغرات القابلة للكشف، يجب حماية نظام التشغيل من الفئة غير المرغوبة.
وليست مراقبة وقت التشغيل جديدة: فالتشخيص الذاتي (OBD) يُشرف على السيارات منذ زمن [14]، وأسست التحقق وقت التشغيل [15] ومراقبة سلامة السيارات [16–18] وشاشات الأمن [19، 20] هذا التخصص. وإسهام الدرس هو تأطير كشف الشذوذ بالذكاء الاصطناعي/تعلم الآلة [21–23] فوق تدفقات المعلومات كالفيديو والليدار والرادار والمسارات ومتواليات الحساسات [24] كحساس عام لخط الدفاع الأخير.
تتكون بنية خط الدفاع الأخير من أربعة عناصر: نظام التشغيل المنشور في بيئته؛ وعنصر كشف الشذوذ (عتاد/برمجيات)؛ وعنصر تخطيط التدخل؛ وكتل تنفيذ التدخل. وينقسم الكشف إلى جزء ثابت — خوارزميات مبرمجة تقارن المرصودات (قيم الحساسات والمشغلات والسرعة والموضع) بالمواصفات والقواعد والسياسات والنماذج والسجلات والبيانات التشغيلية [15] — وجزء ديناميكي بالذكاء الاصطناعي يستهلك تدفقات المعلومات الحية [24].
يُصنف التحليل الشذوذ (إيجابي كاذب مقابل عطل حقيقي أو هجوم أو انحراف) بتقنيات من معالجة الإشارات [30، 31] إلى الكشف القائم على تعلم الآلة [21–23، 29]؛ ويعتمد التدريب على الإشراف الموسوم [25] أو البيانات الاصطناعية [26–28]. ثم ينفذ التدخل استجابات مخططة مسبقًا ولحظية ما أمكن — من الرجوع للحالة الآمنة إلى تسليم المشغل — مُغلقًا حلقة MAPE-K (رصد-تحليل-تخطيط-تنفيذ بالمعرفة [53، 54]) التي تقوم عليها أيضًا القشرة الواقية.
تخدم نماذج تعلم الآلة الثلاثة خط الدفاع الأخير: التعلم الموجه وغير الموجه (بما فيها الأدلة التمهيدية [36]) لنماذج الكشف، والتعلم المعزز [32] — الذي يناسب تحسين السياسات طويلة الأفق [39، 40] قرارات المسارات — للسلوك الذاتي المقيد. وفهم أساسيات التعلم العميق [34] وتعلم الآلة الآمن والمتين [60–62] شرط مسبق، لأن الكاشف نفسه يصبح حرجًا للسلامة.
هندسة سلامة الذكاء الاصطناعي وقت التشغيل تخصص فتي بلا منهجية موحدة بعد، لذا يُظهر الدرس قوتها عبر عينة مفاهيمية (ليست تجربة): تجنب اصطدام السفن ذاتيًا [37، 38]. فمع ازدحام الحركة وسفن أكبر وأسرع ونقص البحارة، تحتاج السفن أتمتة تصل للاستقلال الكامل؛ ويحسب التعلم المعزز العميق المقيد [32، 39] مسارات خالية من الاصطدام خاضعة لقواعد COLREG الإلزامية للمنظمة البحرية الدولية [41، 42]، داعمًا البحار أو متجاوزًا له عبر القشرة الواقية.
وبالمثل، يُعرض أمن الذكاء الاصطناعي وقت التشغيل عبر كشف تسلل غير موجه على ناقل MIL-STD-1553 [43، 44] — وهو ناقل محلي قائم على الرسائل منذ 1973 وما يزال حرجًا في منصات كـF-35، وثغراته المعروفة لا تُصلح بتغيير البروتوكول، فالكشف المتين إلزامي. وتُجسد إحصاءات الشذوذ بأسلوب CUSUM [45–47] على حركة الناقل الكاشف؛ وتمكن مجموعات البيانات لهذه النواقل [43، 44] من التدريب.
تُغلف 'القشرة الواقية' — مفهوم 'الملاك الحارس للذكاء الاصطناعي' للانس إليوت [48] بصيغة تقنية [49] — النظام الحرج بعتاد وبرمجيات إضافية تكشف الشذوذ وتحلله وتستجيب له وقت التشغيل؛ وأصبح الإشراف على أنظمة الذكاء الاصطناعي وقت التشغيل ممارسة فضلى مقبولة [50–52]، وتنظمه بنية قشرة بمفهوم MAPE-K. ومع ذلك يوسع تعلم الآلة سطح الهجوم [55–58]: فالتلاعب العدائي والواجهات الموسعة (تحليل بأسلوب FMEA [56] وإدارة نواقل الهجوم [57]) والنماذج المعتمة تستلزم قابلية التفسير (XAI [59]) ومنهجيات التعلم المتين [62، 63]، مع انضباط التطبيقات عالية المخاطر [64] وفكر سلامة الذكاء المتجسد [52، 61].
يُحَد النشر بالقانون — أنظمة المسؤولية للفاعلين الخوارزميين [33] وقانون الاتحاد الأوروبي للذكاء الاصطناعي [67، 68] — وباحتياجات الأدلة الجنائية بعد الحوادث. ويُثمن الدرس تعلم الآلة كضروري للسلامة والأمن مع سرد تحديات مفتوحة: التحقق من الكاشف، وضمانات الزمن الحقيقي، والمتانة العدائية، وندرة البيانات، ومخاطر التعقيد — فإضافة قشرة تزيد تعقيد النظام، لذا يجب تطويرها هي نفسها بعناية فائقة للسلامة والأمن مع مراقبة السلوكيات الناشئة.
أما السؤال الأخلاقي الختامي — من يتحمل المسؤولية عندما يتجاوز خط الدفاع الذاتي البشر — فلا إجابة تقنية له: تؤطره نقدات التقنية العسكرية [65] وتحذيرات مخاطر الذكاء الاصطناعي [66] وأدبيات المساءلة، لكن موقف الدرس هو التواضع الهندسي: استقلالية شفافة ومقيدة وخاضعة للإشراف تبقى تدخلاتها قابلة للتدقيق.
تتحكم الأنظمة السيبرانية-الفيزيائية اليوم في تطبيقات حرجة قد تسبب مباشرة أضرار سلامة أو أمنًا، لذا تتطلب الممارسات الفضلى بشكل متزايد مراقبة وقت التشغيل مع تدخل لحظي. ويشكل كشف الشذوذ — سيناريوهات مبرمجة مسبقًا معززة بالذكاء الاصطناعي — مع التصنيف والتخفيف والعتاد والبرمجيات والحساسات والعمليات، القشرة الواقية التي تمنع الحوادث أو تخففها. ويجب أن تتحقق الأعمال المستقبلية من الكواشف وتضمن الاستجابة اللحظية وتُحصن ضد الخصوم وتُبقي القشرة نفسها آمنة ومأمونة وقابلة للتدقيق.
Developing, evolving and operating a cyber–physical system (CPS) is a cross-domain, holistic process covering computation, software, physical interfaces, human interaction, and safety and security engineering — and it must assure conceptual integrity across all elements. Yet at every stage, vulnerabilities can enter the system through negligence, mistakes, lack of skill or malice [6–8], and these dormant flaws can cause runtime failures, damage, loss of life, safety accidents or security incidents. A promising mitigation is runtime anomaly detection with artificial intelligence/machine learning. This tutorial introduces the fundamental AI/ML anomaly-detection concepts and the corresponding intervention mechanisms — automated last-line defenses against failures, faults, malfunctions and malicious activity. It stays conceptual, addressing advanced students and researchers entering the field.
Cyber–physical systems tightly couple computation with physical processes, and established foundations cover their principles [1], design methods [2], system safety and security [3, 9–11], and emergence [4]. Holistic approaches to CPS security remain an open research direction [5]. This tutorial complements the author's earlier system-safety work [10, 12] and safety/security architectures [49] with a runtime perspective: no matter how careful development is, residual vulnerabilities reach deployment, so the system needs a last defense that detects anomalous behavior online and intervenes in real time before harm occurs.
The safety/security storyline starts from the 'Impossibility Statement' (adapted from [13]): it is impossible to eliminate every vulnerability during development and evolution, so the deployed runtime CPS necessarily contains unmitigated flaws that may trigger accidents or incidents. The consequence is architectural — the last defense must be runtime monitoring with automatic, preferably real-time, intervention. Anomaly detection, especially with AI/ML, is the enabling technique: a detected anomaly is an observation deviating significantly from learned normal behavior, flagged as unusual relative to the majority of data and therefore requiring intervention.
Runtime CPS behavior falls into two categories: desired (safe, secure, specification-conformant, law-abiding, timely, fault-tolerant, trustworthy) versus undesired (unsafe, insecure, incomprehensible, untrustworthy, erratic). Once every reasonable development effort has removed detectable vulnerabilities, the runtime system must still be protected against the undesired category.
Runtime monitoring is not new: On-Board Diagnostics (OBD) has long supervised automobiles [14], and runtime verification [15], automotive safety monitoring [16–18] and security monitors [19, 20] established the discipline. The tutorial's contribution is framing AI/ML anomaly detection [21–23] over information streams such as video, LIDAR, radar, trajectories and sensor sequences [24] as the generic last-defense sensor.
The last-defense architecture has four elements: the deployed runtime CPS in its environment; the anomaly-detection element (hardware/software); the intervention-planning element; and the intervention-execution blocks. Detection splits into a static part — programmed algorithms comparing observables (sensor/actuator values, speed, position) against specifications, rules, policies, models, logs and operational data [15] — and a dynamic AI/ML part consuming live information streams [24].
Analysis classifies anomalies (false positive versus genuine fault, attack or drift) using techniques from signal processing [30, 31] to ML-based detection [21–23, 29]; training depends on labeled supervision [25] or synthetic data [26–28]. Intervention then executes pre-planned, preferably real-time, responses — from safe-state fallback to operator handover — closing the MAPE-K-style loop (Monitor-Analyze-Plan-Execute with Knowledge [53, 54]) that also underlies the protective shell.
All three ML paradigms serve the last defense: supervised and unsupervised learning (including kickstart guides [36]) for detection models, and reinforcement learning [32] — whose long-horizon policy optimization [39, 40] suits trajectory decisions — for constrained autonomous behavior. Understanding deep learning fundamentals [34] and safe/robust ML [60–62] is prerequisite, since the detector itself becomes safety-critical.
AI/ML runtime safety is a young discipline with no consolidated methodology yet, so the tutorial demonstrates power through a conceptual (not experimental) sample: autonomous ship collision avoidance [37, 38]. Facing denser traffic, larger faster vessels and mariner shortages, ships need automation up to full autonomy; constrained deep reinforcement learning [32, 39] computes collision-free trajectories subject to the mandatory IMO COLREG collision regulations [41, 42], either supporting the mariner or overriding via the protective shell.
Likewise young, AI/ML runtime security is shown through unsupervised intrusion detection on the MIL-STD-1553 bus [43, 44] — a message-based local bus standard since 1973, still critical in platforms like the F-35, whose known vulnerabilities cannot be fixed by protocol change, making robust detection mandatory. CUSUM-style anomaly statistics [45–47] on bus traffic exemplify the detector; dataset collections for such buses [43, 44] enable training.
The 'protective shell' — Lance Eliot's 'AI Guardian Angel Bot' concept [48] in technical form [49] — wraps the mission-critical CPS with extra hardware/software that detects, analyzes and responds to anomalies at runtime; supervising AI/ML systems at runtime is now accepted best practice [50–52], and a MAPE-K-conceptualized shell architecture organizes it. Yet ML widens the attack surface [55–58]: adversarial manipulation, expanded interfaces (FMEA-style analysis [56], attack-vector management [57]) and opaque models demand explainability (XAI [59]) and robust ML methods [62, 63], plus high-risk-application discipline [64] and embodied-AI safety thinking [52, 61].
Deployment is bounded by AI law — liability regimes for algorithmic actants [33] and the EU AI Act [67, 68] — and by forensics needs after incidents. The tutorial values ML as indispensable for safety/security while listing open challenges: detector verification, real-time guarantees, adversarial robustness, data scarcity, and complexity risk — since adding a shell increases system complexity, it must itself be developed with utmost safety/security care, watching emergent behavior.
The closing ethical question — who bears responsibility when an autonomous last defense overrides humans — has no technical answer: military-tech critiques [65], AI-risk warnings [66] and accountability literature frame it, but the tutorial's stance is engineering humility: transparent, constrained, supervised autonomy whose interventions remain auditable.
Today's CPSs control mission-critical applications that can directly cause safety or security harm, so best practice increasingly demands runtime monitoring with real-time intervention. Anomaly detection — preprogrammed scenarios augmented by AI/ML — with classification, mitigation, hardware, software, sensors and processes, forms the protective shell preventing or mitigating accidents and incidents. Future work must verify detectors, guarantee real-time response, harden against adversaries and keep the shell itself safe, secure and auditable.