Instruction optimization method and device
By identifying and displaying unstable nodes using an inference model before the model is officially used, and optimizing instructions based on user feedback, the problem of low instruction optimization efficiency in existing technologies is solved, high-quality instruction generation is achieved, and the execution accuracy and stability of large models in complex tasks are improved.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- ANHUI IFLYHEALTH CO LTD
- Filing Date
- 2025-12-26
- Publication Date
- 2026-04-28
AI Technical Summary
Existing methods for instruction optimization mainly rely on repeated manual debugging or a posteriori correction based on model output results, which is inefficient, makes it difficult to systematically discover logical loopholes and semantic ambiguities in instructions, and fails to improve the completeness and accuracy of instructions.
Before the model is officially used, the inference model generates an inference trajectory, automatically identifies unstable nodes, displays node descriptions and candidate processing solutions in the interactive feedback interface, receives user feedback, iteratively optimizes and generates optimized instructions, until the termination conditions are met.
This system enables the systematic discovery and repair of logical vulnerabilities and ambiguities in instructions before the model is officially used, improving the logical completeness and semantic clarity of instructions, and enhancing the execution accuracy and stability of large models in complex task scenarios.
Smart Images

Figure CN121936588A_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of data processing technology, and in particular to an instruction optimization method and apparatus. Background Technology
[0002] With the widespread application of large language models in complex rule-driven tasks such as legal clause analysis, financial risk control, and medical diagnosis, how to configure high-quality task instructions for the model has become a key factor affecting its execution performance.
[0003] Before a model is actually deployed, the task instructions need to be fully optimized and debugged to ensure that the instructions can clearly and completely guide the model to complete the expected task. However, manually written instruction rules often fail to cover all possible edge cases and logical branches, leading to problems such as unstable output or deviations during model execution. Existing instruction optimization methods mainly rely on repeated manual debugging or a posteriori correction based on model output results. These methods are not only inefficient, but also fail to systematically discover hidden logical flaws and semantic ambiguities in the instructions before the model is used, thus failing to fundamentally improve the completeness and accuracy of the instructions. Summary of the Invention
[0004] This invention provides an instruction optimization method and apparatus to solve the problem that the existing instruction optimization methods mainly rely on repeated manual debugging or a posteriori correction based on model output results, which is inefficient.
[0005] This invention provides an instruction optimization method, comprising: In response to the first input, the task definition, current instruction, and multiple sample questions are input into the inference model to obtain the inference trajectory output by the inference model for each sample question; The reasoning trajectory is analyzed to identify unstable nodes in the reasoning trajectory. The unstable nodes are deduplicated and clustered to generate a set of nodes to be fed back. The unstable nodes include content that generates a preset number of self-questions or viewpoint rebuttals regarding the same issue point in the same reasoning trajectory. If the set of nodes to be fed back is not empty, an interactive feedback interface is displayed; the interactive feedback interface includes node description information for each node to be fed back and multiple corresponding candidate processing solutions. Receive a second input from the user who enters feedback information in the interactive feedback interface; In response to the second input, the set of nodes to be fed back, the feedback information, the task definition, and the current instruction are input into the optimization model to obtain the optimized instruction; The optimized instruction is returned as the new current instruction for execution until the preset iteration termination condition is met, at which point the final instruction is output.
[0006] According to an instruction optimization method provided by the present invention, the unstable node includes content that generates a preset number of self-questions regarding the same problem point within the same inference trajectory; the step of identifying the unstable node in the inference trajectory includes: Extract text fragments containing question semantic features from the reasoning trajectory, and determine the question object to which the text fragments point; If the number of text fragments pointing to the same problem object reaches the preset number, the text fragments pointing to the same problem object are identified as unstable nodes.
[0007] According to an instruction optimization method provided by the present invention, the unstable node includes content that generates a preset number of viewpoint rebuttals for the same judgment object within the same inference trajectory; the step of identifying unstable nodes in the inference trajectory includes: Extract multiple conclusion statements for the same judgment object from the reasoning trajectory, and detect whether there is a semantic conflict or negation relationship among the multiple conclusion statements; The number of times the conclusions with semantic conflicts or negations were changed was recorded. If the number of changes reaches the preset number, the corresponding content will be identified as the unstable node.
[0008] According to an instruction optimization method provided by the present invention, before displaying the interactive feedback interface, the method further includes: Extract the contextual information of the unstable node in the inference trajectory; The unstable node, the context information, and the current instruction are input into the solution generation model; Obtain multiple correction suggestions for the unstable node output by the scheme generation model, and use the multiple correction suggestions as the candidate processing scheme.
[0009] According to an instruction optimization method provided by the present invention, the step of performing deduplication and clustering processing on the unstable nodes to generate a set of nodes to be fed back includes: Obtain the text representation vectors of the identified unstable nodes; Calculate the semantic similarity between the text representation vectors of different unstable nodes; Unstable nodes with semantic similarity greater than a preset threshold are grouped into the same node cluster; Select representative nodes from the node cluster and add them to the set of nodes to be fed back.
[0010] According to an instruction optimization method provided by the present invention, the node description information includes at least one of the following: the problem description text corresponding to the unstable node; the sample problem that caused the unstable node; and the contextual reasoning fragment corresponding to the unstable node in the reasoning trajectory.
[0011] According to an instruction optimization method provided by the present invention, the feedback information includes a target processing scheme selected by the user from the candidate processing schemes, and / or a user-input customized processing scheme; the step of inputting the set of nodes to be fed back, the feedback information, the task definition, and the current instruction into the optimization model in response to the second input to obtain the optimized instruction includes: Based on the target processing scheme selected in the feedback information or the input custom processing scheme, construct modified constraints for each node to be fed back. Combine the modified constraints, the task definition, and the current instruction into a prompt word template; The prompt word template is input into the optimization model to obtain the rewritten instructions generated by the optimization model, and the rewritten instructions are used as the optimized instructions.
[0012] According to an instruction optimization method provided by the present invention, the preset iteration termination condition includes at least one of the following: during a preset number of iterations, the set of nodes to be fed back is empty; the number of iterations reaches a preset maximum number of iterations threshold.
[0013] The present invention also provides an instruction optimization apparatus, comprising the following modules: The first response module is used to respond to the first input by inputting the task definition, the current instruction, and multiple sample questions into the inference model, and to obtain the inference trajectory output by the inference model for each sample question. The analysis module is used to analyze the reasoning trajectory, identify unstable nodes in the reasoning trajectory, perform deduplication and clustering processing on the unstable nodes, and generate a set of nodes to be fed back; wherein, the unstable nodes include content that generates a preset number of self-questions or viewpoint rebuttals for the same problem point in the same reasoning trajectory. The display module is used to display an interactive feedback interface when the set of nodes to be fed back is not empty; the interactive feedback interface includes node description information of each node to be fed back and multiple corresponding candidate processing schemes. The receiving module is used to receive a second input from the user in the interactive feedback interface; The second response module is used to respond to the second input by inputting the set of nodes to be fed back, the feedback information, the task definition and the current instruction into the optimization model to obtain the optimized instruction. The output module is used to return the optimized instruction as the new current instruction for execution until the preset iteration termination condition is met, and then output the final instruction.
[0014] The present invention also provides an electronic device, including a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor, when executing the computer program, implements the instruction optimization method as described above.
[0015] The present invention also provides a non-transitory computer-readable storage medium having a computer program stored thereon, which, when executed by a processor, implements the instruction optimization method as described above.
[0016] The present invention also provides a computer program product, including a computer program that, when executed by a processor, implements the instruction optimization method described above.
[0017] The instruction optimization and apparatus provided by this invention, during the instruction optimization stage before the model is formally used, utilizes the inference model to generate inference trajectories for sample problems and automatically identifies unstable nodes that occur during the inference process. These unstable nodes effectively reflect defects in rule coverage or logical expression of the current instructions, thus achieving proactive exposure of instruction problems rather than relying on posterior results for correction. By deduplicating and clustering the identified unstable nodes, a set of nodes to be fed back is generated, and the user is presented with descriptions and candidate processing schemes for each node in the interactive feedback interface. This allows the user to directly intervene in the instruction optimization stage and provide clear correction suggestions for specific instruction defects. This interactive mechanism accurately integrates expert knowledge into the instruction optimization process, avoiding the ambiguity in the mapping between feedback information and instruction defects in traditional methods. Finally, based on user feedback, the optimization model generates optimized instructions and iteratively optimizes them until the termination condition is met, outputting the final instruction. This results in high-quality instructions with complete logic and clear semantics before the actual deployment of the model, improving the execution accuracy and stability of large models in complex task scenarios. Attached Figure Description
[0018] To more clearly illustrate the technical solutions in this invention or the prior art, the drawings used in the description of the embodiments or the prior art will be briefly introduced below. Obviously, the drawings described below are some embodiments of this invention. For those skilled in the art, other drawings can be obtained from these drawings without creative effort.
[0019] Figure 1 This is a flowchart illustrating the instruction optimization method provided by the present invention; Figure 2A schematic diagram of the instruction optimization device provided by the present invention; Figure 3 This is a schematic diagram of the structure of the electronic device provided by the present invention. Detailed Implementation
[0020] To make the objectives, technical solutions, and advantages of this invention clearer, the technical solutions of this invention will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some, not all, of the embodiments of this invention. All other embodiments obtained by those skilled in the art based on the embodiments of this invention without creative effort are within the scope of protection of this invention.
[0021] The instruction optimization method provided in this invention can be applied to electronic devices equipped with processors, such as servers, computer terminals, cloud computing platforms, or other computing devices with data processing capabilities. The execution entity of the instruction optimization method in this invention can be a processor, which executes the various steps in this invention by calling program code stored in memory. The core application scenario of this invention is the instruction optimization stage before the actual use of a large model. Through an interactive optimization process, the instructions used to guide the large model to perform specific tasks can be fully improved and verified before formal deployment, thereby enhancing the accuracy and robustness of the large model in complex tasks.
[0022] It should be noted that the instruction optimization method involved in the embodiments of the present invention is particularly suitable for large model task scenarios based on complex rules, such as legal clause parsing and medical diagnostic logic. In these scenarios, manually written instruction rules are often difficult to cover all possible situations. Through the interactive instruction optimization method provided by the present invention, logical loopholes and ambiguities in instructions can be systematically discovered and repaired before the model is formally used, reducing the risk of unstable output, deviation, or errors in subsequent practical applications.
[0023] Figure 1 This is a flowchart illustrating the instruction optimization method provided by the present invention, as shown below. Figure 1 As shown, the method includes the following: Step 110: In response to the first input, the task definition, current instruction and multiple sample questions are input into the inference model to obtain the inference trajectory output by the inference model for each sample question; In this application, the first input refers to the operation by which the user triggers the instruction optimization process. This operation can be the user clicking the start optimization button through the human-computer interaction interface, entering a start command, or other interactive behavior that can trigger the start of the optimization process.
[0024] The role of the first input is to initiate the iterative process of the entire instruction optimization, enabling the system to begin executing subsequent steps such as inference trajectory generation and unstable node identification.
[0025] Task definition refers to the descriptive information about the target task that a large model needs to complete. Its content may include the input and output format of the task, the constraints of the task, the evaluation criteria of the task, etc.
[0026] For example, in sentiment analysis tasks, the task definition could be to review user comments, identify negative emotions within them, and output sentiment tendency labels; In medical diagnostic tasks, the task definition can be to determine the possible disease type and provide diagnostic suggestions based on the patient's symptom description. The task definition provides the overall framework and goal orientation for performing the task through the inference model.
[0027] The current instruction refers to the rule-based text used to guide the inference model to execute the task described in the task definition. Its content may include specific execution steps, judgment conditions, processing logic, etc.
[0028] In the initial stage of the iterative optimization process, the current instruction can be a manually written initial instruction; in subsequent iterations, the current instruction is the instruction generated after the previous round of optimization.
[0029] For example, for a sentiment analysis task, the initial current instruction could be: if a comment contains negative or complaining content, mark it as negative.
[0030] Multiple sample problems refer to a set of representative input data used to test the effect of the current instruction execution. These sample problems should cover a variety of situations that the task may encounter, including normal and edge cases.
[0031] The number of sample questions can be set according to the complexity of the task and the testing requirements; for example, it can include 10 to 20 or more sample questions.
[0032] A reasoning model is a large language model with deep reasoning capabilities, capable of generating detailed reasoning processes when performing tasks. Reasoning models can employ large models with deep thinking patterns or step-by-step reasoning patterns.
[0033] The reasoning trajectory refers to the intermediate reasoning process record generated by the reasoning model when dealing with sample problems. Its content reflects the complete thought chain of the reasoning model in understanding the task definition, executing the current instructions, analyzing the sample problem and drawing conclusions.
[0034] The reasoning trajectory can include the model's analysis steps, judgment criteria, intermediate conclusions, and final answer. By acquiring the reasoning trajectory, we can observe the internal logic of the reasoning model when executing the current instruction, thereby discovering potential flaws in the instruction.
[0035] In practice, the processor can combine the task definition, current instructions, and sample questions into prompts, input them into the inference model, and receive the inference trajectory returned by the inference model for each sample question. The inference model can generate inference trajectories independently for each sample question, or it can process multiple sample questions in batches.
[0036] Step 120: Analyze the reasoning trajectory, identify unstable nodes in the reasoning trajectory, perform deduplication and clustering processing on the unstable nodes, and generate a set of nodes to be fed back; wherein, the unstable nodes include content that generates a preset number of self-questions or viewpoint rebuttals for the same problem point in the same reasoning trajectory. An unstable node is a segment of content in the reasoning trajectory that causes uncertainty in the reasoning model due to incomplete rules, logical flaws, or semantic ambiguity of the current instruction. Essentially, an unstable node occurs when the reasoning model encounters a situation where the instruction is not clearly covered or defined, resulting in hesitation, repetition, or contradiction during the reasoning process.
[0037] According to embodiments of the present invention, unstable nodes include two main types: one is content that generates a predetermined number of self-questions about the same problem point in the same reasoning trajectory, and the other is content that generates a predetermined number of viewpoint refutations about the same problem point in the same reasoning trajectory.
[0038] Self-doubt refers to the doubtful statements that a reasoning model expresses regarding a particular point during the reasoning process. These statements are usually presented as interrogative sentences or statements expressing uncertainty. For example, how should the reasoning model handle situations where this occurs multiple times in the reasoning trajectory? Does the instruction include this situation? I'm unsure if this condition applies, etc.
[0039] Opinion refutation refers to a reasoning model arriving at contradictory or negative conclusions regarding the same judgment object during the reasoning process. For example, the reasoning model initially judges that a comment should be marked as negative, but then changes its judgment to say that, based on further analysis, the comment should not be marked as negative. This change in conclusion is opinion refutation.
[0040] The preset number of occurrences refers to a threshold parameter used to determine unstable nodes. When the number of times self-questioning or refuting opinions on the same issue occurs reaches the preset number, the corresponding content is identified as an unstable node. The preset number of occurrences can be set according to actual needs, such as 2 times, 3 times, or other values.
[0041] After identifying unstable nodes, deduplication and clustering are performed on them.
[0042] Since there may be duplicate or highly similar unstable nodes identified from the inference traces of multiple sample problems, deduplication is used to remove exactly the same unstable nodes, and clustering is used to group semantically similar unstable nodes into the same category.
[0043] Through deduplication and clustering, a refined and representative set of nodes to be fed back can be generated, avoiding presenting redundant information to the user.
[0044] Step 130, when the set of nodes to be fed back is not empty, display an interactive feedback interface; the interactive feedback interface includes the node description information of each node to be fed back and corresponding multiple candidate handling solutions. In this application, it is judged whether the set of nodes to be fed back is empty. If the set of nodes to be fed back is not empty, it means that there are defects to be processed in the current instruction. At this time, the processor displays an interactive feedback interface for the user to give feedback.
[0045] The interactive feedback interface refers to a human-computer interaction interface for presenting node information to be fed back to the user and receiving the user's feedback.
[0046] The interactive feedback interface can be presented in the form of a Web page, a client application interface, or other forms. The node description information of each node to be fed back is included in the interactive feedback interface.
[0047] The node description information is used to explain to the user the problem reflected by the node to be fed back, helping the user understand the content that needs to be fed back.
[0048] The node description information may include one or more of the following contents: the problem description text corresponding to the unstable node, the sample problem that caused the unstable node, the corresponding context inference segment of the unstable node in the inference trace, etc.
[0049] The interactive feedback interface also includes multiple candidate handling solutions corresponding to each node to be fed back. The candidate handling solutions are possible solutions pre-generated by the system for the node to be fed back, providing reference and options for the user. By providing candidate handling solutions, the feedback burden of the user can be reduced and the interaction efficiency can be improved.
[0050] This step reflects the core feature of the interactive optimization mechanism of the present invention. By introducing a human-computer interaction link in the instruction optimization stage, domain experts or task requesters can provide professional handling suggestions for the instruction defects automatically discovered by the system, so as to ensure that the optimized instruction can accurately reflect the true intention of the task requester. This interactive optimization method can better handle complex instruction optimization scenarios that require domain knowledge support compared to a completely automated optimization method.
[0051] Step 140: Receive a second input from the user, who enters feedback information in the interactive feedback interface; In this application, the user's actions in the interactive feedback interface are received, which constitute the second input. The user provides feedback information for the node to be fed back through the second input.
[0052] Feedback information refers to the processing opinions or guidance given by users for the nodes to be fed back. Its content may include the solution selected by the user from the candidate processing solutions, the custom processing solution entered by the user, or a combination of the two.
[0053] The feedback information reflects the task requester's clear intention regarding how the corresponding parts of the instructions should be handled.
[0054] Step 150: In response to the second input, the set of nodes to be fed back, the feedback information, the task definition, and the current instruction are input into the optimization model to obtain the optimized instruction; In this application, in response to the second input, the set of nodes to be fed back, the feedback information, the task definition, and the current instruction are taken as input, and the optimization model is invoked to generate the optimized instruction.
[0055] An optimization model is a large language model used to generate improved instructions based on input information. The optimization model can be the same as or a different model from the inference model.
[0056] The optimization model understands the problems of the current instruction based on the set of nodes to be fed back, understands the processing method expected by the task requester based on the feedback information, understands the overall goal and constraints of the task based on the task definition, and understands the basic version that needs to be optimized based on the current instruction. It then generates the optimized instruction by combining all this information.
[0057] The optimized instruction refers to the improved version of the instruction obtained after this round of optimization. Compared with the current instruction, it corrects the defects reflected by the feedback node, making the instruction logic more complete, the rule coverage more comprehensive, and the semantic expression clearer.
[0058] Step 160: The optimized instruction is returned as the new current instruction for execution until the preset iteration termination condition is met, and then the final instruction is output.
[0059] In this application, the optimized instruction obtained in step 150 is used as the new current instruction, and steps 110 to 150 are executed again to form a closed-loop process of iterative optimization.
[0060] In each iteration, it is determined whether the preset iteration termination condition is met. If the iteration termination condition is met, the iteration stops, and the current optimized instruction is output as the final instruction; if the iteration termination condition is not met, the next iteration continues.
[0061] The iteration termination condition can be set according to actual needs. For example, it may include: the set of nodes to be fed back is empty, that is, no new unstable nodes are found; the number of iteration rounds reaches the preset maximum round threshold; the set of nodes to be fed back is empty during the continuous preset rounds of iteration, etc.
[0062] Through the aforementioned iterative optimization process, this embodiment of the invention can systematically identify and fix defects in instructions during the instruction optimization stage before the model is formally used, resulting in more complete and accurate final output instructions. This instruction optimization method based on deep thinking of large models and interactive feedback can effectively reduce the risk of omissions when manually writing instructions and improve the performance of large models in complex tasks.
[0063] In this application, during the instruction optimization stage before the model's formal deployment, the inference model generates inference trajectories for sample problems and automatically identifies unstable nodes that occur during the inference process. These unstable nodes effectively reflect defects in rule coverage or logical expression of the current instructions, thus proactively exposing instruction problems rather than relying on posterior results for correction. By deduplicating and clustering the identified unstable nodes, a set of nodes to be fed back is generated. The user is then presented with a description and candidate processing scheme for each node in the interactive feedback interface. This allows the user to directly intervene during the instruction optimization stage and provide clear correction suggestions for specific instruction defects. This interactive mechanism accurately integrates expert knowledge into the instruction optimization process, avoiding the ambiguity in the mapping between feedback information and instruction defects in traditional methods. Finally, based on user feedback, the optimization model generates optimized instructions and iteratively optimizes them until the termination condition is met, outputting the final instructions. This results in high-quality instructions with complete logic and clear semantics before the model's actual deployment, improving the execution accuracy and stability of large models in complex task scenarios.
[0064] Optionally, the unstable node includes content that generates a preset number of self-questions about the same problem point within the same reasoning trajectory; the step of identifying unstable nodes in the reasoning trajectory includes: Extract text fragments containing question semantic features from the reasoning trajectory, and determine the question object to which the text fragments point; If the number of text fragments pointing to the same problem object reaches the preset number, the text fragments pointing to the same problem object are identified as unstable nodes.
[0065] In this application, the processor performs text analysis on the reasoning trajectory and extracts text fragments containing interrogative semantic features. Interrogative semantic features refer to the semantic expressions in text that convey doubt, uncertainty, or inquiry. The identification methods may include, but are not limited to: detecting interrogative sentence structures; such as interrogative words like "whether," "is it," "can it be," and "how to handle"; detecting words expressing uncertainty, such as "maybe," "perhaps," "uncertain," and "doubtful"; and detecting rhetorical questions or self-questioning sentences.
[0066] After extracting text fragments containing interrogative semantic features, the processor further determines the question object that the text fragment refers to. The question object refers to the specific content or topic that the question addresses, such as a judgment condition, a certain input situation, or a certain processing rule.
[0067] Methods for identifying the problem object may include semantic analysis of text fragments, extraction of keywords or key entities, etc.
[0068] More specifically, the number of text fragments pointing to the same problem object is counted. When the number of text fragments pointing to the same problem object reaches a preset number, it indicates that the inference model has persistent doubts about that problem object. This doubt is usually caused by the current instruction not being clear enough or covering the problem object completely. At this time, the text fragments pointing to the same problem object are identified as unstable nodes.
[0069] In this embodiment of the invention, defects in instructions can be discovered based on the identification of self-doubt. When the reasoning model repeatedly raises questions about a certain problem point during the reasoning process, it often means that the current instruction has missing rules or unclear expression at that problem point, which needs to be improved through subsequent interactive feedback and instruction optimization.
[0070] Optionally, the unstable node includes content that refutes a predetermined number of viewpoints regarding the same judgment object within the same reasoning trajectory; the step of identifying unstable nodes in the reasoning trajectory includes: Extract multiple conclusion statements for the same judgment object from the reasoning trajectory, and detect whether there is a semantic conflict or negation relationship among the multiple conclusion statements; The number of times the conclusions with semantic conflicts or negations were changed was recorded. If the number of changes reaches the preset number, the corresponding content will be identified as the unstable node.
[0071] In this application, the reasoning trajectory is analyzed to identify multiple conclusion statements regarding the same judgment object. The judgment object refers to the specific matter requiring judgment during the reasoning process, such as the sentiment of a comment, the disease type corresponding to a symptom, or whether a behavior is in violation of regulations. The conclusion statement refers to the judgment result given by the reasoning model for the judgment object.
[0072] After extracting multiple conclusion statements for the same judgment object, the processor detects whether there are semantic conflicts or negation relationships among these conclusion statements.
[0073] Semantic conflict refers to a contradiction in the meaning expressed by different conclusions, such as a semantic conflict between what should be labeled negative and what should be labeled positive. Negation refers to a subsequent conclusion explicitly negating a previous conclusion, such as: the previous judgment was incorrect and should be reassessed.
[0074] In this application, the number of changes to the conclusion statements in the statistical reasoning trajectory where there are semantic conflicts or negations is counted.
[0075] The number of changes refers to the number of times the inference model changes its judgment conclusion for the same judgment object. For example, if the inference model gives three conclusions successively: positive, negative, and positive, then the number of changes is 2.
[0076] More specifically, it determines whether the number of changes has reached a preset limit. When the number of changes reaches the preset limit, it indicates that the inference model exhibits significant instability regarding the object being judged. This instability is usually caused by ambiguity or logical flaws in the current instruction's handling rules for this type of situation. In this case, the processor identifies the corresponding content as an unstable node.
[0077] In this application, logical flaws in instructions can be discovered based on the identification of viewpoint refutations.
[0078] When a reasoning model repeatedly changes its judgment conclusion for a certain judgment object during the reasoning process, it often means that there is a contradiction or unclear boundary in the rules of the current instruction for this type of situation, which needs to be clarified through subsequent interactive feedback and instruction optimization.
[0079] Optionally, before displaying the interactive feedback interface, the method further includes: Extract the contextual information of the unstable node in the inference trajectory; The unstable node, the context information, and the current instruction are input into the solution generation model; Obtain multiple correction suggestions for the unstable node output by the scheme generation model, and use the multiple correction suggestions as the candidate processing scheme.
[0080] In this application, the contextual information of unstable nodes in the inference trajectory is extracted.
[0081] Contextual information refers to the relevant content before and after the unstable node in the inference trajectory. Its role is to provide background information for the generation of subsequent solutions, so that the generated candidate solutions can be more accurately targeted at the specific situation of the unstable node.
[0082] Contextual information may include the reasoning steps before the unstable node appears, the processing after the unstable node appears, and other reasoning content related to the unstable node.
[0083] The unstable node, context information, and current instruction are taken as input, and the solution generation model is invoked. The solution generation model refers to a large language model used to generate corrective suggestions for unstable nodes.
[0084] The solution generation model can be the same as the inference model or optimization model, or it can be a separate model specifically designed to generate solution suggestions.
[0085] More specifically, the solution generation model outputs multiple correction suggestions for the unstable node. These correction suggestions refer to the possible correction methods proposed by the solution generation model based on the specific circumstances of the unstable node, contextual information, and the overall structure of the current instruction.
[0086] Suggested revisions may include supplementing missing rules, clarifying ambiguous statements, and defining boundary conditions.
[0087] The processor will use the multiple correction suggestions it receives as candidate processing solutions and display them to the user in the subsequent interactive feedback interface.
[0088] By pre-generating candidate processing solutions, users can be provided with references, reducing their feedback burden. At the same time, it can guide users to choose from multiple possible optimization directions or inspire them to form their own processing ideas.
[0089] Optionally, the step of performing deduplication and clustering on the unstable nodes to generate a set of nodes to be fed back includes: Obtain the text representation vectors of the identified unstable nodes; Calculate the semantic similarity between the text representation vectors of different unstable nodes; Unstable nodes with semantic similarity greater than a preset threshold are grouped into the same node cluster; Select representative nodes from the node cluster and add them to the set of nodes to be fed back.
[0090] In this application, Obtain the text representation vectors of the identified unstable nodes. A text representation vector is a numerical vector representation of the text content of an unstable node, which can characterize the semantic information of the unstable node.
[0091] Methods for obtaining text representation vectors may include encoding the text of unstable nodes using a pre-trained text encoding model, extracting word embeddings of unstable nodes and aggregating them, etc.
[0092] More specifically, the semantic similarity between the text representation vectors of different unstable nodes is calculated.
[0093] Semantic similarity refers to the degree of similarity between two unstable nodes at the semantic level. Its calculation methods can include cosine similarity, the reciprocal of Euclidean distance, dot product similarity, etc.
[0094] By calculating semantic similarity, unstable nodes that, although not exactly the same in their textual expression, actually reflect the same or similar problems can be identified.
[0095] Unstable nodes with semantic similarity greater than a preset threshold are grouped into the same node cluster. The preset threshold is a boundary value used to determine whether two unstable nodes are sufficiently similar, and this threshold can be set according to actual needs.
[0096] A node cluster is a collection of multiple semantically similar unstable nodes. Clustering can be used to group unstable nodes that reflect the same or similar problems together.
[0097] Select representative nodes from the node cluster and add them to the set of nodes to be fed back. A representative node is one that can represent the problem commonly reflected by all unstable nodes in the node cluster.
[0098] Methods for selecting representative nodes may include selecting the node closest to the cluster center, selecting the node with the most complete text description, or selecting the node that appears most frequently.
[0099] In this invention, the above-mentioned deduplication and clustering steps can effectively simplify the identified unstable nodes, avoiding the presentation of a large number of repetitive or similar problems to users in the interactive feedback interface, thereby improving the user's feedback efficiency and experience.
[0100] Optionally, the node description information includes at least one of the following: the problem description text corresponding to the unstable node; the sample problem that caused the unstable node; and the contextual reasoning fragment corresponding to the unstable node in the reasoning trajectory.
[0101] In this application, the node description information includes at least one of the following: The problem description text corresponding to the unstable node; the problem description text refers to the text content that summarizes the problem reflected by the unstable node. The problem description text explains to the user in a concise and clear way what the problem involving the unstable node is, such as the current instruction not clearly specifying how to handle comments containing sarcasm; or the current instruction not covering synonyms such as dissatisfaction.
[0102] The sample problem that leads to the unstable node; the sample problem refers to the specific input data that triggers the unstable node during the inference trajectory generation process. By showing users the sample problems that lead to the unstable node, it is helpful to understand the specific scenario in which the unstable node occurs, thus providing more targeted feedback.
[0103] The contextual reasoning fragments corresponding to unstable nodes in the inference trajectory; these fragments refer to the specific content of the unstable node within the inference trajectory and the related reasoning processes preceding and following it. By showing these contextual reasoning fragments to users, it helps them gain a deeper understanding of the specific reasoning performance of the inference model when encountering the unstable node, thereby more accurately identifying the root cause of the problem and the appropriate handling method.
[0104] In this application, the node description information may include one, two, or all three of the above three types of content, and the specific presentation method can be adjusted according to the design of the interactive feedback interface and user needs. By providing rich node description information, users can fully understand the situation of each node to be fed back, thereby providing high-quality feedback.
[0105] Optionally, the feedback information includes the target processing scheme selected by the user from the candidate processing schemes, and / or a custom processing scheme input by the user; the step of responding to the second input by inputting the set of nodes to be fed back, the feedback information, the task definition, and the current instruction into the optimization model to obtain the optimized instruction includes: Based on the target processing scheme selected in the feedback information or the input custom processing scheme, construct modified constraints for each node to be fed back. Combine the modified constraints, the task definition, and the current instruction into a prompt word template; The prompt word template is input into the optimization model to obtain the rewritten instructions generated by the optimization model, and the rewritten instructions are used as the optimized instructions.
[0106] In this application, the feedback information includes the target processing scheme selected by the user from the candidate processing schemes, and / or the custom processing scheme entered by the user.
[0107] The target processing solution refers to the solution that the user selects from multiple candidate processing solutions provided by the system. Users can choose the solution that best meets their expectations from the candidate solutions based on their understanding of the task requirements.
[0108] Custom processing solutions refer to processing solutions that users input themselves based on their professional knowledge and judgment. When none of the candidate processing solutions can fully meet the user's needs, the user can input a custom processing solution to clearly express their processing intention.
[0109] Feedback information can include only the target processing solution, only the custom processing solution, or both. This flexible feedback method can adapt to different users' feedback habits and feedback needs in different scenarios.
[0110] More specifically, modified constraints are constructed for each node to be fed back based on the feedback information.
[0111] Modified constraints refer to the constraints that the optimization model should follow when generating optimized instructions, and their content reflects the processing intentions expressed by the user through feedback information.
[0112] For example, if the user's selected target processing scheme is to expand the negative word list to cover synonyms, the corresponding corrective constraint could be to add coverage of synonyms such as 'unsatisfied', 'disappointed', and 'bad' in the optimized instruction.
[0113] The modified constraints, task definition, and current instructions are combined into a prompt word template. The prompt word template is a structured text input to the optimization model, containing all the information and guidance needed for the optimization model to generate optimized instructions.
[0114] The structure of the prompt template may include: first, explaining the optimization goal and background; then, presenting the current instruction that needs to be optimized; next, listing the corrective constraints that need to be met; and finally, instructing the optimization model to generate an optimized instruction that meets the above requirements.
[0115] Then, input the prompt word template into the optimization model to obtain the rewritten instructions generated by the optimization model.
[0116] The rewritten instructions are new versions of instructions generated by the optimization model based on the information and constraints in the prompt word template. While maintaining the basic structure of the current instructions, these instructions have been corrected and improved to address the issues reflected by the feedback nodes. The processor uses the rewritten instructions as optimized instructions in subsequent iterative optimization processes.
[0117] This invention effectively transforms user feedback into constraints understandable to the optimization model, thereby guiding the model to generate optimized instructions that meet user expectations. This method of constructing corrective constraints based on feedback information ensures that the instruction optimization process fully utilizes the generation capabilities of a large model while guaranteeing that the optimization results align with the true intent of the task requester.
[0118] Optionally, the preset iteration termination condition includes at least one of the following: during a preset number of iterations, the set of nodes to be fed back is empty; the number of iterations reaches a preset maximum number of iterations threshold.
[0119] In this application, during the iterative process of a preset number of rounds, the set of nodes to be fed back is empty. This termination condition indicates that when the system fails to identify new unstable nodes in multiple consecutive iterations, it can be considered that the current instructions have reached a relatively perfect state, without obvious rule loopholes or logical ambiguities, and the iteration can be terminated at this time.
[0120] The number of preset rounds can be set according to actual needs, such as 2 rounds, 3 rounds, etc. Using consecutive preset rounds instead of single rounds as the judgment condition can improve the stability of the termination judgment and avoid misjudgment caused by accidental factors in a single round.
[0121] The iteration reaches a preset maximum iteration threshold. This termination condition limits the maximum number of iterations in the iterative optimization process, preventing the iteration from continuing indefinitely.
[0122] The maximum number of rounds threshold can be set based on factors such as task complexity, time requirements, and resource constraints.
[0123] When the number of iterations reaches the maximum threshold, the system will terminate the iteration and output the current optimized instruction as the final instruction, even if there are still nodes waiting for feedback.
[0124] The preset iteration termination condition can be one of the two conditions mentioned above, or a combination of both. When using a combined condition, the iteration will terminate as long as either condition is met. This flexible termination condition setting method can adapt to the needs of different scenarios and achieve a balance between instruction optimization quality and optimization efficiency.
[0125] In this application, the provided instruction optimization method achieves automatic optimization of instruction rules through the organic combination of deep thinking of a large model and an interactive feedback mechanism. By exposing instruction defects, introducing human-computer interaction feedback, and iteratively generating optimized instructions, it can effectively discover and repair incomplete rules and logical loopholes in manually written instructions, reduce the dependence on human experts for instruction optimization, improve optimization efficiency and quality, and ultimately enable the large model to achieve more accurate and stable execution results in complex tasks.
[0126] In one alternative embodiment, the present invention will be described in detail below with reference to embodiments, and the implementation environment includes a large model platform (such as Hugging Face, OpenAI API) and a user interface.
[0127] Step 1: Generate optimized data; Input: Manually written task definition (e.g., "Review user comments and identify negative sentiment") and current instructions (e.g., "Mark comments as negative if they contain 'bad' or 'complaint'").
[0128] Process: Using a large-scale deep thinking model, run the same task 10-20 times to generate diverse thinking processes (such as "Step 1: Check keywords; Step 2: Analyze context...") and answers.
[0129] Output: Multiple thought process files (JSON format).
[0130] Step 2: Analyze and extract points of doubt; Input: The thought process generated in step 1.
[0131] Process: Call the large model analysis module and input prompts such as "Analyze the following thought process to identify question points (e.g., undefined variants of 'complaint') and swing points (e.g., ambiguity in neutral statements) caused by rule loopholes".
[0132] Output: a list of questions (e.g., "How to handle synonyms like 'unsatisfied'?") and a list of swing points (e.g., "The rule does not cover the sarcasm case").
[0133] Step 3: Deduplication and simplification; Input: Questions and points of contention in step 2.
[0134] Process: Use large models or simple algorithms (such as TF-IDF similarity calculation) to perform deduplication (removing duplicate points) and simplification (such as merging "synonym processing" and "variant expression" into "vocabulary coverage expansion").
[0135] Output: A simplified set of key points.
[0136] Step 4: Human-computer interaction response; Input: Key points for simplification in step 3.
[0137] Process: The key points are presented to the task requester (such as the product manager) through a web interface, and the user responds with clarification (such as "Add rule: See the attachment for a list of all negative words").
[0138] Output: Reply text.
[0139] Step 5: Instruction optimization; Input: Key points of step 3, response of step 4, task definition, previous version instructions.
[0140] Process: Input large model prompts such as "Generate optimized instructions based on the following questions, replies and old instructions", output new instructions (such as "Mark as negative if the comment contains negative vocabulary or sarcasm pattern").
[0141] Output: Optimized instructions.
[0142] Step 6: Iterative optimization; Repeat steps 1-5, using the new instructions as input, until the large model self-checks or manual verification confirms that there are no defects (e.g., test set accuracy > 99%).
[0143] Termination condition: No new questions are generated for two consecutive rounds.
[0144] In this application, a multi-round thinking process is used to systematically expose incomplete rules and logical loopholes in instructions; a large model is used to analyze the thinking process, extract representative question points, and perform deduplication and clustering; the question points are submitted to the requester to obtain a response, and the instructions are optimized based on the response, forming a closed-loop optimization process; instructions are automatically generated and optimized through a large model, reducing the dependence on manual writing and annotation; this method does not depend on a specific task structure and is suitable for open domain and complex logical tasks.
[0145] The instruction optimization apparatus provided by the present invention will be described below. The instruction optimization apparatus described below and the instruction optimization method described above can be referred to in correspondence.
[0146] Figure 2 A schematic diagram of the instruction optimization device provided by the present invention is shown below. Figure 2 As shown, it includes: The first response module 210 is used to respond to the first input by inputting the task definition, current instruction and multiple sample questions into the inference model, and to obtain the inference trajectory output by the inference model for each sample question; The analysis module 220 is used to analyze the reasoning trajectory, identify unstable nodes in the reasoning trajectory, perform deduplication and clustering processing on the unstable nodes, and generate a set of nodes to be fed back; wherein, the unstable nodes include content that generates a preset number of self-questions or viewpoint rebuttals for the same problem point in the same reasoning trajectory. The display module 230 is used to display an interactive feedback interface when the set of nodes to be fed back is not empty; the interactive feedback interface includes node description information of each node to be fed back and multiple corresponding candidate processing schemes. The receiving module 240 is used to receive a second input from the user in the interactive feedback interface; The second response module 250 is used to respond to the second input by inputting the set of nodes to be fed back, the feedback information, the task definition and the current instruction into the optimization model to obtain the optimized instruction. The output module 260 is used to return the optimized instruction as the new current instruction for execution until the preset iteration termination condition is met, and then output the final instruction.
[0147] In this application, during the instruction optimization stage before the model's formal deployment, the inference model generates inference trajectories for sample problems and automatically identifies unstable nodes that occur during the inference process. These unstable nodes effectively reflect defects in rule coverage or logical expression of the current instructions, thus proactively exposing instruction problems rather than relying on posterior results for correction. By deduplicating and clustering the identified unstable nodes, a set of nodes to be fed back is generated. The interactive feedback interface displays the description information and candidate processing solutions for each node to be fed back to the user, allowing the user to directly intervene during the instruction optimization stage and provide clear corrective opinions for specific instruction defects. This interactive mechanism accurately integrates expert knowledge into the instruction optimization process, avoiding the ambiguity in the mapping between feedback information and instruction defects in traditional methods. Finally, based on user feedback, the optimization model generates optimized instructions and iteratively optimizes them until the termination condition is met, outputting the final instruction. This results in high-quality instructions with complete logic and clear semantics before actual model deployment, improving the execution accuracy and stability of large models in complex task scenarios.
[0148] Figure 3 This is a schematic diagram of the structure of the electronic device provided by the present invention, such as... Figure 3 As shown, the electronic device may include a processor 310, a communications interface 320, a memory 330, and a communication bus 340, wherein the processor 310, the communications interface 320, and the memory 330 communicate with each other via the communication bus 340. The processor 310 can invoke logical instructions from the memory 330 to execute an instruction optimization method, which includes: in response to a first input, inputting a task definition, a current instruction, and multiple sample questions into an inference model, and obtaining the inference trajectory output by the inference model for each sample question; The reasoning trajectory is analyzed to identify unstable nodes in the reasoning trajectory. The unstable nodes are deduplicated and clustered to generate a set of nodes to be fed back. The unstable nodes include content that generates a preset number of self-questions or viewpoint rebuttals regarding the same issue point in the same reasoning trajectory. If the set of nodes to be fed back is not empty, an interactive feedback interface is displayed; the interactive feedback interface includes node description information for each node to be fed back and multiple corresponding candidate processing solutions. Receive a second input from the user who enters feedback information in the interactive feedback interface; In response to the second input, the set of nodes to be fed back, the feedback information, the task definition, and the current instruction are input into the optimization model to obtain the optimized instruction; The optimized instruction is returned as the new current instruction for execution until the preset iteration termination condition is met, at which point the final instruction is output.
[0149] Furthermore, the logical instructions in the aforementioned memory 330 can be implemented as software functional units and, when sold or used as independent products, can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of the present invention, essentially, or the part that contributes to the prior art, or a part of the technical solution, can be embodied in the form of a software product. This computer software product is stored in a storage medium and includes several instructions to cause a computer device (which may be a personal computer, server, or network device, etc.) to execute all or part of the steps of the methods described in the various embodiments of the present invention. The aforementioned storage medium includes various media capable of storing program code, such as USB flash drives, portable hard drives, read-only memory (ROM), random access memory (RAM), magnetic disks, or optical disks.
[0150] On the other hand, the present invention also provides a computer program product, the computer program product including a computer program, the computer program being able to be stored on a non-transitory computer-readable storage medium, the computer program being executed by a processor, the computer being able to execute the instruction optimization method provided by the above methods, the method including: in response to a first input, inputting a task definition, a current instruction and multiple sample questions into an inference model, and obtaining the inference trajectory output by the inference model for each sample question; The reasoning trajectory is analyzed to identify unstable nodes in the reasoning trajectory. The unstable nodes are deduplicated and clustered to generate a set of nodes to be fed back. The unstable nodes include content that generates a preset number of self-questions or viewpoint rebuttals regarding the same issue point in the same reasoning trajectory. If the set of nodes to be fed back is not empty, an interactive feedback interface is displayed; the interactive feedback interface includes node description information for each node to be fed back and multiple corresponding candidate processing solutions. Receive a second input from the user who enters feedback information in the interactive feedback interface; In response to the second input, the set of nodes to be fed back, the feedback information, the task definition, and the current instruction are input into the optimization model to obtain the optimized instruction; The optimized instruction is returned as the new current instruction for execution until the preset iteration termination condition is met, at which point the final instruction is output.
[0151] In another aspect, the present invention also provides a non-transitory computer-readable storage medium having a computer program stored thereon, which, when executed by a processor, is implemented to perform the instruction optimization method provided by the above methods, the method comprising: in response to a first input, inputting a task definition, a current instruction and a plurality of sample questions into an inference model, and obtaining an inference trajectory output by the inference model for each sample question; The reasoning trajectory is analyzed to identify unstable nodes in the reasoning trajectory. The unstable nodes are deduplicated and clustered to generate a set of nodes to be fed back. The unstable nodes include content that generates a preset number of self-questions or viewpoint rebuttals regarding the same issue point in the same reasoning trajectory. If the set of nodes to be fed back is not empty, an interactive feedback interface is displayed; the interactive feedback interface includes node description information for each node to be fed back and multiple corresponding candidate processing solutions. Receive a second input from the user who enters feedback information in the interactive feedback interface; In response to the second input, the set of nodes to be fed back, the feedback information, the task definition, and the current instruction are input into the optimization model to obtain the optimized instruction; The optimized instruction is returned as the new current instruction for execution until the preset iteration termination condition is met, at which point the final instruction is output.
[0152] The device embodiments described above are merely illustrative. The units described as separate components may or may not be physically separate. The components shown as units may or may not be physical units; that is, they may be located in one place or distributed across multiple network units. Some or all of the modules can be selected to achieve the purpose of this embodiment according to actual needs. Those skilled in the art can understand and implement this without any creative effort.
[0153] Through the above description of the embodiments, those skilled in the art can clearly understand that each embodiment can be implemented by means of software plus necessary general-purpose hardware platforms, and of course, it can also be implemented by hardware. Based on this understanding, the above technical solutions, in essence or the part that contributes to the prior art, can be embodied in the form of a software product. This computer software product can be stored in a computer-readable storage medium, such as ROM / RAM, magnetic disk, optical disk, etc., and includes several instructions to cause a computer device (which may be a personal computer, server, or network device, etc.) to execute the methods described in the various embodiments or some parts of the embodiments.
[0154] Finally, it should be noted that the above embodiments are only used to illustrate the technical solutions of the present invention, and not to limit them; although the present invention has been described in detail with reference to the foregoing embodiments, those skilled in the art should understand that modifications can still be made to the technical solutions described in the foregoing embodiments, or equivalent substitutions can be made to some of the technical features; and these modifications or substitutions do not cause the essence of the corresponding technical solutions to deviate from the spirit and scope of the technical solutions of the embodiments of the present invention.
Claims
1. An instruction optimization method, characterized in that, include: In response to the first input, the task definition, current instruction, and multiple sample questions are input into the inference model to obtain the inference trajectory output by the inference model for each sample question; The reasoning trajectory is analyzed to identify unstable nodes in the reasoning trajectory. The unstable nodes are deduplicated and clustered to generate a set of nodes to be fed back. The unstable nodes include content that generates a preset number of self-questions or viewpoint rebuttals regarding the same issue point in the same reasoning trajectory. If the set of nodes to be fed back is not empty, an interactive feedback interface is displayed; the interactive feedback interface includes node description information for each node to be fed back and multiple corresponding candidate processing solutions. Receive a second input from the user in the interactive feedback interface; the feedback information includes the target processing scheme selected by the user from the candidate processing schemes, and / or a custom processing scheme input by the user; In response to the second input, the set of nodes to be fed back, the feedback information, the task definition, and the current instruction are input into the optimization model to obtain the optimized instruction; The optimized instruction is returned as the new current instruction for execution until the preset iteration termination condition is met, at which point the final instruction is output.
2. The instruction optimization method according to claim 1, characterized in that, The unstable nodes include content that generates a preset number of self-questions about the same problem point within the same reasoning trajectory; the step of identifying unstable nodes in the reasoning trajectory includes: Extract text fragments containing question semantic features from the reasoning trajectory, and determine the question object to which the text fragments point; If the number of text fragments pointing to the same problem object reaches the preset number, the text fragments pointing to the same problem object are identified as unstable nodes.
3. The instruction optimization method according to claim 1, characterized in that, The unstable node includes the content that refutes a predetermined number of viewpoints regarding the same judgment object within the same reasoning trajectory; The step of identifying unstable nodes in the inference trajectory includes: Extract multiple conclusion statements for the same judgment object from the reasoning trajectory, and detect whether there is a semantic conflict or negation relationship among the multiple conclusion statements; The number of times the conclusions with semantic conflicts or negations were changed was recorded. If the number of changes reaches the preset number, the corresponding content will be identified as the unstable node.
4. The instruction optimization method according to claim 1, characterized in that, Before displaying the interactive feedback interface, the method further includes: Extract the contextual information of the unstable node in the inference trajectory; The unstable node, the context information, and the current instruction are input into the solution generation model; Obtain multiple correction suggestions for the unstable node output by the scheme generation model, and use the multiple correction suggestions as the candidate processing scheme.
5. The instruction optimization method according to claim 1, characterized in that, The step of performing deduplication and clustering on the unstable nodes to generate a set of nodes to be fed back includes: Obtain the text representation vectors of the identified unstable nodes; Calculate the semantic similarity between the text representation vectors of different unstable nodes; Unstable nodes with semantic similarity greater than a preset threshold are grouped into the same node cluster; Select representative nodes from the node cluster and add them to the set of nodes to be fed back.
6. The instruction optimization method according to claim 1, characterized in that, The node description information includes at least one of the following: the problem description text corresponding to the unstable node; the sample problem that caused the unstable node; and the contextual reasoning fragment corresponding to the unstable node in the reasoning trajectory.
7. The instruction optimization method according to claim 1, characterized in that, The step of responding to the second input by inputting the set of nodes to be fed back, the feedback information, the task definition, and the current instruction into the optimization model to obtain the optimized instruction includes: Based on the target processing scheme selected in the feedback information or the input custom processing scheme, construct modified constraints for each node to be fed back. Combine the modified constraints, the task definition, and the current instruction into a prompt word template; The prompt word template is input into the optimization model to obtain the rewritten instructions generated by the optimization model, and the rewritten instructions are used as the optimized instructions.
8. The instruction optimization method according to claim 1, characterized in that, The preset iteration termination conditions include at least one of the following: during a series of preset iterations, the set of nodes to be fed back is empty; or the number of iterations reaches a preset maximum iteration threshold.
9. An instruction optimization apparatus, characterized in that, include: The first response module is used to respond to the first input by inputting the task definition, the current instruction, and multiple sample questions into the inference model, and to obtain the inference trajectory output by the inference model for each sample question. The analysis module is used to analyze the reasoning trajectory, identify unstable nodes in the reasoning trajectory, perform deduplication and clustering processing on the unstable nodes, and generate a set of nodes to be fed back; wherein, the unstable nodes include content that generates a preset number of self-questions or viewpoint rebuttals for the same problem point in the same reasoning trajectory. The display module is used to display an interactive feedback interface when the set of nodes to be fed back is not empty; the interactive feedback interface includes node description information of each node to be fed back and multiple corresponding candidate processing schemes. The receiving module is used to receive a second input from the user in the interactive feedback interface; The second response module is used to respond to the second input by inputting the set of nodes to be fed back, the feedback information, the task definition and the current instruction into the optimization model to obtain the optimized instruction. The output module is used to return the optimized instruction as the new current instruction for execution until the preset iteration termination condition is met, and then output the final instruction.
10. An electronic device comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, characterized in that, When the processor executes the computer program, it implements the instruction optimization method as described in any one of claims 1 to 8.
11. A non-transitory computer-readable storage medium having a computer program stored thereon, characterized in that, When the computer program is executed by the processor, it implements the instruction optimization method as described in any one of claims 1 to 8.