As the semiconductor industry rapidly develops, wafer defect detection becomes increasingly important, given that wafers are a key raw material [1]. Wafer defects can significantly affect chip reliability and performance, and timely detection and management of these defects are crucial for improving chip yield. This paper delves into the challenges of wafer defect detection and introduces an improved YOLOv8[2] deep learning architecture: YOLOv8-AM. In this architecture, the Neck layer incorporates the AFPN (Adaptive Feature Pyramid Network) to replace the original structure, enhancing the fusion capabilities of different feature layers. Additionally, to boost network robustness, the MLIM (Multi-Layer Interaction Module) based on self-attention mechanisms is introduced, strengthening the learning of both shallow and deep features. The combination of AFPN and MLIM creates a new Neck layer, augmenting the model's learning ability and context information aggregation. Experiments show that YOLOv8-AM, with a reduced parameter count of 2.12M, achieves high detection precision (95.228%) and recall rate (89.249%), with a mean Average Precision (mAP50) of 88.598% on wafer defect datasets. Compared to mainstream defect detection algorithms, this model performs better, has fewer parameters, and is more suitable for industrial deployments.