With the continuous scaling of semiconductor devices, fab manufacturers are demanding to measure and inspect new, more complex 3D structures with smaller error budget. Optical critical dimension (OCD) is fundamentally capable for the measurements. However, obtaining accurate and robust results depends on deterministic physical modeling procedures that can be excessively lengthy and expensive. This talk explains how AI (Artificial Intelligence) and ML (Machine Learning) work and demonstrates how they are successfully applied in optical metrology and inspection to meet those challenges. The relationship between physics-based modeling and ML based prediction is explored, and the future of AI and ML in semiconductor metrology and inspection is projected in a synergizing manner.