Large model cue word optimization method and system oriented to domain tool call conflict
By generating structured semantic representations and performing conflict diagnosis, the structure set of prompt words was optimized, which solved the conflict problem in the collaborative execution of multiple tools and improved the accuracy and stability of task execution.
Patent Information
- Application Number
- CN202610185362.5
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2026-02-09
- Publication Date
- 2026-05-08
AI Technical Summary
Existing technologies cannot effectively identify and coordinate conflicts arising from the collaborative execution of multiple tools, leading to task interruptions or failures, especially in complex task scenarios, and cannot guarantee the accuracy and stability of task execution.
By acquiring natural language commands input by users and their associated contextual metadata, a structured semantic representation is generated. Candidate tools are identified and structured conflict diagnosis data is generated. Based on the conflict diagnosis data, processing priorities and coordination strategies are determined. An optimized set of prompt words is generated, and semantic rewriting, intent decomposition, parameter completion, and call order adjustment are performed. A standardized call request is constructed, and finally, call response data is received and analyzed to adjust the coordination strategy.
It effectively alleviates the problem of conflicting prompt words in multi-tool calls and improves the accuracy of system calls and scheduling stability in complex task scenarios.
Smart Images

Figure CN121997942A_ABST
Abstract
Description
Technical Field
[0001] This invention relates to a method and system for optimizing prompt words in large models to address domain tool invocation conflicts, belonging to the field of artificial intelligence and natural language processing technology. Background Technology
[0002] With the continuous development of natural language processing technology driven by large language models, intelligent systems are gradually acquiring the ability to collaborate across tools when performing complex tasks. In application scenarios such as AI assistants, automated process scheduling, and tool-enhanced models, systems rely on natural language prompts to guide the model to select and invoke external tools to complete sub-tasks such as searching, computing, and analysis. However, in multi-tool collaborative scenarios, functional overlap, interface differences, and state dependencies between tools often lead to invocation conflicts, resulting in stability issues such as reduced task execution efficiency and process interruptions. Therefore, prompts are no longer merely carriers of language input but have become core control elements in multi-tool scheduling, and their optimization capabilities have become a key factor influencing system performance.
[0003] Existing prompt word design methods are mostly based on static templates, rule matching, or manual construction, making it difficult to handle dynamic task changes and multi-tool combinations. During multi-tool invocation, the following typical conflicts often arise: First, target function ambiguity conflicts, where the semantics of user commands can be mapped to the functions of multiple candidate tools, making it impossible for the system to uniquely determine the tool to invoke. This stems from the non-unique mapping between the ambiguity of user natural language expression and the tool function definition. Second, parameter field conflicts, where different tool interfaces contain parameters with the same name but inconsistent technical attributes such as data type, value range, or business meaning. Failure to effectively distinguish these can lead to data mismatch or execution errors. Third, inconsistent invocation contexts, where some tools have pre-dependent dependencies, requiring a specific system state or completion of preceding tasks before invocation, and the prompt word generation logic fails to meet these preconditions. These conflicts can not only lead to incorrect tool selection but also cause system logic chaos and execution delays, severely impacting the overall task completion.
[0004] Although existing methods have introduced tool capability descriptions or function signature hints to improve the structure of the hint words generated, these methods mainly focus on improving the compatibility between user commands and single tools. They fail to effectively identify and coordinate conflicts that arise during the collaborative execution of multiple tools. Especially in the case of complex tasks, they cannot guarantee the timely identification and dynamic adjustment of conflicts, thereby affecting the accuracy and stability of task execution and leading to task interruption or failure. Summary of the Invention
[0005] The purpose of this invention is to provide a method and system for optimizing large-scale prompt words to address conflicts in domain tool invocation, in order to solve the problem that the current methods cannot effectively identify and coordinate conflicts that arise during the collaborative execution of multiple tools, leading to task interruption or failure.
[0006] To address the aforementioned technical problems, this invention provides a method for optimizing large model prompts to resolve domain tool invocation conflicts. This optimization method includes:
[0007] 1) Obtain the natural language instructions input by the user and their associated contextual meta-information, and generate a structured semantic representation;
[0008] 2) Identify candidate tools based on the structured semantic representation, and identify and generate structured conflict diagnosis data containing conflict type, conflict field position and semantic difference information based on the functional intent, parameter interface and calling preconditions of the candidate tools;
[0009] 3) Determine the processing priority and coordination strategy to be executed based on the structured conflict diagnosis data, and perform at least one operation including semantic rewriting, intent decomposition, parameter completion and call order adjustment according to the coordination strategy to generate an optimized prompt word structure set;
[0010] 4) Input the optimized prompt word structure set into the tool call interface, construct and execute a standardized call request containing the target tool identifier, parameter filling content and operation order.
[0011] Furthermore, the method also includes receiving call response data containing call status and processing results after receiving a standardized call request, analyzing the call response data containing call status and processing results, evaluating the effectiveness of the determined coordination strategy based on the analysis results, and adjusting the parameters of the coordination strategy based on the evaluation results.
[0012] Furthermore, the structured conflict diagnosis data generation process in step 2) includes:
[0013] Semantic encoding is performed on the operation intent, target entity, and context parameter fields in the structured semantic representation to generate user instruction semantic vectors; the function tags, parameter interface definitions, and call context dependencies of each tool in the candidate tool set are extracted to construct the semantic vectors of each tool; and the candidate tools are identified by semantic matching between the user instruction semantic vectors and the semantic vectors of each tool.
[0014] Diagnose candidate tools for functional conflicts, parameter conflicts, and context conflicts. Functional conflicts refer to the similarity between the current tool and the candidate tool exceeding a set threshold. Parameter conflicts refer to the two candidate tools having similar parameter field names but inconsistent types, or missing or conflicting parameters. Context conflicts refer to the current environment not meeting the context conditions required for the candidate tool to execute.
[0015] The detected target function conflicts, parameter conflicts, and context conflicts are organized into structured conflict diagnostic data. The structured conflict diagnostic data includes conflict type, conflict field location, involved tool identifier, similarity value, parameter difference measure, context precondition satisfaction rate, and semantic deviation description.
[0016] Furthermore, the generation of the optimized prompt word structure set includes:
[0017] The structured conflict diagnostic data are quantitatively evaluated to generate evaluation values that characterize the severity of the conflict. The scoring function used in the quantitative evaluation includes target function conflict measure, parametric conflict measure and contextual conflict measure.
[0018] Set up a set of coordination strategies and select coordination strategies by at least one of the following methods: filtering by conflict severity, matching by conflict type, and prioritizing each strategy or strategy combination based on historical success rate, execution cost, and user feedback.
[0019] The prompt word structure is optimized based on the selected coordination strategy to obtain the optimized prompt word structure set.
[0020] Furthermore, the set of coordination strategies includes some or all of semantic rewriting, parameter completion, intent decomposition, and order adjustment;
[0021] The selected coordination strategy performs optimization processing on the prompt word structure, including: semantic rewriting to correct the semantic expression of conflicting fields to resolve functional ambiguity; parameter completion to fill in or infer missing fields to ensure call integrity; intent decomposition to parse compound instructions into atomic task units; order adjustment to reconstruct call paths that conform to dependencies; and combining multiple strategies when conflicts involve multiple dimensions.
[0022] Furthermore, the method also includes a completeness verification of the optimized prompt word structure set, which includes semantic consistency verification, uniqueness verification, and model adaptability verification. Semantic consistency verification is used to confirm that the optimized prompt word structure is consistent with the user's original intent; uniqueness verification is used to ensure that the output corresponds to only one tool call path to avoid ambiguity or polysemy; and model adaptability verification is used to check whether the parameter type, field constraints, and protocol format meet the interface requirements of the target tool.
[0023] Furthermore, step 4) also includes:
[0024] The coordinated and optimized prompt word structure set is input into the language model interface to generate a standardized call request containing target tool identifier, parameter filling content and operation sequence information;
[0025] The standardized call request is converted into a communication protocol format adapted to the target tool, and a cross-platform call request is constructed.
[0026] Execute the call request and obtain the response data generated after the call request is executed, which includes the call status identifier, processing result data and response time.
[0027] Furthermore, when a preset exception type occurs during the call, a rollback mechanism is triggered. The rollback mechanism includes at least one of executing a backup tool call, rewriting the prompt word to generate a new call request, or re-initiating the original request.
[0028] Furthermore, the adjustment of coordination strategy parameters includes:
[0029] Obtain user feedback information and call response data. The user feedback information includes user satisfaction ratings for the call results, records of manual corrections of prompt words, and some or all of the tool selection preferences. The tool call result data includes some or all of the call success rate, task completion status, response time, and anomaly frequency.
[0030] The system performs structured encoding and feature extraction on user feedback information and call response data to generate an evaluation matrix for the optimization effect of prompt words.
[0031] The obtained prompt word optimization effect evaluation matrix is compared with the historical strategy baseline to identify coordination strategies with degraded performance or insufficient robustness, and strategy optimization suggestions are output according to preset rules or trained models.
[0032] Based on the strategy optimization suggestions, the strategy parameters are adjusted. Reinforcement learning, self-supervised learning, or heuristic optimization algorithms are used to update the rule configuration, parameter weights, and template priorities in the strategy library to generate a new coordination strategy.
[0033] This invention also provides a large model prompt word optimization system for domain tool call conflicts, including a processor. The processor is used to execute a corresponding calculation program to implement the large model prompt word optimization method for domain tool call conflicts described in this invention. The optimization method includes:
[0034] 1) Obtain the natural language instructions input by the user and their associated contextual meta-information, and generate a structured semantic representation;
[0035] 2) Identify candidate tools based on the structured semantic representation, and identify and generate structured conflict diagnosis data containing conflict type, conflict field position and semantic difference information based on the functional intent, parameter interface and calling preconditions of the candidate tools;
[0036] 3) Determine the processing priority and coordination strategy to be executed based on the structured conflict diagnosis data, and perform at least one operation including semantic rewriting, intent decomposition, parameter completion and call order adjustment according to the coordination strategy to generate an optimized prompt word structure set;
[0037] 4) Input the optimized prompt word structure set into the tool call interface, construct and execute a standardized call request containing the target tool identifier, parameter filling content and operation order.
[0038] Furthermore, the method also includes receiving call response data containing call status and processing results after receiving a standardized call request, analyzing the call response data containing call status and processing results, evaluating the effectiveness of the determined coordination strategy based on the analysis results, and adjusting the parameters of the coordination strategy based on the evaluation results.
[0039] Furthermore, the structured conflict diagnosis data generation process in step 2) includes:
[0040] Semantic encoding is performed on the operation intent, target entity, and context parameter fields in the structured semantic representation to generate user instruction semantic vectors; the function tags, parameter interface definitions, and call context dependencies of each tool in the candidate tool set are extracted to construct the semantic vectors of each tool; and the candidate tools are identified by semantic matching between the user instruction semantic vectors and the semantic vectors of each tool.
[0041] Diagnose candidate tools for functional conflicts, parameter conflicts, and context conflicts. Functional conflicts refer to the similarity between the current tool and the candidate tool exceeding a set threshold. Parameter conflicts refer to the two candidate tools having similar parameter field names but inconsistent types, or missing or conflicting parameters. Context conflicts refer to the current environment not meeting the context conditions required for the candidate tool to execute.
[0042] The detected target function conflicts, parameter conflicts, and context conflicts are organized into structured conflict diagnostic data. The structured conflict diagnostic data includes conflict type, conflict field location, involved tool identifier, similarity value, parameter difference measure, context precondition satisfaction rate, and semantic deviation description.
[0043] Furthermore, the generation of the optimized prompt word structure set includes:
[0044] The structured conflict diagnostic data are quantitatively evaluated to generate evaluation values that characterize the severity of the conflict. The scoring function used in the quantitative evaluation includes target function conflict measure, parametric conflict measure and contextual conflict measure.
[0045] Set up a set of coordination strategies and select coordination strategies by at least one of the following methods: filtering by conflict severity, matching by conflict type, and prioritizing each strategy or strategy combination based on historical success rate, execution cost, and user feedback.
[0046] The prompt word structure is optimized based on the selected coordination strategy to obtain the optimized prompt word structure set.
[0047] Furthermore, the set of coordination strategies includes some or all of semantic rewriting, parameter completion, intent decomposition, and order adjustment;
[0048] The selected coordination strategy performs optimization processing on the prompt word structure, including: semantic rewriting to correct the semantic expression of conflicting fields to resolve functional ambiguity; parameter completion to fill in or infer missing fields to ensure call integrity; intent decomposition to parse compound instructions into atomic task units; order adjustment to reconstruct call paths that conform to dependencies; and combining multiple strategies when conflicts involve multiple dimensions.
[0049] Furthermore, the method also includes a completeness verification of the optimized prompt word structure set, which includes semantic consistency verification, uniqueness verification, and model adaptability verification. Semantic consistency verification is used to confirm that the optimized prompt word structure is consistent with the user's original intent; uniqueness verification is used to ensure that the output corresponds to only one tool call path to avoid ambiguity or polysemy; and model adaptability verification is used to check whether the parameter type, field constraints, and protocol format meet the interface requirements of the target tool.
[0050] Furthermore, step 4) also includes:
[0051] The coordinated and optimized prompt word structure set is input into the language model interface to generate a standardized call request containing target tool identifier, parameter filling content and operation sequence information;
[0052] The standardized call request is converted into a communication protocol format adapted to the target tool, and a cross-platform call request is constructed.
[0053] Execute the call request and obtain the response data generated after the call request is executed, which includes the call status identifier, processing result data and response time.
[0054] Furthermore, when a preset exception type occurs during the call, a rollback mechanism is triggered. The rollback mechanism includes at least one of executing a backup tool call, rewriting the prompt word to generate a new call request, or re-initiating the original request.
[0055] Furthermore, the adjustment of coordination strategy parameters includes:
[0056] Obtain user feedback information and call response data. The user feedback information includes user satisfaction ratings for the call results, records of manual corrections of prompt words, and some or all of the tool selection preferences. The tool call result data includes some or all of the call success rate, task completion status, response time, and anomaly frequency.
[0057] The system performs structured encoding and feature extraction on user feedback information and call response data to generate an evaluation matrix for the optimization effect of prompt words.
[0058] The obtained prompt word optimization effect evaluation matrix is compared with the historical strategy baseline to identify coordination strategies with degraded performance or insufficient robustness, and strategy optimization suggestions are output according to preset rules or trained models.
[0059] Based on the strategy optimization suggestions, the strategy parameters are adjusted. Reinforcement learning, self-supervised learning, or heuristic optimization algorithms are used to update the rule configuration, parameter weights, and template priorities in the strategy library to generate a new coordination strategy.
[0060] The beneficial effects of this invention are as follows: This invention generates a structured semantic representation by semantically parsing user natural language commands, and performs conflict diagnosis from different dimensions based on this structured semantic representation to obtain structured conflict diagnosis information. Then, it determines the processing priority and coordination strategy to be executed based on the conflict diagnosis information, and generates an optimized prompt word structure set based on the coordination strategy. Finally, it inputs the optimized prompt word structure set into the tool invocation interface, constructs and executes a standardized invocation request containing the target tool identifier, parameter filling content, and operation order, and invokes the tool according to the standardized invocation request. Therefore, this invention can generate an optimized prompt word structure set based on the conflict diagnosis results, effectively alleviating the prompt word conflict problem in multi-tool invocation and improving the invocation accuracy and scheduling stability of the system in complex task scenarios. Attached Figure Description
[0061] Figure 1 This is the overall flowchart of the large model prompt word optimization method for domain tool call conflicts of the present invention;
[0062] Figure 2 This is a schematic diagram of the structure of the large model prompt word optimization system for domain tool call conflicts according to the present invention;
[0063] Figure 3 This is a flowchart of the conflict detection process in the large model prompt word optimization method for domain tool call conflicts in this invention;
[0064] Figure 4 This is a flowchart of the prompt word coordination process in the large model prompt word optimization method for domain tool call conflicts in this invention. Detailed Implementation
[0065] The specific embodiments of the present invention will be further described below with reference to the accompanying drawings.
[0066] This invention generates structured semantic representations by semantically parsing user natural language commands. Based on these representations, it performs conflict diagnosis from different dimensions to obtain structured conflict diagnosis information. Then, it determines the processing priority and coordination strategy to be executed based on the conflict diagnosis information, and generates an optimized prompt word structure set according to the coordination strategy. Finally, it inputs the optimized prompt word structure set into the tool invocation interface to construct and execute a standardized invocation request containing the target tool identifier, parameter filling content, and operation sequence, and invokes the tool according to the standardized invocation request. This invention effectively alleviates the prompt word conflict problem in multi-tool invocation and improves the invocation accuracy and scheduling stability of the system in complex task scenarios (such as shipborne aircraft deck task coordination and multi-link linkage in the supply chain).
[0067] Implementation of a Large Model Hint Optimization Method for Domain-Specific Tool Invocation Conflicts
[0068] This invention first acquires the natural language commands input by the user and their associated contextual metadata, and generates a structured semantic representation. Then, it identifies candidate tools based on the structured semantic representation, and generates structured conflict diagnostic data containing conflict type, conflict field position, and semantic difference information based on the candidate tools' functional intent, parameter interface, and pre-call conditions. Next, it determines the processing priority and coordination strategy to be executed based on the structured conflict diagnostic data, and performs at least one operation, including semantic rewriting, intent decomposition, parameter completion, and call order adjustment, according to the coordination strategy, generating an optimized prompt word structure set. The optimized prompt word structure set is input to the tool call interface to construct and execute a standardized call request containing the target tool identifier, parameter filling content, and operation order. Finally, it receives call response data containing the call status and processing result, analyzes the call response data, evaluates the effectiveness of the determined coordination strategy based on the analysis results, and adjusts the parameters of the coordination strategy based on the evaluation results. The implementation principle of this method is as follows: Figure 1 As shown below, a detailed explanation will follow.
[0069] Step S1: Obtain the natural language instructions input by the user and their associated contextual metadata, and generate a structured semantic representation.
[0070] Contextual metadata refers to additional information related to the natural language commands input by the user, including but not limited to task background, historical dialogue content, the user's previous behavior records, and other auxiliary information that helps understand the user's intent. Through this contextual information, user needs can be parsed more accurately, more precise structured semantic representations can be generated, and prompt word conflicts can be better identified and resolved in multi-tool calls. The implementation of this step specifically includes:
[0071] S11. Receive natural language instructions input by the user and contextual meta-information including timestamps, user identifiers, historical session content and session topic annotations, and normalize the natural language instructions to obtain standardized input text.
[0072] S12. Perform semantic parsing on the acquired standardized input text to extract operation verbs, target entities and context parameters to form a set of semantic elements;
[0073] S13. Construct a structured semantic representation based on the formed set of semantic elements, wherein the structured semantic representation includes the operation intent type, target entity identifier and context parameter structure.
[0074] Step S2: Identify candidate tools based on structured semantic representation, and generate structured conflict diagnostic data containing conflict type, conflict field location, and semantic difference information based on the functional intent, parameter interface, and pre-call conditions of the candidate tools. Specifically, this step is implemented as follows: Figure 3 As shown, the process includes the following:
[0075] S21. Semantically encode the operation intent, target entity, and context parameter fields in the structured semantic representation to generate a user instruction semantic vector; extract the function label, interface parameter definition, and call context dependency conditions of each tool in the candidate tool set, and construct the function semantic vector, parameter field set, and context condition set respectively; perform semantic matching between the user instruction semantic vector and the semantic vector of each tool to form a candidate tool semantic structure set;
[0076] S22. Perform functional conflict diagnosis: For the input natural language command, generate a semantic task representation using a semantic encoding model (such as a large language model or a dedicated semantic encoder), and calculate the similarity between this representation and the functional description vectors of each tool in the tool capability library. If the similarity exceeds a set threshold, it is determined that there may be a functional conflict. The functional conflict metric used in this implementation is defined as follows:
[0077]
[0078] in, The maximum semantic similarity between the current tool and the candidate tools. This is the functional conflict threshold. This metric is normalized to the [0,1] interval and is used to represent the degree of overlap in functional semantics between tools. The output includes: functional similarity value, markers that exceed the threshold, and conflict metric value.
[0079] S23. Parameter Conflict Diagnosis: For the parameter sets required by candidate tools, calculate the semantic overlap, type consistency, and constraint differences between parameter sets. If two candidate tools have parameter field names that are similar but have inconsistent types, or if parameters are missing or conflicting, it is judged as a parameter conflict. The parameter conflict metric is defined as follows:
[0080]
[0081] in, This indicates the percentage of semantic overlap in the parameter fields. The penalty coefficient for inconsistent types is represented, and the result is normalized to obtain the parameter conflict measure in the interval [0,1].
[0082] S24. Context Conflict Diagnosis: For the context conditions (such as prior state, data dependencies, permission requirements, etc.) required for the execution of candidate tools, calculate their satisfaction in the current environment. In this implementation, the context conflict metric is defined as:
[0083]
[0084] in, The set of conditions required for the tool to execute. The result is the set of conditions that have been met. It is also normalized to the interval [0,1]. The output includes: the set of required conditions, the set of met conditions, the satisfaction rate, and the context conflict measure.
[0085] S25. Organize the conflict metrics and raw indicators detected in S22-S24 into unified structured diagnostic data. This data includes conflict type, conflict field location, involved tool identifiers, semantic deviation description, similarity values, parameter difference metrics, and contextual precondition satisfaction rate. The semantic deviation description is generated from the raw metrics and can be implemented using template-based filling or controlled natural language generation to facilitate user and system understanding. Examples include: functional similarity values, parameter field overlap, data type inconsistencies, and missing contextual conditions. These raw indicators are transformed into human-readable text descriptions, which constitute the "semantic deviation description." The conflict impact level is not directly given in this step but will be calculated and confirmed uniformly during the conflict quantification process in S31.
[0086] The structured conflict diagnostic data output in this step serves as input to the prompt word coordination module, supporting subsequent prompt word structure optimization and tool path selection adjustments.
[0087] S3. Based on the structured conflict diagnosis data, determine its processing priority and the coordination strategy to be executed, and perform at least one operation according to the coordination strategy, including semantic rewriting, intent decomposition, parameter completion, and call order adjustment, to generate an optimized prompt word structure set. Specifically, as follows: Figure 4 As shown, the specific implementation process is as follows:
[0088] S31. Based on the structured conflict diagnosis data, a conflict feature vector is constructed and quantitatively evaluated to generate an evaluation value characterizing the severity of the conflict. The scoring function used for this evaluation value comprehensively considers functional conflict measures. Parameter conflict measurement Context conflict measurement Specifically:
[0089]
[0090] in, , , The weighting coefficients for function, parameters, and context conflict are respectively, satisfying... The weighting coefficients can be set based on the conflict category, the importance of the conflict field in the user command structure, and the sensitivity to contextual dependencies, and can also be dynamically adjusted based on historical call results and feedback information. The scoring results are normalized to the [0,1] interval and mapped to three levels: mild, moderate, and severe, serving as input for subsequent coordination strategy selection.
[0091] S32. Set up a set of coordination strategies ,in, For semantic rewriting, To complete the parameters, Intended to dismantle, For order adjustment, strategy selection includes the following steps:
[0092] Level selection: Based on the rating level of S31, a set of candidate strategies is determined. For minor conflicts, parameter completion is preferred; for moderate conflicts, parameter completion and order adjustment are preferred; and for severe conflicts, semantic rewriting, intent decomposition, and multi-strategy combination are used.
[0093] Type matching: In the candidate set, a priority strategy is determined according to the conflict type. For functional conflicts, semantic rewriting and intent decomposition are preferred; for parameter conflicts, parameter completion is preferred; and for context conflicts, order adjustment is preferred.
[0094] Prioritization: In the candidate strategy set, each strategy or strategy combination is prioritized based on historical success rate, execution cost, and user feedback. The expected utility value is calculated, and the optimal path is selected. The expected utility value is defined as the product of the strategy's success probability and expected return, minus the execution cost. The strategy success probability is obtained through weighted statistics of historical call data similarity, and the execution cost includes standardized indicators such as latency, resource consumption, and user intervention costs.
[0095] When none of the candidate strategies meet the preset utility threshold, a degradation mechanism or user confirmation is triggered to avoid erroneous decisions. In extended embodiments, the strategy set can be extended to advanced strategies such as alternative tool replacement, parallel invocation, or invocation of degradation to enhance the system's adaptability and robustness.
[0096] This step also selects the optimal strategy from a pre-defined set of coordination strategies based on the severity score output by S31. This set of coordination strategies is a versionable strategy library, containing strategy identifiers, applicable conditions, adjustable parameters, priority weights, and historical performance records. Updates to the strategy library include, but are not limited to: parameter adjustments (such as modifying weights or thresholds), adding or deleting strategies, and replacing strategy logic. Strategy updates can be triggered by performance degradation, input distribution drift, the introduction of new tools, or repeated failure modes. Triggering mechanisms can be implemented using rule-driven, supervised / reinforcement learning models, or multi-armed trials. All strategy library updates are versioned and support small-scale verification and automatic rollback to ensure the controllability and auditability of the strategy evolution process.
[0097] Detailed explanation:
[0098] The strategy library is continuously evolving, flexible, and scalable, and offers three operational modes:
[0099] ① Adjustment of numbers: Modify the weights, thresholds, and priorities of the strategy;
[0100] ② Addition / Removal Strategies: Introduce new strategies for new application scenarios, or remove invalid strategies;
[0101] ③ Replace or rewrite: Replace the original strategy with more advanced logic, such as replacing "static completion" with "contextual prediction completion".
[0102] S33. Based on the selected optimization strategy, perform corresponding processing on the prompt word structure. Semantic rewriting resolves ambiguity regarding the target function; intent decomposition parses compound instructions into atomic task units; parameter completion fills in missing necessary fields; and sequence adjustment reconstructs the call path to conform to tool dependencies. When conflicts involve multiple dimensions, multiple strategies can be combined. The results generated during strategy execution, including success status, execution time, resource consumption, and user feedback, are recorded and sent back to the strategy library to update the priority and weight of each strategy, thereby achieving adaptive optimization of the strategy set.
[0103] S34. Perform semantic consistency, uniqueness, and model adaptability verification on the optimized prompt word structure set generated after executing the coordination strategy to ensure that the output structure meets the tool call requirements.
[0104] ① Semantic consistency verification: Confirm that the optimized prompt word structure is consistent with the user's original intent;
[0105] ② Uniqueness verification: Ensure that the output corresponds to only one unique tool call path to avoid ambiguity or redundancy;
[0106] ③ Model compatibility verification: Check whether the parameter types, field constraints, and protocol formats meet the interface requirements of the target tool.
[0107] When the verification passes, the prompt word structure set is output and the tool invocation process begins; when the verification fails, a secondary optimization or rollback mechanism is triggered to ensure the stability and correctness of the system invocation.
[0108] S4. Input the optimized prompt word structure set into the tool invocation interface to construct and execute a standardized invocation request containing the target tool identifier, parameter filling content, and operation sequence. Specifically, this invention inputs the optimized prompt word structure set into the tool invocation interface to construct and execute a standardized invocation request containing the target tool identifier, parameter filling content, and operation sequence information, and receives invocation response data containing invocation status and processing results, including the following steps:
[0109] S41. Input the coordinated and optimized prompt word structure set into the language model interface to parse and generate a standardized call request containing the target tool identifier, parameter filling content and operation sequence information;
[0110] S42. Through a unified tool call middleware, standardized call requests are input to a unified interface adaptation and scheduling layer. This layer is responsible for adapting and format conversion according to the communication protocol requirements of the target tool, and executing cross-platform calls. At the same time, combined with the results of conflict diagnosis and strategy library, it supports parameter mapping, field completion, call order adjustment and backup tool triggering. After the call is completed, the original response results are uniformly encapsulated into standardized structured data for subsequent feedback and optimization.
[0111] Middleware is an "interface adaptation and call execution layer" between the system and tools. Generally, this layer only performs format / protocol conversion (e.g., ...). The innovation of this invention lies in the fact that this layer dynamically determines the invocation method by referring to the conflict diagnosis results (such as steps S25 and S31) and the strategy selection (such as step S32).
[0112] S43. Execute the call request and receive response data containing call status identifier, processing result data and response time, and structure and encode it for subsequent feedback and policy update;
[0113] S44. When a preset exception type occurs during the call process, such as timeout, parameter error, interface failure, etc., a rollback mechanism is triggered. The rollback mechanism includes at least one of executing a backup tool call, rewriting the prompt word to generate a new call request, or re-initiating the original request.
[0114] It should be noted that the specific triggering logic of the rollback mechanism can be configured according to the error type and task importance. For example, for non-critical tasks, the backup tool replacement can be prioritized; while in tasks requiring strong transactional consistency, the system tends to rewrite the warning message and initiate a second request. The above strategies can be flexibly adjusted through the priority configuration file or dynamically generated based on the task risk level.
[0115] S5. Receive call response data containing call status and processing results, analyze the call response data containing call status and processing results, evaluate the effectiveness of the determined coordination strategy based on the analysis results, and adjust the parameters of the coordination strategy based on the evaluation results.
[0116] Specifically, this invention collects the call response data and user feedback information, analyzes performance indicators across multiple dimensions including call success rate, user satisfaction, and task completion status, comprehensively evaluates the effectiveness of the coordination strategy for this call, and dynamically adjusts the parameters of the coordination strategy based on the evaluation results to achieve adaptive evolution of the coordination capability, including the following steps:
[0117] S51. Collect user feedback information and tool call result data as input for coordination strategy updates; the feedback information includes user satisfaction ratings for call results, manual correction records of prompt words, and tool selection preferences; the tool call result data includes call success rate, task completion status, response time, and anomaly frequency.
[0118] S52. Perform structured encoding and feature extraction operations on the feedback and call data to generate a prompt word optimization effect evaluation matrix; the matrix includes multiple performance indicator dimensions, including call success rate. User satisfaction rating Division of task completion status And so on; and based on the following comprehensive evaluation function, the execution effect of the strategy path is quantitatively evaluated, as shown in the following formula:
[0119]
[0120] in, , The weights of each item can be dynamically set according to the actual scenario;
[0121] S53. Based on the current evaluation matrix results and the historical strategy baseline, perform performance comparison analysis to identify coordination strategies with declining performance or insufficient robustness, and output strategy optimization suggestions according to preset rules or training models.
[0122] S54. Based on the optimization direction of the strategy, perform strategy parameter adjustment operations, and use reinforcement learning, self-supervised learning or heuristic optimization algorithms to update the rule configuration, parameter weights and template priorities in the strategy library to generate a new version of the coordination strategy.
[0123] It's important to note that reinforcement learning, self-supervised learning, and heuristic optimization algorithms each play a crucial role in the strategy parameter adjustment process: Reinforcement learning algorithms gradually optimize the strategy by simulating the reward and penalty mechanisms during task execution. After each task is completed, the system adjusts the strategy based on the task's outcome (such as task success rate, user satisfaction, etc.). For example, if the task is successfully completed, the system increases the weight of the corresponding strategy; if the task fails, the system reduces the weight of the strategy through a penalty mechanism, ultimately achieving automatic learning of the optimal strategy. Self-supervised learning methods learn from historical data, extracting key features and updating the strategy library. The system utilizes unlabeled historical task data to analyze which task parameter configurations and tool combinations have performed well in past executions, automatically identifying potential patterns. In this way, the system can reduce its reliance on manual annotation while ensuring continuous strategy optimization to adapt to changing task requirements. Heuristic optimization algorithms quickly adjust strategies using empirical rules. In complex task scenarios, the system uses heuristic algorithms to search the strategy library for the most suitable path, helping to quickly identify the optimal strategy configuration. For example, when choosing tool combinations and invocation order, heuristic algorithms infer the most effective strategy configuration based on historical experience and intuition, reducing computational complexity and improving system response speed.
[0124] Implementation of a Large Model Hint Optimization System for Domain-Specific Tool Invocation Conflicts
[0125] The present invention provides a large model prompt word optimization system for domain-specific tool call conflicts, comprising a processor for executing corresponding calculation programs to implement the large model prompt word optimization method for domain-specific tool call conflicts of the present invention. Figure 2 As shown, the system can also be divided into an instruction parsing module, a conflict detection module, a prompt word coordination module, a tool invocation module, and a strategy evolution module. The instruction parsing module receives natural language instructions and their contextual metadata from the user, and performs semantic parsing to generate a structured semantic representation. The conflict detection module identifies a set of candidate tools based on the structured semantic representation, and analyzes these candidate tools across three dimensions: functional intent, parameter interface, and preconditions for invocation, to generate structured conflict diagnostic data. The prompt word coordination module matches and executes corresponding coordination strategies, including semantic rewriting, intent decomposition, parameter completion, and invocation order adjustment, based on the structured conflict diagnostic data to generate an optimized prompt word structure set. The tool invocation module converts the optimized prompt word structure set into a standardized invocation request, executes the request to interact with external tools, and receives invocation response data. The strategy evolution module collects tool invocation results and user feedback information, constructs and evaluates a strategy evaluation model that includes invocation success rate, task completion status, and user satisfaction, and dynamically updates the parameters of the coordination strategy.
[0126] It should be noted that the various modules of the system interact through standardized intermediate data structures to ensure semantic consistency and decoupling of invocation. For example, structured semantic representation serves as input to the conflict detection module, while conflict diagnosis data is the data source upon which the prompt word coordination module relies. This modular design facilitates flexible system expansion and independent debugging. Through collaborative cooperation, the various modules of this system can implement the large-model prompt word optimization method for domain-oriented tool invocation conflicts of this invention. The implementation principle is as follows: Figure 1 As shown, the specific steps include:
[0127] 1. Receive natural language instructions and their associated contextual metadata from the user, perform semantic parsing on the natural language instructions to extract the operation verbs, target entities and contextual parameters, and generate a structured semantic representation based on the extracted elements.
[0128] 2. Based on the generated structured semantic representation, a set of candidate tools are identified, and compatibility and explicitness analysis is performed on the candidate tools in three dimensions: functional intent, parameter interface, and preconditions for invocation, in order to identify and generate structured conflict diagnostic data containing conflict type, conflict field location, and semantic difference information.
[0129] 3. Based on structured conflict diagnostic data, comprehensively evaluate the type, scope of impact and context sensitivity of the identified conflicts to determine their processing priority and coordination strategy to be executed. According to the determined coordination strategy, perform at least one operation including semantic rewriting, intent decomposition, parameter completion and call order adjustment to generate an optimized prompt word structure set.
[0130] 4. Input the optimized prompt word structure set into the tool call interface to construct and execute a standardized call request containing the target tool identifier, parameter filling content and operation sequence information, and receive call response data containing call status and processing results.
[0131] 5. Collect call response data and user feedback information. By analyzing performance indicators from multiple dimensions, including call success rate, user satisfaction, and task completion status, comprehensively evaluate the effectiveness of the coordination strategy for this call. Based on the evaluation results, dynamically adjust the parameters of the coordination strategy to achieve adaptive evolution of coordination capabilities.
[0132] To better illustrate the effects of the present invention, the solution of the present invention will first be applied to specific scenarios. The solution of the present invention will be described below with two different application scenario examples.
[0133] Example 1: Carrier-based aircraft deck operation scheduling scenario
[0134] In this example, the user enters a natural language command: "Please execute the takeoff formation plan for the next batch of carrier-based aircraft and arrange the corresponding refueling and ammunition loading sequence."
[0135] S1 Input Analysis
[0136] The system parsed the operation verbs "execute" and "arrange", the target entities "takeoff formation plan" and "refueling and ammunition loading sequence", and the context parameter "next batch of carrier-based aircraft".
[0137] S2 Conflict Detection and Diagnosis
[0138] The system compared the tool capabilities library and found that:
[0139] Tool E (flight plan generation tool) and Tool F (deck scheduling tool) both involve takeoff queue arrangement, with a functional similarity α=0.70;
[0140] Tool F and Tool G (refueling and ammunition preparation tool) are represented inconsistently in the "task batch" parameter field, with a parameter conflict metric β=0.55;
[0141] Tool G requires "deck availability state", the current context precondition satisfaction rate is 0.4, and the context conflict metric γ=0.60.
[0142] S3 Conflict Quantification and Strategy Coordination
[0143] The overall score is calculated as Score = 0.4 × 0.70 + 0.3 × 0.55 + 0.3 × 0.60 = 0.63, which is considered moderately severe.
[0144] The system filters candidate strategies {semantic rewriting, parameter completion, and order adjustment} based on the conflict level, and selects a combination {t1, t2, t4} based on the conflict type. During execution, the "takeoff queue" and "scheduling order" are semantically rewritten first, then the "mission batch" parameters are completed, and finally the calling order is adjusted to ensure that refueling and ammunition are executed with priority.
[0145] S4 Tool Invocation and Execution
[0146] The system generates standardized call requests, sequentially invoking flight plan generation, deck scheduling, and refueling / ammunition tools. During the refueling and ammunition tool execution, an "interface call timeout" exception occurs. The system detects that this exception is of a preset type and immediately triggers a rollback mechanism:
[0147] ① First, call up the spare refueling and ammunition tool G′;
[0148] ②If the backup tool still fails, the prompt will be automatically rewritten, and the "arrange refueling and ammunition order" will be broken down into two sub-tasks: "arrange refueling order" and "arrange ammunition order", and the call request will be regenerated.
[0149] ③The system successfully completed the task.
[0150] S5 Feedback and Updates
[0151] The system records the types of exceptions triggered during this execution, the rollback paths, and the final success rates in the strategy database. Statistical analysis revealed a high failure rate for "refueling and ammunition tools." Therefore, the system prioritizes the backup tool G′ in subsequent carrier-based aircraft scenarios and strengthens the triggering conditions for "intent dismantling" in high-risk missions.
[0152] Example 2: Supply Chain Risk Detection and Visualization
[0153] In this example, the user enters a natural language command: "Please detect the current supply chain delay risk and draw a geographic visualization of the key nodes."
[0154] S1 Input Analysis
[0155] The system parses the operation verbs "detect" and "draw", the target entities "delay risk" and "key node geographic visualization map", and the context parameter "current supply chain".
[0156] S2 Conflict Detection and Diagnosis
[0157] The system calls the tool capability library and found:
[0158] Both Tool H (risk detection tool) and Tool I (logistics analysis tool) involve delay risk identification, with a functional similarity α=0.65;
[0159] Tool H outputs floating-point delay probabilities, while tool J (map visualization tool) requires discrete-level input with a parameter conflict metric β=0.50;
[0160] Tool J requires "node geographic coordinates", but the current context is missing, and the context conflict metric γ=0.75.
[0161] S3 Conflict Quantification and Strategy Coordination
[0162] The overall score is calculated as Score = 0.3 × 0.65 + 0.3 × 0.50 + 0.4 × 0.75 = 0.67, which falls under the category of severe conflict.
[0163] The system selects candidate strategies based on the level (semantic rewriting, parameter completion, intent decomposition, and order adjustment), and determines the final combination {t1, t2, t4} based on the conflict type. During execution, the system semantically distinguishes between "delay risk detection" and "logistics node analysis," completes the floating-point probability parameters into discrete level inputs, and adjusts the order to ensure that geographic coordinate data is loaded first, followed by the invocation of visualization tools.
[0164] S4 Tool Invocation and Execution
[0165] The system uses tools to call middleware to sequentially perform risk detection, logistics node analysis, and map visualization, and receives the results data. During the map visualization process, a rendering failure occurred due to missing input parameters. Upon detecting the anomaly, the system triggers a rollback mechanism:
[0166] ① Try using the backup visualization tool J′ first;
[0167] ② If it fails, rewrite the prompt, changing "Draw a geographic visualization of key nodes" to "Draw a distribution table of key nodes" and generate a new request;
[0168] ③ The system ultimately returns usable distribution results, ensuring task completion.
[0169] S5 Feedback and Updates
[0170] The system recorded the anomaly and the rollback path, discovering that map visualization tool J lacked robustness when geographic coordinates were missing. The system automatically increased the weight of the "parameter completion + sequence adjustment" strategy and raised the priority of the backup tool J' to ensure the success rate of subsequent supply chain visualization tasks.
[0171] In summary, this invention achieves significant technical results in improving tool invocation accuracy and system stability through a closed-loop prompt word scheduling mechanism comprised of conflict identification, coordinated optimization, and adaptive evolution. Unlike existing technologies, this invention uses conflict diagnosis as the driving starting point for prompt word structure optimization, achieves quantitative conflict assessment through a structured scoring function, and designs a strategy evolution mechanism based on user feedback, forming a closed-loop control system. This is significantly different from existing prompt word generation methods based on static templates or rule mapping.
Claims
1. A method for optimizing prompt words in a large model to address domain tool call conflicts, characterized in that, The optimization method includes: 1) Obtain the natural language instructions input by the user and their associated contextual meta-information, and generate a structured semantic representation; 2) Identify candidate tools based on the structured semantic representation, and identify and generate structured conflict diagnosis data containing conflict type, conflict field position and semantic difference information based on the functional intent, parameter interface and calling preconditions of the candidate tools; 3) Determine the processing priority and coordination strategy to be executed based on the structured conflict diagnosis data, and perform at least one operation including semantic rewriting, intent decomposition, parameter completion and call order adjustment according to the coordination strategy to generate an optimized prompt word structure set; 4) Input the optimized prompt word structure set into the tool call interface, construct and execute a standardized call request containing the target tool identifier, parameter filling content and operation order.
2. The method for optimizing large model prompts for domain-specific tool call conflicts according to claim 1, characterized in that, The method also includes receiving call response data containing call status and processing results after receiving a standardized call request, analyzing the call response data containing call status and processing results, evaluating the effectiveness of the determined coordination strategy based on the analysis results, and adjusting the parameters of the coordination strategy based on the evaluation results.
3. The method for optimizing large model prompts for domain-specific tool call conflicts according to claim 1, characterized in that, The structured conflict diagnostic data generation process in step 2) includes: Semantic encoding is performed on the operation intent, target entity, and context parameter fields in the structured semantic representation to generate user instruction semantic vectors; the function tags, parameter interface definitions, and call context dependencies of each tool in the candidate tool set are extracted to construct the semantic vectors of each tool; and the candidate tools are identified by semantic matching between the user instruction semantic vectors and the semantic vectors of each tool. Diagnose candidate tools for functional conflicts, parameter conflicts, and context conflicts. Functional conflicts refer to the similarity between the current tool and the candidate tool exceeding a set threshold. Parameter conflicts refer to the two candidate tools having similar parameter field names but inconsistent types, or missing or conflicting parameters. Context conflicts refer to the current environment not meeting the context conditions required for the candidate tool to execute. The detected target function conflicts, parameter conflicts, and context conflicts are organized into structured conflict diagnostic data. The structured conflict diagnostic data includes conflict type, conflict field location, involved tool identifier, similarity value, parameter difference measure, context precondition satisfaction rate, and semantic deviation description.
4. The method for optimizing large model prompts for domain-specific tool call conflicts according to claim 1, characterized in that, The generation of the optimized prompt word structure set includes: The structured conflict diagnostic data are quantitatively evaluated to generate evaluation values that characterize the severity of the conflict. The scoring function used in the quantitative evaluation includes target function conflict measure, parametric conflict measure and contextual conflict measure. Set up a set of coordination strategies and select coordination strategies by at least one of the following methods: filtering by conflict severity, matching by conflict type, and prioritizing each strategy or strategy combination based on historical success rate, execution cost, and user feedback. The prompt word structure is optimized based on the selected coordination strategy to obtain the optimized prompt word structure set.
5. The method for optimizing large model prompts for domain-specific tool call conflicts according to claim 4, characterized in that, The set of coordination strategies includes some or all of semantic rewriting, parameter completion, intent decomposition, and order adjustment. The selected coordination strategy performs optimization processing on the prompt word structure, including: semantic rewriting to correct the semantic expression of conflicting fields to resolve functional ambiguity; parameter completion to fill in or infer missing fields to ensure call integrity; intent decomposition to parse compound instructions into atomic task units; order adjustment to reconstruct call paths that conform to dependencies; and combining multiple strategies when conflicts involve multiple dimensions.
6. The method for optimizing large model prompts for domain-specific tool call conflicts according to claim 4, characterized in that, The method also includes a completeness verification of the optimized prompt word structure set, which includes semantic consistency verification, uniqueness verification, and model adaptability verification. Semantic consistency verification is used to confirm that the optimized prompt word structure is consistent with the user's original intent; uniqueness verification is used to ensure that the output corresponds to only one tool call path to avoid ambiguity or polysemy; and model adaptability verification is used to check whether the parameter types, field constraints, and protocol formats meet the interface requirements of the target tool.
7. The method for optimizing large model prompts for domain-specific tool call conflicts according to claim 1, characterized in that, Step 4) further includes: The coordinated and optimized prompt word structure set is input into the language model interface to generate a standardized call request containing target tool identifier, parameter filling content and operation sequence information; The standardized call request is converted into a communication protocol format adapted to the target tool, and a cross-platform call request is constructed. Execute the call request and obtain the response data generated after the call request is executed, which includes the call status identifier, processing result data and response time.
8. The method for optimizing large model prompts for domain-specific tool call conflicts according to claim 7, characterized in that, When a preset exception type occurs during the call, a rollback mechanism is triggered. The rollback mechanism includes at least one of the following: executing a backup tool call, rewriting the prompt word to generate a new call request, or re-initiating the original request.
9. The method for optimizing large model prompts for domain-specific tool call conflicts according to claim 2, characterized in that, The adjustment of coordination strategy parameters includes: Obtain user feedback information and call response data. The user feedback information includes user satisfaction ratings for the call results, records of manual corrections of prompt words, and some or all of the tool selection preferences. The tool call result data includes some or all of the call success rate, task completion status, response time, and anomaly frequency. The system performs structured encoding and feature extraction on user feedback information and call response data to generate an evaluation matrix for the optimization effect of prompt words. The obtained prompt word optimization effect evaluation matrix is compared with the historical strategy baseline to identify coordination strategies with degraded performance or insufficient robustness, and strategy optimization suggestions are output according to preset rules or trained models. Based on the strategy optimization suggestions, the strategy parameters are adjusted. Reinforcement learning, self-supervised learning, or heuristic optimization algorithms are used to update the rule configuration, parameter weights, and template priorities in the strategy library to generate a new coordination strategy.
10. A large-scale prompt word optimization system for domain-specific tool call conflicts, comprising a processor, characterized in that, The processor is used to execute a corresponding computational program to implement the large model prompt word optimization method for domain-oriented tool call conflicts as described in any one of claims 1-9.
Citation Information
Cited By
Question answering methods, model training methods, equipment and storage media
CN122311471A