Mechanism model agent calling and optimization method and system based on large language model

By automatically decomposing user requirements and generating execution plans using a large language model, the problem of relying on professional personnel to call mechanistic models has been solved. This has enabled full-process automation and intelligence of complex scientific computing tasks, improving the system's autonomous optimization capabilities and user experience.

CN121960562BActive Publication Date: 2026-07-21NANJING HYDRAULIC RES INST
View PDF 2 Cites 0 Cited by

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
NANJING HYDRAULIC RES INST
Filing Date
2026-04-03
Publication Date
2026-07-21

Smart Images

  • Figure CN121960562B_ABST
    Figure CN121960562B_ABST
Patent Text Reader

Abstract

The application discloses a mechanism model intelligent agent calling and optimization method and system based on a large language model. The method receives a user natural language task, understands and decomposes the task by using a large language model, intelligently selects an intelligent agent encapsulating a mechanism model according to a subtask and predefined metadata, and generates an execution plan containing an execution sequence and a data flow. The system drives the intelligent agent to execute the plan and collects process, result, performance data and user feedback, and then analyzes the data by using the large language model, realizes double optimization, that is, automatically optimizes and calibrates internal parameters of the intelligent agent, and iteratively optimizes a strategy for generating the plan by the large language model, and finally outputs a result in a natural language report. The application significantly reduces a use threshold of a professional mechanism model, and realizes full-process automation and intelligentization from understanding, execution to optimization of a complex scientific calculation task.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention belongs to the interdisciplinary field of artificial intelligence and scientific computing, and in particular relates to a method and system for invoking and optimizing intelligent agents based on a mechanism model of a large language model. Background Technology

[0002] With the rapid development of computational science and engineering, mechanistic models built based on first-principles calculations play an irreplaceable role in many key industries such as aerospace, energy and chemical engineering, biomedicine, and environmental simulation. These models can accurately describe the intrinsic operating mechanisms of physical, chemical, and biological systems, possessing strong interpretability, high reliability, and good extrapolation capabilities, and are widely used in system simulation, process optimization, and fault diagnosis. However, as scientific research and engineering problems become increasingly complex, single mechanistic models often fail to cover global requirements, and the combined use of multiple heterogeneous models has become the norm. This places higher demands on the understanding, scheduling, and integration capabilities of models.

[0003] Currently, the invocation and combination of mechanistic models primarily rely on the deep involvement of professionals. Domain experts need to manually select appropriate models, set parameters, design execution processes, and manually analyze and adjust the results based on the task objectives. Although some systems provide graphical modeling or scripting interfaces, they are essentially still in a "human-led, machine-assisted" mode. In recent years, with the development of artificial intelligence technology, some studies have attempted to apply machine learning methods to model parameter calibration or result post-processing, and some commercial software has also begun to integrate optimization algorithms to achieve automatic parameter adjustment.

[0004] Existing technologies for using mechanistic models generally suffer from low automation, reliance on expert experience, and rigid task execution processes, making it difficult to flexibly adapt to changing application scenarios and user needs. Especially when facing complex tasks, they lack the ability to interpret higher-order intents, cannot achieve dynamic orchestration and collaborative computation of multiple models, and struggle to automatically optimize model parameters or adjust invocation strategies based on execution results. This results in high application barriers, long development cycles, and poor reusability for mechanistic models, severely hindering their widespread adoption and in-depth application in industry and research. Summary of the Invention

[0005] Purpose of the invention: The purpose of this invention is to provide a method and system for calling and optimizing mechanistic model intelligent agents based on a large language model. It aims to leverage the powerful understanding and planning capabilities of large language models to lower the barrier to entry for using professional mechanistic models, improve the automation and intelligence level of complex scientific computing tasks, and achieve system self-optimization, enabling intelligent calling of multiple models, parameter optimization, and adaptive strategy improvement under complex tasks.

[0006] Technical solution: The method for invoking and optimizing a mechanism model-based intelligent agent based on a large language model, as described in this invention, includes the following steps:

[0007] Receive natural language task input from the user;

[0008] The system utilizes a large language model to perform semantic parsing and task understanding on the user's natural language task input, and automatically decomposes it into several atomic sub-tasks based on preset task objectives.

[0009] Based on the atomic subtasks and combined with predefined mechanism model agent metadata, at least one mechanism model agent is selected using the large language model. The mechanism model agent encapsulates a mathematical model based on first principles and provides standardized input / output interfaces and functional description metadata.

[0010] An execution plan is generated using the large language model, and the execution plan includes the calling order, data flow, logic control, parallel or serial execution relationship, and conditional branches of the mechanism model agent;

[0011] The mechanism model agent is driven to perform computational tasks according to the execution plan, and execution process data, execution result data, and execution performance data are collected.

[0012] Collect user feedback data;

[0013] The large language model is used to analyze the execution process data, execution result data, execution performance data, and user feedback data to generate task execution performance evaluation results and optimization decision information.

[0014] Based on the performance evaluation results and optimization decision information, perform at least one of the following optimization operations: optimize the internal parameters of at least one mechanistic model agent; optimize the strategy for generating execution plans for the large language model;

[0015] The large language model is used to convert the execution result data, analysis results, and optimization process information into natural language reports and output them to the user.

[0016] This invention, by deeply integrating the semantic understanding, task planning, and self-optimization capabilities of a large language model, systematically lowers the application threshold of professional mechanistic models, achieving full-process automation and intelligence for complex scientific computing tasks. Specifically, firstly, the large language model accurately parses and breaks down the user's ambiguous natural language requirements into executable atomic sub-tasks, bridging the gap between professional expression and user intent. Then, based on task requirements and predefined model metadata, it intelligently selects and combines the most suitable mechanistic model agents, breaking down the calling barriers between multi-physics or multi-scale models. Next, the large language model dynamically generates the optimal execution plan, including data logic and parallel control, achieving automated orchestration of complex computational processes. During execution, the system not only drives efficient model computation but also comprehensively collects process and performance data, providing a basis for subsequent closed-loop optimization. Finally, by analyzing execution data and user feedback, the large language model can autonomously evaluate task performance and iteratively optimize internal model parameters or its own planning strategies, thus forming an adaptive improvement cycle. The results and optimization details of the entire process are ultimately transformed into intuitive natural language reports by the large language model, significantly improving decision-making transparency and user experience. These steps work together to enable the system to autonomously complete advanced cognitive and computational tasks, from task understanding and multi-model intelligent collaboration to performance self-optimization, without relying on deep human intervention.

[0017] Preferably, the execution performance data includes at least one of the following: computation time, resource consumption, convergence index, numerical stability index, parallel efficiency, or overall task completion time for each mechanism model agent.

[0018] The user feedback data includes at least one of the following: result satisfaction rating, requests for correction of specific result items, evaluation of execution speed, or evaluation of report comprehensibility.

[0019] By precisely defining the specific types of execution performance data and user feedback data, the system provides multi-dimensional quantitative basis and qualitative reference for self-optimization, thereby achieving a deeper intelligent closed loop. Performance indicators such as computation time, resource consumption, and parallel efficiency enable the large language model to accurately assess the efficiency bottlenecks and resource utilization of the computation process; while convergence and numerical stability indicators ensure the reliability and accuracy of the mechanistic model solution. Simultaneously, the introduction of feedback data such as user satisfaction, correction requests, and comprehensibility evaluations incorporates human professional judgment and subjective experience into the optimization loop. The combination of these two types of data allows the system to not only optimize model parameters and execution strategies from an objective performance perspective but also adjust the presentation of reports and the accuracy of results based on users' implicit needs, ultimately achieving an intelligent service that conforms to scientific computing standards and closely meets user expectations.

[0020] Preferably, the analysis of the execution process data, execution result data, execution performance data, and user feedback data using the large language model includes:

[0021] Based on the execution performance data and execution process data, the computation time, resource consumption, convergence status or execution failure records of each mechanism model agent in the execution plan are evaluated to identify performance bottlenecks, error sources or potential optimization locations in the task execution process.

[0022] Based on the deviation between the execution result data and the preset task objective, the calculation results of different mechanism model agents are compared and analyzed to evaluate the performance of each mechanism model agent and its contribution to the completion of the preset overall objective, and to generate task execution performance evaluation results.

[0023] Based on the user feedback data, semantic understanding and intent recognition are performed to extract user requirements for task results improvement, performance preferences, or additional analysis needs from the user feedback data, so as to obtain user demand information for generating optimization decision information.

[0024] This optimized solution significantly enhances the system's diagnostic, attribution, and demand-aware intelligence by endowing the large language model with multi-dimensional and in-depth analytical capabilities. Specifically, the system can not only accurately locate performance bottlenecks, root causes of errors, and optimizable nodes in the computation process based on execution performance and process data, achieving a leap from "being able to execute" to "being able to diagnose," but also quantitatively evaluate the contribution of each mechanism model to the overall task by comparing the deviation between the computation results and the task objectives, thereby identifying the performance advantages and disadvantages and adaptability of different models and providing a scientific basis for subsequent precise optimization. Furthermore, through semantic understanding of user feedback, the system can proactively mine and formalize users' implicit needs, performance preferences, and improvement intentions, transforming subjective evaluations into executable optimization instructions. This series of analytical capabilities works together to make optimization decisions no longer blind parameter adjustments, but rather based on a global insight into the execution process, result quality, and user expectations, thereby driving the system to achieve more targeted adaptive improvements and strategy upgrades.

[0025] Preferably, the optimization of the internal parameters of at least one mechanistic model agent includes:

[0026] Calculate and quantify the error between the execution result data of the mechanism model intelligent agent and the preset reference data. The measurement of the error includes, but is not limited to, absolute error, relative error, mean square error, root mean square error, mean absolute error, or coefficient of determination.

[0027] Based on error measurement data, execution process data, and metadata of the mechanism model intelligent agent, the large language model is used to attribute errors and identify the set of internal parameters that need to be optimized.

[0028] The large language model generates optimization instructions for the set of internal parameters, the optimization instructions including the optimization objective function, optimization variables, constraints and initialization suggestions;

[0029] Trigger and execute the parameter optimization algorithm associated with the mechanism model agent to obtain new parameters, and write the new parameters back to the mechanism model agent.

[0030] This preferred scheme achieves deep self-correction and continuous evolution of the mechanistic model agent's performance by introducing a closed loop of refined error analysis and parameter optimization driven by a large language model. Specifically, the system first uses various scientific metrics to accurately quantify the deviation between the model output and the reference benchmark, providing a reliable quantitative basis for subsequent optimization. Then, leveraging the powerful reasoning capabilities of the large language model, combined with execution process data and model metadata, it accurately attributes the sources of error and intelligently identifies the set of key parameters that need adjustment, avoiding blind parameter traversal. On this basis, the large language model can autonomously generate complete optimization instructions containing objectives, variables, and constraints, setting clear objectives and boundaries for the parameter optimization algorithm. Finally, by triggering associated optimization algorithms to perform parameter optimization and writing the new parameters back to the model, a fully automated closed loop from error identification and attribution analysis to strategy generation and parameter updates is completed. This process enables the mechanistic model to achieve adaptive calibration based on actual performance data, continuously improving its simulation accuracy and reliability without the need for manual intervention in complex mathematical modeling and parameter tuning processes.

[0031] Preferably, the error-based measurement data, execution process data, and metadata of the mechanism model agent are used to perform error attribution and identify the set of internal parameters that need to be optimized using the large language model, including the following three stages: Causal hypothesis generation stage: Error measurement data, execution process data, metadata of the mechanism model agent, and physical meaning descriptions of the internal parameters to be optimized are input into the large language model. The large language model then generates a set of causal hypotheses based on preset domain knowledge. Where G is the set of causal hypotheses; K is the total number of causal hypotheses generated by the large language model; each causal hypothesis... Indicates internal parameters This is the cause of the current error, among which The m-th suspected internal parameter in the mechanistic model agent; the large language model simultaneously outputs the causal confidence score of each causal hypothesis. ;in, This represents the conditional probability estimation function, and context represents the complete contextual information including error metrics, execution process data, and metadata of the mechanistic model agent. The value reflects the self-evaluation probability of the large language model regarding the likelihood of the causal hypothesis being true based on domain knowledge. The closer the value is to 1, the more certain the large language model is that the suspected internal parameter is the main cause of the error. Confidence-guided validation sampling phase: for each internal parameter in the causal hypothesis set First, calculate the uncertainty measure of the normalized parameters, then calculate the verification priority: For internal parameters Within the preset value range The range of values ​​is divided into B intervals by equally spaced discrete sampling, where B is the preset number of discretization intervals. The frequency of each interval is statistically analyzed based on historical values ​​of internal parameters or prior distribution. , ,in Internal parameters The frequency falling into the b-th interval, and satisfying ; Calculate the internal parameters Discrete sampling information entropy: ;in, For information entropy estimated based on discrete sampling, The intrinsic parameter reaches its maximum value when the frequency is equal across all intervals. The minimum value is 0 when the parameters are concentrated in a single interval; The discrete sampled information entropy is normalized to obtain a normalized parameter uncertainty measure: ;in, This is a measure of the uncertainty of the normalized parameters. The closer the value is to 1, the more uniform the distribution of the parameter within its range and the higher its uncertainty. The maximum information entropy when B intervals are uniformly distributed is used as the normalization denominator; Calculate the verification priority score for each internal parameter using the following verification priority formula: ;in, Internal parameters Verification priority score; As a balancing factor, it is used to adjust the relative weight between inference confidence and parameter uncertainty in large language models: when When the value is close to 1, the validation priority is determined by the causal confidence of the large language model; when... When the value is close to 0, the verification priority is determined by the uncertainty measure of the internal parameters; superscript and These are the power exponents of the corresponding terms, used to achieve geometric weighted fusion of the two information sources; Scoring based on verification priority From high to low, for internal parameters Apply small perturbation , ;in, To apply internal parameters The amount of disturbance on; The preset relative disturbance ratio is used to control the magnitude of the disturbance relative to the internal parameter itself. For each intrinsic parameter Calculate the normalized perturbation response ratio: ;in, Internal parameters The normalized perturbation response ratio, It reflects the relative change in error caused by internal parameter disturbances; This represents the absolute value of the error change after applying a positive disturbance. The absolute value of the baseline error before the disturbance is used as the normalization reference. when When determining internal parameters After significant verification, the process proceeds to the joint attribution quantification stage; among which... The preset significance threshold; when If the internal parameter is determined to have no significant impact on the current error, it will no longer participate in the joint attribution quantification stage. Joint attribution quantification stage: For internal parameters that have passed significance verification, first calculate the normalized numerical sensitivity, and then calculate the joint attribution score based on it. For each internal parameter that passed the significance test Calculate the normalized numerical sensitivity: ;in, Internal parameters Normalized numerical sensitivity, ; For internal parameters The absolute value of the ratio of the observed change in error after applying a perturbation to the amount of perturbation; The maximum absolute value of the original numerical sensitivity among all verified internal parameters is used as the normalization denominator, so that the internal parameter with the highest sensitivity is set to 1, and the remaining internal parameters are scaled proportionally to the interval [0, 1]. Calculate the joint attribution score for each internal parameter using the following joint attribution score formula: ;in, Internal parameters The joint attribution score, The higher the value, the greater the contribution of the internal parameter to the current error, and the more it should be included in the set of internal parameters that need to be optimized. To normalize the numerical sensitivity, ; This represents the causal confidence score output by the large language model during the causal hypothesis generation stage. ; For user feedback data and internal parameters The semantic relevance between them ; Feedback data provided to users includes result satisfaction ratings and requests for corrections to specific result items; As a balancing factor, it is dynamically determined by the large language model based on the sufficiency of the current data: when the results of the significance verification are sufficiently reliable, Choose a higher value to emphasize the sensitivity of the normalized values; when numerical data is insufficient or there is a lot of noise. Lower values ​​are chosen to rely more on the reasoning and judgment of the large language model and user feedback; Joint attribution score Sort by size from largest to smallest, and select the top-ranked items. The intrinsic parameters of the bits are determined as the set of intrinsic parameters to be optimized, where The upper limit of the number of optimization parameters is preset and is adaptively determined by the large language model based on the distribution characteristics of the joint attribution score.

[0032] This error attribution mechanism achieves precise localization and quantification of the sources of error in the mechanistic model through a three-stage process. First, it utilizes the domain knowledge of a large language model to generate causal hypotheses with confidence levels. Second, by integrating the inference confidence of the large language model with the inherent distributional uncertainty of the parameters, it intelligently calculates verification priorities and conducts perturbation experiments to determine significance or eliminate irrelevant parameters. Finally, it comprehensively considers numerical sensitivity, the confidence level of the large language model, and the semantics of user feedback to calculate a joint attribution score, thereby automatically selecting the most critical parameters for optimization. This process not only integrates data-driven numerical analysis and knowledge-driven reasoning but also incorporates user feedback, enabling intelligent, accurate, and interpretable identification of the true root causes of error from massive amounts of parameters, providing a highly focused and reliable basis for subsequent parameter optimization.

[0033] Preferably, the causal hypothesis generation stage further includes: The large language model generates each causal hypothesis. At the same time, a corresponding inference chain text is generated. The inference chain text records the step-by-step reasoning process from error phenomenon to parameter attribution, including the physical laws on which it is based, the causal transmission path between parameters, and the reasoning basis for excluding other parameters. The causal confidence is verified using the inference chain text: the large language model performs an overall quality assessment of the inference chain text and outputs the inference chain verification coefficient. The evaluation is based on the following criterion: when the reasoning steps in the reasoning chain text are consistent with known physical laws and logically coherent, The value is close to 1; when there are logical jumps, insufficient evidence, or contradictions with known physical laws in the reasoning chain, The value is close to 0; The causal confidence score is corrected using the inference chain verification coefficients to obtain the corrected causal confidence score: ;in, The corrected causal confidence level. ; The causal confidence score output by the large language model during the causal hypothesis generation phase; This is the inference chain verification coefficient; when the inference chain quality is high... When the value is close to 1, the corrected causal confidence remains unchanged; however, when there are serious flaws in the reasoning chain... As the value approaches zero, the corrected causal confidence level decreases.

[0034] This preferred approach enhances the credibility of causal confidence generated by large language models by introducing traceable inference chain text and its quality verification mechanism. It not only requires the model to output attribution conclusions but also mandates the generation of a complete logical path from the error phenomenon to the root cause of the parameters, and performs self-evaluation and correction based on the consistency of physical laws and the coherence of reasoning. This process effectively filters out false causal hypotheses based on superficial associations or flawed logic, ensuring that the causal confidence used for subsequent verification has stronger interpretability and reliability, thereby improving the scientific rigor of the entire error attribution process.

[0035] Preferably, the parameter optimization algorithm includes at least one of the following:

[0036] Gradient-based optimization algorithms include gradient descent and stochastic gradient descent.

[0037] Derivative-free optimization algorithms, including particle swarm optimization and covariance matrix adaptive evolution strategy;

[0038] Constrained optimization algorithms include sequential quadratic programming, interior point method, and augmented Lagrange method;

[0039] When the objective function is not differentiable or contains noise, the derivative-free optimization algorithm is preferred.

[0040] This preferred scheme significantly enhances the system's adaptive solution capability for different optimization problems by integrating diverse parameter optimization algorithms and establishing an intelligent selection mechanism. Specifically, the system encompasses gradient-based algorithms to efficiently handle smooth and differentiable objective functions, integrates derivative-free optimization algorithms to address complex engineering scenarios where the objective function is non-differentiable or contains noise, and incorporates constrained optimization algorithms to ensure that the optimization results conform to physical or engineering constraints. Crucially, the scheme introduces a strategic priority selection logic: when characteristics of the optimization problem (such as a non-differentiable objective function) are identified, the system automatically tends to employ derivative-free algorithms such as particle swarm optimization or covariance matrix adaptive evolution strategies. This mechanism allows the parameter optimization process to move beyond relying on a fixed single algorithm and dynamically match appropriate solvers based on the problem's nature revealed in the error analysis phase. This ensures optimization effectiveness while improving the system's robustness and success rate in handling various complex, nonlinear, and constrained optimization problems.

[0041] Preferably, the optimization of the internal parameters of at least one mechanistic model agent further includes:

[0042] When the execution result data, reference data, or user feedback data are insufficient to define or evaluate the optimization objective function, the large language model is used to generate synthetic data or simulated scene generation instructions for parameter optimization. Based on the synthetic data or simulated scene generation instructions, synthetic data or simulated scenes are automatically generated, and the synthetic data or simulated scenes are incorporated into the optimization objective function to construct an enhanced objective function. The enhanced objective function is then used to drive the parameter optimization algorithm to optimize the internal parameters.

[0043] This preferred approach overcomes the bottleneck of traditional parameter optimization's reliance on real data by introducing synthetic data and simulated scene generation capabilities driven by a large language model. This significantly enhances the system's adaptive optimization capabilities in scenarios with scarce data or ambiguous feedback. Specifically, when actual execution results, benchmarks, or user feedback are insufficient to support a clear definition of the optimization objective, the system can leverage the prior knowledge and scene construction capabilities of the large language model to automatically generate high-fidelity synthetic data or simulated scenes and integrate them into the enhanced objective function. This mechanism enables the parameter optimization process to iterate effectively based on reasonable assumptions and a simulation environment even in the absence of real samples. This ensures that the mechanistic model agent can achieve performance calibration and continuous evolution even in data-sparse or cold-start phases, greatly expanding the system's robustness and applicability in real-world engineering applications.

[0044] Preferably, optimizing the strategy for generating the execution plan from the large language model includes:

[0045] The user feedback data, execution process data, and execution performance data are used to construct feedback signals or training data. Based on the feedback signals or training data, reinforcement learning, supervised fine-tuning, or cue word engineering optimization methods are used to update the decision logic of the large language model to generate the execution plan.

[0046] The update of the decision logic includes at least one of the following: adjusting the model parameters of the large language model; optimizing the prompt template used to guide the generation of the execution plan; and updating the knowledge base about the performance or applicable scenarios of the mechanism model agent.

[0047] This optimized approach achieves systematic evolution and continuous optimization of the planning capabilities of a large language model by introducing a closed-loop learning mechanism based on real-world execution feedback. Specifically, the system transforms diverse feedback signals, such as user evaluations, process records, and performance metrics, into structured training data or reinforcement signals. Then, it employs reinforcement learning, supervised fine-tuning, or prompt word engineering to precisely update the underlying decision-making logic of the model's execution plan generation. This optimization process is not limited to single-dimensional adjustments but encompasses everything from fine-tuning model parameters to alter its inherent reasoning preferences, to optimizing prompt templates to guide a more accurate understanding of task requirements, and to dynamically updating the mechanistic model knowledge base to reflect the latest performance insights. Through this multi-layered strategy evolution, the large language model can continuously adapt to complex and ever-changing computational tasks, gradually improving its planning quality and adaptability in model selection, process orchestration, and logic control, thereby achieving self-evolution and iterative improvement of the system's overall intelligence level.

[0048] Preferably, optimizing the strategy for generating the execution plan from the large language model further includes:

[0049] The large language model is used to analyze cases of execution failure or poor performance, identify erroneous decision points in the execution plan, and generate targeted training samples or correction instructions for policy optimization, serving as a data source for reinforcement learning, supervised fine-tuning, or cue word engineering optimization.

[0050] This preferred approach significantly enhances the targeting and self-healing capabilities of system strategy optimization by introducing a deep reflection mechanism for failure cases driven by a large language model. Specifically, when an execution plan encounters failure or underperformance, the system no longer relies solely on external feedback signals. Instead, it proactively utilizes the large language model to perform introspective analysis of failure cases, accurately identifying specific erroneous decision points in the execution plan (such as inappropriate model selection, data logic errors, or parallel strategy failures). Based on this diagnosis, the large language model can autonomously generate highly targeted training samples or correction instructions, providing high-quality optimization data for reinforcement learning, supervised fine-tuning, or cue word engineering. This mechanism enables the system to learn from its own mistakes, transforming each failure into valuable experience for improving planning strategies. This allows it to effectively avoid similar problems in subsequent tasks, achieving an evolution from passive response to proactive prevention, and continuously improving the robustness and decision-making quality of the execution plan.

[0051] The mechanism model intelligent agent invocation and optimization system based on a large language model described in this invention includes:

[0052] A natural language interaction interface is used to receive user natural language input and present natural language reports;

[0053] A large language model engine is used for task understanding, subtask decomposition, agent selection, execution plan generation, data analysis, and optimization decision-making.

[0054] Mechanism Model Intelligent Agent Library is used to store multiple mechanism model intelligent agents encapsulated with first-principles mathematical models, and to provide standardized input / output interfaces and metadata descriptions for each intelligent agent;

[0055] The execution engine is used to load and execute the execution plan generated by the large language model engine, schedule the operation of the mechanism model agent, and manage the data flow;

[0056] The data collection module is used to collect execution process data, result data, execution performance data, and user feedback during execution; and

[0057] The optimization engine is communicatively connected to the large language model engine, the data collection module, and the mechanism model agent library. It is used to: call the large language model engine to analyze the collected data; and based on the analysis results, send parameter optimization instructions to a specific mechanism model agent or generate training data or feedback signals to drive the strategy optimization of the large language model engine.

[0058] Preferably, the mechanism model agent library further includes an algorithm adaptive learning library, which records historical performance metadata of different models and algorithms in various task scenarios. The historical performance metadata includes convergence speed, stability, accuracy, and computational cost. The large language model engine uses the algorithm adaptive learning library as a reference for agent selection, model switching, or numerical parameter suggestions. Furthermore, the large language model engine supports parallel / distributed scheduling, dynamic adjustment of grid resolution, and numerical stability monitoring.

[0059] This preferred solution, by constructing an algorithm adaptive learning library and integrating advanced computational monitoring capabilities, endows the system with the ability to make intelligent decisions and dynamically adjust based on historical experience, significantly improving computational efficiency and robustness in multi-model collaborative scenarios. Specifically, the algorithm adaptive learning library systematically accumulates historical performance metadata (such as convergence speed, stability, accuracy, and cost) of different mechanistic models and algorithms in various task scenarios. This allows the large language model to accurately match based on rich prior knowledge when selecting agents, switching models, or suggesting parameters, avoiding repeated trial and error and achieving experience-driven optimization decisions. Simultaneously, the system's integrated parallel / distributed scheduling, dynamic grid resolution adjustment, and numerical stability monitoring functions enable it to dynamically adjust computational resources and solution strategies according to real-time status during the execution of complex computational tasks, effectively preventing numerical divergence and optimizing computational efficiency. This mechanism upgrades the static model library into an intelligent computing engine with learning and adaptive capabilities, ensuring that the system can make more informed planning choices and guarantee high efficiency and stability during execution when facing complex and ever-changing scientific computing tasks.

[0060] Beneficial Effects: Compared with existing technologies, this invention has the following significant advantages: 1. This invention uses a large language model to perform deep semantic understanding and task decomposition of user natural language input, transforming complex mechanistic models that originally required a deep professional background into intuitive conversational interactions. This allows researchers or engineers to complete highly complex scientific computing tasks by driving multi-model collaboration through everyday language without needing to be proficient in underlying mathematical models and programming details, significantly lowering the barrier to entry for using professional mechanistic models; 2. The system achieves full-process automation from task understanding and intelligent multi-model matching to execution plan orchestration. The large language model can dynamically plan the model calling order, data flow, and logical control according to the task objectives, autonomously completing the construction and execution of complex workflows, avoiding the high time consumption and error-proneness of manual model combination, and greatly improving the execution efficiency and intelligence level of complex scientific computing tasks; 3. This invention constructs a closed-loop optimization mechanism that can utilize performance data, result deviations, and user feedback during the execution process to drive continuous system evolution. Through adaptive calibration of the internal parameters of the mechanistic model and iterative optimization of the large language model planning strategy, the system can continuously accumulate experience and correct deviations, achieving a leap from "passive execution" to "active evolution," ensuring higher accuracy and robustness when facing new tasks. 4. Leveraging the generative capabilities of the large language model, the system automatically transforms complex numerical calculation results, data flow between models, and optimization processes into easily understandable natural language reports. This not only allows users to clearly understand the origin of the calculation results and the system's internal decision-making logic but also enhances the interpretability of the scientific computing process, promoting trust and collaboration between humans and machines. Attached Figure Description

[0061] Figure 1 This is a schematic diagram of the system architecture of the present invention;

[0062] Figure 2 This is a schematic diagram of the intelligent optimization path for the large language model of the present invention;

[0063] Figure 3 This is a schematic diagram of the application system task input and intelligent analysis of the large language model of the present invention;

[0064] Figure 4 This is a schematic diagram illustrating the execution optimization of the large language model in the application system of the present invention;

[0065] Figure 5 This is a schematic diagram of the analysis results of the large language model of the application system of the present invention;

[0066] Figure 6 This is a schematic diagram illustrating the intelligent learning and updating of the large language model in the application system of this invention. Detailed Implementation

[0067] The technical solution of the present invention will be further described below with reference to the accompanying drawings.

[0068] This invention provides a method for invoking and optimizing intelligent agents based on a mechanistic model of a large language model, such as... Figure 1 As shown, it includes the following steps:

[0069] Step S1: Receive the user's natural language task input. The system supports multimodal input, including text, speech, or annotated geographic information files.

[0070] Step S2: Utilize a large language model to understand the task input and decompose it into atomic subtasks based on the task objective. The large language model engine performs task understanding through semantic parsing and domain knowledge bases (such as a hydraulic engineering terminology database and a physical law database) and extracts key parameters.

[0071] Step S3: Based on the atomic subtasks and predefined mechanistic model agent metadata, select at least one mechanistic model agent using a large language model. The mechanistic model agent encapsulates a mathematical model based on first principles of physics and provides standardized input / output interfaces and functional description metadata.

[0072] Step S4: Generate an execution plan using the large language model, which includes the calling order, data flow, and logical control of the selected mechanistic model agents. The execution plan defines the data dependencies between the mechanistic model agents, the parallel or serial execution logic, and conditional branches.

[0073] Step S5: Execute the execution plan, drive the selected mechanism model agent to perform calculations, and collect execution process data, execution result data, and execution performance data.

[0074] Step S6: Collect user feedback data. The system outputs results in the form of visual charts and natural language reports, and actively solicits user feedback, including: satisfaction ratings, suggestions for correcting specific results, evaluations of calculation speed and report clarity, and potential new needs.

[0075] Step S7: Analyze execution performance data, execution process data, execution result data, and user feedback data using a large language model. The analysis includes multiple dimensions:

[0076] Performance analysis: Identify computational bottlenecks (such as excessive time consumption by a certain intelligent agent);

[0077] Error analysis: Compare simulation results with historical data to calculate indicators such as MSE and RMSE;

[0078] Attribution analysis: Inferring the source of error (e.g., inaccurate roughness parameters, unreasonable mesh generation);

[0079] Intent reasoning: Extracting deeper user needs (such as attention to dynamic processes) from feedback.

[0080] Step S8: Based on the analysis results of step S7, perform at least one of the following optimization operations:

[0081] The internal parameters of at least one selected mechanistic model agent are optimized; the strategy for generating the execution plan for the large language model is optimized. The optimization path is attached. Figure 2 As shown.

[0082] Furthermore, optimizing the internal parameters of at least one selected mechanistic model agent includes:

[0083] S8.1: Calculate the difference between the execution result data and the reference data or expected target using the large language model.

[0084] S8.2: Based on the above differences, generate optimization suggestions or instructions for the internal parameters of the agent in this mechanism model.

[0085] S8.3: Trigger and execute the parameter optimization algorithm associated with the agent of the mechanism model, wherein the optimization suggestions or instructions are used to guide the target setting, constraints or initialization parameters of the parameter optimization algorithm.

[0086] Specifically, the optimization process can be broken down as follows:

[0087] ① Error Calculation and Analysis: Data is parsed using a large language model to identify errors or deviations in the agent's output. Calculation methods include absolute / relative error, statistical error measures (such as MSE, RMSE), key feature point matching error, physical constraint violation measures, etc.

[0088] ② Error Attribution and Optimization Needs Understanding: Analyze the sources of error using a large language model, infer whether they are related to specific internal parameters, and determine which specific parameters need to be optimized.

[0089] ③ Generate optimization instructions and constraints: The large language model generates explicit optimization instructions, including defining the optimization objective function, specifying optimization variables, setting constraints, providing initialization suggestions, and providing suggestions for selecting optimization algorithms.

[0090] ④ Execute parameter optimization algorithms: Trigger and execute associated optimization algorithms, such as gradient-based algorithms, derivative-free optimization algorithms, or constrained optimization algorithms, to find the optimal parameters. Gradient-based methods: If the model is differentiable, use the adjoint method to calculate the gradient; derivative-free optimization: such as PSO, CMA-ES, suitable for black-box or high-noise scenarios; multi-objective optimization: simultaneously optimize accuracy and computational efficiency (such as Pareto front search).

[0091] ⑤ Update and Verify: Update the optimized parameters to the agent and selectively perform verification and evaluation.

[0092] Furthermore, error attribution and optimization requirement understanding includes the following three stages:

[0093] Causal hypothesis generation stage: Error measurement data, execution process data, metadata of the mechanism model agent, and physical meaning descriptions of the internal parameters to be optimized are input into the large language model. The large language model then generates a set of causal hypotheses based on pre-defined domain knowledge. Where G is the set of causal hypotheses; K is the total number of causal hypotheses generated by the large language model; each causal hypothesis... Indicates internal parameters This is the cause of the current error, among which The m-th suspected internal parameter in the mechanistic model agent; the causal confidence of each causal hypothesis is simultaneously output by the large language model. ;in, This represents the conditional probability estimation function, and context represents the complete contextual information including error metrics, execution process data, and metadata of the mechanistic model agent. The value reflects the self-evaluation probability of the large language model regarding the likelihood of the causal hypothesis being true based on domain knowledge. The closer the value is to 1, the more confident the large language model is that the suspected internal parameters are the main cause of the error. Confidence-guided validation sampling phase: for each internal parameter in the causal hypothesis set First, calculate the uncertainty measure of the normalized parameters, then calculate the verification priority: For internal parameters Within the preset value range The range of values ​​is divided into B intervals by equally spaced discrete sampling, where B is the preset number of discretization intervals. The frequency of each interval is statistically analyzed based on historical values ​​of internal parameters or prior distribution. , ,in Internal parameters The frequency falling into the b-th interval, and satisfying ; Calculate the internal parameters Discrete sampling information entropy: ;in, For information entropy estimated based on discrete sampling, The intrinsic parameter reaches its maximum value when the frequency is equal across all intervals. The minimum value is 0 when the parameters are concentrated in a single interval; Normalizing the discrete sampled information entropy yields a normalized parameter uncertainty measure: ;in, This is a measure of the uncertainty of the normalized parameters. The closer the value is to 1, the more uniform the distribution of the parameter within its range and the higher its uncertainty. The maximum information entropy when B intervals are uniformly distributed is used as the normalization denominator; Calculate the verification priority score for each internal parameter using the following verification priority formula: ;in, Internal parameters Verification priority score; As a balancing factor, it is used to adjust the relative weight between inference confidence and parameter uncertainty in large language models: when When the value is close to 1, the validation priority is determined by the causal confidence of the large language model; when... When the value is close to 0, the verification priority is determined by the uncertainty measure of the internal parameters; superscript and These are the power exponents of the corresponding terms, used to achieve geometric weighted fusion of the two information sources; Scoring based on verification priority From high to low, for internal parameters Apply small perturbation , ;in, To apply internal parameters The amount of disturbance on; The preset relative disturbance ratio is used to control the magnitude of the disturbance relative to the internal parameter itself. For each intrinsic parameter Calculate the normalized perturbation response ratio: ;in, Internal parameters The normalized perturbation response ratio, It reflects the relative change in error caused by internal parameter disturbances; This represents the absolute value of the error change after applying a positive disturbance. The absolute value of the baseline error before the disturbance is used as the normalization reference. when When determining internal parameters After significant verification, the process proceeds to the joint attribution quantification stage; among which... The preset significance threshold; when If the internal parameter is determined to have no significant impact on the current error, it will no longer participate in the joint attribution quantification stage. Joint attribution quantification stage: For internal parameters that have passed significance verification, first calculate the normalized numerical sensitivity, and then calculate the joint attribution score based on it. For each internal parameter that passed the significance test Calculate the normalized numerical sensitivity: ;in, Internal parameters Normalized numerical sensitivity, ; For internal parameters The absolute value of the ratio of the observed change in error after applying a perturbation to the amount of perturbation; The maximum absolute value of the original numerical sensitivity among all verified internal parameters is used as the normalization denominator, so that the internal parameter with the highest sensitivity is set to 1, and the remaining internal parameters are scaled proportionally to the interval [0, 1]. Calculate the joint attribution score for each internal parameter using the following joint attribution score formula: ;in, Internal parameters The joint attribution score, The higher the value, the greater the contribution of the internal parameter to the current error, and the more it should be included in the set of internal parameters that need to be optimized. To normalize the numerical sensitivity, ; This represents the causal confidence score output by the large language model during the causal hypothesis generation stage. ; For user feedback data and internal parameters The semantic relevance between them ; Feedback data provided to users includes result satisfaction ratings and requests for corrections to specific result items; As a balancing factor, it is dynamically determined by the large language model based on the sufficiency of the current data: when the results of the significance verification are sufficiently reliable, Choose a higher value to emphasize the sensitivity of the normalized values; when numerical data is insufficient or there is a lot of noise. Lower values ​​are chosen to rely more on the reasoning and judgment of the large language model and user feedback; Joint attribution score Sort by size from largest to smallest, and select the top-ranked items. The intrinsic parameters of the bits are determined as the set of intrinsic parameters to be optimized, where The upper limit of the number of optimization parameters is preset and is adaptively determined by the large language model based on the distribution characteristics of the joint attribution score.

[0094] Furthermore, the causal hypothesis generation stage also includes:

[0095] Large language models generate each causal hypothesis At the same time, a corresponding inference chain text is generated. The inference chain text records the step-by-step reasoning process from error phenomenon to parameter attribution, including the physical laws on which it is based, the causal transmission path between parameters, and the reasoning basis for excluding other parameters. Causal confidence is validated using inference chain text: A large language model performs an overall quality assessment of the inference chain text and outputs the inference chain validation coefficient. The evaluation is based on the following criteria: when the reasoning steps in the reasoning chain text are consistent with known physical laws and logically coherent, The value is close to 1; when there are logical jumps, insufficient evidence, or contradictions with known physical laws in the reasoning chain, The value is close to 0; The causal confidence score is corrected using the inference chain verification coefficient, resulting in the corrected causal confidence score: ;in, The corrected causal confidence level. ; This represents the causal confidence score output by the large language model during the causal hypothesis generation phase. This is the inference chain verification coefficient; when the inference chain quality is high... When the value is close to 1, the corrected causal confidence remains unchanged; however, when there are serious flaws in the reasoning chain... As the value approaches zero, the corrected causal confidence level decreases.

[0096] Furthermore, the parameter optimization process may also include using large language models to generate synthetic data or simulated scenarios for parameter optimization, in order to construct a more robust enhanced objective function to drive the optimization algorithm and improve the model's performance in a wide range of or critical scenarios.

[0097] Furthermore, optimizing the strategy for generating execution plans from large language models includes:

[0098] S8.4: Construct training data or feedback signals using user feedback, execution performance data, etc.

[0099] S8.5: Based on training data or feedback signals, update the decision logic of the large language model's generation execution plan using reinforcement learning, supervised fine-tuning, or cue engineering optimization methods. Updates include adjusting the large language model's own model parameters, optimizing cue templates, or updating its internal knowledge base regarding agent performance and composition strategies.

[0100] Furthermore, the process also includes using large language models to analyze failure cases, identify erroneous decision points, and generate targeted training samples to reinforce learning.

[0101] Step S9: Use a large language model to convert the execution results and process information into a natural language report and output it to the user.

[0102] This invention also provides a system for implementing the above method, comprising:

[0103] Natural Language Interaction Interface: Used to receive user input and output natural language reports.

[0104] Large Language Model Engine: The core processing unit used for task understanding, decomposition, agent selection, plan generation, data analysis, and optimization decision-making.

[0105] Mechanism Model Intelligent Agent Library: Stores multiple intelligent agents that encapsulate mechanistic models and provide standardized interfaces and metadata.

[0106] Execution Engine: Used to load and execute execution plans generated by large language models, driving agents in the agent library to perform computations and manage data flow.

[0107] Data collection module: Used to collect execution process data, result data, performance data, and user feedback.

[0108] Optimization Engine: Communicates with the large language model engine, data collection module, and agent library, and is configured to trigger agent parameter optimization and / or drive the large language model engine to update its planned generation strategy based on the analysis results of the large language model.

[0109] The following section uses the typical application scenario of urban river flood simulation and risk assessment to illustrate the specific implementation process of this invention.

[0110] S1: Receives the user's natural language task input.

[0111] Users input the task through the system's natural language interface: "Analyze the highest water level and maximum flow velocity of the main river in our city under the scenario of heavy rainfall (forecast cumulative rainfall of 200mm) over the next three days, and determine which sections of the dikes are at risk of overflow." (See attached image.) Figure 3 As shown.

[0112] S2-S4: Task understanding, decomposition, agent selection, and plan generation. (See attached document) Figure 4 As shown.

[0113] After receiving the task, the large language model engine first performs semantic parsing to identify the core objective of the task as "flood evolution simulation and risk assessment," and extracts key parameters (such as location, time, rainfall, and output requirements). Subsequently, based on its embedded hydraulic engineering knowledge, the large language model decomposes the task into a series of sub-tasks, including data acquisition, model configuration, simulation calculation, result extraction, and risk analysis.

[0114] Based on subtasks, the large language model queries the metadata in the mechanism model agent library to select the agent most suitable for completing the task.

[0115] Data acquisition agent: used to acquire river geographic information data, real-time rainfall forecast data, watershed surface parameters (such as soil type, land use, slope, etc.) and reservoir characteristic data (such as reservoir capacity curve, flood discharge capacity, etc.) from external databases or APIs.

[0116] Hydrological runoff model agent: This agent encapsulates runoff numerical models such as the Xin'anjiang model, SWAT model, or SCS-CN. Its metadata describes the parameters it needs to input, such as watershed rainfall, soil type, land use, and evaporation. It can output the watershed runoff process (runoff volume and runoff duration) as the inflow boundary conditions for downstream hydrodynamic models and can calculate reservoir inflow runoff.

[0117] One-dimensional / two-dimensional hydrodynamic model agent: This agent encapsulates a hydrodynamic numerical model based on the Saint-Venant equations and is the core computing unit of this task. Its metadata describes the parameters that need to be input, such as river topography, roughness, initial conditions, inflow runoff and boundary conditions calculated by the hydrological runoff model, and can output the spatiotemporal distribution of water level, velocity and flow rate.

[0118] Post-processing and risk analysis intelligent agent: It encapsulates data analysis algorithms to extract extreme values ​​from the output of hydrodynamic models and to judge the overflow risk based on the design elevation of the dike; at the same time, it can also process the inflow runoff data output by the hydrological runoff model and perform reservoir inflow runoff impact analysis.

[0119] The large language model generates a structured execution plan (such as JSON format) based on the logical relationships between subtasks. This plan clarifies the execution flow:

[0120] The data acquisition agent is invoked in parallel to acquire terrain, rainfall, watershed surface and reservoir data.

[0121] The hydrological runoff model agent is invoked to calculate the watershed runoff process using rainfall and watershed surface data.

[0122] Configure and serially call the hydrodynamic model agent to perform simulation calculations, where the inflow boundary conditions are derived from the hydrological runoff model.

[0123] Finally, the risk analysis agent is invoked to process the output results of the hydrodynamic model.

[0124] S5: Execute the plan and collect data.

[0125] The execution engine loads the plan and drives each agent to execute sequentially. First, the hydrological runoff model agent is invoked to calculate the runoff process based on rainfall and watershed characteristics. Subsequently, the hydrodynamic model agent receives inflow data from the hydrological runoff model agent and performs numerical calculations. The data collection module records the computational status, time consumption, and memory usage (performance data) of each agent throughout the process, as well as the final water level, velocity field, risk section list, and runoff process (result data).

[0126] S6: Collect feedback.

[0127] The system presents the risk analysis results (such as "the highest water level in section 3 of the dike is expected to exceed the warning line by 0.5 meters") to the user in the form of visual charts and natural language reports, and requests feedback. The user may provide feedback such as "I am satisfied with the overflow risk analysis, but I would like to know when the flood peak will arrive at each key point."

[0128] S7-S8: Analysis and Optimization.

[0129] The large language model engine comprehensively analyzes execution performance data, result data, and user feedback. (See attached image) Figure 5 As shown.

[0130] Data quality optimization: The large language model analyzes the completeness and accuracy of the input data. If key data is missing or anomalies are detected, the data acquisition agent can be automatically triggered to supplement or correct it, such as interpolating missing rainfall sequences or correcting obviously distorted terrain data.

[0131] Model and Algorithm Optimization: An algorithm adaptive learning library is constructed and maintained dynamically. This library records the historical performance of different algorithms (such as optimization algorithms SCE-UA and PSO, numerical solution algorithms, etc.) under various task scenarios (such as steep riverbeds, plain river networks, urban flooding), data conditions (such as scarce data, high data noise), and computational objectives (such as pursuing speed, pursuing accuracy), including metadata such as convergence speed, stability, final accuracy, and computational cost. Based on this learning library, when the large language model recognizes the characteristics of the current simulation task (e.g., "complex riverbed topography", "urgent need for rapid forecasting") or encounters specific problems (e.g., parameter optimization not converging, unstable numerical computation), it will actively match the algorithm that has historically performed best in similar situations from the learning library. The concept of the learning library is also extended to the core mechanism model. The large language model can suggest the most suitable model based on watershed characteristics (such as humid / arid regions), spatial scale (such as large / small watersheds), and simulation objectives. For example, the Xin'anjiang model might be the preferred choice for humid watersheds dominated by runoff generation, while relevant modules from the SWAT model might be recommended for semi-arid watersheds dominated by infiltrative runoff. When insufficient simulation accuracy or low computational efficiency is identified, the large language model can determine whether to switch model structures or adjust numerical algorithms. For example, for complex floodplains or urban flooding areas, the large language model can suggest upgrading the one-dimensional hydrodynamic model to a two-dimensional model. For scenarios with high computational resource consumption, the large language model can guide adjustments to grid resolution, time step, or the adoption of parallel computing strategies to improve computational efficiency while ensuring accuracy.

[0132] Parameter Optimization: The large-scale language model detected a systematic deviation between the simulated water level and historical measured data in a certain river segment. Analysis suggested this might be due to an improperly set roughness parameter for that segment. The large-scale language model generated optimization instructions, defining the objective function as minimizing the root mean square error (RMSE) between the simulated and historical values ​​for that segment, using the roughness coefficient as the optimization variable, and setting reasonable physical constraints (e.g., a roughness coefficient range of 0.025-0.045). Subsequently, an agent-associative optimization algorithm (e.g., the SCE-UA algorithm) was triggered to automatically calibrate the roughness parameter. The optimized parameters were then updated in the model configuration. Simultaneously, the large-scale language model may also detect deviations in the hydrological runoff model's simulation of historical runoff, inferring that this might be due to unreasonable settings of watershed runoff parameters (e.g., the CN value in the SCS-CN model, or the water storage capacity parameter in the Xin'anjiang model). The large-scale language model will generate corresponding optimization instructions to automatically calibrate the runoff parameters with the objective of minimizing the RMSE between the simulated and historical runoff.

[0133] Task Strategy Optimization and Self-Learning: The large language model learned from this task that when user tasks involve "risk assessment," their underlying needs usually also include "time effect" analysis and "upstream hydrological response" analysis. The large language model uses the successful task decomposition logic (adding the sub-task of "extracting the peak arrival time") and positive user feedback as reinforcement learning signals to update its internal decision-making logic, enabling it to automatically incorporate time analysis and runoff analysis into the execution plan when handling similar tasks in the future.

[0134] S9: Output report.

[0135] After optimization, the large language model can drive the system to re-execute the task or directly generate the final report. The report summarizes the simulation results, risk list, and optimization process description in natural language, as shown in the attached document. Figure 5 As shown in the attached image. In response to new user needs, the system will supplement the specific arrival times of the flood peak at each key point. Future similar tasks will automatically include flood peak arrival time analysis. Figure 6 As shown.

Claims

1. A method for invoking and optimizing intelligent agents based on a mechanistic model of a large language model, characterized in that, The method is used for urban river flood simulation and risk assessment, and includes the following steps: A natural language task for simulating and assessing urban river floods and risks by receiving user input. The natural language task is semantically parsed using a large language model to identify the task objectives of flood evolution simulation and risk assessment, extract location, time, rainfall and output requirements, and decompose the natural language task into sub-tasks of data acquisition, model configuration, simulation calculation, result extraction and risk analysis. Based on the aforementioned atomic subtasks and combined with predefined mechanistic model agent metadata, the large language model is used to select hydrological runoff model agents and one-dimensional or two-dimensional hydrodynamic model agents as mechanistic model agents, as well as data acquisition agents and post-processing and risk analysis agents. Each mechanistic model agent encapsulates a mathematical model based on first principles and provides standardized input / output interfaces and functional description metadata. The hydrological runoff model agent encapsulates a hydrological runoff numerical model for calculating the runoff process of the basin based on basin rainfall and basin surface parameters. The one-dimensional or two-dimensional hydrodynamic model agent encapsulates a hydrodynamic numerical model based on the Saint-Venant equations for calculating the spatiotemporal distribution of water level, flow velocity, and flow rate based on river topography, roughness coefficient, initial conditions, and inflow boundary conditions. An execution plan is generated using the large language model. The execution plan includes the calling order of the selected agents, data flow, logic control, parallel or serial execution relationships, and conditional branches. It is defined that: the data acquisition agent acquires river topography data, rainfall data, and watershed surface parameters; the hydrological runoff model agent calculates the watershed runoff process using the rainfall data and watershed surface parameters; the watershed runoff process is used as the inflow boundary condition for the one-dimensional or two-dimensional hydrodynamic model agent; and the post-processing and risk analysis agent extracts water level extremes from the spatiotemporal distribution of the water level and determines the dike sections with overflow risk based on the water level extremes and the dike design elevation. The selected intelligent agent is driven to perform computational tasks according to the execution plan, and execution process data, execution result data and execution performance data are collected. The execution result data includes the watershed runoff process, the spatiotemporal distribution of water level, flow velocity and flow rate, and dike sections with overflow risk. Collect user feedback data; The large language model is used to analyze the execution process data, execution result data, execution performance data, and user feedback data to generate task execution performance evaluation results and optimization decision information. Based on the task execution performance evaluation results and optimization decision information, the internal parameters of at least one mechanistic model agent are optimized; wherein, the internal parameter optimization includes: when there is a systematic deviation between the simulated water level of a certain river segment output by the one-dimensional or two-dimensional hydrodynamic model agent and the historical measured data, an optimization instruction is generated using the large language model, the optimization instruction takes minimizing the root mean square error between the simulated water level of the certain river segment and the corresponding historical value in the historical measured data as the objective function, the roughness coefficient of the certain river segment as the optimization variable, and includes the physical value constraint of the roughness coefficient; triggering and executing the parameter optimization algorithm associated with the one-dimensional or two-dimensional hydrodynamic model agent, calibrating the roughness coefficient, and updating the optimized roughness coefficient to the model configuration of the one-dimensional or two-dimensional hydrodynamic model agent; After the roughness coefficient is updated, the task is re-executed using the large language model-driven system, and the execution result data after re-execution is obtained. The large language model is used to convert the execution result data, analysis results and optimization process information after re-execution into a natural language report and output it to the user.

2. The method according to claim 1, characterized in that, The execution performance data includes at least one of the following: computation time, resource consumption, convergence index, numerical stability index, parallel efficiency, or overall task completion time for each mechanism model agent. The user feedback data includes at least one of the following: result satisfaction rating, requests for correction of specific result items, evaluation of execution speed, or evaluation of report comprehensibility.

3. The method according to claim 1, characterized in that, The analysis of the execution process data, execution result data, execution performance data, and user feedback data using the large language model includes: Based on the execution performance data and execution process data, the computation time, resource consumption, convergence status or execution failure records of each mechanism model agent in the execution plan are evaluated to identify performance bottlenecks, error sources or potential optimization locations in the task execution process. Based on the deviation between the execution result data and the preset task objective, the calculation results of different mechanism model agents are compared and analyzed to evaluate the performance of each mechanism model agent and its contribution to the completion of the preset overall objective, and to generate task execution performance evaluation results. Based on the user feedback data, semantic understanding and intent recognition are performed to extract user requirements for improving task results, performance preferences, or additional analysis needs from the user feedback data, so as to obtain user demand information for generating optimization decision information.

4. The method according to claim 1, characterized in that, The optimization of the internal parameters of at least one mechanistic model agent includes: The error between the execution result data of the mechanism model intelligent agent and the preset reference data is calculated and quantified. The error measurement includes at least one of the following: absolute error, relative error, mean square error, root mean square error, mean absolute error, or coefficient of determination. Based on error measurement data, execution process data, and metadata of the mechanism model intelligent agent, the large language model is used to attribute errors and identify the set of internal parameters that need to be optimized. The large language model generates optimization instructions for the set of internal parameters, the optimization instructions including the optimization objective function, optimization variables, constraints and initialization suggestions; Trigger and execute the parameter optimization algorithm associated with the mechanism model agent to obtain new parameters, and write the new parameters back to the mechanism model agent.

5. The method according to claim 4, characterized in that, The error-based measurement data, execution process data, and metadata of the mechanism model agent are used to perform error attribution and identify the set of internal parameters that need to be optimized using the large language model, including the following three stages: Causal hypothesis generation stage: Error measurement data, execution process data, metadata of the mechanism model agent, and physical meaning descriptions of the internal parameters to be optimized are input into the large language model. The large language model then generates a set of causal hypotheses based on preset domain knowledge. Where G is the set of causal hypotheses; K is the total number of causal hypotheses generated by the large language model; each causal hypothesis... Indicates internal parameters This is the cause of the current error. ,in The m-th suspected internal parameter in the mechanistic model agent; the large language model simultaneously outputs the causal confidence score of each causal hypothesis. ;in, This represents the conditional probability estimation function, and context represents the complete contextual information including error metrics, execution process data, and metadata of the mechanistic model agent. The value reflects the self-evaluation probability of the large language model regarding the likelihood of the causal hypothesis being true based on domain knowledge. The closer the value is to 1, the more certain the large language model is that the suspected internal parameter is the main cause of the error. Confidence-guided validation sampling phase: for each internal parameter in the causal hypothesis set First, calculate the uncertainty measure of the normalized parameters, then calculate the verification priority: For internal parameters Within the preset value range The range of values ​​is divided into B intervals by equally spaced discrete sampling, where B is the preset number of discretization intervals. The frequency of each interval is statistically analyzed based on historical values ​​of internal parameters or prior distribution. , ,in Internal parameters The frequency of falling into the b-th interval, and satisfying ; Calculate the internal parameters Discrete sampling information entropy: ;in, For information entropy estimated based on discrete sampling, The intrinsic parameter reaches its maximum value when the frequency is equal across all intervals. The minimum value is 0 when the parameters are concentrated in a single interval; The discrete sampled information entropy is normalized to obtain a normalized parameter uncertainty measure: ;in, This is a measure of the uncertainty of the normalized parameters. The closer the value is to 1, the more uniform the distribution of the parameter within its range and the higher its uncertainty. The maximum information entropy when B intervals are uniformly distributed is used as the normalization denominator; Calculate the verification priority score for each internal parameter using the following verification priority formula: ;in, Internal parameters Verification priority score; As a balancing factor, it is used to adjust the relative weight between inference confidence and parameter uncertainty in large language models: when When the value is close to 1, the validation priority is determined by the causal confidence of the large language model; when... When the value is close to 0, the verification priority is determined by the uncertainty measure of the internal parameters; superscript and These are the power exponents of the corresponding terms, used to achieve geometric weighted fusion of the two information sources; Scoring based on verification priority From high to low, for internal parameters Apply small perturbation , ;in, To apply internal parameters The amount of disturbance on; The preset relative disturbance ratio is used to control the magnitude of the disturbance relative to the internal parameter itself. For each intrinsic parameter Calculate the normalized perturbation response ratio: ;in, Internal parameters The normalized perturbation response ratio, It reflects the relative change in error caused by internal parameter disturbances; This represents the absolute value of the error change after applying a positive disturbance. The absolute value of the baseline error before the disturbance is used as the normalization reference. when When determining internal parameters After significant verification, the process proceeds to the joint attribution quantification stage; among which... The preset significance threshold; when If the internal parameter is determined to have no significant impact on the current error, it will no longer participate in the joint attribution quantification stage. Joint attribution quantification stage: For internal parameters that have passed significance verification, first calculate the normalized numerical sensitivity, and then calculate the joint attribution score based on it. For each internal parameter that passed the significance test Calculate the normalized numerical sensitivity: ;in, Internal parameters Normalized numerical sensitivity, ; For internal parameters The absolute value of the ratio of the observed change in error after applying a perturbation to the amount of perturbation; The maximum absolute value of the original numerical sensitivity among all verified internal parameters is used as the normalization denominator, so that the internal parameter with the highest sensitivity is set to 1, and the remaining internal parameters are scaled proportionally to the interval [0, 1]. Calculate the joint attribution score for each internal parameter using the following joint attribution score formula: ;in, Internal parameters The joint attribution score, The higher the value, the greater the contribution of the internal parameter to the current error, and the more it should be included in the set of internal parameters that need to be optimized. To normalize the numerical sensitivity, ; This represents the causal confidence score output by the large language model during the causal hypothesis generation stage. ; For user feedback data and internal parameters The semantic relevance between them ; Feedback data provided to users includes result satisfaction ratings and requests for corrections to specific result items; As a balancing factor, it is dynamically determined by the large language model based on the sufficiency of the current data: when the results of the significance verification are sufficiently reliable, Choose a higher value to emphasize the sensitivity of the normalized values; when numerical data is insufficient or there is a lot of noise. Lower values ​​are chosen to rely more on the reasoning and judgment of the large language model and user feedback; Joint attribution score Sort by size from largest to smallest, and select the top-ranked items. The intrinsic parameters of the bits are determined as the set of intrinsic parameters to be optimized, where The upper limit of the number of optimization parameters is preset and is adaptively determined by the large language model based on the distribution characteristics of the joint attribution score.

6. The method according to claim 5, characterized in that, The causal hypothesis generation stage also includes: The large language model generates each causal hypothesis. At the same time, a corresponding inference chain text is generated. The inference chain text records the step-by-step reasoning process from error phenomenon to parameter attribution, including the physical laws on which it is based, the causal transmission path between parameters, and the reasoning basis for excluding other parameters. The causal confidence is verified using the inference chain text: the large language model performs an overall quality assessment of the inference chain text and outputs the inference chain verification coefficient. The evaluation is based on the following criterion: when the reasoning steps in the reasoning chain text are consistent with known physical laws and logically coherent, The value is close to 1; when there are logical jumps, insufficient evidence, or contradictions with known physical laws in the reasoning chain, The value is close to 0; The causal confidence score is corrected using the inference chain verification coefficients to obtain the corrected causal confidence score: ;in, The corrected causal confidence level. ; The causal confidence score output by the large language model during the causal hypothesis generation phase; This is the inference chain verification coefficient; when the inference chain quality is high... When the value is close to 1, the corrected causal confidence remains unchanged; however, when there are serious flaws in the reasoning chain... As the value approaches zero, the corrected causal confidence level decreases.

7. The method according to claim 4, characterized in that, The parameter optimization algorithm includes at least one of the following: Gradient-based optimization algorithms include gradient descent and stochastic gradient descent. Derivative-free optimization algorithms, including particle swarm optimization and covariance matrix adaptive evolution strategy; Constrained optimization algorithms include sequential quadratic programming, interior point method, and augmented Lagrange method; When the objective function is not differentiable or contains noise, the derivative-free optimization algorithm is preferred.

8. The method according to claim 4, characterized in that, The optimization of the internal parameters of at least one mechanistic model agent also includes: When the execution result data, reference data, or user feedback data are insufficient to define or evaluate the optimization objective function, the large language model is used to generate synthetic data or simulated scene generation instructions for parameter optimization. Based on the synthetic data or simulated scene generation instructions, synthetic data or simulated scenes are automatically generated, and the synthetic data or simulated scenes are incorporated into the optimization objective function to construct an enhanced objective function. The enhanced objective function is then used to drive the parameter optimization algorithm to optimize the internal parameters.

9. The method according to claim 1, characterized in that, The method further includes optimizing the strategy for generating the execution plan from the large language model, wherein optimizing the strategy for generating the execution plan from the large language model includes: The user feedback data, execution process data, and execution performance data are used to construct feedback signals or training data. Based on the feedback signals or training data, reinforcement learning, supervised fine-tuning, or cue word engineering optimization methods are used to update the decision logic of the large language model to generate the execution plan. The update of the decision logic includes at least one of the following: adjusting the model parameters of the large language model; optimizing the prompt template used to guide the generation of the execution plan; and updating the knowledge base about the performance or applicable scenarios of the mechanism model agent.

10. The method according to claim 9, characterized in that, The optimization of the strategy for generating the execution plan from the large language model also includes: The large language model is used to analyze cases of execution failure or poor performance, identify erroneous decision points in the execution plan, and generate targeted training samples or correction instructions for policy optimization, serving as a data source for reinforcement learning, supervised fine-tuning, or cue word engineering optimization.

11. A mechanism model-based intelligent agent invocation and optimization system based on a large language model, characterized in that, include: A natural language interaction interface is used to receive user input for a natural language task of urban river flood simulation and risk assessment and to present a natural language report. The large language model engine is used to perform semantic parsing on the natural language task, identify the task objectives of flood evolution simulation and risk assessment, extract location, time, rainfall and output requirements, decompose the natural language task into atomic subtasks of data acquisition, model configuration, simulation calculation, result extraction and risk analysis, select hydrological runoff model agent, one-dimensional or two-dimensional hydrodynamic model agent, data acquisition agent and post-processing and risk analysis agent based on the atomic subtasks and predefined mechanism model agent metadata, generate execution plans, and perform data analysis and optimization decisions. A mechanism model intelligence agent library is used to store multiple mechanism model intelligence agents encapsulated with mathematical models based on first principles of physics, and to provide standardized input / output interfaces and metadata descriptions for each mechanism model intelligence agent. These multiple mechanism model intelligence agents include hydrological runoff model intelligence agents and one-dimensional or two-dimensional hydrodynamic model intelligence agents. The library also stores data acquisition intelligence agents and post-processing and risk analysis intelligence agents. The hydrological runoff model intelligence agent encapsulates a hydrological runoff numerical model for calculating watershed runoff processes based on watershed rainfall and watershed surface parameters. The one-dimensional or two-dimensional hydrodynamic model intelligence agent encapsulates a hydrodynamic numerical model based on the Saint-Venant equations for calculating the spatiotemporal distribution of water level, velocity, and flow rate based on river topography, roughness coefficient, initial conditions, and inflow boundary conditions. An execution engine is used to load and execute the execution plan generated by the large language model engine, schedule the operation of the mechanism model agent, the data acquisition agent, and the post-processing and risk analysis agent, and manage the data flow. The data acquisition agent acquires river topography data, rainfall data, and watershed surface parameters. The hydrological runoff model agent uses the rainfall data and watershed surface parameters to calculate the watershed runoff process, which serves as the inflow boundary condition for the one-dimensional or two-dimensional hydrodynamic model agent. The post-processing and risk analysis agent extracts water level extremes from the spatiotemporal distribution of the water level and determines the levee sections with overflow risk based on the water level extremes and the levee design elevation. The data collection module is used to collect execution process data, execution result data, execution performance data and user feedback data during execution. The execution result data includes the watershed runoff process, the spatiotemporal distribution of water level, flow velocity and flow rate, and dike sections with overflow risk. An optimization engine, communicatively connected to the large language model engine, data collection module, and mechanism model intelligence agent library, is used to call the large language model engine to analyze the collected data. When there is a systematic deviation between the simulated water level of a certain river segment output by the one-dimensional or two-dimensional hydrodynamic model intelligence agent and the historical measured data, the large language model engine is invoked to generate an optimization instruction. The optimization instruction takes minimizing the root mean square error between the simulated water level of the certain river segment and the corresponding historical value in the historical measured data as the objective function, the roughness coefficient of the certain river segment as the optimization variable, and includes the physical value constraint of the roughness coefficient. The optimization engine triggers and executes the parameter optimization algorithm associated with the one-dimensional or two-dimensional hydrodynamic model intelligence agent to calibrate the roughness coefficient and update the optimized roughness coefficient to the model configuration of the one-dimensional or two-dimensional hydrodynamic model intelligence agent. The large language model engine is also used to drive the execution engine to re-execute the execution plan after the roughness coefficient is updated, so as to obtain the execution result data after re-execution.

12. The system according to claim 11, characterized in that, The mechanism model agent library also includes an algorithm adaptive learning library, which records historical performance metadata of different models and algorithms in various task scenarios. The historical performance metadata includes convergence speed, stability, accuracy, and computational cost. The large language model engine uses the algorithm adaptive learning library for reference matching when selecting agents, switching models, or suggesting numerical parameters. Furthermore, the large language model engine supports parallel or distributed scheduling, dynamic adjustment of grid resolution, and numerical stability monitoring.