MCP-Enabled LLM for Meta-optics Inverse Design: Leveraging Differentiable Solver without LLM Expertise
Yi Huang, Bowen Zheng, Yunxi Dong, Hong Tang, Huan Zhao, Rakibul Hasan Shawon, Sensong An, Hualiang Zhang
TL;DR
The work tackles the barrier of specialized expertise in differentiable metasurface inverse design by introducing a Model Context Protocol (MCP) that allows LLMs to autonomously orchestrate design workflows using verified templates and solver documentation. By evaluating two prompt strategies (P1 and P2) against a documentation-only baseline, the study shows that structured prompting with mandatory two-stage optimization markedly improves design quality, efficiency, and reliability for a Huygens meta-atom with TorchRDIT. Key findings include higher success rates, reduced token usage, and substantially fewer hallucination- and solver-related errors under P2, illustrating that tool-aware orchestration can democratize access to rigorous electromagnetic design. The results have practical impact by enabling researchers without deep programming expertise to leverage differentiable solvers for complex metasurface optimization, with potential extensions to other scientific tasks via solver-agnostic MCP templates.
Abstract
Automatic differentiation (AD) enables powerful metasurface inverse design but requires extensive theoretical and programming expertise. We present a Model Context Protocol (MCP) assisted framework that allows researchers to conduct inverse design with differentiable solvers through large language models (LLMs). Since LLMs inherently lack knowledge of specialized solvers, our proposed solution provides dynamic access to verified code templates and comprehensive documentation through dedicated servers. The LLM autonomously accesses these resources to generate complete inverse design codes without prescribed coordination rules. Evaluation on the Huygens meta-atom design task with the differentiable TorchRDIT solver shows that while both natural language and structured prompting strategies achieve high success rates, structured prompting significantly outperforms in design quality, workflow efficiency, computational cost, and error reduction. The minimalist server design, using only 5 APIs, demonstrates how MCP makes sophisticated computational tools accessible to researchers without programming expertise, offering a generalizable integration solution for other scientific tasks.
