Abstract
Efficient machine learning inference is essential for the rapid adoption of artificial intelligence (AI) across various domains. On-chip optical computing has emerged as a transformative solution due to its ultra-low power consumption, yet improving computational density remains challenging because of the difficulty of miniaturizing interference-based components. Here, we demonstrate fabrication-constrained scattering optical computing within nanophotonic media, enabled by fabrication-aware inverse design. This yields an ultra-compact optical neural architecture occupying 64 µm²-a three-order reduction compared to conventional optical neural networks. Our prototype achieves 86.7% accuracy on the Iris dataset, closely matching simulations. To further validate scalability, we train a larger 64-input design for optical character recognition using 8×8 handwritten digits, reaching 92.8% test accuracy. These results highlight the potential of nanophotonic media to perform large-scale tasks in ultra-small footprints, paving the way for dense, energy-efficient optical processors for next-generation AI.