# AI-Driven Safety and Security for UAVs: From Machine Learning to Large Language Models
## 3 AI for UAV Safety
### UAV Flight Control  
During mission execution, UAVs occasionally experience navigation failures. In such events, they autonomously search for and rely on nearby UAVs as leaders to guide them  
Figure 10: UAV collision avoidance and path planning. back to safe areas. However, a leader UAV may operate improperly or be illegally controlled by attackers, such as being manipulated to deviate from its intended flight path, and chain reactions may be triggered. These reactions include mid-air collisions, loss of control, and crashes, resulting in property damage and casualties. On the other hand, UAVs at low altitudes typically depend on electronic fence technology to define their flight areas and ensure that they fly within authorized airspace. However, suppose that an electronic fence is compromised by illegal attacks or malicious tampering. In this case, the aircraft may lose control and enter into no-fly zones, hazardous areas, military regions, and other sensitive locations. This intrusion significantly increases the risk of collisions and may also trigger safety accidents, posing a significant threat to life and property. In terms of electronic fence defense and anomaly detection, in 2023, [PERSON] et al. investigated the use of 5G technology for remote UAV control and addressed issues such as loss of control and crashes through aerial electronic fences [156]. An illustration of a UAV electric fence for a prison is presented in Figure 11. In the case of out-of-control failure, a UAV can return automatically and safely via the electronic fence integrated with GPS-based navigation cloud platforms. These systems support functions such as remote real-time control, data transmission, and image transmission, significantly enhancing UAV safety and extending the flight radius [156]. Regarding UAV flight control, [PERSON] et al. explored the use of RL to control UAV quadrotors, training them in AirSim. By incorporating YOLOv7-tiny for object detection, the system unifies simulation and real-world inputs, reaching a 52% traversal rate in tests. This integration provides valuable frameworks for RL reward mechanisms and object detection in UAV navigation [157]. In 2022, autonomous indoor UAV flight control was performed via monocular camera images, enabling UAVs to predict movement directions, correct positioning, and adjust heading simultaneously. This model was successfully deployed on a real UAV to navigate corridors and make decisions at junctions. A custom dataset supports training and validation, demonstrating the potential of multitask learning for UAV navigation [158]. In 2023, [PERSON] et al. presented a data-efficient DRL approach for the attitude control of fixed-wing UAVs, requiring only three minutes of flight data. The performance of the learned controller is comparable to that of the ArduPlane PID controller [159]. Transferability was improved by incorporating sim-to-real measures such as domain randomization and actuation latency. The study also provides insights into RL controller behavior through linear analysis, highlighting its potential for enhancing UAV capabilities. However, in complex electromagnetic and physical environments, such as those involving high-frequency signal interference and malicious lead UAV yaw attacks, electronic  
Figure 11: Electric fence for a prison. fence defense systems can be severely challenged [160], and collaborative positioning algorithms may fail. Moreover, when the physical environment is complex, the model size grows exponentially with the number of unknown cells in the environment, greatly limiting the scalability of existing models. To address this, some authors have proposed that future UAV sampling trajectory algorithms should be combined with crowd-sourcing strategies or RL approaches based on graph attention multi-agents or link feedback to improve the efficiency of UAV collaboration. For traffic incidents such as UAV crashes, in 2024, [PERSON] et al. proposed a multimodal AI-based traffic incident response system [161].