Prompt word optimization method and computer equipment

By using large language model prediction and feature importance optimization of the candidate prompt word set, the problems of high cost of manual prompt word optimization and low efficiency of automated optimization are solved, realizing an efficient and interpretable prompt word optimization process, and improving generation quality and efficiency.

CN121502277APending Publication Date: 2026-02-10LENOVO (BEIJING) LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202511768075.9
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2025-11-27
Publication Date
2026-02-10

AI Technical Summary

Technical Problem

In existing technologies, manual optimization of prompt words is costly, difficult to reproduce and scale, and has limited room for manual debugging, resulting in low efficiency and reliability of prompt word generation. Traditional automated optimization methods are inefficient in searching high-dimensional spaces and find it difficult to explore prompt word structures with high potential value.

Method used

By acquiring a candidate prompt word set, using a large language model to predict performance evaluation results and performance prediction bias, and combining feature importance, prompt word optimization guidance information is generated, and the candidate prompt word set is systematically updated to achieve automated optimization.

Benefits of technology

It improves the efficiency and reliability of prompt word optimization, reduces manpower and time costs, enables deeper exploration of high-performance prompt words, breaks through the limitations of model cognition, and achieves an engineering-interpretable optimization process.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN121502277A_ABST
    Figure CN121502277A_ABST
Patent Text Reader

Abstract

The invention provides a cue word optimization method and computer equipment, and relates to the field of artificial intelligence, a first candidate cue word set is obtained, each first candidate cue word is associated with at least one text feature and a first performance evaluation result of the text feature on a target task, and the first candidate cue word set is obtained based on a first model used for predicting performance feedback of the target task on cue words. Processing the text feature of each first candidate cue word to predict a second performance evaluation result of the corresponding first candidate cue word on the target task, and determining a performance prediction deviation of the corresponding first candidate cue word based on the second performance evaluation result and the first performance evaluation result of each first candidate cue word, and on the basis of the performance prediction deviation and the first candidate cue word set, cue word optimization guide information is determined, so that the first candidate cue word set is updated on the basis of the cue word optimization guide information, and a task cue word matched with the target task is determined from an obtained second candidate cue word set.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This application relates to the field of artificial intelligence technology, and in particular to a method for optimizing prompt words and a computer device. Background Technology

[0002] With the rapid popularization and development of artificial intelligence technology, Large Language Models (LLMs) based on cue word engineering have been widely applied in many fields of Natural Language Processing (NLP). Among them, cue words, as a key bridge connecting the powerful capabilities of LLM models and downstream tasks, directly determine the performance of the model output, thereby affecting the quality of downstream task completion.

[0003] However, the industry currently typically employs manual prompt engineering, which relies on experienced prompt engineers to manually design, test, and iterate to stimulate the model's reasoning ability through specific prompt structures. This manual optimization approach not only results in extremely high costs and makes the optimization process difficult to reproduce and scale, but also limits the space for manual prompt debugging, making it easy to fall into fixed mindsets and find it difficult to discover structurally better solutions, thus reducing the efficiency and reliability of prompt generation. Summary of the Invention

[0004] In view of the above problems, this application provides the following solution:

[0005] The first aspect of this application provides a method for optimizing prompt words, the method comprising:

[0006] Obtain the first candidate prompt word set; each first candidate prompt word is associated with at least one text feature and its first performance evaluation result on the target task;

[0007] The text features of each first candidate prompt word are processed based on the first model to predict the second performance evaluation result of the corresponding first candidate prompt word on the target task; the first model is used to predict the performance feedback of the target task to the prompt word;

[0008] Based on the second performance evaluation result and the first performance evaluation result for each first candidate suggestion word, the performance prediction deviation of the corresponding first candidate suggestion word is determined;

[0009] Based on the performance prediction deviation and the first candidate prompt word set, the prompt word optimization guidance information is determined;

[0010] Based on the optimized guidance information of the prompt words, the first candidate prompt word set is updated, and the task prompt words that match the target task are determined from the obtained second candidate prompt word set.

[0011] In one possible implementation, determining the prompt word optimization guidance information based on the performance prediction deviation and the first candidate prompt word set includes:

[0012] Based on the performance prediction deviation, target prompt words and reference prompt words are filtered from the first candidate prompt word set; the performance prediction deviation of the target prompt word is greater than the deviation threshold, and the performance prediction deviation of the reference prompt word is less than that of the target prompt word;

[0013] The target prompt and the reference prompt are compared based on the second model to generate a difference description; the difference description is used to describe the difference between the target prompt and the reference prompt.

[0014] Based on the aforementioned differences, prompts are used to optimize guidance information.

[0015] In one possible implementation, the method further includes:

[0016] Obtain the feature importance obtained by the first model processing the text features; the feature importance represents the contribution of the text features to the corresponding second performance evaluation result;

[0017] The step of determining the prompt words to optimize guidance information based on the difference description includes:

[0018] Based on the difference description and the feature importance, the prompt words are determined to optimize the guidance information.

[0019] In one possible implementation, the step of filtering target prompt words and reference prompt words in the first candidate prompt word set based on the performance prediction deviation includes any of the following:

[0020] Based on the comparison results between the performance prediction deviations corresponding to each of the first candidate prompt words, target prompt words and reference prompt words are filtered from the first candidate prompt word set;

[0021] Based on the comparison results between the performance prediction deviations corresponding to each of the first candidate prompt words, target prompt words are filtered in the first candidate prompt word set; based on the combination of at least one of the performance evaluation difference and text feature similarity with the performance prediction deviation, the difference score between the target prompt word and each other first candidate prompt word in the first candidate prompt word set is determined; based on the difference score, reference prompt words are filtered from each other first candidate prompt word.

[0022] Wherein, the performance evaluation difference is the difference between the second performance evaluation results of each of the other first candidate prompt words relative to the target prompt word;

[0023] The text feature similarity is the similarity between the text features of each of the other first candidate prompt words relative to the target prompt word.

[0024] In one possible implementation, the first performance evaluation result for each first candidate suggestion word is obtained by executing the target task on the target task's task dataset using a third model;

[0025] The first model is obtained by training a gradient boosting decision tree model, and the training process includes:

[0026] Based on the text features of each first candidate prompt word and the first performance evaluation result, a gradient boosting decision tree model is trained to learn the mapping relationship between the text features and the first performance evaluation result, thus obtaining the first model.

[0027] In one possible implementation, the first performance evaluation result for each of the first candidate prompt words is obtained by performing the target task on the target task's task dataset using a third model, including:

[0028] Obtain the task dataset and benchmark prompt words for the target task; the benchmark prompt words are prompt words used to guide the third model to process the task dataset, so as to filter the task data that failed to be processed as difficult samples based on the processing results;

[0029] Based on the baseline prompt words and the third model, a set of difficult samples is selected from the task dataset;

[0030] On the difficult sample set, the performance of each of the first candidate prompt words is evaluated by the third model to obtain the first performance evaluation result.

[0031] In one possible implementation, updating the candidate prompt word set based on the optimized guidance information of the prompt words includes:

[0032] Based on the optimized guidance information of the prompt words, at least one second candidate prompt word is generated;

[0033] Add the second candidate suggestion word to the first candidate suggestion word set to update the first candidate suggestion word set;

[0034] The steps of predicting the second performance evaluation result, generating prompt word optimization guidance information, and updating the candidate prompt word set are executed iteratively until the optimization termination condition is met, so as to obtain the second candidate prompt word set.

[0035] In one possible implementation, the step of optimizing the guidance information based on the prompt word and generating at least one second candidate prompt word includes:

[0036] Based on at least one of the first performance evaluation results and the performance prediction deviation corresponding to each of the first candidate prompt words, at least one prompt word to be optimized is determined in the first candidate prompt word set;

[0037] Based on the optimized guidance information of the prompt words, the at least one prompt word to be optimized is modified to obtain at least one second candidate prompt word.

[0038] In one possible implementation, at least one text feature associated with each first candidate prompt word is obtained, including:

[0039] For each first candidate prompt word, data attributes are extracted to obtain at least one attribute feature;

[0040] Perform feature clustering analysis on all semantic units of each of the first candidate prompt words to determine multiple semantic clusters;

[0041] Obtain the distribution of semantic units contained in each of the first candidate prompt words in each of the semantic clusters, and determine at least one semantic feature of the corresponding first candidate prompt word;

[0042] The semantic features and the attribute features are determined as the text features of the corresponding first candidate prompt words.

[0043] A second aspect of this application provides a computer device, the computer device comprising:

[0044] At least one memory is provided for storing a set of candidate prompt words;

[0045] At least one processor is configured to acquire a first candidate prompt word set; each first candidate prompt word is associated with at least one text feature and its first performance evaluation result on a target task; the text features of each first candidate prompt word are processed based on a first model to predict a second performance evaluation result of the corresponding first candidate prompt word on the target task; the first model is configured to predict the performance feedback of the target task to the prompt word; based on the second performance evaluation result and the first performance evaluation result of each first candidate prompt word, a performance prediction deviation of the corresponding first candidate prompt word is determined; based on the performance prediction deviation and the first candidate prompt word set, prompt word optimization guidance information is determined; based on the prompt word optimization guidance information, the first candidate prompt word set is updated, and a task prompt word matching the target task is determined from the obtained second candidate prompt word set. Attached Figure Description

[0046] The above and other features, advantages, and aspects of the embodiments of this disclosure will become more apparent from the accompanying drawings and the following detailed description. Throughout the drawings, the same or similar reference numerals denote the same or similar elements. It should be understood that the drawings are schematic, and the originals and elements are not necessarily drawn to scale.

[0047] Figure 1 This is a flowchart illustrating a prompt word optimization method proposed in Embodiment 1 of this application;

[0048] Figure 2 This is a flowchart illustrating a prompt word optimization method proposed in Embodiment 2 of this application;

[0049] Figure 3 This is a flowchart illustrating a prompt word optimization method proposed in Embodiment 3 of this application;

[0050] Figure 4 This is a schematic diagram illustrating one method for updating the first candidate prompt word set in a prompt word optimization method proposed in an embodiment of this application;

[0051] Figure 5 This is a flowchart illustrating the process of selecting a difficult sample set of the target task and determining the prompt word optimization guidance information in a prompt word optimization method proposed in an embodiment of this application.

[0052] Figure 6 This is a flowchart illustrating a prompt word optimization method proposed in Embodiment 4 of this application;

[0053] Figure 7 This is a schematic diagram of the structure of a prompt word optimization device proposed in an embodiment of this application;

[0054] Figure 8 This is a schematic diagram of the hardware structure of a computer device according to an embodiment of this application. Detailed Implementation

[0055] The embodiments of this application are described below with reference to the accompanying drawings. The terminology used in the implementation section of this application is only for explaining specific embodiments and is not intended to limit the application. The embodiments of this application are described below with reference to the accompanying drawings. It will be understood by those skilled in the art that, with the development of technology and the emergence of new scenarios, the technical solutions provided in the embodiments of this application are also applicable to similar technical problems.

[0056] The terms "first," "second," etc., used throughout this application and in the foregoing figures are used to distinguish similar objects and are not necessarily used to describe a specific order or sequence. It should be understood that such terms are interchangeable where appropriate; this is merely a way of distinguishing objects with the same attributes in the embodiments of this application. Furthermore, the terms "comprising" and "having," and any variations thereof, are intended to cover non-exclusive inclusion, so that a process, method, system, product, or apparatus that comprises a series of units is not necessarily limited to those units, but may include other units not explicitly listed or inherent to those processes, methods, products, or apparatuses.

[0057] To address the problems of the manual word optimization methods described in the background section, this paper proposes treating word optimization as a reinforcement learning problem. The policy is updated by maximizing a scalar reward signal, such as through the Group Relative Policy Optimization (GRPO) algorithm. This involves extensive testing of the words on the task, collecting reward signals, estimating the policy gradient to improve the model, and achieving automated word optimization. However, this method suffers from low sample efficiency, often requiring tens or even hundreds of thousands of optimizations to achieve good performance on new tasks, posing a serious bottleneck in scenarios with high testing costs or limited data.

[0058] Furthermore, this paper proposes using a powerful LLM (Large Language Model) to directly generate or rewrite candidate cue words for the target task. The LLM integrates learning signals into natural language by reflecting on and analyzing successful or failed trajectories. For example, it can summarize "memories" from successful agent trajectories to guide subsequent behaviors, or dynamically generate "memos" during testing to synthesize strategies, thus achieving automated cue word generation and optimization. However, the cue words generated by the LLM often exhibit high similarity in semantics and structure, limiting the breadth of exploration of the cue word space.

[0059] To address these issues, an iterative search and optimization approach for suggestion words is proposed. This approach, building upon automatically generated suggestion words, introduces a more systematic search strategy to explore the suggestion word space and gradually find better solutions. For example, evolutionary algorithms can be used to progressively optimize the suggestion word population. However, this iterative optimization method lacks clear guidance when generating candidate suggestion words, easily leading to a significant waste of computational resources on evaluating low-quality candidates. Alternatively, Bayesian optimization can be used to jointly optimize suggestion words and a small number of examples. For instance, MIPROv2 uses a tree-structure estimator to propose candidate configurations and updates the probability model based on evaluation scores, thus favoring high-performance candidate suggestion words. However, this method heavily relies on a large number of evaluations, resulting in relatively low sample efficiency. Furthermore, Bayesian optimization's search efficiency drops significantly in high-dimensional spaces, making it difficult to handle high-dimensional, structurally complex suggestion word spaces. Moreover, both of these optimization methods are like a "black box"—due to the uninterpretability of the search process, even if a high-performance suggestion word is found, its success cannot be attributed to key features, making it difficult to generalize the optimization experience to subsequent iterations or other tasks.

[0060] Furthermore, feedback-based gradient optimization methods have been proposed, simulating the gradient descent process in a discrete text space. For example, TextGrad obtains text feedback from other LLMs and "backpropagates" it to optimize prompt words. However, this iterative optimization method tends to fine-tune (utilize) the current optimal solution during the search process, lacking effective exploration of novel, high-potential-value prompt word structures. This results in limited diversity and a high tendency to converge to local optima.

[0061] To address the problems existing in the above-described prompt word optimization methods, this application proposes a new prompt word optimization method and computer device. The following will describe in detail one embodiment of the prompt word optimization method of this application with reference to the accompanying drawings.

[0062] Reference Figure 1 This is a flowchart illustrating a prompt word optimization method proposed in Embodiment 1 of this application. This method can be applied to computer devices, which can be device nodes in systems such as servers or cloud platforms, or terminal devices such as smartphones, laptops, desktop computers, or business terminals. This application does not impose any limitations on this. Figure 1 The prompt word optimization method proposed in this embodiment may include:

[0063] Step S11: Obtain the first candidate prompt word set; each first candidate prompt word is associated with at least one text feature and its first performance evaluation result on the target task;

[0064] The target task can refer to a natural language processing task performed by the target model, which may include, but is not limited to, at least one of the following: understanding tasks such as text analysis, sentiment analysis, natural language reasoning or question answering; generation tasks such as text summarization, machine translation, text paraphrasing or code generation; and interactive tasks such as dialogue systems or instruction following. For different target tasks, corresponding task datasets and task performance evaluation criteria are usually obtained to execute the method proposed in this application, determine task prompt words that match the actual target task, and complete the processing of the task dataset.

[0065] For example, if the target task is sentiment analysis, its task dataset could be a movie review dataset, and the performance evaluation criterion could be the classification accuracy on that dataset. If the target task is text summarization, its task dataset could come from open-source corpora, be downloaded from websites / network platforms, be from internal enterprise databases, or be actual input text data to be processed, and the prediction accuracy of the generated summary (such as the difference between the generated summary and the reference summary) could be used as the performance evaluation criterion for this target task. If the target task is a complex reasoning task such as solving mathematical word problems, its task dataset could come from open-source datasets used to evaluate and train the mathematical reasoning ability of language models, or data crawled from the Internet, or databases stored locally on computer devices, or actual input mathematical data to be answered, and the accuracy of the problem-solving could be used as the performance evaluation criterion for this target task. However, the dataset sources and performance evaluation criteria are not limited to the examples described in this application and can be determined according to the actual needs of the target task.

[0066] Based on the task datasets corresponding to the various target tasks identified above, a series of diverse initial prompt words (denoted as first candidate prompt words) can be generated using a general large model. This involves generating multiple first candidate prompt words with significant differences in structure and content, forming a first candidate prompt word set. For this, a set of structured prompt word generation constraints can be predefined. These constraints can cover multiple dimensions such as prompt word format, length, and instruction wording. They can be configured or adjusted according to actual processing needs or experience. This application does not restrict the content of the prompt word generation constraints. Subsequently, by arranging and combining different values ​​of these dimensions, a series of prompt word templates with different structures can be generated. Based on the task dataset, each prompt word template is instantiated using the general large model to obtain the first candidate prompt word set, but this method is not limited to this prompt word generation approach.

[0067] Subsequently, for each first candidate prompt word, the target model can quantify and score its performance on the target task's dataset. The obtained true performance score is used as the first performance evaluation result, associated with the first candidate prompt word, and stored for subsequent queries. Additionally, feature extraction can be performed on each first candidate prompt word. This includes extracting at least one textual feature (i.e., explicit feature) from at least one inherent attribute feature (such as directly quantifiable physical features like total number of characters, number of words, number of sentences, etc.) and at least one semantic feature (deep semantic information), which is directly associated with and stored on the first candidate prompt word. Alternatively, the feature vector resulting from concatenating the textual features can be associated with and stored on the first candidate prompt word. The implementation method for extracting the textual features of each candidate prompt word in this application is not limited and can be based on, but not limited to, the feature extractor in the first model.

[0068] It should be noted that the general-purpose large-scale model involved in this application can be an artificial intelligence model with a massive number of parameters (usually reaching billions or even hundreds of billions). It learns the features and patterns of natural language by training on large amounts of diverse data, thereby enabling it to understand and generate natural language. It typically has hundreds of millions to hundreds of billions of model parameters (model parameters are variables that control the behavior of the target model) and is capable of capturing complex relationships and patterns in natural language. The general-purpose large-scale model can include, but is not limited to, generative models and generative language models (GLMs). For example, large language models (LLMs), GPT (Generative Pre-trained Transformer) series models, T5 (Text to Text Transfer Transformer) models, visual large-scale models, multimodal large-scale models, and any other type of model. Optionally, this application can also use an expert large-scale model obtained by fine-tuning based on requirements to replace the above-mentioned general-purpose large-scale model to generate the first candidate prompt word set; the implementation process is not detailed in this application.

[0069] The target model involved in the embodiments of this application can be a lightweight model, that is, a model with a small number of parameters, relatively limited comprehensive processing capabilities, and whose performance is highly sensitive to the quality and structure of the input prompt words. It is a language model ultimately deployed in practical business applications, especially suitable for environments with limited computing resources, such as mobile devices or edge servers (i.e., "end-side" applications). Therefore, the target model of this application can be obtained by compressing (e.g., quantization, pruning, or knowledge distillation) and fine-tuning a large model suitable for practical business applications. This application does not limit the type of target model. Furthermore, the first candidate prompt words initially constructed or generated can also be manually written, or the first candidate prompt word set can consist of candidate prompt words generated based on a general large model and manually written prompt words.

[0070] Step S12: Process the text features of each first candidate prompt word based on the first model to predict the second performance evaluation result of the corresponding first candidate prompt word on the target task;

[0071] The first model is used to predict the performance feedback of the target task to the prompt words. It can be a pre-trained model with this predictive ability, or a task performance prediction model obtained by fine-tuning the pre-trained model. It can also be a surrogate model trained using training samples constructed from a set of first candidate prompt words and the first performance evaluation results corresponding to each first candidate prompt word, used to predict the task performance of each first candidate prompt word on the target task. For example, at least one of the following models can be used: a decision tree-based model, a neural network model, or a gradient boosting decision tree (GBDT) model, to learn the mapping relationship between the text features of the first candidate prompt words and the first performance evaluation results. The first model is different from the target model and general large model mentioned above. This application does not limit the model type or source of the first model.

[0072] After determining the text features of each first candidate prompt word using, but not limited to, the methods described above, these features can be input into a first model. The first model then performs the target task on the task dataset based on these text features, predicts the task performance, and obtains a second performance evaluation result for the first candidate prompt word, such as a predicted performance score. This application does not restrict the implementation method of how the first model predicts the performance score of each first candidate prompt word on the target task. This can be determined in conjunction with the task performance evaluation criteria of the target task. Furthermore, since there may be multiple task performance evaluation criteria for the target task, the predicted performance score of the same candidate prompt word on the target task may differ for different criteria; this is not restricted.

[0073] Step S13: Based on the second performance evaluation result and the first performance evaluation result of each first candidate suggestion word, determine the performance prediction deviation of the corresponding first candidate suggestion word;

[0074] Based on the above description of the acquisition process of the first performance evaluation result (true performance score) and the second performance evaluation result (predicted performance score) of the same first candidate prompt word on the same target task, due to the limited feature extraction capability of the target model, it cannot exhaustively enumerate all the features contained in the first candidate prompt word. This may result in the failure to extract features that are important to its task performance, making the second performance evaluation result predicted by the first model inaccurate. Alternatively, because the mapping relationship between the text features learned by the first model and the prompt word is not accurate enough, it cannot capture other features that are important to task performance based on explicit text features (denoted as implicit features), which will also make the second performance evaluation structure inaccurate, underestimate the task performance of the first candidate prompt word, and fail to explain the excellent performance (i.e., potential ability) in the first candidate prompt word.

[0075] In order to extract implicit features that are important to the task performance of candidate prompts, i.e. features that are different from the extracted text features, this application compares the second performance evaluation results and the first performance evaluation results of the same first candidate prompt. The difference between the two performance evaluation results is determined as the performance prediction deviation of the first model for the first candidate prompt, i.e., the prediction performance residual, which characterizes the uncertainty / error of the first model for the target task performance of the first candidate prompt. Based on this, subsequent steps are used to search the set of first candidate prompts for target prompts that the first model is not good at predicting but have good task performance, and to mine their potential task performance features (implicit features) on the target task.

[0076] Step S14: Based on the performance prediction deviation and the first candidate prompt word set, determine the prompt word optimization guidance information;

[0077] Step S15: Optimize guidance information based on prompt words, update the first candidate prompt word set, and determine the task prompt words that match the target task from the obtained second candidate prompt word set.

[0078] Following the above analysis, after determining the performance prediction bias of the first model for each first candidate prompt, a comparative analysis can be performed on each first candidate prompt to determine the natural language description of the reasons for the differences in task performance of different first candidate prompts. This serves as an interpretation of the potential task performance characteristics of the first candidate prompts, reliably generating prompt optimization guidance information for optimizing the first candidate prompts, such as structured and executable prompt modification suggestions. Based on this, guided updates to the first candidate prompt set can be implemented, such as adding / deleting keywords, adjusting syntactic structure, and adjusting semantic constraints for at least one first candidate prompt, to obtain second candidate prompts with higher task performance, which are then added to the first candidate prompt set. After several iterations of optimization, a second candidate prompt set that meets the optimization termination conditions (such as the number of optimization iterations reaching a threshold, the performance prediction bias decreasing to convergence, etc.) is obtained.

[0079] Subsequently, this application can store a second set of candidate prompt words, where each candidate prompt word can be associated with its own performance prediction deviation, performance evaluation results, and other data, stored as a reusable structured knowledge base. Thus, during the actual execution of the target task, task prompt words matching the target task can be directly selected from this set based on actual processing requirements. For example, based on the predicted performance score (second performance evaluation result), the candidate prompt word with the highest task performance can be selected as the task prompt word; or, constrained by the computing resources of the processing device or the model's constraints on the prompt word format, candidate prompt words of a specified length or format can be selected as the task prompt words. This application does not restrict the category of task prompt words or their selection dependencies; these can be determined as appropriate.

[0080] Therefore, this application generates a first set of candidate prompts for a target task, automatically predicts the task performance of each first candidate prompt on the target task through a first model (second performance evaluation result), and combines this with the actual task performance of each first candidate prompt obtained from pre-testing (first performance evaluation result) to determine the performance prediction deviation of the first model for each first candidate prompt. This deviation is then used as a heuristic signal to systematically balance the search and utilization strategies for prompt optimization. This provides engineering-interpretable prompt optimization guidance information for the prompt optimization process, transforming "black box" search into data-driven guided optimization. In other words, it transforms the originally uninterpretable prompt optimization process into a data-driven, attributable analysis process, facilitating deeper and more guided iterative optimization of candidate prompts, improving the efficiency and reliability of prompt optimization, and reducing manpower and time costs.

[0081] Reference Figure 2This is a flowchart illustrating a prompt word optimization method proposed in Embodiment 2 of this application. This embodiment describes an optional implementation method for determining prompt word optimization guidance information in the prompt word optimization method described in the above embodiments, such as... Figure 2 As shown, the implementation method may include:

[0082] Step S21: Based on the performance prediction deviation of each first candidate prompt word, filter the target prompt word and reference prompt word in the first candidate prompt word set; the performance prediction deviation of the target prompt word is greater than the deviation threshold, and the performance prediction deviation of the reference prompt word is less than that of the target prompt word;

[0083] Based on the above description of the performance prediction deviation and the implementation process of the prompt word optimization guidance information determined accordingly, the performance prediction deviation of the first candidate prompt word can be used to measure the number of implicit features contained in the first candidate prompt word itself, that is, the number of features that are not understood / captured by the first model. The smaller the absolute value of the performance prediction deviation, the more the actual task performance of the corresponding first candidate prompt word matches the predicted task performance of the first model; conversely, the more the actual task performance of the corresponding first candidate prompt word does not match the predicted task performance of the first model, that is, the higher the degree of underestimation of the task performance of the first candidate prompt word by the first model.

[0084] Based on this, this application can determine the first candidate prompt words whose actual task performance is severely underestimated by the first model (i.e., positive performance prediction residual with a large degree of underestimation, or performance prediction deviation greater than the deviation threshold, which can be a large value but is not limited to the value) based on the performance prediction deviation of each first candidate prompt word. If one or more first candidate prompt words with the highest performance prediction deviation are selected as target prompt words, i.e., the highest potential candidate prompt words, their excellent performance has not been captured by the first model, indicating that the target prompt word may contain some high-value implicit patterns or knowledge that have not been fully modeled by the extracted text features. This application can focus on analyzing such candidate prompt words, which can guide the prompt word optimization process to discover high-performance prompt word strategies, thereby breaking through the current cognitive limitations of the first model and achieving more efficient search, but is not limited to the target prompt word screening method described in this embodiment.

[0085] After determining the target prompt word, another first candidate prompt word with similar task performance to the target prompt word can be selected from other first candidate prompt words in the first candidate prompt word set. However, this other first candidate prompt word does not contain high-value implicit features that the target prompt word has not been captured / understood by the first model. This other first candidate prompt word is used as the reference prompt word for the target prompt word. The performance prediction deviation of the reference prompt word is smaller than that of the target prompt word, indicating that the first model underestimates the task performance of the reference prompt word to a lesser extent. This application can select the first candidate prompt word with the smaller or smallest absolute value of the performance prediction deviation as a more reliable comparison benchmark for the target prompt word. This reference prompt word is denoted as the reference prompt word for the target prompt word. The actual task performance of the reference prompt word is compared with / best matches the predicted task performance of the first model.

[0086] Therefore, in one possible implementation, this application can filter target and reference prompts in the set of first candidate prompts based on the comparison results between the performance prediction deviations corresponding to each first candidate prompt. For example, the prompt with the highest residual (maximum performance prediction deviation) / high-performance potential prompt can be the target prompt, and the first candidate prompt with the smallest absolute value of the performance prediction deviation can be the reference prompt, etc., but this method is not limited to this specific implementation.

[0087] Step S22: Based on the second model, the target prompt word and the reference prompt word are compared to generate a difference description; this difference description is used to describe the difference between the target prompt word and the reference prompt word.

[0088] Step S23: Based on the difference description, determine the prompt words to optimize the guidance information.

[0089] Based on the above description of the selection methods for target and reference prompts, comparing and analyzing these two different first candidate prompts can generate a difference description to explain the performance difference between the target prompt and the reference prompt on the target task. That is, it describes the difference between the two first candidate prompts on the same target task. This description can be a description of the implicit features in the target prompt, such as a description of at least one of the following: text features that show differences between the target prompt and the reference prompt, effective text features unique to the target prompt, and defective features that cause a decrease in its task performance.

[0090] Subsequently, the difference description can be used as the optimized prompt word of the first candidate prompt word and input into the second model (i.e., the general large model described above). The second model is then guided to generate prompt word optimization guidance information. This allows for targeted modification of at least one first candidate prompt word to obtain at least one second candidate prompt word with higher task performance on the target task. This solves the problems of imbalance between exploration and utilization, low search efficiency, and uninterpretable process in the traditional prompt word optimization method described above, thereby improving the efficiency and reliability of prompt word optimization.

[0091] In some other embodiments, regarding the method for filtering target prompts and reference prompts from the first candidate prompt set, after filtering the target prompts using the comparison results of the performance prediction deviation described above, when filtering the reference prompts for comparison, this application may also consider the performance similarity and / or feature structure similarity between the target prompts and the reference prompts. Therefore, this application may also determine the difference score between the target prompt and each other first candidate prompt in the first candidate prompt set based on the combination of at least one of the performance evaluation difference and text feature similarity with the performance prediction deviation. The difference score indicates the probability that the corresponding other first candidate prompt is selected as a reference prompt for the target prompt. The larger the difference score, the greater the probability of being selected as a reference prompt. Therefore, this application may filter the reference prompts among the other first candidate prompts based on the difference scores corresponding to each other first candidate prompt. For example, the other first candidate prompt with the largest difference score is the reference prompt, without limitation.

[0092] In this context, the performance evaluation difference mentioned above refers to the difference between the first performance evaluation results of each other first candidate prompt word relative to the target prompt word. Text feature similarity can be the similarity between the text features of each other first candidate prompt word and the target prompt word. It can be calculated using a suitable similarity algorithm, such as cosine similarity or vector distance. If a candidate prompt word contains multiple text features, these features can be concatenated into a single feature vector before similarity calculation to obtain the text feature similarity between the two candidate prompt words. Alternatively, a weighted similarity calculation can be performed on each text feature to obtain the text feature similarity. In this case, the weights used can represent the importance of the corresponding text feature to the task performance of the candidate prompt word.

[0093] Based on the above analysis, after obtaining the second performance evaluation results of the first model for each first candidate suggestion word, and determining the performance prediction bias accordingly, the difference score between the target suggestion word and each other first candidate suggestion word selected from the first candidate suggestion word set can be determined by the following CCS (Contrastive Candidate Score) calculation formula, so as to determine the reference suggestion word for the target suggestion word by maximizing the CCS:

[0094] (1);

[0095] In formula (1), This represents the i-th first candidate prompt word in the first candidate prompt word set; This represents the difference score between the i-th first candidate prompt word and the target prompt word. This represents the performance evaluation difference between the i-th first candidate suggestion word and the target suggestion word, and can also be the true performance score S of the i-th first candidate suggestion word. i The actual performance score S of the target prompt words target The smaller the difference between the two scores, the higher the score similarity. The larger this value is, It can represent the weighting coefficients of score similarity. The text feature X represents the i-th first candidate prompt word. i Text features X of the target cue words target Similarity, such as through a weighted cosine similarity function. The text feature similarity is calculated. It can represent the weight coefficients of text feature similarity. It can represent the residual penalty term, which is the absolute value of the performance prediction deviation of the i-th first candidate prompt word, and is used to measure how much implicit feature the i-th first candidate prompt word itself contains; The weighting coefficients can represent the deviation in performance prediction. The weighting coefficients of each item in formula (1) can be determined based on experience or experimentation, or can be dynamically adjusted during the iterative optimization of prompt words. This application does not impose any restrictions on the values ​​of each weighting coefficient.

[0096] It should be noted that during the iterative optimization of candidate prompt words, the target prompt words selected according to, but not limited to, the methods described above may be different in different rounds of iterative optimization, and the reference prompt words selected may also be different. In each round of iterative optimization, the selection process of target prompt words and reference prompt words in the current candidate prompt word set is similar, and this application will not describe them in detail.

[0097] Reference Figure 3This is a flowchart illustrating a prompt word optimization method proposed in Embodiment 3 of this application. This embodiment can be based on the prompt word optimization methods described in the preceding embodiments, by introducing the contribution of the text features of the first candidate prompt word to its prediction task performance, i.e., the text feature importance, and combining this with the performance prediction deviation to determine the prompt word optimization guidance information. Based on this, as... Figure 3 As shown, the prompt word optimization method proposed in this embodiment may include:

[0098] Step S31: Obtain the first candidate prompt word set; each first candidate prompt word is associated with at least one text feature and its first performance evaluation result on the target task;

[0099] Step S32: Process the text features of each first candidate prompt word based on the first model to predict the second performance evaluation result of the corresponding first candidate prompt word on the target task, and obtain the feature importance obtained by processing the text features; the feature importance represents the contribution of the text features to the corresponding second performance evaluation result.

[0100] In this embodiment, since the feature importance of each candidate prompt can indicate which phrase or sentence features in the candidate prompt contribute the most to the prediction of its task performance on the target task, this application can also guide prompt optimization through text feature importance, making the modification of candidate prompts more targeted and greatly improving search efficiency.

[0101] In this application, if the first model learns the mapping relationship between the text features of the prompt words and the task performance, such as by training a proxy model from scratch using a training sample set constructed based on the first candidate prompt word set, the weights of each mapping relationship in the first model can be obtained to determine the feature importance of the corresponding text features. If the first model is a pre-trained model or a model fine-tuned from it, the feature importance of each text feature can also be determined by quantitatively analyzing the contribution of each text feature to the prediction task performance of the corresponding candidate prompt words. The higher the contribution, the higher the feature importance of the text feature. This application does not describe the implementation process of this quantitative analysis in detail.

[0102] Step S33: Based on the second performance evaluation result and the first performance evaluation result of each first candidate suggestion word, determine the performance prediction deviation of the corresponding first candidate suggestion word;

[0103] Step S34: Determine the optimized guidance information for each first candidate prompt word based on the performance prediction deviation and feature importance.

[0104] Based on the performance prediction deviation described in the above embodiments, the implementation process for determining the prompt word optimization guidance information involves generating a difference description between the target prompt word and the reference prompt word. This difference description and feature importance can be used to determine the prompt word optimization guidance information. For example, the difference description and feature importance can be input into a second model to generate prompt word guidance information. Alternatively, based on the difference description and feature importance, an optimized prompt word can be constructed to guide the second model in generating prompt word modification suggestions. This optimized prompt word can then be input into the second model to generate prompt word optimization guidance information, such as a specific modification scheme for the first candidate prompt word, to guide the modification of at least one first candidate prompt word. This application does not limit the modification implementation method.

[0105] Step S35: Optimize the guidance information based on the prompt words and generate at least one second candidate prompt word;

[0106] To improve the efficiency and accuracy of prompt word optimization, this application can directly modify all first candidate prompt words in the entire first candidate prompt word set without optimizing the prompt word guidance information. It can select at least one representative first candidate prompt word as the prompt word to be optimized, and then modify at least one prompt word to be optimized based on the prompt word optimization guidance information to obtain at least one second candidate prompt word, that is, the optimized prompt word.

[0107] In one possible implementation, this application can determine at least one prompt word to be optimized in the first candidate prompt word set based on at least one of the first performance evaluation results and performance prediction deviations corresponding to each first candidate prompt word. For example, in order to consolidate and enhance known advantages, the first candidate prompt word with the highest first performance evaluation result can be selected as the highest performance prompt word as the optimal solution of this round of iteration optimization, and it can be modified based on the prompt word optimization guidance information. This optimization process belongs to the "utilization" strategy. The modified at least one optimized prompt word is recorded as the second candidate prompt word and added to the first candidate prompt word set.

[0108] Optionally, this application may also select the performance potential solution that is underestimated by the first model, i.e. the first candidate prompt word with the largest performance prediction deviation, as the prompt word to be optimized. Based on the prompt word optimization guidance information, it is modified to discover and strengthen its advantages that were not understood / captured by the first model. This optimization process belongs to the "exploration / search" strategy. At this time, at least one optimized prompt word obtained by modification is still recorded as the second candidate prompt word and added to the first candidate prompt word set.

[0109] In addition, this application may select the benchmark solution that best understands the first model, such as the first candidate prompt word with the smallest absolute value of performance prediction deviation, as the prompt word to be optimized. Based on the prompt word optimization guidance information, it is modified to stably verify the effectiveness of the modification suggestions in the prompt word optimization guidance information. At this time, at least one optimized prompt word obtained by modification is still recorded as the second candidate prompt word and added to the first candidate prompt word set.

[0110] Specifically, the modification process for each suggestion word to be optimized, as described above, i.e., the implementation of generating the second candidate suggestion word, is as follows: Figure 4 As shown, at least one prompt word to be optimized selected from the first candidate prompt word set according to the method described above, along with the aforementioned determined prompt word optimization guidance information, can be input into the second model. This prompt word optimization guidance information guides the second model to modify each prompt word to be optimized, thereby obtaining at least one second candidate prompt word. Optionally, this application can also generate at least one second candidate prompt word based on other models and the prompt word optimization guidance information. This application does not limit the implementation method of modifying at least one prompt word to be optimized in the first candidate prompt word set based on the prompt word optimization guidance information to obtain at least one second candidate prompt word.

[0111] Step S36: Add the second candidate prompt word to the first candidate prompt word set to update the first candidate prompt word set;

[0112] Step S37: Iteratively execute the steps of predicting the second performance evaluation result, generating prompt word optimization guidance information, and updating the candidate prompt word set until the optimization termination condition is met, so as to obtain the second candidate prompt word set.

[0113] Following the method described above, the initially constructed first candidate prompt word set undergoes one round of optimization. The second candidate prompt words generated in this round of optimization, together with the first candidate prompt word set, constitute the candidate prompt word set obtained in this round of optimization, denoted as the third candidate prompt word set. Afterwards, the system can initiate a new round of optimization on the third candidate prompt word set, that is, updating the third candidate prompt words according to the closed-loop process of "performance evaluation → analysis → optimization" described above. This iterative optimization is repeated multiple times until a preset optimization termination condition is met, such as the task performance reaching a target threshold, or completing a specified number of iterations (i.e., the iteration threshold). The final optimized candidate prompt word set is then denoted as the second candidate prompt word set.

[0114] In the above iterative optimization process, the first performance evaluation result of each first candidate prompt word, i.e. the true performance score, can be obtained by executing the target task on the task dataset of the target task using the third model (i.e. the target model described in the above embodiment). The implementation process can be referred to the description of the corresponding part of the above embodiment.

[0115] Preferably, for the task performance of the first candidate prompt word on the target task, the first model for determining the second performance evaluation result, i.e., the predicted performance score, can be obtained by training a Gradient Boosting Decision Tree (GBDT) model. During this training process, after obtaining the first performance evaluation result for each first candidate prompt word by performing the target task on the target task dataset using the third model (target model), a Gradient Boosting Decision Tree model can be trained based on the text features of each first candidate prompt word and the first performance evaluation result to learn the mapping relationship between text features and the first performance evaluation result, thus obtaining the first model. The detailed training process of GBDT is not described in detail in this application.

[0116] In some embodiments, such as Figure 5 As shown, to accurately evaluate the task performance of each candidate prompt, a difficult sample set can first be selected from the task dataset, i.e., the task dataset of the target task and the benchmark prompts can be obtained. These benchmark prompts are used to guide the third model in processing the task dataset, filtering out task data that failed to be processed as difficult samples based on the processing results. Thus, based on the benchmark prompts and the third model, a difficult sample set is selected from the task dataset. This involves the third model performing a preliminary test on the task dataset using the benchmark prompts, and identifying task data that failed to be correctly processed by the benchmark prompts during the test as difficult samples, forming the difficult sample set. Since difficult samples are more sensitive to subtle differences in task information when evaluating candidate prompts, they can provide a reliable basis for task performance feedback in the subsequent prompt optimization process. Therefore, this application can evaluate the performance of each first candidate prompt on the difficult sample set using the third model to obtain the first performance evaluation result, i.e., the true performance score.

[0117] After that, as Figure 5 As shown, the system can apply each first candidate prompt word generated in the initialization process described above to the hard sample set to perform the target task. The system quantifies and scores the performance of each first candidate prompt word on the hard sample set according to predefined task performance evaluation criteria, such as classification accuracy, to obtain the true performance score of the first candidate prompt word.

[0118] For each first candidate prompt word, at least one text feature can be extracted, such as inherent attribute features (i.e., meta-features) and semantic features, to construct a GBDT model. The trained proxy model serves as the first model. Then, the text features of each first candidate prompt word are analyzed to predict its task performance, resulting in a prediction performance score, which is recorded as the second performance evaluation result. Afterwards, as... Figure 5As shown, the feature importance of each text feature can be obtained from the proxy model. The difference between the actual performance score and the predicted performance score of each candidate prompt word is calculated and recorded as the performance prediction deviation. This deviation is used to determine the target prompt word with the high performance deviation. Then, reference prompt words are selected in the manner described by, but not limited to, formula (1) above. The implicit features in the target prompt word are identified by the second model, that is, the description of the difference in task performance between the target prompt word and the reference prompt word. These features, along with the feature importance, are input into the teacher's large language model (i.e., the third model) to generate prompt word optimization guidance information. The implementation process can be referred to the description of the corresponding part of the method embodiment above.

[0119] The third model can also be a general large model, such as a language model with a huge number of parameters (e.g., tens or hundreds of billions) and top-level performance. Such models have powerful natural language understanding, logical reasoning, and text generation capabilities. In this application, the third model does not directly perform the target task. It can utilize cognitive abilities to undertake higher-order analysis tasks, such as candidate prompt word generation, implicit feature recognition, and the determination of prompt word optimization guidance information. The implementation process is not detailed in this application.

[0120] Reference Figure 6 This is a flowchart illustrating a prompt word optimization method proposed in Embodiment 4 of this application. This embodiment describes in detail how to obtain the text features of each first candidate prompt word, such as... Figure 6 As shown, the implementation method may include:

[0121] Step S61: Extract data attributes for each first candidate prompt word to obtain at least one attribute feature;

[0122] Among them, the attribute features may include, but are not limited to, the total number of characters, the number of words, the number of sentences, and other directly quantifiable physical features contained in the corresponding first candidate prompt word. The attribute category can be flexibly determined according to actual needs or prompt word constraints.

[0123] Step S62: Perform feature clustering analysis on all semantic units of each first candidate prompt word to determine multiple semantic clusters;

[0124] Step S63: Obtain the distribution of semantic units contained in each first candidate prompt word in each semantic cluster, and determine at least one semantic feature of the corresponding first candidate prompt word; wherein, semantic features and attribute features are determined as text features of the corresponding first candidate prompt word.

[0125] To capture the deep semantic information of each first candidate prompt word, constrained by the input limitations of the feature extractor, each first candidate prompt word can be segmented into multiple semantic units (such as sentences). Then, using a pre-trained embedding model, each semantic unit is converted into a high-dimensional semantic vector. Through similarity calculation or clustering algorithms, cluster analysis is performed on all semantic vectors of all first candidate prompt words to form several semantic clusters. For each semantic cluster, the distribution of each semantic unit contained in each first candidate prompt word is statistically analyzed to obtain the semantic features of that first candidate prompt word. Therefore, for each first candidate prompt word, its semantic features are defined as the statistical distribution of its contained semantic units in various semantic clusters, but are not limited to this definition.

[0126] In practical applications, computer devices can run intelligent programs to execute the prompt word optimization method of this application. For example, the intelligent program can be an artificial intelligence assistant built into the operating system of an electronic device, which can be woken up and launched through voice or specific operations. It can also be an intelligent agent or other program that enables human-computer dialogue interaction; there are no limitations on this. The intelligent program has the ability to call various models (such as the first model, second model, and third model mentioned above), and for example, the calling interfaces corresponding to different models are different.

[0127] Optionally, the intelligent program may also have one or more models. In this case, the models are part of the intelligent program. Therefore, during the operation of the intelligent program, the intelligent program can start one or more models to perform corresponding task processing according to actual needs, thereby realizing the prompt word optimization method proposed in this application.

[0128] Reference Figure 7 This is a schematic diagram of the structure of a prompt word optimization device proposed in an embodiment of this application, as shown below. Figure 7 As shown, the prompt word optimization device may include:

[0129] The first acquisition module 71 is used to acquire a first candidate prompt word set; each first candidate prompt word is associated with at least one text feature and its first performance evaluation result on the target task;

[0130] The first performance prediction module 72 is used to process the text features of each first candidate prompt word based on the first model to predict the second performance evaluation result of the corresponding first candidate prompt word on the target task; the first model is used to predict the performance feedback of the target task to the prompt word;

[0131] The performance prediction deviation determination module 73 is used to determine the performance prediction deviation of the corresponding first candidate prompt word based on the second performance evaluation result and the first performance evaluation result for each first candidate prompt word;

[0132] The prompt word optimization guidance information determination module 74 is used to determine prompt word optimization guidance information based on the performance prediction deviation and the first candidate prompt word set;

[0133] The candidate prompt word update module 75 is used to optimize the guidance information based on the prompt words, update the first candidate prompt word set, and determine the task prompt word that matches the target task from the obtained second candidate prompt word set.

[0134] Optionally, the prompt word optimization guidance information determination module 74 may include:

[0135] The first filtering unit is used to filter target prompt words and reference prompt words in the first candidate prompt word set based on the performance prediction deviation; the performance prediction deviation of the target prompt word is greater than the deviation threshold, and the performance prediction deviation of the reference prompt word is less than that of the target prompt word;

[0136] The difference description generation unit is used to compare the target prompt word and the reference prompt word based on the second model and generate a difference description; the difference description is used to describe the difference between the target prompt word and the reference prompt word;

[0137] The first determining unit is used to determine the prompt words to optimize the guidance information based on the difference description.

[0138] In some embodiments, the above-mentioned prompt word optimization device may further include:

[0139] The feature importance acquisition module is used to acquire the feature importance obtained by the first model processing the text features; the feature importance represents the contribution of the text features to the corresponding second performance evaluation result;

[0140] Based on this, the aforementioned first determining unit may include:

[0141] The second determining unit is used to determine the prompt word optimization guidance information based on the difference description and the feature importance.

[0142] Optionally, the first filtering unit mentioned above may include:

[0143] The second filtering unit is used to filter target prompts and reference prompts in the first candidate prompt set based on the comparison results between the performance prediction deviations corresponding to each of the first candidate prompts.

[0144] Alternatively, the first filtering unit mentioned above may also include:

[0145] The third filtering unit is used to filter target prompt words in the first candidate prompt word set based on the comparison results between the performance prediction deviations corresponding to each of the first candidate prompt words.

[0146] The difference scoring determination unit is used to determine the difference score between the target prompt word and each other first candidate prompt word in the first candidate prompt word set based on a combination of at least one of the performance evaluation difference and text feature similarity with the performance prediction deviation;

[0147] The fourth filtering unit is used to filter reference prompts among the other first candidate prompts based on the difference score;

[0148] Wherein, the performance evaluation difference is the difference between the second performance evaluation results of each of the other first candidate prompt words relative to the target prompt word; the text feature similarity is the similarity between the text features of each of the other first candidate prompt words relative to the target prompt word.

[0149] In this embodiment of the application, the first performance evaluation result of each first candidate prompt word can be obtained by executing the target task on the task dataset of the target task through a third model; the above-mentioned device may further include a model training module for obtaining the first model by training a gradient boosting decision tree model. Optionally, the model training module may be specifically used to train a gradient boosting decision tree model based on the text features of each first candidate prompt word and the first performance evaluation result, so as to learn the mapping relationship between the text features and the first performance evaluation result, and obtain the first model.

[0150] In some embodiments, the first performance evaluation result obtaining module in the above-described apparatus can be used to execute the target task on the task dataset of the target task using a third model to obtain the first performance evaluation result for each of the first candidate prompt words. Specifically, it may include:

[0151] The second acquisition unit is used to acquire the task dataset and benchmark prompt words of the target task; the benchmark prompt words are prompt words used to guide the third model to process the task dataset, so as to filter the task data that failed to be processed as difficult samples based on the processing results;

[0152] The fifth filtering unit is used to filter a set of difficult samples from the task dataset based on the benchmark prompt words and the third model;

[0153] The performance evaluation unit is used to evaluate the performance of each of the first candidate prompt words on the difficult sample set using the third model, so as to obtain the first performance evaluation result.

[0154] In some embodiments, the candidate suggestion word update module 75 may include:

[0155] The first generation unit is used to optimize the guidance information based on the prompt words and generate at least one second candidate prompt word;

[0156] An adding unit is used to add the second candidate prompt word to the first candidate prompt word set to update the first candidate prompt word set;

[0157] The iterative processing unit is used to iteratively execute the steps of predicting the second performance evaluation result, generating prompt word optimization guidance information, and updating the candidate prompt word set until the optimization termination condition is met, so as to obtain the second candidate prompt word set.

[0158] Optionally, the first generation unit mentioned above may include:

[0159] The unit for determining the prompt word to be optimized is used to determine at least one prompt word to be optimized in the first candidate prompt word set based on at least one of the first performance evaluation results and the performance prediction deviation corresponding to each of the first candidate prompt words.

[0160] The modification unit is used to modify the at least one prompt word to be optimized based on the prompt word optimization guidance information to obtain at least one second candidate prompt word.

[0161] Optionally, the text feature extraction module can be used to obtain at least one text feature associated with each first candidate prompt word, specifically including:

[0162] The attribute feature extraction unit is used to extract data attributes for each first candidate prompt word to obtain at least one attribute feature;

[0163] The clustering analysis unit is used to perform feature clustering analysis on all semantic units into which each of the first candidate prompt words is divided, and to determine multiple semantic clusters;

[0164] A semantic feature determination unit is used to obtain the distribution of semantic units contained in each of the first candidate prompt words in each of the semantic clusters, and determine at least one semantic feature of the corresponding first candidate prompt word; wherein the semantic feature and the attribute feature are determined as the text features of the corresponding first candidate prompt word.

[0165] This application also provides a computer program product including computer-readable instructions, which, when executed on a computer device (such as a terminal or server), cause the electronic device to implement any of the prompt word optimization methods provided in this application.

[0166] This application also provides a computer-readable storage medium that carries one or more computer programs. When the one or more computer programs are executed by a computer device, the computer device can implement any of the prompt word optimization methods provided in this application.

[0167] Reference Figure 8 This is a schematic diagram of the hardware structure of a computer device according to an embodiment of this application, such as... Figure 8 As shown, the computer device includes at least one memory 81 and at least one processor 82.

[0168] The memory 81 can be used to store a set of candidate prompt words (here, the second set of candidate prompt words) to read task prompt words that match the target task, input them into the second model along with the task data to be processed, and guide the second model to process the task data through the task prompt words to obtain the task processing result.

[0169] Processor 82 is used to acquire a first candidate prompt word set; each first candidate prompt word is associated with at least one text feature and its first performance evaluation result on the target task; the text feature of each first candidate prompt word is processed based on a first model to predict a second performance evaluation result of the corresponding first candidate prompt word on the target task; the first model is used to predict the performance feedback of the target task to the prompt word; based on the second performance evaluation result and the first performance evaluation result of each first candidate prompt word, the performance prediction deviation of the corresponding first candidate prompt word is determined; based on the performance prediction deviation and the first candidate prompt word set, prompt word optimization guidance information is determined; based on the prompt word optimization guidance information, the first candidate prompt word set is updated, and task prompt words matching the target task are determined from the obtained second candidate prompt word set. The specific implementation process of this prompt word optimization method can be referred to the description of the corresponding part of the above method embodiment, and will not be repeated here.

[0170] In this application, the processor 82 can implement an intelligent program based on the intelligent program in its working state. This intelligent program is configured to implement the prompt word optimization method proposed in this application, and the implementation process is not detailed in this application. Based on the above description of the intelligent program, it can be an intelligent agent or artificial intelligence assistant, or other programs capable of human-computer dialogue interaction, etc., and this application does not impose any restrictions on it.

[0171] In the case where the model invoked by the intelligent program is a model deployed locally on the computer device, the model can be stored in the local memory 81 of the computer device. The memory 81 is used to store at least the data of the first model and / or the second model. Of course, the aforementioned first model, second model, and third model can also be cloud-based models. In this case, the intelligent program can send an invocation request to the cloud, which can carry task data and task prompts to execute downstream target tasks.

[0172] It should be understood that, Figure 8 The structure of the computer device shown does not constitute a limitation on the computer device in the embodiments of this application. In practical applications, the computer device may include more than Figure 8 The application does not provide a detailed list of all the components shown, including more or fewer components, or combinations of certain components, such as various communication elements, various input components or other output components, power management modules, and various sensors.

[0173] It should also be noted that the device embodiments described above are merely illustrative. The units described as separate components may or may not be physically separate, and the components shown as units may or may not be physical units; that is, they may be located in one place or distributed across multiple network units. Some or all of the modules can be selected to achieve the purpose of this embodiment according to actual needs. In addition, in the accompanying drawings of the device embodiments provided in this application, the connection relationship between modules indicates that they have a communication connection, which can be implemented as one or more communication buses or signal lines.

[0174] In the above embodiments, implementation can be achieved entirely or partially through software, hardware, firmware, or any combination thereof. When implemented in software, it can be implemented entirely or partially as a computer program product. The various embodiments in this specification are described in a progressive or parallel manner, with each embodiment focusing on its differences from other embodiments. Similar or identical parts between embodiments can be referred to interchangeably. For the apparatus and computer devices disclosed in the embodiments, since they correspond to the methods disclosed in the embodiments, the descriptions are relatively simple, and relevant parts can be referred to the method section.

Claims

1. A method for optimizing prompt words, the method comprising: Obtain the first set of candidate suggestion words; Each first candidate prompt word is associated with at least one text feature and its first performance evaluation result on the target task; The text features of each first candidate prompt word are processed based on the first model to predict the second performance evaluation result of the corresponding first candidate prompt word on the target task; The first model is used to predict the performance feedback of the target task to the prompt words; Based on the second performance evaluation result and the first performance evaluation result for each first candidate suggestion word, the performance prediction deviation of the corresponding first candidate suggestion word is determined; Based on the performance prediction deviation and the first candidate prompt word set, the prompt word optimization guidance information is determined; Based on the optimized guidance information of the prompt words, the first candidate prompt word set is updated, and the task prompt words that match the target task are determined from the obtained second candidate prompt word set.

2. The method according to claim 1, wherein determining the prompt word optimization guidance information based on the performance prediction deviation and the first candidate prompt word set includes: Based on the performance prediction deviation, target prompt words and reference prompt words are filtered from the first candidate prompt word set; The performance prediction deviation of the target prompt word is greater than the deviation threshold, and the performance prediction deviation of the reference prompt word is less than that of the target prompt word. The target prompt and the reference prompt are compared based on the second model to generate a difference description; the difference description is used to describe the difference between the target prompt and the reference prompt. Based on the aforementioned differences, prompts are used to optimize guidance information.

3. The method according to claim 2, further comprising: Obtain the feature importance obtained by the first model processing the text features; The feature importance represents the contribution of the text feature to the corresponding second performance evaluation result; The step of determining the prompt words to optimize guidance information based on the difference description includes: Based on the difference description and the feature importance, the prompt words are determined to optimize the guidance information.

4. The method according to claim 2, wherein filtering the target prompt words and reference prompt words in the first candidate prompt word set based on the performance prediction deviation includes any one of the following: Based on the comparison results between the performance prediction deviations corresponding to each of the first candidate prompt words, target prompt words and reference prompt words are filtered from the first candidate prompt word set; Based on the comparison results between the performance prediction deviations corresponding to each of the first candidate prompt words, target prompt words are filtered from the first candidate prompt word set; Based on a combination of at least one of the performance evaluation difference and text feature similarity with the performance prediction deviation, a difference score is determined between the target prompt word and each other first candidate prompt word in the first candidate prompt word set. Based on the difference score, reference prompt words are selected from each other first candidate prompt word. Wherein, the performance evaluation difference is the difference between the second performance evaluation results of each of the other first candidate prompt words relative to the target prompt word; The text feature similarity is the similarity between the text features of each of the other first candidate prompt words relative to the target prompt word.

5. The method according to any one of claims 1-4, wherein, The first performance evaluation result for each of the first candidate prompt words is obtained by executing the target task on the target task's task dataset using the third model; The first model is obtained by training a gradient boosting decision tree model, and the training process includes: Based on the text features of each first candidate prompt word and the first performance evaluation result, a gradient boosting decision tree model is trained to learn the mapping relationship between the text features and the first performance evaluation result, thus obtaining the first model.

6. The method according to claim 5, wherein, The first performance evaluation result for each of the first candidate prompt words is obtained by executing the target task on the target task's task dataset using the third model, including: Obtain the task dataset and benchmark prompt words for the target task; the benchmark prompt words are prompt words used to guide the third model to process the task dataset, so as to filter the task data that failed to be processed as difficult samples based on the processing results; Based on the baseline prompt words and the third model, a set of difficult samples is selected from the task dataset; On the difficult sample set, the performance of each of the first candidate prompt words is evaluated by the third model to obtain the first performance evaluation result.

7. The method according to any one of claims 1-4, wherein updating the candidate prompt word set based on the prompt words to optimize the guidance information includes: Based on the optimized guidance information of the prompt words, at least one second candidate prompt word is generated; Add the second candidate suggestion word to the first candidate suggestion word set to update the first candidate suggestion word set; The steps of predicting the second performance evaluation result, generating prompt word optimization guidance information, and updating the candidate prompt word set are executed iteratively until the optimization termination condition is met, so as to obtain the second candidate prompt word set.

8. The method according to claim 7, wherein optimizing the guidance information based on the prompt word and generating at least one second candidate prompt word comprises: Based on at least one of the first performance evaluation results and the performance prediction deviation corresponding to each of the first candidate prompt words, at least one prompt word to be optimized is determined in the first candidate prompt word set; Based on the optimized guidance information of the prompt words, the at least one prompt word to be optimized is modified to obtain at least one second candidate prompt word.

9. The method according to any one of claims 1-4, wherein at least one text feature associated with each first candidate prompt word is obtained, comprising: For each first candidate prompt word, data attributes are extracted to obtain at least one attribute feature; Perform feature clustering analysis on all semantic units of each of the first candidate prompt words to determine multiple semantic clusters; Obtain the distribution of semantic units contained in each of the first candidate prompt words in each of the semantic clusters, and determine at least one semantic feature of the corresponding first candidate prompt word; The semantic features and the attribute features are determined as the text features of the corresponding first candidate prompt words.

10. A computer device, the computer device comprising: At least one memory is provided for storing a set of candidate prompt words; At least one processor is used to acquire a first set of candidate prompt words; Each first candidate prompt word is associated with at least one text feature and its first performance evaluation result on the target task; The text features of each first candidate prompt word are processed based on the first model to predict the second performance evaluation result of the corresponding first candidate prompt word on the target task; The first model is used to predict the performance feedback of the target task to the prompt words; Based on the second performance evaluation result and the first performance evaluation result for each first candidate suggestion word, the performance prediction deviation of the corresponding first candidate suggestion word is determined; Based on the performance prediction deviation and the first candidate prompt word set, the prompt word optimization guidance information is determined; Based on the optimized guidance information of the prompt words, the first candidate prompt word set is updated, and the task prompt words that match the target task are determined from the obtained second candidate prompt word set.