The exponential growth of Internet of Things (IoT) devices integrated with fifth-generation (5G) wireless networks has created unprecedented opportunities for ultra-low-latency applications while introducing complex security vulnerabilities and computational challenges. This paper presents a comprehensive framework for deploying adaptive lightweight Convolutional Neural Networks (CNNs) in 5G-enabled IoT environments to address intrusion detection, intelligent traffic classification, and dynamic resource optimization. We propose a novel multi-objective optimization approach that integrates Adaptive Depthwise Separable Convolutions (ADSC), Dynamic Quantization-Aware Training (DQAT), and Real time Pruning Strategy (RPS) specifically designed for 5G network slicing architectures. Our methodology incorporates federated learning principles, edge-cloud collaboration, and context-aware adaptation mechanisms. Comprehensive evaluation on multiple datasets, including NF-ToN-IoT-v2, NSL-KDD, and CICIDS-2017, demonstrates superior performance with 97.8% accuracy in multi-class attack detection, 76% reduction in computational overhead, 71% decrease in energy consumption, and 42% improvement in network throughput. The framework achieves inference times under 8.5ms on edge devices while maintaining robust security postures across heterogeneous IoT deployments. Statistical significance testing and large-scale ablation studies verify the effectiveness of each of the suggested elements.
