Collaborative interaction strategy optimization method based on multi-agent

By quantifying the collaborative contribution potential index of high-quality parent instructions and collaborative reorganization, the problem that the advantage characteristics of multiple high-quality parent instructions in the APE framework are not integrated, and the overall performance and efficiency of instruction optimization of large-scale language model are improved.

CN120354878BActive Publication Date: 2025-08-22SHANDONG SHENGDE INTELLIGENT TECH CO LTD
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202510837485.8
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2025-06-23
Publication Date
2025-08-22
Estimated Expiration
2045-06-23

AI Technical Summary

Technical Problem

When generating large language model instructions, the existing automation prompt engineering (APE) framework fails to effectively integrate the advantages of multiple high-quality parent instructions, making it difficult to achieve performance breakthroughs during iterative optimization, and it is easy to converge to the local optimal solution prematurely.

Method used

Using a multi-agent-based collaborative interaction strategy optimization method, by quantifying the collaboration contribution potential index of each high-quality parent instruction, systematically fuses the advantageous feature fragments of multiple high-quality parent instructions, and uses the proposed model to collaborate and generate child instructions.

Benefits of technology

Improve the overall performance and efficiency of instruction optimization, and the generated child instructions more effectively integrate the advantages of multiple sources, improving the accuracy and logic of large language models on specific tasks.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN120354878B_ABST
    Figure CN120354878B_ABST
Patent Text Reader

Abstract

The present invention relates to the technical field of strategy optimization, and in particular to a collaborative interaction strategy optimization method based on multi-agents. In the process of APE generating instructions through iterative optimization, the method obtains all high-quality parent instructions in any iteration round; obtains the collaborative contribution potential index of each high-quality parent instruction, selects a core contribution parent instruction in turn from all the high-quality parent instructions, extracts the dominant advantage feature fragments of the core contribution parent instruction selected each time, uses a proposal model to perform text reorganization on each dominant advantage feature fragment, and obtains a child instruction set; selects high-quality parent instructions for the next iteration round of any iteration round from the child instruction set, and repeats the method for obtaining the child instruction set until the iteration round requirements are met, thereby obtaining a set of candidate instruction sets, and selects the candidate instruction with the highest quality evaluation result from the candidate instruction set, thereby improving the overall performance of the automated instruction optimization process.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the field of strategy optimization technology, and in particular to a collaborative interaction strategy optimization method based on multiple intelligent agents. Background Art

[0002] Large Language Models (LLMs) demonstrate powerful general-purpose computing capabilities by following natural language instructions (prompts). Their performance on various tasks is highly dependent on the quality of the instructions used. To reduce the cost and difficulty of manually designing and verifying high-quality instructions, Automatic Prompt Engineering (APE) has emerged. The process of finding the optimal instructions is formalized as an optimization problem with three core stages: first, a LLM (as a proposal model) is used to generate a set of candidate instructions based on a task description and a small number of input and output examples; second, each candidate instruction is scored to evaluate its effectiveness in guiding the target LLM to complete the task; finally, the highest-scoring instruction is selected as the output based on the scores.

[0003] To further improve instruction quality, the APE framework also incorporates iterative optimization. In this iterative mechanism, the system uses a proposal model to generate a new generation of candidate instructions (called child instructions) with expected better performance, based on the candidate instructions (called parent instructions) selected in the previous round of evaluation. Existing mainstream iterative proposal methods typically instruct the proposal model to independently perform local rewrites or mutations on each selected parent instruction, primarily based on semantic similarity, in the hope of making small improvements based on the parent instruction, thereby gradually approaching a more optimal instruction.

[0004] However, when guiding the generation of a new generation of child instructions based on multiple parent instructions screened in the previous round, the commonly adopted strategy is to independently rewrite each parent instruction based on local semantic similarity. This strategy essentially treats each parent instruction as an isolated optimization target, and therefore lacks an effective mechanism to identify and actively integrate the advantageous features or successful instruction construction patterns contained in these different parent instructions. Since it is impossible to achieve complementary advantages between different parent instructions, the newly generated child instructions are only simple improvements to a single parent instruction, and it is difficult to produce instructions that achieve performance breakthroughs. As a result, the potential synergistic value of multiple parent instructions in this iterative proposal process is insufficiently explored, limiting the APE framework's ability to continuously improve the upper limit of instruction quality and optimization efficiency through iteration, making it easy to converge to a local optimal solution prematurely. Summary of the Invention

[0005] In view of this, an embodiment of the present invention provides a collaborative interaction strategy optimization method based on multiple agents to solve the problem of how to promote the effective integration of the advantageous features of multiple parent instructions in the generation of child instructions, thereby improving the overall performance of instruction optimization.

[0006] An embodiment of the present invention provides a method for optimizing a collaborative interaction strategy based on a multi-agent system, the method comprising the following steps:

[0007] When APE generates instructions through iterative optimization, all high-quality parent instructions in any iteration round are obtained;

[0008] For any high-quality parent instruction, the text content of any high-quality parent instruction is identified and counted to obtain the number of explicit structural units. Based on the number of explicit structural units, the clarity of the structured instruction is obtained. Based on the frequency of occurrence of specific parts of speech in the text content of any high-quality parent instruction, the core instruction semantic strength is obtained. Combining the structured instruction clarity and the core instruction semantic strength, the collaborative contribution potential index of any high-quality parent instruction is obtained.

[0009] Obtaining the collaborative contribution potential index of each high-quality parent instruction, selecting a core contribution parent instruction from all high-quality parent instructions in turn based on the collaborative contribution potential index of each high-quality parent instruction, extracting the dominant advantage feature fragments of each selected core contribution parent instruction, and using the proposed model to perform text reorganization on each of the dominant advantage feature fragments to obtain a set of child instructions;

[0010] Select high-quality parent instructions of the next iteration round of any iteration round from the child instruction set, and repeat the method for obtaining the child instruction set until the iteration round requirements are met, to obtain a set of candidate instruction sets, and select the candidate instruction with the highest quality evaluation result from the candidate instruction set.

[0011] Preferably, obtaining the structured instruction clarity according to the number of the explicit structure units includes:

[0012] The sum of the number of explicit structure units and a constant 1 is used as an independent variable of a natural logarithm function to obtain the structured instruction clarity.

[0013] Preferably, obtaining the semantic strength of the core instruction based on the frequency of occurrence of a specific part of speech in the text content of any high-quality parent instruction includes:

[0014] The occurrence frequencies of verbs, demonstrative pronouns and moral auxiliary verbs in the text content of any high-quality parent instruction are counted separately, the sum of the occurrence frequencies of verbs and moral auxiliary verbs is calculated, the product of a preset non-negative penalty coefficient and the occurrence frequency of demonstrative pronouns is calculated, the difference between the sum of the frequencies and the product is used as the numerator, and the instruction length of any high-quality parent instruction is used as the denominator to obtain the semantic strength of the core instruction.

[0015] Preferably, the combination of the clarity of the structured instruction and the semantic strength of the core instruction to obtain the collaborative contribution potential index of any high-quality parent instruction includes:

[0016] Normalizing the structured instruction clarity and the core instruction semantic strength respectively to obtain a structured instruction clarity normalized value and a core instruction semantic strength normalized value, and recording the sum of the structured instruction clarity normalized value and the core instruction semantic strength normalized value as the instruction feature value of any high-quality parent instruction;

[0017] Obtain the instruction feature values ​​corresponding to all high-quality parent instructions, take the mean of all instruction feature values ​​as the bias term, take the difference between the instruction feature value of any high-quality parent instruction and the bias term as the independent variable of the Sigmoid activation function, and obtain the collaborative contribution potential index of any high-quality parent instruction.

[0018] Preferably, the step of sequentially selecting a core contribution parent instruction from all high-quality parent instructions according to the collaborative contribution potential index of each high-quality parent instruction includes:

[0019] According to the collaborative contribution potential index of each high-quality parent instruction, a core contribution parent instruction is selected in turn from all high-quality parent instructions using the roulette wheel selection method.

[0020] Preferably, extracting the dominant advantage feature fragment of the core contribution parent instruction selected each time includes:

[0021] Based on the clarity of structured instructions and the semantic strength of core instructions of all high-quality parent instructions, the mean values ​​of structured instruction clarity and core instruction semantic strength are calculated respectively. For any selected core contribution parent instruction, if the core instruction semantic strength of any selected core contribution parent instruction is greater than or equal to the mean value of the core instruction semantic strength, the smallest text unit containing verbs and moral auxiliary verbs in the text content of any selected core contribution parent instruction is taken as the dominant advantage feature segment.

[0022] If the structured instruction clarity of any selected core contribution parent instruction is greater than or equal to the structured instruction clarity mean, all explicit structural units in the text content of any selected core contribution parent instruction are taken as dominant feature segments.

[0023] Preferably, the proposed model is used to perform text reorganization on each of the dominant feature segments to obtain a set of child instructions, including:

[0024] The dominant characteristic segment of the core contribution parent instruction selected at any time is used as the target segment, and the target segment is textually reorganized using the proposal model to obtain a candidate child instruction. The legality and validity of the candidate child instruction are verified. If the verification passes, the candidate child instruction is used as the child instruction. If the verification fails, the dominant characteristic segment of the core contribution parent instruction selected at any next time is used as the target segment. The verification method is repeated until the number of child instructions meets the quantity requirement, and a set of child instructions is obtained.

[0025] Preferably, the checking of the legality and validity of the candidate child instruction includes:

[0026] If the candidate child instruction is empty or the instruction length is not within the length range or contains banned words, the test is determined to have failed; if the candidate child instruction is not empty, the instruction length is within the length range and does not contain banned words, the test is determined to have passed.

[0027] Compared with the prior art, the embodiments of the present invention have the following beneficial effects:

[0028] The present invention introduces a collaborative contribution potential index to characterize the structural and semantic advantages of each high-quality parent instruction that are worth learning from. Based on the collaborative contribution potential index, the present invention systematically and focusedly integrates the advantageous feature fragments of multiple parent instructions with high collaborative contribution potential (that is, the dominant advantageous feature fragments). Through the collaborative reorganization prompt template to guide the proposal model, these advantageous feature fragments from different high-quality parents are reconstructed to generate new child instructions. The newly generated child instructions through this optimization strategy can more effectively integrate the advantages of multiple sources, making the entire APE framework more efficient in exploring the instruction space and improving the overall performance of the automated instruction optimization process. BRIEF DESCRIPTION OF THE DRAWINGS

[0029] In order to more clearly illustrate the technical solutions in the embodiments of the present invention, the following briefly introduces the drawings required for use in the embodiments or the description of the prior art. Obviously, the drawings described below are only some embodiments of the present invention. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying any creative work.

[0030] Figure 1 This is a method flow chart of a multi-agent collaborative interaction strategy optimization method provided in Example 1 of the present invention. DETAILED DESCRIPTION

[0031] The embodiments of the present disclosure are described in detail below, and examples of the embodiments are shown in the accompanying drawings. The embodiments described below with reference to the accompanying drawings are exemplary and intended to be used to explain the present disclosure, but should not be understood as limiting the present disclosure.

[0032] It should be noted that the terms "first," "second," and the like in the specification of the present disclosure and the accompanying drawings are used to distinguish similar objects and are not necessarily used to describe a specific order or precedence. It should be understood that the terms used in this manner are interchangeable where appropriate, so that the embodiments of the present disclosure described herein can be implemented in an order other than those illustrated or described herein. The embodiments described in the following exemplary embodiments do not represent all embodiments consistent with the present disclosure. Instead, they are merely examples of devices and methods consistent with some aspects of the present disclosure.

[0033] In order to illustrate the technical solution of the present invention, a specific embodiment is provided below. It should be noted that the execution subject of this embodiment can be a computing service device with data processing, network communication and program running functions, such as a tablet computer, personal computer, mobile phone, etc., or an electronic device, terminal system, etc. that can realize the above functions.

[0034] See also Figure 1 , is a method flow chart of a method for optimizing a collaborative interaction strategy based on multiple agents provided in the first embodiment of the present invention, such as Figure 1 As shown, the method may include:

[0035] Step S101 , in the process of APE generating instructions through iterative optimization, all high-quality parent instructions in any iteration round are obtained.

[0036] Large Language Models (LLMs), also known as large language models or large models, are characterized by their large scale, as the name suggests, with network parameters reaching tens of billions, hundreds of billions, or even more. They are also universal, meaning they are not limited to specific problems or domains. Third, they are emergent, meaning they generate unexpected new capabilities. Generative large language models are models or large models that possess capabilities such as natural language processing, image processing, or speech processing, and can generate content such as text, images, audio, and video. Large language models are used in many professional fields, such as law, healthcare, and finance, to handle complex natural language understanding and generation tasks. In the legal field, models are required to generate case summaries from case files and extract key issues. In healthcare, models are required to interpret pathology reports and explain them in a way that is easy for patients to understand. In intelligent customer service scenarios, models must engage in multiple rounds of conversation to accurately understand user intent and provide appropriate solutions. For these complex tasks, manually designing prompts that can comprehensively, accurately, and efficiently guide large language models to produce high-quality output is often extremely challenging, requiring extensive expertise and repeated trial and error.

[0037] The existing automated prompting engineering (APE) generates large language model instructions through an iterative optimization process, which mainly includes the following three steps: (1) Initial candidate instruction generation. (2) Iterative optimization, including: selecting a subset of evaluation data, scoring candidate instructions, screening high-quality parent instructions, iterative proposal and child instruction generation (using the proposal model LLM, based on the high-quality parent instructions, by rewriting, mutating or resampling them with semantic similarity to generate a new generation of candidate instructions, that is, child instructions), and checking the iteration termination condition (the number of iteration rounds meets the number requirements). (3) The selection and output of the final instruction, that is, the candidate instruction with the highest candidate instruction score. Candidate instructions are a piece of text or question provided to the generative large language model to guide the generative large language model to generate a specific type of text or answer. Candidate instructions can be a sentence, a question, an article or a topic, etc., which can guide the generative large language model to generate information or answers related to the candidate instructions. For example, when given the question "What is artificial intelligence?", the generative large language model can generate an article or answer about artificial intelligence.

[0038] However, when generating large language model instructions through the above-mentioned iterative optimization process, the core limitation of its iterative optimization step is that the newly generated child instructions are only simple improvements on a single high-quality parent instruction, and fail to fully explore and effectively integrate the unique advantages and characteristics contained in multiple high-quality parent instructions. If subsequent optimization decisions are made based solely on the overall performance score of the high-quality parent instructions, it is difficult to distinguish whether the score is derived from a universally excellent instruction design or an accidental fit in a specific situation, thereby hindering the possibility of inheriting truly valuable instruction genes and integrating them into the new generation of instructions. Therefore, an embodiment of the present invention provides an improved iterative proposal method to promote the effective integration of the advantageous characteristics of multiple high-quality parent instructions in the generation of child instructions, thereby improving the overall performance of instruction optimization.

[0039] Since the embodiment of the present invention optimizes the steps of iterative proposal and child instruction generation based on high-quality parent instructions in the iterative optimization process of step (2), at the beginning of a typical APE iterative optimization cycle, it is necessary to determine a set of high-quality parent instructions for guiding the generation of child instructions in this round. In the embodiment of the present invention, taking any iterative round as an example, in the process of APE generating instructions through iterative optimization, according to the candidate instructions (child instructions) generated in the previous iterative round of any iterative round, high-quality parent instructions are obtained from all candidate instructions through candidate instruction scoring screening, and used for the generation of child instructions in any iterative round. At this point, all high-quality parent instructions in any iterative round can be obtained. It should be noted that in the first iteration, the high-quality parent instructions come from the initial candidate instructions generated by the proposal model based on the initial task description and a small number of examples, and a part of the instructions obtained through candidate instruction scoring screening.

[0040] Step S102: for any high-quality parent instruction, identify and count the text content of any high-quality parent instruction to obtain the number of explicit structural units, and obtain the clarity of the structured instruction based on the number of explicit structural units; obtain the core instruction semantic strength based on the frequency of occurrence of specific parts of speech in the text content of any high-quality parent instruction, and combine the structured instruction clarity and the core instruction semantic strength to obtain the collaborative contribution potential index of any high-quality parent instruction.

[0041] In order to achieve more efficient iterative proposals, a key prerequisite is to be able to accurately identify and quantify the key structural elements or characteristics in the intrinsic text of each high-quality parent instruction that play a decisive role in its excellent performance and have subsequent migration and combination value. Therefore, the embodiment of the present invention introduces the collaborative contribution potential index , which is used to quantify the potential value of each high-quality parent instruction as a knowledge contributor. This value is specifically reflected in the level of structured organization displayed by the text content of the high-quality parent instruction and the clarity and concentration of the core instruction semantics. A high-quality parent instruction that is rich in clear structural levels and can accurately and efficiently convey the intention of the core instruction has a higher potential for collaborative contribution. In the subsequent process of guiding the generation of better child instructions, it should be given a higher weight or more priority consideration. Therefore, in an embodiment of the present invention, a collaborative contribution potential index is quantified for each high-quality parent instruction, thereby providing a key decision-making basis for the subsequent coordinated integration and innovative combination of high-quality parent instructions.

[0042] Instruction with any superior parent For example, first, perform standard natural language processing operations on the text content of any high-quality parent instruction, including word segmentation, part-of-speech tagging, and be able to count the total number of words and the number of explicit structural units It should be noted that natural language processing operations belong to the existing technology and will not be described here. Then, identify and count the number of explicit structural units it contains. , where explicit structural units specifically include: independent list items led by standard list markers (e.g., "1.", "a"), "-", "*", etc. at the beginning of a line), and text paragraphs containing substantive instruction content that are clearly separated by one or more consecutive blank lines. Finally, according to the number of explicit structural units, any high-quality parent instruction is obtained. The structured instruction clarity is obtained by taking the sum of the number of explicit structure units and a constant 1 as independent variables of a natural logarithm function to obtain the structured instruction clarity.

[0043] In one embodiment, the calculation formula for structured instruction clarity is:

[0044]

[0045] in, represents the structural clarity of any good parent instruction, represents the natural logarithm function, 1 represents a constant, Indicates the number of explicit structure units contained in the text content of any good parent directive.

[0046] It should be noted that the clarity of structured instructions Ability to identify and quantify any good parent instruction The design quality of information organization and process guidance was evaluated by logarithmically transforming the number of explicit structural units in the text content. This effectively gave positive evaluations to high-quality parent instructions that presented instruction content in a clear, layered, and easy-to-follow structure. This quantification of instruction structure allows for more reliable reference and retention of the organizational framework of high-quality parent instructions that excel in coherence and standardization during subsequent collaborative reorganization processes, thereby improving the comprehensibility and execution accuracy of the child instructions.

[0047] Complementing the structural level, first, we count the frequency of verbs in the text content of any high-quality parent instruction. , the frequency of occurrence of demonstrative pronouns and the frequency of occurrence of moral auxiliary verbs , where verbs include but are not limited to "generate", "analyze", "summarize", "ensure", "compare", "list", etc., especially verbs commonly used to express instructions, commands or requests; moral auxiliary verbs include but are not limited to modal verbs or auxiliary verbs used to express necessity, compulsion or prohibition, such as: "must", "should", "need", "can", "must not", "prohibit", etc.; demonstrative pronouns refer to words that introduce semantic ambiguity when there is no clear referent, such as: "it", "this", "that", "they", "these", etc. Then, by combining the frequency of occurrence of the above parts of speech and considering the instruction length of any high-quality parent instruction (that is, the total number of words), ), obtain the semantic strength of the core instruction. The specific acquisition method is:

[0048] Calculate the sum of the frequency of verbs and the frequency of moral auxiliary verbs, calculate the product of the preset non-negative penalty coefficient and the frequency of demonstrative pronouns, take the difference between the sum of the frequencies and the product as the numerator, and the instruction length of any high-quality parent instruction as the denominator, and get any high-quality parent instruction. The semantic strength of the core instructions.

[0049] In one embodiment, the calculation formula for the semantic strength of the core instruction is:

[0050]

[0051] in, Indicates the core instruction semantic strength of any high-quality parent instruction, Represents the preset non-negative penalty coefficient, which is set to 0.3.

[0052] It should be noted that Focus on evaluating any good parent instruction The density and semantic clarity of the instruction content of the text are quantified by positively stimulating the density of core action verbs and binding modal words in the instructions and moderately suppressing the use of demonstrative pronouns that may introduce ambiguity. High-quality parent instructions with high value usually mean that their instruction intentions are more direct and their action directions are more clear, and their potential as high-quality gene contributors is correspondingly higher. Therefore, the analysis of the semantic strength of core instructions can effectively distinguish between instructions that are concise and to the point and instructions that are redundant and unclear in focus.

[0053] After receiving any high-quality parent instruction After the structural instruction clarity and core instruction semantic strength of any high-quality parent instruction The clarity of the structured instructions and the semantic strength of the core instructions are aggregated in a regularized manner to obtain the collaborative contribution potential index of any high-quality parent instruction. The regularized aggregation method is:

[0054] Normalize the clarity of structured instructions and the semantic strength of core instructions respectively to obtain the normalized value of structured instruction clarity and the normalized value of core instruction semantic strength. The sum of the normalized value of structured instruction clarity and the normalized value of core instruction semantic strength is recorded as the instruction feature value of any high-quality parent instruction.

[0055] Obtain the instruction feature values ​​corresponding to all high-quality parent instructions, take the mean of all instruction feature values ​​as the bias term, take the difference between the instruction feature value and the bias term of any high-quality parent instruction as the independent variable of the Sigmoid activation function, and obtain the collaborative contribution potential index of any high-quality parent instruction.

[0056] In one embodiment, the calculation formula for the collaborative contribution potential index of any high-quality parent instruction is:

[0057]

[0058] in, Represents the collaborative contribution potential index of any high-quality parent instruction, Standard The activation function, whose mathematical expression is , represents the normalization function, represents the bias term.

[0059] It should be noted that, after obtaining any high-quality parent instruction After calculating the clarity of the structured instructions and the semantic strength of the core instructions, they are adjusted to a unified scale through a dynamic minimum-maximum normalization function to ensure the adaptability and comparability of the scores at different iteration stages or between different tasks; the two normalized scores are directly added together and a bias term is subtracted, which is also dynamically calculated based on all the high-quality parent instruction data of the current round. , forming an original potential value that comprehensively reflects the dual effectiveness of instruction structure and content. This dynamic bias term The setting of makes the input of the Sigmoid function centered around the average level of the current parent group, thereby making more effective use of the sensitive distinction area of ​​the Sigmoid function. The standard Sigmoid activation function is applied to the original potential value adjusted by the bias term. This nonlinear transformation not only converts the final collaborative contribution potential index Normalized to the interval (0, 1), more importantly, through its S-shaped curve characteristics, it can effectively amplify the score differences between high-quality parent instructions that perform well or poorly in both structural and semantic dimensions, thereby improving the recognition and differentiation of high-quality parent instructions with high collaborative contribution potential.

[0060] Similarly, obtain the collaborative contribution potential index of each high-quality parent instruction in any iteration round.

[0061] In step S103, the collaborative contribution potential index of each high-quality parent instruction is obtained. According to the collaborative contribution potential index of each high-quality parent instruction, a core contribution parent instruction is selected from all high-quality parent instructions in turn. The dominant advantage feature fragments of each selected core contribution parent instruction are extracted, and the proposed model is used to perform text reorganization on each dominant advantage feature fragment to obtain a set of child instructions.

[0062] According to the above method, the collaborative contribution potential index of each high-quality parent instruction is obtained. This index reveals the structural and semantic advantages of each high-quality parent instruction that are worth learning from. In order to overcome the problem that the existing APE iterative proposal method is difficult to effectively integrate the scattered advantages due to local optimization of high-quality parent instructions, the embodiment of the present invention proposes a child instruction generation strategy based on the collaborative contribution potential index to promote the collaborative reorganization of the advantageous features of multiple high-quality parent instructions. Among them, the specific method of this generation strategy is as follows:

[0063] (1) According to the collaborative contribution potential index of each high-quality parent instruction, a core contribution parent instruction is selected from all high-quality parent instructions using the roulette wheel selection method.

[0064] Calculate the cumulative value of the collaborative contribution potential index of all high-quality parent instructions ; Calculate the ratio of the collaborative contribution potential index of each high-quality parent instruction to the cumulative value, and record it as the selection probability of the corresponding high-quality parent instruction Based on the selection probability of each high-quality parent instruction, a random sampling is performed among all high-quality parent instructions, and the selected high-quality parent instruction is the core contribution parent instruction , this method ensures The higher the value, the higher the quality of the parent instruction. Its core features and structure are more likely to be inherited by its children.

[0065] (2) Extract the dominant advantage feature fragments of the core contribution parent instructions for each selection.

[0066] Core contribution parent instructions for any selection , according to the structural instruction clarity and core instruction semantic strength of all high-quality parent instructions, the mean structural instruction clarity is calculated and the mean semantic strength of core instructions , if any selected core contributes to the structural instruction clarity of the parent instruction Greater than or equal to the mean score for clarity of structured instruction , it indicates that the core contributes to the parent instruction It has an advantage in structural organization. At this time, all the explicit structural units in the text content of any selected core contribution parent instruction are taken as the dominant advantage feature fragments, that is, in calculating the core contribution parent instruction of All explicit structural units identified at the time are considered to be contributing structural feature fragments. All explicit structural units in the text content of any selected core contribution parent instruction are taken as dominant feature fragments. Otherwise, this part does not extract dominant feature fragments.

[0067] If any selected core contributes to the core instruction semantic strength of the parent instruction Greater than or equal to the mean semantic strength of core instructions , then the core contributes to the parent instruction In the case of a core semantic expression advantage, the smallest text unit containing verbs and deontic auxiliary verbs in the text content of any selected core contributing parent instruction is considered the dominant feature segment. Otherwise, this segment is not extracted. It is worth noting that if a text unit contains multiple core words, they are extracted as a whole segment and not counted repeatedly. This method ensures that the extracted semantic feature segment is the part of the instruction that actually carries the core operation or constraint.

[0068] At this point, the feature segments with positive contributions in any selected core contribution parent instruction can be obtained based on the dominant feature segments extracted from the two parts.

[0069] (3) Use the proposed model to reorganize the text of each dominant feature segment to obtain a set of offspring instructions.

[0070] The dominant characteristic fragment of the core contribution parent instruction selected at any time is taken as the target fragment , the proposed model is used to reorganize the target fragment text to obtain a candidate child instruction, and the legality and validity of the candidate child instruction are tested. The specific testing method is: if the candidate child instruction is empty or the instruction length is not within the length range or contains banned words, then the test is determined to fail; if the candidate child instruction is not empty, the instruction length is within the length range and does not contain banned words, then the test is determined to pass.

[0071] If the test passes, the candidate child instruction is used as the child instruction. If the test fails, the dominant feature fragment of the next core contribution parent instruction is used as the target fragment. Repeat the test method until the test is completed and the number of child instructions obtained meets the quantity requirement , at this time, all the child instructions are grouped into a child instruction set, and the number of elements in the child instruction set is Among them, the quantity requirement There is no restriction and it can be set according to needs.

[0072] It should be noted that for the target segment using the proposed model To restructure text, we need to design a structured prompt template that clearly identifies the target segment. As the main body, it guides the proposal model to reorganize and generate text. The core structure of the prompt template is:

[0073] Task context: clearly describes the target task for the current instruction optimization;

[0074] Leading Feature Instructions: "Please base your instruction on the following core ideas and structure: [Put the target fragment The fragments / patterns in the [are] organized and presented in a natural language way].

[0075] Innovation and Optimization Requirements: "Please integrate, optimize, and innovate the above information to generate a new, complete, and fluent instruction that may perform better in terms of [specific desired improvement direction, such as clearer, more concise, more guiding, or better handling of a specific situation]. Please ensure that the core objectives of the instruction are consistent with the task requirements. The generated new instruction should be: xxxx." Submit the constructed collaborative restructuring and innovation prompt containing the above guidance content to the preset proposal model (LLM). The proposal model will process this prompt and generate a new text as a candidate child instruction. .

[0076] At this point, the task of generating child instructions for high-quality parent instructions in any iteration round is completed. This generation strategy no longer regards high-quality parent instructions as independent optimization starting points, but as a shared pool of high-quality feature fragments. It systematically selects high-quality parent instructions with high contribution potential (that is, high collaborative contribution potential index) and explicitly extracts their most significant advantageous features (dominant advantageous feature fragments). Then, it guides the proposal model through the collaborative recombination prompt template to reconstruct these advantageous feature fragments from different high-quality parent instructions, thereby generating new child instructions.

[0077] Step S104, select the high-quality parent instruction of the next iteration round of any iteration round from the child instruction set, and repeat the method of obtaining the child instruction set until the iteration round requirements are met, to obtain a set of candidate instruction sets, and select the candidate instruction with the highest quality evaluation result from the candidate instruction set.

[0078] The optimization method provided in the embodiments of the present invention focuses on improving the iterative proposal process within the automated prompting engineering (APE) framework. Specifically, when generating a new generation of candidate instructions (child instructions) based on high-quality parent instructions evaluated and screened in the previous iteration, the existing iterative proposal process within the existing automated prompting engineering (APE) is replaced by a child instruction generation strategy guided by a collaborative contribution potential index to promote the collaborative recombination of the advantageous features of multiple high-quality parent instructions. Therefore, after completing the task of generating child instructions for high-quality parent instructions in any iteration and obtaining a set of child instructions, the child instruction set is further evaluated and screened for high-quality parent instructions for the next iteration of any iteration. The corresponding child instruction set is then obtained using the above-described method for generating child instruction sets. This process of obtaining child instruction sets is repeated until the iteration meets the iteration requirements, and a set of candidate instruction sets is output, which is the set of child instructions obtained in the final iteration. It is worth noting that the iteration round requirement means that the iteration rounds are between 20 and 50. Preferably, the embodiment of the present invention sets the number of iteration rounds to 30. There is no limitation here and it can be set according to the actual implementation scenario.

[0079] It is known that in the existing automated prompting engineering (APE) step of generating large language model instructions through an iterative optimization process, after completing the iterative optimization to obtain a set of candidate instruction sets, the final instruction can be selected and output from the candidate instruction set, that is, the candidate instruction with the highest candidate instruction score in the candidate instruction set can be selected as the output of the large language model instruction.

[0080] It is worth noting that the focus of the present invention is to provide an improved candidate instruction generation method for the APE framework, that is, by quantifying the contribution potential of each knowledge unit of each high-quality parent instruction and guiding the proposal model to collaboratively reorganize the advantageous features of these different knowledge units, thereby generating a new generation of candidate instructions (child instructions). The specific operation steps are steps S102-S103. The selection of the candidate instruction with the highest candidate instruction score in the candidate instruction set belongs to the existing technology and will not be described in detail here.

[0081] The automated prompt engineering iterative proposal optimization method proposed in this invention can play an important role in different application scenarios. By quantifying the collaborative contribution potential of parent instructions that have shown advantages in guiding the model to process specific sub-aspects (for example, "contract element identification" in legal texts, "key indicator extraction and risk assessment" in medical reports, and "context coherence maintenance" in conversations) in previous iterations, and using a collaborative recombination strategy to fuse the advantageous features of these different parent instructions, a series of candidate instructions with better overall performance are automatically generated. After continuous iterative optimization of the APE framework, it is eventually possible to screen out instructions that guide the model to achieve higher accuracy, stronger logic, better structure, or better compliance with specific domain requirements on specific natural language tasks.

[0082] The above embodiments are only used to illustrate the technical solutions of the present invention, rather than to limit the same. Although the present invention has been described in detail with reference to the aforementioned embodiments, those skilled in the art should understand that they can still modify the technical solutions described in the aforementioned embodiments, or make equivalent replacements for some of the technical features therein. These modifications or replacements do not deviate the essence of the corresponding technical solutions from the spirit and scope of the technical solutions of the various embodiments of the present invention, and should all be included in the scope of protection of the present invention.

Claims

1. A collaborative interaction strategy optimization method based on multi-agents, characterized by: The method comprises: When APE generates instructions through iterative optimization, all high-quality parent instructions in any iteration round are obtained; For any high-quality parent instruction, the text content of any high-quality parent instruction is identified and counted to obtain the number of explicit structural units. Based on the number of explicit structural units, the clarity of the structured instruction is obtained. Based on the frequency of occurrence of specific parts of speech in the text content of any high-quality parent instruction, the core instruction semantic strength is obtained. Combining the structured instruction clarity and the core instruction semantic strength, the collaborative contribution potential index of any high-quality parent instruction is obtained. Obtaining the collaborative contribution potential index of each high-quality parent instruction, selecting a core contribution parent instruction from all high-quality parent instructions in turn based on the collaborative contribution potential index of each high-quality parent instruction, extracting the dominant advantage feature fragments of each selected core contribution parent instruction, and using the proposed model to perform text reorganization on each of the dominant advantage feature fragments to obtain a set of child instructions; Select high-quality parent instructions of the next iteration round of any iteration round from the child instruction set, and repeat the method for obtaining the child instruction set until the iteration round requirements are met, to obtain a set of candidate instruction sets, and select the candidate instruction with the highest quality evaluation result from the candidate instruction set.

2. The multi-agent-based collaborative interaction strategy optimization method according to claim 1 is characterized in that: Obtaining structured instruction clarity according to the number of explicit structure units includes: The sum of the number of explicit structure units and a constant 1 is used as an independent variable of a natural logarithm function to obtain the structured instruction clarity.

3. The multi-agent-based collaborative interaction strategy optimization method according to claim 1, characterized in that: The obtaining of the semantic strength of the core instruction based on the frequency of occurrence of a specific part of speech in the text content of any high-quality parent instruction includes: The occurrence frequencies of verbs, demonstrative pronouns and moral auxiliary verbs in the text content of any high-quality parent instruction are counted separately, the sum of the occurrence frequencies of verbs and moral auxiliary verbs is calculated, the product of a preset non-negative penalty coefficient and the occurrence frequency of demonstrative pronouns is calculated, the difference between the sum of the frequencies and the product is used as the numerator, and the instruction length of any high-quality parent instruction is used as the denominator to obtain the semantic strength of the core instruction.

4. The multi-agent collaborative interaction strategy optimization method according to claim 1, characterized in that: The collaborative contribution potential index of any high-quality parent instruction is obtained by combining the clarity of the structured instruction and the semantic strength of the core instruction, including: Normalizing the structured instruction clarity and the core instruction semantic strength respectively to obtain a structured instruction clarity normalized value and a core instruction semantic strength normalized value, and recording the sum of the structured instruction clarity normalized value and the core instruction semantic strength normalized value as the instruction feature value of any high-quality parent instruction; Obtain the instruction feature values ​​corresponding to all high-quality parent instructions, take the mean of all instruction feature values ​​as the bias term, take the difference between the instruction feature value of any high-quality parent instruction and the bias term as the independent variable of the Sigmoid activation function, and obtain the collaborative contribution potential index of any high-quality parent instruction.

5. The multi-agent-based collaborative interaction strategy optimization method according to claim 1, characterized in that: According to the collaborative contribution potential index of each high-quality parent instruction, a core contribution parent instruction is selected in turn from all high-quality parent instructions, including: According to the collaborative contribution potential index of each high-quality parent instruction, a core contribution parent instruction is selected in turn from all high-quality parent instructions using the roulette wheel selection method.

6. The multi-agent-based collaborative interaction strategy optimization method according to claim 3, characterized in that: The extraction of the dominant advantage feature fragment of the core contribution parent instruction of each selection includes: Based on the clarity of structured instructions and the semantic strength of core instructions of all high-quality parent instructions, the mean values ​​of structured instruction clarity and core instruction semantic strength are calculated respectively. For any selected core contribution parent instruction, if the core instruction semantic strength of any selected core contribution parent instruction is greater than or equal to the mean value of the core instruction semantic strength, the smallest text unit containing verbs and moral auxiliary verbs in the text content of any selected core contribution parent instruction is taken as the dominant advantage feature segment. If the structured instruction clarity of any selected core contribution parent instruction is greater than or equal to the structured instruction clarity mean, all explicit structural units in the text content of any selected core contribution parent instruction are taken as dominant feature segments.

7. The multi-agent-based collaborative interaction strategy optimization method according to claim 6, characterized in that: The proposed model is used to perform text reorganization on each of the dominant feature segments to obtain a set of child instructions, including: The dominant characteristic segment of the core contribution parent instruction selected at any time is used as the target segment, and the target segment is textually reorganized using the proposal model to obtain a candidate child instruction. The legality and validity of the candidate child instruction are verified. If the verification passes, the candidate child instruction is used as the child instruction. If the verification fails, the dominant characteristic segment of the core contribution parent instruction selected at any next time is used as the target segment. The verification method is repeated until the number of child instructions meets the quantity requirement, and a set of child instructions is obtained.

8. The multi-agent-based collaborative interaction strategy optimization method according to claim 7, characterized in that: The checking of the legality and validity of the candidate descendant instruction includes: If the candidate child instruction is empty or the instruction length is not within the length range or contains banned words, the test is determined to have failed; if the candidate child instruction is not empty, the instruction length is within the length range and does not contain banned words, the test is determined to have passed.

Citation Information

Patent Citations

  • Strategy processing method and device, equipment, storage medium and program product

    CN116943205A

  • Lead compound discovery method based on large language model

    CN120148609A