pith. sign in

arxiv: 2508.10277 · v3 · submitted 2025-08-14 · ⚛️ physics.comp-ph · physics.optics

MCP-Enabled LLM for Meta-optics Inverse Design: Leveraging Differentiable Solver without LLM Expertise

Pith reviewed 2026-05-18 23:36 UTC · model grok-4.3

classification ⚛️ physics.comp-ph physics.optics
keywords meta-opticsinverse designlarge language modelsModel Context Protocoldifferentiable solverHuygens meta-atomTorchRDITcomputational physics
0
0 comments X

The pith

The Model Context Protocol lets large language models autonomously generate inverse design codes for meta-optics by accessing code templates and documentation from dedicated servers.

A machine-rendered reading of the paper's core claim, the machinery that carries it, and where it could break.

The paper shows that an MCP-assisted framework supplies LLMs with dynamic access to verified code templates and documentation via dedicated servers. This setup enables the models to produce complete inverse design scripts for tasks like Huygens meta-atom optimization using the TorchRDIT solver, without users needing programming or LLM expertise and without fixed coordination rules. Tests indicate high success rates overall, with structured prompting delivering better design quality, lower computational cost, and fewer errors than natural language prompting. A sympathetic reader would care because the approach removes the programming barrier that currently limits access to powerful automatic-differentiation tools in meta-optics research.

Core claim

The MCP-assisted framework allows LLMs to autonomously access verified code templates and comprehensive documentation through dedicated servers 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 both natural language and structured prompting strategies achieve high success rates, yet 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

What carries the argument

Model Context Protocol (MCP) that provides dynamic access to verified code templates and documentation through dedicated servers, enabling LLMs to generate complete inverse design codes autonomously.

If this is right

  • Researchers without programming expertise can perform inverse design for meta-optics using LLMs and differentiable solvers.
  • Structured prompting yields higher design quality and lower computational cost than natural language prompting.
  • A server exposing only five APIs is sufficient to support full autonomous code generation for the task.
  • The same MCP pattern offers a generalizable way to connect LLMs to other specialized scientific solvers.

Where Pith is reading between the lines

These are editorial extensions of the paper, not claims the author makes directly.

  • The same server-based template approach could be applied to inverse design problems in related fields such as acoustics or nanophotonics.
  • Success may hinge on the curation quality of the supplied templates, suggesting that template maintenance becomes a new research task.
  • Extending the framework to multi-objective or fabrication-constrained designs would test whether LLM reasoning scales without added human oversight.

Load-bearing premise

LLMs can reliably interpret and correctly apply the dynamically provided code templates and documentation to produce functional, efficient inverse-design scripts without introducing critical errors or requiring human debugging for complex meta-optics tasks.

What would settle it

Executing the LLM-generated code on the Huygens meta-atom task with TorchRDIT and checking whether the output designs meet performance targets without manual error correction or additional debugging.

Figures

Figures reproduced from arXiv: 2508.10277 by Bowen Zheng, Hong Tang, Hualiang Zhang, Huan Zhao, Sensong An, S. M. Rakibul Hasan Shawon, Yi Huang, Yunxi Dong.

Figure 1
Figure 1. Figure 1: illustrates the framework’s operation. The LLM, acting as an MCP client, autonomously accesses well￾structured APIs through MCP based on the JSON-RPC 2.0 protocol [27]. Without prescribed rules or hard-coded logic, the LLM decides whether to search documentation, retrieve templates, or combine both approaches based on its reasoning. This flexibility enables adaptation to varying problem complexities while … view at source ↗
Figure 2
Figure 2. Figure 2: a statistically reveals highly significant differences of DES between the two prompt strategies (p < 0.001, |d| = 1.228), with P2 achieving higher mean efficiency than P1 (0.48 vs 0.23). From the total 100 experimental trials, there are 47 successful trials for P1 and 50 successful trials for P2. The basic experimental statistics are shown in Table S2. Both strategies show a high success rate within the 5-… view at source ↗
Figure 3
Figure 3. Figure 3: Comprehensive tool usage pattern analysis across prompt strategies. (a) Top 6 tool usage analysis. (b) Tool diversity per trial. (c) Average tools per turn analysis. (d) Temporal tool usage patterns aggregated by turn number. Tool diversity analysis (Figure 3b and (c)) reveals that the model under P2 employs diverse tool access patterns, with a tighter distribution around 6 unique tools per trial and a med… view at source ↗
Figure 4
Figure 4. Figure 4: Token usage and cost analysis across prompting strategies. (a) Distribution of estimated total tokens consumed per trial showing P2’s more efficient token usage (Cohen’s d = 0.885, p < 0.001). (b) Total computational cost per trial in USD (input token: $3/MTok, output token: $15/MTok ), with P2 achieving 37% cost reduction. (c) Token type distribution across all trials, revealing similar proportions of too… view at source ↗
Figure 5
Figure 5. Figure 5: Performance and design metrics between natural language (P1) and structured guidance (P2) prompt strategies. (a) Composite score distribution of all successful trials versus prompt strategies. The composite score classification is shown in Table S1 in Supplementary Information. (b) Absolute counts shown with percentages of total errors (P1 = 106, P2 = 48). Scatter plots show (c) transmission efficiency, (d… view at source ↗
read the original 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.

Editorial analysis

A structured set of objections, weighed in public.

Desk editor's note, referee report, simulated authors' rebuttal, and a circularity audit. Tearing a paper down is the easy half of reading it; the pith above is the substance, this is the friction.

Referee Report

3 major / 2 minor

Summary. The manuscript introduces an MCP-assisted framework that enables LLMs to perform inverse design of meta-optics using differentiable solvers (e.g., TorchRDIT) by dynamically accessing verified code templates and documentation via a minimalist 5-API server. The LLM generates complete inverse-design scripts autonomously without prescribed coordination rules. On the Huygens meta-atom design task, both natural-language and structured prompting achieve high success rates, with structured prompting reported as superior in design quality, workflow efficiency, computational cost, and error reduction. The approach aims to make advanced computational tools accessible to researchers lacking programming or LLM expertise.

Significance. If the quantitative claims hold, the work could lower barriers to using differentiable solvers for meta-optics inverse design and offer a generalizable integration pattern for other scientific domains. The minimalist server design and emphasis on autonomy without custom rules are positive features. However, the absence of numerical success fractions, success definitions, error breakdowns, and implementation details limits assessment of whether the framework truly delivers reliable, human-intervention-free results.

major comments (3)
  1. Abstract: The central claim that both prompting strategies 'achieve high success rates' on the Huygens meta-atom task lacks any numerical success fraction, definition of success (e.g., runtime-error-free code, convergence to target efficiency, correct use of autodiff), or distribution of failure modes. This information is load-bearing for evaluating whether the MCP-supplied templates enable genuine autonomy or merely near-working code that still requires human fixes.
  2. Evaluation section (implied by abstract claims): No quantitative metrics, error bars, retry counts, or human-intervention statistics are reported for the comparative success rates or the advantages of structured prompting. Without these, it is impossible to substantiate the reported superiority in design quality, efficiency, and error reduction.
  3. Server design description: The minimalist 5-API server is presented as sufficient to guarantee resource access and correct synthesis, yet the manuscript provides no concrete details on how the APIs prevent critical errors in code generation for complex meta-optics tasks or on the observed failure modes across trials.
minor comments (2)
  1. Clarify the exact scope of 'complete inverse design codes' generated by the LLM (e.g., whether they include full optimization loops, visualization, or only the forward model).
  2. Provide at least one concrete example of a generated script or a table summarizing success/failure cases to illustrate the workflow.

Simulated Author's Rebuttal

3 responses · 0 unresolved

We thank the referee for their constructive feedback on our manuscript. The comments highlight important aspects for improving the presentation of our results. We provide detailed responses to each major comment and commit to revisions that enhance the manuscript's clarity and substantiation of claims.

read point-by-point responses
  1. Referee: Abstract: The central claim that both prompting strategies 'achieve high success rates' on the Huygens meta-atom task lacks any numerical success fraction, definition of success (e.g., runtime-error-free code, convergence to target efficiency, correct use of autodiff), or distribution of failure modes. This information is load-bearing for evaluating whether the MCP-supplied templates enable genuine autonomy or merely near-working code that still requires human fixes.

    Authors: We agree that the abstract should include more specific information to support the claims. In the revised manuscript, we will incorporate numerical success fractions from our experimental trials, provide a clear definition of success (including runtime-error-free code and convergence to target efficiency with correct autodiff usage), and outline the distribution of failure modes. This will allow readers to better assess the autonomy enabled by the MCP framework. revision: yes

  2. Referee: Evaluation section (implied by abstract claims): No quantitative metrics, error bars, retry counts, or human-intervention statistics are reported for the comparative success rates or the advantages of structured prompting. Without these, it is impossible to substantiate the reported superiority in design quality, efficiency, and error reduction.

    Authors: The current manuscript presents the advantages of structured prompting based on observed outcomes in the evaluation. To strengthen this, we will revise the evaluation section to include quantitative metrics such as success rates, error bars, retry counts, and human-intervention statistics. These additions will provide concrete evidence for the superiority in design quality, workflow efficiency, computational cost, and error reduction. revision: yes

  3. Referee: Server design description: The minimalist 5-API server is presented as sufficient to guarantee resource access and correct synthesis, yet the manuscript provides no concrete details on how the APIs prevent critical errors in code generation for complex meta-optics tasks or on the observed failure modes across trials.

    Authors: We will enhance the description of the server design by adding concrete details on the role of each of the 5 APIs in preventing critical errors during code generation. We will also include information on the observed failure modes across trials and how the MCP setup addresses them, thereby demonstrating the framework's reliability for complex tasks. revision: yes

Circularity Check

0 steps flagged

No circularity: empirical framework evaluation is self-contained against external solver benchmarks

full rationale

The paper describes an MCP-assisted LLM framework for generating inverse-design code for meta-optics tasks and evaluates it empirically on the Huygens meta-atom design problem using the external TorchRDIT differentiable solver. Claims rest on comparisons of natural-language versus structured prompting, reported success rates, and workflow metrics rather than any derivation, fitted parameter, or uniqueness theorem that reduces to the paper's own inputs. No equations, self-definitional loops, or load-bearing self-citations appear in the provided text; the approach is therefore independent of the circularity patterns enumerated in the guidelines.

Axiom & Free-Parameter Ledger

0 free parameters · 1 axioms · 0 invented entities

The framework rests primarily on the domain assumption that LLMs can correctly leverage supplied resources; no free parameters, invented entities, or additional axioms are introduced in the abstract.

axioms (1)
  • domain assumption LLMs can reliably interpret and apply dynamically provided code templates and documentation to produce correct inverse-design code.
    This assumption underpins the claim of autonomous generation without prescribed rules.

pith-pipeline@v0.9.0 · 5712 in / 1220 out tokens · 27793 ms · 2026-05-18T23:36:34.433917+00:00 · methodology

discussion (0)

Sign in with ORCID, Apple, or X to comment. Anyone can read and Pith papers without signing in.

Lean theorems connected to this paper

Citations machine-checked in the Pith Canon. Every link opens the source theorem in the public Lean library.

  • IndisputableMonolith/Cost/FunctionalEquation.lean washburn_uniqueness_aczel unclear
    ?
    unclear

    Relation between the paper passage and the cited Recognition theorem.

    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...

  • IndisputableMonolith/Foundation/BranchSelection.lean branch_selection unclear
    ?
    unclear

    Relation between the paper passage and the cited Recognition theorem.

    Our minimalist server design, using only 5 APIs, demonstrates how MCP makes sophisticated computational tools accessible...

What do these tags mean?
matches
The paper's claim is directly supported by a theorem in the formal canon.
supports
The theorem supports part of the paper's argument, but the paper may add assumptions or extra steps.
extends
The paper goes beyond the formal theorem; the theorem is a base layer rather than the whole result.
uses
The paper appears to rely on the theorem as machinery.
contradicts
The paper's claim conflicts with a theorem or certificate in the canon.
unclear
Pith found a possible connection, but the passage is too broad, indirect, or ambiguous to say the theorem truly supports the claim.

Forward citations

Cited by 1 Pith paper

Reviewed papers in the Pith corpus that reference this work. Sorted by Pith novelty score.

  1. A General Differentiable Ray-Wave Framework for Hybrid Refractive-Diffractive System Modeling and Optimization

    physics.optics 2026-05 unverdicted novelty 6.0

    A plug-and-play differentiable model bridging ray and wave optics for hybrid systems that enables end-to-end optimization of planar and conformal diffractive elements.

Reference graph

Works this paper leans on

42 extracted references · 42 canonical work pages · cited by 1 Pith paper

  1. [1]

    A review of metasurfaces: Physics and applications,

    H.-T. Chen, A. J. Taylor, and N. Yu, “A review of metasurfaces: Physics and applications,” Rep. Prog. Phys., vol. 79, p. 076401, July 2016

  2. [2]

    Advances in Meta-Optics and Metasurfaces: Fundamentals and Applications,

    K. Ou, H. Wan, G. Wang, J. Zhu, S. Dong, T. He, H. Yang, Z. Wei, Z. Wang, and X. Cheng, “Advances in Meta-Optics and Metasurfaces: Fundamentals and Applications,” Nanomaterials, vol. 13, p. 1235, Jan. 2023

  3. [3]

    Metasurfaces: Physics and applications in wireless communications,

    V . G. Ataloglou, S. Taravati, and G. V . Eleftheriades, “Metasurfaces: Physics and applications in wireless communications,” National Science Review, vol. 10, p. nwad164, Aug. 2023

  4. [4]

    Inverse design and flexible parameterization of meta-optics using algorithmic differentiation,

    S. Colburn and A. Majumdar, “Inverse design and flexible parameterization of meta-optics using algorithmic differentiation,”Commun Phys, vol. 4, p. 65, Mar. 2021

  5. [5]

    Empowering Metasurfaces with Inverse Design: Principles and Applications,

    Z. Li, R. Pestourie, Z. Lin, S. G. Johnson, and F. Capasso, “Empowering Metasurfaces with Inverse Design: Principles and Applications,” ACS Photonics, vol. 9, pp. 2178–2192, July 2022

  6. [6]

    Merging automatic differentiation and the adjoint method for photonic inverse design,

    A. Luce, R. Alaee, F. Knorr, and F. Marquardt, “Merging automatic differentiation and the adjoint method for photonic inverse design,”Mach. Learn.: Sci. Technol., vol. 5, p. 025076, June 2024

  7. [7]

    A Differentiable Wave Optics Model for End-to-End Computational Imaging System Optimization,

    C.-J. Ho, Y . Belhe, S. Rotenberg, R. Ramamoorthi, T.-M. Li, and N. Antipa, “A Differentiable Wave Optics Model for End-to-End Computational Imaging System Optimization,” Dec. 2024

  8. [8]

    Eigendecomposition-free inverse design of meta-optics devices,

    Y . Huang, Z. Zhu, Y . Dong, H. Tang, B. Zheng, V . A. Podolskiy, and H. Zhang, “Eigendecomposition-free inverse design of meta-optics devices,”Opt. Express, vol. 32, pp. 13986–13997, Apr. 2024

  9. [9]

    Differentiable inverse design of free-form meta-optics using multiplicative filter network,

    Y . Huang, Y . Dong, H. Zhao, H. Tang, B. Zheng, and H. Zhang, “Differentiable inverse design of free-form meta-optics using multiplicative filter network,” in2024 International Applied Computational Electromagnetics Society Symposium (ACES), pp. 1–2, IEEE, 2024

  10. [10]

    A 3D-Printed Millimeter-Wave Free-Form Metasurface Based on Automatic Differentiable Inverse Design,

    Y . Huang, H. Tang, H. Zhao, Y . Dong, B. Zheng, and H. Zhang, “A 3D-Printed Millimeter-Wave Free-Form Metasurface Based on Automatic Differentiable Inverse Design,” in2024 IEEE/MTT-S International Microwave Symposium - IMS 2024 , (Washington, DC, USA), pp. 559–562, IEEE, June 2024

  11. [11]

    Differential Shape Optimization with Image Representation for Photonic Design,

    Z. Liu and J. Bonar, “Differential Shape Optimization with Image Representation for Photonic Design,” Dec. 2024

  12. [12]

    Automatic Differentiation Accelerated Shape Optimization Approaches to Photonic Inverse Design in FDFD/FDTD,

    S. Hooten, P. Sun, L. Gantz, M. Fiorentino, R. Beausoleil, and T. Van Vaerenbergh, “Automatic Differentiation Accelerated Shape Optimization Approaches to Photonic Inverse Design in FDFD/FDTD,”Laser &amp; Photonics Reviews, vol. 19, p. 2301199, Jan. 2025. 11

  13. [13]

    A flexible framework for large-scale FDTD simulations: Open-source inverse design for 3D nanostructures,

    Y . Mahlau, F. Schubert, K. Bethmann, R. Caspary, A. Calà Lesina, M. Munderloh, J. Ostermann, and B. Rosenhahn, “A flexible framework for large-scale FDTD simulations: Open-source inverse design for 3D nanostructures,” in Photonic and Phononic Properties of Engineered Nanostructures XV (A. Adibi, S.-Y . Lin, and A. Scherer, eds.), (San Francisco, United S...

  14. [14]

    Large Language Models: A Survey,

    S. Minaee, T. Mikolov, N. Nikzad, M. Chenaghlu, R. Socher, X. Amatriain, and J. Gao, “Large Language Models: A Survey,” Mar. 2025

  15. [15]

    Large Language Model (LLM) for Telecommunications: A Comprehensive Survey on Principles, Key Techniques, and Opportunities,

    H. Zhou, C. Hu, Y . Yuan, Y . Cui, Y . Jin, C. Chen, H. Wu, D. Yuan, L. Jiang, D. Wu, X. Liu, C. Zhang, X. Wang, and J. Liu, “Large Language Model (LLM) for Telecommunications: A Comprehensive Survey on Principles, Key Techniques, and Opportunities,” Sept. 2024

  16. [16]

    Survey on Large Language Model-Enhanced Reinforcement Learning: Concept, Taxonomy, and Methods,

    Y . Cao, H. Zhao, Y . Cheng, T. Shu, Y . Chen, G. Liu, G. Liang, J. Zhao, J. Yan, and Y . Li, “Survey on Large Language Model-Enhanced Reinforcement Learning: Concept, Taxonomy, and Methods,”IEEE Trans. Neural Netw. Learning Syst., vol. 36, pp. 9737–9757, June 2025

  17. [17]

    OptoGPT: A foundation model for inverse design in optical multilayer thin film structures,

    T. Ma, H. Wang, L. J. Guo, Department of Physics, University of Michigan, Ann Arbor, Michigan 48109, USA, and Department of Electrical Engineering and Computer Science, University of Michigan, Ann Arbor, Michigan 48109, USA, “OptoGPT: A foundation model for inverse design in optical multilayer thin film structures,”OEA, vol. 7, no. 7, pp. 240062–240062, 2024

  18. [18]

    MetasurfaceViT: A generic AI model for metasurface inverse design,

    J. Yan, J. Yi, C. Ma, Y . Bao, Q. Chen, and B. Li, “MetasurfaceViT: A generic AI model for metasurface inverse design,” Apr. 2025

  19. [19]

    Nanophotonic device design based on large language models: Multilayer and metasurface examples,

    M. Kim, H. Park, and J. Shin, “Nanophotonic device design based on large language models: Multilayer and metasurface examples,”Nanophotonics, vol. 14, pp. 1273–1282, Apr. 2025

  20. [20]

    Learning Electromagnetic Metamaterial Physics With ChatGPT,

    D. Lu, Y . Deng, J. M. Malof, and W. J. Padilla, “Learning Electromagnetic Metamaterial Physics With ChatGPT,” Feb. 2025

  21. [21]

    A multi-agentic framework for real-time, autonomous freeform metasurface design,

    R. Lupoiu, Y . Shao, T. Dai, C. Mao, K. Edee, and J. A. Fan, “A multi-agentic framework for real-time, autonomous freeform metasurface design,” Mar. 2025

  22. [22]

    Practical Considerations for Agentic LLM Systems,

    C. Sypherd and V . Belle, “Practical Considerations for Agentic LLM Systems,” Dec. 2024

  23. [23]

    Agentic AI: Autonomous Intelligence for Complex Goals—A Comprehensive Survey,

    D. B. Acharya, K. Kuppan, and B. Divya, “Agentic AI: Autonomous Intelligence for Complex Goals—A Comprehensive Survey,”IEEE Access, vol. 13, pp. 18912–18936, 2025

  24. [24]

    Function calling and other API updates,

    OpenAI, “Function calling and other API updates,” June 2023

  25. [25]

    Enhancing Function-Calling Capabilities in LLMs: Strategies for Prompt Formats, Data Integration, and Multilingual Translation,

    Y .-C. Chen, P.-C. Hsu, C.-J. Hsu, and D.-s. Shiu, “Enhancing Function-Calling Capabilities in LLMs: Strategies for Prompt Formats, Data Integration, and Multilingual Translation,” Dec. 2024

  26. [26]

    Machine Learning Driven API Data Standardization,

    B. B. Sreeravindra and A. Gupta, “Machine Learning Driven API Data Standardization,”International Journal of Global Innovations and Solutions (IJGIS) , Oct. 2024

  27. [27]

    Model Context Protocol

    Anthropic, “Model Context Protocol.” https://modelcontextprotocol.io/introduction, Nov. 2024

  28. [28]

    Introducing the Model Context Protocol,

    Anthropic, “Introducing the Model Context Protocol,” Nov. 2024

  29. [29]

    Advancing Multi-Agent Systems Through Model Context Protocol: Architecture, Implementation, and Applications,

    N. Krishnan, “Advancing Multi-Agent Systems Through Model Context Protocol: Architecture, Implementation, and Applications,” Apr. 2025

  30. [30]

    Unlocking the power of Model Context Protocol (MCP) on AWS

    Aditya Addepalli, Elie Schoppik, Jawhny Cooke, Kenton Blacutt, Mani Khanuja, and Nicolai van der Smagt, “Unlocking the power of Model Context Protocol (MCP) on AWS.” https://aws.amazon.com/blogs/machine- learning/unlocking-the-power-of-model-context-protocol-mcp-on-aws/, June 2025

  31. [31]

    Model Context Protocol (MCP): Landscape, Security Threats, and Future Research Directions,

    X. Hou, Y . Zhao, S. Wang, and H. Wang, “Model Context Protocol (MCP): Landscape, Security Threats, and Future Research Directions,” Apr. 2025

  32. [32]

    A Survey of the Model Context Protocol (MCP): Standardizing Context to Enhance Large Language Models (LLMs),

    A. Singh, A. Ehtesham, S. Kumar, and T. T. Khoei, “A Survey of the Model Context Protocol (MCP): Standardizing Context to Enhance Large Language Models (LLMs),” Apr. 2025

  33. [33]

    Retrieval-Augmented Generation for Knowledge-Intensive NLP Tasks,

    P. Lewis, E. Perez, A. Piktus, F. Petroni, V . Karpukhin, N. Goyal, H. Küttler, M. Lewis, W.-t. Yih, T. Rocktäschel, S. Riedel, and D. Kiela, “Retrieval-Augmented Generation for Knowledge-Intensive NLP Tasks,” Apr. 2021

  34. [34]

    Context7

    Upstash, “Context7.” https://github.com/upstash/context7, Mar. 2025

  35. [35]

    Chain-of-Thought Prompting Elicits Reasoning in Large Language Models,

    J. Wei, X. Wang, D. Schuurmans, M. Bosma, B. Ichter, F. Xia, E. Chi, Q. Le, and D. Zhou, “Chain-of-Thought Prompting Elicits Reasoning in Large Language Models,” Jan. 2023. 12 Supplementary Information S1 Complete Content of Structured Prompt P2 <role> You are a TorchRDIT Design Assistant that creates photonic device optimizations for domain experts. Gene...

  36. [36]

    Use ‘list_templates()‘ if unsure what’s possible

    **Clarify Goal**: Identify the user’s objective (e.g., ‘basic_simulation‘, ‘optimization‘, ‘ metasurface‘). Use ‘list_templates()‘ if unsure what’s possible

  37. [37]

    This is your primary strategy tool

    **Propose Workflow**: Use ‘get_workflow_guide(workflow_type=...)‘ to get a structured plan. This is your primary strategy tool

  38. [38]

    Combine these blocks to build the full script

    **Assemble Code**: Sequentially call ‘get_template()‘ for each template listed in the workflow guide. Combine these blocks to build the full script

  39. [39]

    First, call ‘resolve_library_id()‘ to find the library, then use ‘get_library_docs()‘ to retrieve specific documentation

    **Verify APIs (If Necessary)**: If you encounter an unfamiliar API or need more detail than the templates provide, use the Context7 tools. First, call ‘resolve_library_id()‘ to find the library, then use ‘get_library_docs()‘ to retrieve specific documentation

  40. [40]

    **Incorporate Best Practices**: For optimization tasks, call ‘get_optimization_tips()‘ and apply relevant advice (e.g., gradient clipping, parameter clamping)

  41. [41]

    - Refer to clarification templates (‘layer_order‘, ‘material_api‘, ‘common_mistakes‘) to ensure correctness

    **Validate and Refine**: - Use ‘validate_layer_setup()‘ on the generated layer code to catch common API mistakes. - Refer to clarification templates (‘layer_order‘, ‘material_api‘, ‘common_mistakes‘) to ensure correctness

  42. [42]

    parameter exploration

    **Deliver and Explain**: Present the complete script, explaining the design choices and how to run it. If optimization is involved, explain the strategy. </workflow> <optimization_strategy> **MANDATORY: Two-stage global optimization (when applicable)** This is critical for avoiding local minima in complex photonic design spaces. **Stage 1 - Parameter Expl...