Large model cue word automatic optimization method and device and electronic equipment

Through structured analysis and large-model evaluation, candidate prompt words are generated, and the iterative and distillation evaluation techniques are combined to automatically optimize prompt words, solving the problem that traditional prompt word design relies on manual intervention, and achieving the high accuracy and generalization ability of large-models in the generation of key problems.

CN120086360APending Publication Date: 2025-06-03THINKING CHAIN (TIANJIN) INTELLIGENT TECH CO LTD

Patent Information

Application Number
CN202510571779.0
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2025-05-06
Publication Date
2025-06-03

AI Technical Summary

Technical Problem

Existing large models face the gap between user input and model understanding in practical applications. Traditional prompt word design relies on manual intervention, is costly and lacks an automated feedback mechanism, resulting in delayed model response and waste of resources.

Method used

By obtaining user input problems, using the background-role-objective-key outcome analysis method for structured analysis, multiple candidate prompt words are generated, and the results of these candidate prompt words are evaluated and sorted using a large model. Combining iteration and distillation evaluation technology, prompt words are automatically optimized.

Benefits of technology

The automated optimization of prompt words is realized, which reduces the cost of manual intervention, improves the accuracy and generalization ability of large models in the generation of key problems, and reduces model response delay and resource waste.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN120086360A_ABST
    Figure CN120086360A_ABST
Patent Text Reader

Abstract

The invention relates to the technical field of large models, in particular to a large model cue word automatic optimization method and device and electronic device.The large model cue word automatic optimization method comprises the steps that a question input by a user is obtained, and a plurality of candidate cue words are generated based on the question; performing effect evaluation on each candidate cue word by utilizing a large model, performing descending sorting on each candidate cue word according to an effect evaluation result to determine a plurality of optimal cue words, and storing the optimal cue words; carrying out iteration on the optimal cue word in the cue word bank, carrying out distillation evaluation on the optimal cue word after iteration, and if a distillation evaluation result reaches a set threshold value, updating the number of iterations; and performing descending sorting on the optimal cue words completing the set number of iterations according to the distillation evaluation result, and outputting the first optimal cue word as a final cue word. According to the method, the cue word can be automatically optimized, the cue word quality is improved, and the key problem generation accuracy of a large model is improved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the field of large model technology, and in particular to a large model prompt word automatic optimization method, device and electronic equipment. Background Art

[0002] In the context of rapid iteration of artificial intelligence technology, large models have been widely used in finance, medical care, education, customer service and other fields with their powerful natural language processing capabilities. However, with the complexity of business scenarios and the refinement of user needs, large models face multiple pain points in practical applications, and the gap between user input and model understanding has become a core challenge. Although large models can generate high-quality content, their output quality is highly dependent on the accuracy of user input.

[0003] Prompts are the key bridge between user needs and model outputs, and their optimization quality directly affects business results. However, traditional prompt design is highly dependent on manual intervention. Manually writing and iterating prompts requires professional engineers or domain experts to invest a lot of time, especially under cross-language, cross-scenario or changing needs, and labor costs rise significantly; traditional methods rely on trial-and-error optimization and lack an automated feedback mechanism, resulting in delayed model response and waste of resources.

[0004] At the same time, the misalignment between technology and business goals further exacerbates the challenges. For example, in the government sector, policy interpretation applications require accurate understanding of complex clauses, but existing prompt words are difficult to capture semantic nuances; in the e-commerce sector, personalized recommendations rely on multimodal prompt word optimization, but the black box nature of the visual language model leads to a lack of transparency in prompt word adjustments, making it difficult for companies to optimize independently. Therefore, how to build a set of automated, low-cost prompt word optimization technology has become the core demand of companies to unlock the value of large models. Summary of the invention

[0005] The present application provides a large model prompt word automatic optimization method, device, electronic device and storage medium to solve the problems in the above-mentioned background technology.

[0006] In a first aspect, the present application provides a large model prompt word automatic optimization method, comprising: Obtaining a question input by a user, and generating a plurality of candidate prompt words based on the question; Use the big model to evaluate the effect of each candidate prompt word, and then sort each candidate prompt word in descending order according to the effect evaluation results to determine multiple optimal prompt words and store them in the database; Iterate the optimal prompt word in the prompt word library, and perform distillation evaluation on the optimal prompt word after iteration. If the distillation evaluation result reaches the set threshold, the number of iterations is updated; Sort the optimal prompts that have completed the set number of iterations in descending order according to the distillation evaluation results, and output the first optimal prompt as the final prompt.

[0007] Further, generating a plurality of candidate prompts based on the problem includes: Structurally analyze the problem through background-role-goal-key result analysis to obtain a structured problem; Optimize the structured problem through a set of optimization strategies to generate a plurality of candidate prompts.

[0008] Further, the optimization strategies include few-shot prompting, role assignment, and chain of thought reasoning.

[0009] Further, evaluating the effects of each candidate prompt using a large model, and then sorting each candidate prompt in descending order according to the effect evaluation results to determine a plurality of optimal prompts and storing them in a database, includes: Evaluate the effects of each candidate prompt using a large model to determine the relevance and credibility of each candidate prompt; Sort the candidate prompts whose average values of relevance and credibility reach the expected value in descending order according to the average value, and take the first set number of candidate prompts as the optimal prompts and store them in the database.

[0010] Further, evaluating the effects of each candidate prompt using a large model to determine the relevance and credibility of each candidate prompt includes: Input each candidate prompt into the large model to obtain the answer corresponding to each candidate prompt; Perform vector processing on the answer and conduct semantic analysis and relevance query with the vector data of the problem, and obtain the relevance of each candidate prompt through vector calculation; Quantitatively compare the similarity and text overlap degree of the answer with a set of automated metrics to obtain the credibility of each candidate prompt.

[0011] Further, the process of distillation evaluation includes: Distill the optimal prompt to obtain a distilled prompt, and input the distilled prompt into the large model to obtain a prediction result; Calculate the cosine similarity between the vector of the prediction result and the expected result vector to obtain the distillation evaluation result.

[0012] Further, after iterating the optimal prompts in the prompt library and performing distillation evaluation on the optimal prompts after iteration, it further includes: If the distillation evaluation result does not reach the set threshold, iterate the optimal prompt again until the distillation evaluation result reaches the set threshold.

[0013] In a second aspect, the present application provides an automatic optimization device for large model prompt words, including: A candidate generation module, configured to obtain a question input by a user and generate multiple candidate prompt words based on the question; An effect evaluation module, configured to use a large model to evaluate the effects of each candidate prompt word, and then sort each candidate prompt word in descending order according to the effect evaluation result to determine multiple optimal prompt words and store them in a library; An iterative distillation module, configured to iterate the optimal prompt words in the prompt word library, perform distillation evaluation on the optimal prompt words after iteration, and update the iteration times if the distillation evaluation result reaches a set threshold; A final output module, configured to sort the optimal prompt words that have completed the set number of iterations in descending order according to the distillation evaluation result, and output the first optimal prompt word as the final prompt word.

[0014] In a third aspect, the present application provides an electronic device, including a memory, a processor, and a computer program stored in the memory and executable on the processor. When the processor executes the computer program, the above-mentioned automatic optimization method for large model prompt words is implemented.

[0015] In a fourth aspect, the present application provides a computer-readable storage medium storing a computer program, and when the computer program is executed by a processor, the above-mentioned automatic optimization method for large model prompt words is implemented.

[0016] The above technical solutions of the present application have the following advantages: The automatic optimization method for large model prompt words provided in the first aspect of the present application, by obtaining a question input by a user, generating multiple candidate prompt words based on the question, using a large model to evaluate the effects of each candidate prompt word, sorting each candidate prompt word in descending order according to the effect evaluation result to determine multiple optimal prompt words and storing them in a library, iterating the optimal prompt words in the prompt word library, performing distillation evaluation on the optimal prompt words after iteration, updating the iteration times if the distillation evaluation result reaches a set threshold, sorting the optimal prompt words that have completed the set number of iterations in descending order according to the distillation evaluation result, and outputting the first optimal prompt word as the final prompt word, combines feedback update technologies and automatic loop optimization technologies of the prompt word library, etc., realizes the automatic optimization ability of prompt words, and greatly improves the accuracy and generalization ability of the large model in generating key questions.

[0017] It can be understood that the beneficial effects of the above second aspect, third aspect, and fourth aspect can refer to the relevant descriptions in the above first aspect and will not be elaborated here. Description of the Drawings

[0018] To more clearly illustrate the specific embodiments of the present application or the technical solutions in the prior art, the following will briefly introduce the drawings required for the description of the specific embodiments or the prior art. Obviously, the drawings in the following description are some embodiments of the present application. For those of ordinary skill in the art, without creative efforts, other drawings can also be obtained based on these drawings.

[0019] Figure 1 It is a schematic flow chart of the large model prompt word automatic optimization method provided by the present application; Figure 2 It is a schematic structural diagram of the large model prompt word automatic optimization device provided by the present application; Figure 3 It is a schematic structural diagram of the electronic device provided by the present application. Specific Embodiments

[0020] In the following description, for the purpose of illustration rather than limitation, specific details such as specific system structures and technologies are presented to thoroughly understand the embodiments of the present application. However, those skilled in the art should clearly understand that the present application can also be implemented in other embodiments without these specific details. In other cases, the detailed descriptions of well-known systems, devices, circuits, and methods are omitted to avoid unnecessary details from interfering with the description of the present application.

[0021] It should be understood that when used in the specification and appended claims of the present application, the term "comprising" indicates the presence of the described features, wholes, steps, operations, elements, and / or components, but does not exclude the presence or addition of one or more other features, wholes, steps, operations, elements, components, and / or their combinations.

[0022] In addition, in the description of the specification and appended claims of the present application, the terms "first", "second", "third", etc. are only used for distinguishing descriptions and cannot be understood as indicating or implying relative importance.

[0023] The reference to "one embodiment" or "some embodiments" etc. in the specification of the present application means that a specific feature, structure, or characteristic described in conjunction with the embodiment is included in one or more embodiments of the present application. Thus, the statements "in one embodiment", "in some embodiments", "in other some embodiments", "in still other embodiments", etc. that appear in different places in this specification are not necessarily all referring to the same embodiment, but mean "one or more but not all embodiments", unless otherwise specifically emphasized in other ways. The terms "comprising", "including", "having", and their variants all mean "including but not limited to", unless otherwise specifically emphasized in other ways. "Plurality" means "two or more".

[0024] The following will further describe in detail the specific implementation manners of the present application in conjunction with the accompanying drawings and embodiments. The following embodiments are used to illustrate the present application, but are not used to limit the scope of the present application.

[0025] As Figure 1 shown, the embodiment of the present application provides a method for automatically optimizing large model prompt words, which specifically includes the following steps: obtaining a problem input by a user, and generating multiple candidate prompt words based on the problem; using a large model to evaluate the effects of each candidate prompt word, and then sorting each candidate prompt word in descending order according to the evaluation results to determine multiple optimal prompt words and storing them in a database; iterating the optimal prompt words in the prompt word database, and performing distilled evaluation on the optimal prompt words after iteration. If the distilled evaluation result reaches a set threshold, update the iteration times; sorting the optimal prompt words that have completed the set number of iterations in descending order according to the distilled evaluation results, and outputting the first optimal prompt word as the final prompt word.

[0026] In some embodiments, generating multiple candidate prompt words based on the problem includes: performing structured analysis on the problem through the background-role-goal-key result analysis method to obtain a structured problem; optimizing the structured problem through a set optimization strategy to generate multiple candidate prompt words.

[0027] In some embodiments, the optimization strategy includes few-shot prompting, role assignment, and chain-of-thought reasoning.

[0028] In some embodiments, using a large model to evaluate the effects of each candidate prompt word, and then sorting each candidate prompt word in descending order according to the evaluation results to determine multiple optimal prompt words and storing them in a database includes: using a large model to evaluate the effects of each candidate prompt word to determine the relevance and credibility of each candidate prompt word; sorting each candidate prompt word whose average value of relevance and credibility reaches an expected value in descending order according to the average value, and taking the first set number of candidate prompt words as the optimal prompt words and storing them in a database.

[0029] In some embodiments, using a large model to evaluate the effects of each candidate prompt word to determine the relevance and credibility of each candidate prompt word includes: inputting each candidate prompt word into the large model to obtain the answer corresponding to each candidate prompt word; performing vector processing on the answer and performing semantic analysis and relevance query on the vector data of the problem, and obtaining the relevance of each candidate prompt word through vector calculation; quantitatively comparing the similarity and text overlap degree of the answer with a set automation index to obtain the credibility of each candidate prompt word.

[0030] In some embodiments, the process of distillation evaluation includes: distilling the optimal prompt to obtain a distilled prompt, inputting the distilled prompt into a large model to obtain a prediction result; calculating the cosine similarity between the vector of the prediction result and the vector of the expected result to obtain the distillation evaluation result.

[0031] In some embodiments, after iterating the optimal prompt in the prompt library and performing distillation evaluation on the optimal prompt after iteration, it further includes: if the distillation evaluation result does not reach the set threshold, iterating the optimal prompt again until the distillation evaluation result reaches the set threshold.

[0032] In an application, after a user question is input, the user input question is obtained and structurally analyzed through the BROK analysis method (background, role, objective, key results), and a structured question is output. Background (B): Provide necessary context information for the model. Role definition (R): Clearly define the role that the model should play in the interaction. Objective setting (O): Clearly define the task that is expected to be completed by the model. Key results display (K): Specify the expected output format and content. Final analysis result (E): The result of the structural analysis of the user's needs. By analyzing the problem requirements, a prompt template with the problem background, role, objective, format, etc. as the framework is formed, and an optimization strategy is generated.

[0033] For example: User input question: "I have been operating a food blog recently, but the traffic has been very low. How can I optimize the content to attract more readers?"

[0034] Decompose the original question: The core appeal of the user is to "increase blog traffic and interaction rate", but the original question lacks specific background and objectives.

[0035] Supplement the background (user identity, current data), role (expert advisor), objective (traffic, interaction), and key results (quantitative indicators) through the BROK framework.

[0036] Structured output (BROK analysis): B (background): I am an operator of a food blog, mainly targeting young people aged 20 - 35.

[0037] Currently, the blog content mainly consists of recipes and restaurant recommendations, but the monthly page views are less than 500 times, and the interaction rate (likes, comments, shares) is lower than the industry average.

[0038] Hope to improve the search ranking and user stickiness by optimizing the content.

[0039] R (role): Please act as a content marketing expert and SEO consultant, and provide actionable optimization strategies by combining user behavior in the food industry and platform algorithms.

[0040] O (Objective): Improve the blog's ranking in search engines and increase organic traffic.

[0041] Increase user engagement rate (likes, comments, shares).

[0042] Increase monthly page views to over 2,000 within 3 months.

[0043] K (Key Result): List at least 5 actionable SEO optimization steps (such as keyword selection, content structure adjustment).

[0044] Provide 3 creative content forms to increase user interaction (such as video tutorials, user UGC collection activities).

[0045] Develop a 1-month test plan with clear quantifiable metrics (such as click-through rate, dwell time).

[0046] Optimize structured questions (few-shot prompting, role assignment, chain-of-thought reasoning) and output multiple candidate prompt words.

[0047] I. Few-shot Prompting Optimization Goal: By providing diverse examples that cover the boundary conditions and complex scenarios of the task, avoid the model from overfitting to simple patterns.

[0048] Optimization Method: Diversity: Cover different input types, complexities, and expressions (such as positive examples, negative examples, contradictory cases).

[0049] Relevance: The examples need to be highly relevant to the target task to ensure that the model can transfer knowledge.

[0050] Balance: The ratio of positive examples to negative examples is reasonable to avoid bias.

[0051] Example 1 (Simple Positive Example): Input: The service in this restaurant is amazing. Highly recommended! Output: Positive Example 2 (Complex Positive Example): Input: Although we had to wait for 1 hour, every dish was worth it.

[0052] Output: Positive Example 3 (Implicit Negative): Input: The steak was like the sole of a leather shoe, but the dessert was a work of art.

[0053] Output: Neutral Example 4 (Counterexample): Input: The dishes are ordinary but the prices are comparable to those of Michelin-starred restaurants.

[0054] Output: Negative II. Role Specification Optimization Goal: Guide the model to output a structure that meets expectations through clear instructions and formats.

[0055] Optimization Method: System Instruction: Clearly define the model's role (e.g., "You are an SQL expert").

[0056] Example Formatting: Arrange examples in input-output pairs and clearly separate them with delimiters.

[0057] Task Requirement: Describe the output format in natural language (e.g., "Please explain step by step and finally give the SQL statement").

[0058] III. Chain of Thought Reasoning (COT) Optimization Goal: Let the model demonstrate its thinking process through step-by-step explanations, improving the interpretability and accuracy of the output.

[0059] Optimization Method: Include intermediate reasoning steps in the examples instead of only outputting the answers. Use instructions such as "Please explain step by step and finally give the conclusion".

[0060] Example: Question: If all cats like fish and Tom is a cat, does Tom like fish? Example 1 (with COT): Input: All birds can fly. Penguins are birds. Can penguins fly? Output: Step 1: Premise 1: All birds can fly.

[0061] Step 2: Premise 2: Penguins are birds.

[0062] Step 3: But there is a contradiction in reality, so the universality of Premise 1 needs to be questioned.

[0063] Conclusion: Penguins cannot fly.

[0064] Task Requirement: Please analyze whether Tom likes fish in a similar way.

[0065] Obtain candidate prompt words and evaluate their effects (evaluate the relevance and credibility through the answers feedback by the large model). If the average value of relevance and credibility does not reach the expected value, regenerate candidate prompt words and evaluate. Sort the candidate prompt words whose average values of relevance and credibility reach the expected value in descending order according to the average value, and select several of the top optimal prompt words for storage in the database.

[0066] Relevance: Vectorize the answer and perform semantic analysis and relevance query with the vector data of the question, and calculate the proportion of relevance through vector calculation.

[0067] Credibility (objective evaluation): Quantify the text similarity and text overlap through automated metrics.

[0068] For example: User question: What's the weather like today? A (Answer from the large model): It's sunny, the highest temperature is 10 degrees, and the lowest temperature is 5 degrees.

[0069] A1 (Automated metric): It's sunny today, and the temperature is 10 - 5 degrees.

[0070] Quantitatively compare the similarity and text overlap between A (Answer from the large model) and A1 (Automated metric).

[0071] The evaluation is sorted based on the average of the answer effects of the candidate prompt words, such as the relevance and credibility of the answer. The top set number of candidates are selected as the optimal prompt words. (The expected value is a set parameter, e.g., 70% (average of relevance and credibility)). Example (selected): Candidate 1: Relevance 69%, Credibility 73%, (optimal) Candidate 2: Relevance 68%, Credibility 73%, Candidate 3: Relevance 67%, Credibility 73%, Example (not selected): Candidate 1: Relevance 69%, Credibility 70%, Candidate 2: Relevance 68%, Credibility 57%, Candidate 3: Relevance 67%, Credibility 56%, Iteratively optimize the prompt words in the prompt word library. After iteration, perform distilled evaluation on the prompt words. If the distilled evaluation result reaches the set threshold, update the iteration times. If the distilled evaluation result does not reach the set threshold, re-iterate the optimal prompt words until the distilled evaluation result reaches the set threshold; sort the optimal prompt words that have completed the set number of iterations in descending order according to the distilled evaluation result, and output the first optimal prompt word as the final prompt word.

[0072] Distillation evaluation is to shorten the length of the prompt while infinitely retaining the meaning of the original prompt, and evaluate it through the Q&A feedback of the large model. Prompt distillation evaluation is a technique that first distills complex long-text prompts into more concise prompts while maintaining or approaching the performance of the original prompts, and then evaluates the accuracy of the distilled prompts. It is necessary to compare the performance differences of the original prompts and the distilled prompts on the task. The following is the evaluation implementation process and examples: Original prompt: "I have been operating a food blog recently, but the traffic has been very low. How can I optimize the content to attract more readers?" Distilled prompt: "Improve the traffic of the food blog by optimizing the content to attract readers." Distillation method: Based on the capabilities of the large model, optimize the parameters of the distilled prompt (such as reinforcement learning or Bayesian optimization).

[0073] Distilled prompt evaluation: Input the distilled prompt into the model to obtain the prediction result, and calculate the distillation evaluation result (calculation example: calculate the cosine similarity between the vector of the prediction result and the vector of the expected result).

[0074] The final output prompt is submitted to the large model for inference, and the large model returns the inference result to the user side.

[0075] The large model prompt automatic optimization method provided by the embodiments of this application obtains the problem input by the user, generates multiple candidate prompts based on the problem, uses the large model to evaluate the effects of each candidate prompt, sorts each candidate prompt in descending order according to the evaluation result to determine multiple optimal prompts and stores them in the library, iterates the optimal prompts in the prompt library, conducts distillation evaluation on the optimal prompts after iteration, updates the iteration times if the distillation evaluation result reaches the set threshold, sorts the optimal prompts that have completed the set iteration times in descending order according to the distillation evaluation result, and outputs the first optimal prompt as the final prompt. It combines the feedback update technology of the prompt library and the automatic loop optimization technology, etc., realizes the automatic optimization ability of the prompt, and greatly improves the accuracy and generalization ability of the large model in generating key questions.

[0076] Corresponding to the large model prompt automatic optimization method described in the above embodiments, the embodiments of this application also provide a large model prompt automatic optimization device, as Figure 2 shown. The large model prompt automatic optimization device includes: A candidate generation module, configured to obtain the problem input by the user and generate multiple candidate prompts based on the problem; An effect evaluation module, configured to use the large model to evaluate the effects of each candidate prompt, and then sort each candidate prompt in descending order according to the evaluation result to determine multiple optimal prompts and store them in the library; An iterative distillation module is used to iterate the optimal prompt words in the prompt word library. After iteration, the optimal prompt words are subjected to distillation evaluation. If the distillation evaluation result reaches the set threshold, the iteration count is updated. A final output module is used to sort the optimal prompt words that have completed the set number of iterations in descending order according to the distillation evaluation results, and output the first optimal prompt word as the final prompt word.

[0077] It should be noted that the information interaction, execution process, etc. between the above modules / units, due to being based on the same concept as the method embodiment of the present application, for their specific functions and the technical effects brought, reference can be specifically made to the method embodiment part, and details will not be elaborated here.

[0078] Those skilled in the art can clearly understand that for the convenience and brevity of description, only the above division of each functional unit and module is used as an example. In actual applications, the above functions can be allocated to different functional units and modules according to needs, that is, the internal structure of the device is divided into different functional units or modules to complete all or part of the functions described above. Each functional unit and module in the embodiment can be integrated in a processing unit, or each unit can exist physically alone, or two or more units can be integrated in one unit. The above integrated unit can be implemented in the form of hardware or in the form of a software functional unit. In addition, the specific names of each functional unit and module are only for the convenience of mutual distinction and do not limit the protection scope of the present application. The specific working process of the units and modules in the above system can refer to the corresponding process in the foregoing method embodiment, and details will not be elaborated here.

[0079] The embodiment of the present application also provides an electronic device, as Figure 3 shown, including a memory, a processor, and a computer program stored in the memory and executable on the processor. When the processor executes the computer program, it implements the steps of the large model prompt word automatic optimization method provided in the first aspect.

[0080] In applications, the electronic device may include, but is not limited to, a processor and a memory. Figure 3 This is only an example of an electronic device and does not limit the electronic device. It may include more or fewer components than shown in the figure, or combine certain components, or different components. For example, input / output devices, network access devices, etc. The input / output devices may include a camera, an audio acquisition / playback device, a display screen, etc. The network access device may include a network module for performing wireless network with external devices.

[0081] In an application, the processor may be a central processing unit (CPU), and the processor may also be other general-purpose processors, digital signal processors (DSPs), application specific integrated circuits (ASICs), field-programmable gate arrays (FPGAs), or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components, etc. The general-purpose processor may be a microprocessor or the processor may also be any conventional processor, etc.

[0082] In an application, the memory may be an internal storage unit of an electronic device in some embodiments, such as a hard disk or memory of the electronic device. The memory may also be an external storage device of the electronic device in other embodiments. For example, a plug-in hard disk, a smart media card (SMC), a secure digital (SD) card, a flash card, etc., equipped on the electronic device. The memory may also include both an internal storage unit and an external storage device of the electronic device. The memory is used to store an operating system, application programs, a boot loader, data, and other programs, such as program codes of computer programs. The memory may also be used to temporarily store data that has been output or will be output.

[0083] The embodiments of the present application also provide a computer-readable storage medium storing a computer program, and when the computer program is executed by a processor, the steps in the above method embodiments can be implemented.

[0084] To implement all or part of the processes in the above method embodiments of the present application, it can be completed by instructing relevant hardware through a computer program. The computer program can be stored in a computer-readable storage medium. When the computer program is executed by a processor, the steps in the above method embodiments can be implemented. Among them, the computer program includes computer program code, and the computer program code can be in the form of source code, object code, executable file, or some intermediate form, etc. The computer-readable medium may at least include: any entity or device capable of carrying the computer program code to an electronic device, a recording medium, a computer memory, a read-only memory (ROM), a random access memory (RAM), an electrical carrier signal, a telecommunication signal, and a software distribution medium. For example, a USB flash drive, a mobile hard disk, a magnetic disk, or an optical disc, etc.

[0085] Those of ordinary skill in the art can realize that the devices and algorithm steps of each example described in combination with the embodiments disclosed herein can be implemented by electronic hardware, or a combination of computer software and electronic hardware. Whether these functions are executed in a hardware or software manner depends on the specific application and design constraints of the technical solution. Professional technicians can use different methods to implement the described functions for each specific application, but such implementation should not be considered to exceed the scope of this application.

[0086] In the embodiments provided in this application, it should be understood that the disclosed devices and methods can be implemented in other ways. For example, the device embodiments described above are merely illustrative. Additionally, the couplings or direct couplings or communication connections shown or discussed among each other can be through some interfaces. The devices are indirectly coupled or communication-connected, and can be in electrical, mechanical, or other forms.

[0087] The above-described embodiments are only used to illustrate the technical solutions of this application, rather than to limit them; although this application has been described in detail with reference to the foregoing embodiments, those of ordinary skill in the art should understand that they can still modify the technical solutions recorded in the foregoing embodiments, or perform equivalent replacements for some of the technical features; and these modifications or replacements do not cause the essence of the corresponding technical solutions to deviate from the spirit and scope of the technical solutions of each embodiment of this application, and should all be included within the protection scope of this application.

Claims

1. A large model prompt word automatic optimization method, characterized in that: include: Obtaining a question input by a user, and generating a plurality of candidate prompt words based on the question; Use the big model to evaluate the effect of each candidate prompt word, and then sort each candidate prompt word in descending order according to the effect evaluation results to determine multiple optimal prompt words and store them in the database; Iterate the optimal prompt word in the prompt word library, and perform distillation evaluation on the optimal prompt word after iteration. If the distillation evaluation result reaches the set threshold, the number of iterations is updated; The optimal prompt words that have completed the set number of iterations are sorted in descending order according to the distillation evaluation results, and the first optimal prompt word is output as the final prompt word.

2. The automatic optimization method for large model prompt words according to claim 1, characterized in that: The step of generating a plurality of candidate prompt words based on the question includes: Conduct structured analysis on the problem through the context-role-goal-key result analysis method to obtain a structured problem; The structured problem is optimized by a set optimization strategy to generate a plurality of candidate prompt words.

3. The automatic optimization method for large model prompt words according to claim 2, characterized in that: The optimization strategies include small sample prompts, role assignment, and thought chain reasoning.

4. The automatic optimization method for large model prompt words according to claim 1, characterized in that: The method of using the large model to evaluate the effect of each candidate prompt word, and then sorting each candidate prompt word in descending order according to the effect evaluation results to determine multiple optimal prompt words and store them in the database includes: Use the big model to evaluate the effect of each candidate prompt word and determine the relevance and credibility of each candidate prompt word; The candidate prompt words whose average values ​​of relevance and credibility reach the expected values ​​are sorted in descending order according to the average values, and the first set number of candidate prompt words are taken as the optimal prompt words and stored in the database.

5. The large model prompt word automatic optimization method according to claim 4, characterized in that: The use of the large model to evaluate the effect of each candidate prompt word and determine the relevance and credibility of each candidate prompt word includes: Input each candidate prompt word into the big model to obtain the answer corresponding to each candidate prompt word; The answer is processed by vector and semantic analysis and relevance query are performed with the vector data of the question, and the relevance of each candidate prompt word is obtained by vector calculation; The answer is quantitatively compared with the set automatic indicators in terms of similarity and text overlap to obtain the credibility of each candidate prompt word.

6. The large model prompt word automatic optimization method according to claim 1, characterized in that: The distillation evaluation process includes: Distilling the optimal prompt words to obtain distilled prompt words, and inputting the distilled prompt words into the large model to obtain prediction results; The cosine similarity between the predicted result vector and the expected result vector is calculated to obtain a distillation evaluation result.

7. The large model prompt word automatic optimization method according to claim 1, characterized in that: After iterating the optimal prompt word in the prompt word library and performing distillation evaluation on the optimal prompt word after iteration, the method further includes: If the distillation evaluation result does not reach the set threshold, the optimal prompt word is iterated again until the distillation evaluation result reaches the set threshold.

8. A large model prompt word automatic optimization device, characterized in that: include: A candidate generation module, used to obtain a question input by a user and generate a plurality of candidate prompt words based on the question; An effect evaluation module is used to evaluate the effect of each candidate prompt word using a large model, and then sort each candidate prompt word in descending order according to the effect evaluation results to determine multiple optimal prompt words and store them in the database; Iterative distillation module, used to iterate the optimal prompt word in the prompt word library, and after iteration, perform distillation evaluation on the optimal prompt word. If the distillation evaluation result reaches the set threshold, the number of iterations is updated; The final output module is used to sort the optimal prompt words that have completed the set number of iterations in descending order according to the distillation evaluation results, and output the first optimal prompt word as the final prompt word.

9. 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, the method for automatically optimizing large model prompt words as described in any one of claims 1 to 7 is implemented.

10. A computer-readable storage medium storing a computer program, characterized in that: When the computer program is executed by a processor, the method for automatically optimizing large model prompt words as described in any one of claims 1 to 7 is implemented.

Citation Information

Patent Citations

  • Prompt word full life cycle management method and system, electronic equipment and storage medium

    CN117494814A

  • Prompt word optimization method for processing multi-label classification task for large language model

    CN118350361A

  • Method and system for optimizing cue word, electronic equipment and storage medium

    CN118428492A

  • Prompt word optimization method and system based on large language model

    CN119047482A

  • Problem prompt word generation method and system and electronic equipment

    CN119782768A

Cited By

  • Large model cue word automatic optimization method based on distributed intelligent agent

    CN120277204A

  • Prompt word optimization method, intelligent agent and storage medium

    CN120278153A

  • Preset field Prompt generation method and device and related equipment

    CN121233721A

  • A preset field prompt generation method and device, and related equipment

    CN121233721B

  • Prompt word optimization method, electronic equipment, storage medium and program product

    CN121480506A