A prompt word optimization method, device and storage medium of a text evaluator
By using a multi-factor optimization method, combined with local and global perturbation approaches, the text evaluator prompts of a large language model are optimized, which solves the problem of low evaluator relevance and achieves higher evaluation performance and quality compliance.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2025-02-17
- Publication Date
- 2026-03-17
AI Technical Summary
Existing text evaluators based on large language models have low correlation between evaluation results and human evaluations, and existing optimization methods are limited to a single design factor, resulting in insufficient improvement in evaluation performance.
A multi-factor optimization method is adopted. By initializing the selection strategy cluster, perturbation is applied to generate new selection strategies. Evaluation results are generated on a validation set with human evaluation using a large language model. Correlation coefficients are calculated to update the selection strategy cluster. The selection strategies of design factors are optimized by combining local and global perturbation methods.
It significantly improves the correlation between the evaluation results of the text evaluator and human evaluation, ensuring that the evaluation quality meets human standards and improving evaluation performance.
Smart Images

Figure CN120124622B_ABST
Abstract
Description
Technical Field
[0001] This application belongs to the field of artificial intelligence technology, and specifically relates to a method, device and storage medium for optimizing prompt words in a text evaluator. Background Technology
[0002] Automatic text quality assessment has always been an important and challenging research problem in the field of natural language processing. In recent years, with the rise of large language model technology, text quality assessment using large language model-based text evaluators has been widely used in various scenarios. Thanks to the powerful language understanding and instruction-following capabilities of large models, researchers have transformed the assessment task into an instruction-following task. By inputting prompt words containing task descriptions, assessment rules, etc., along with the text to be evaluated, the large language model can output accurate assessment results. In terms of flexibility, interpretability, and task generalization, it has shown significant advantages over automatic assessment methods based on similarity calculation with reference answers and automatic assessment methods based on probabilities or results generated by small pre-trained language models.
[0003] However, text evaluators based on large language models still suffer from low correlation between their evaluation results and human evaluations, and cannot completely replace human evaluations as the authoritative standard. Therefore, existing technologies include a series of methods to improve the performance of large language models as evaluators by optimizing the input prompts. One approach is the "AutoCoT" prompt paradigm, which requires the large language model to generate evaluation steps first, and then generates the evaluation result based on these steps. Another method involves requiring the large language model to explain the reasons for the evaluation result while generating it, thus improving the correlation between the evaluation result and human evaluations. Yet another method involves iteratively modifying and optimizing the evaluation criteria in the prompts based on a validation set with human evaluations.
[0004] A common shortcoming of this series of works is that they are limited to optimizing single design factors of the prompt words (such as output format or evaluation criteria). Considering that prompt words used for evaluation typically contain multiple components, and each component contains multiple design factors, all of which simultaneously affect the performance of text evaluators based on large language models, optimizing only a single design factor is insufficient. Therefore, how to optimize multiple design factors simultaneously to fully unleash the evaluation capabilities of large language models is a worthy research topic in this field. Summary of the Invention
[0005] Based on the above analysis, the embodiments of the present invention aim to provide a method, device and storage medium for optimizing prompt words in a text evaluator, so as to simultaneously optimize multiple design factors and fully unleash the evaluation capabilities of a large language model.
[0006] A first aspect of this application provides a method for optimizing prompt words in a text evaluator, comprising:
[0007] Initialize a selection strategy cluster, which includes multiple design factor selection strategies for evaluation prompts; each evaluation prompt includes multiple design factors, and each design factor has multiple options; the design factor selection strategy is a set formed by selecting one of the options for each design factor of each evaluation prompt.
[0008] In each iteration, a perturbation is applied to each selection strategy in the selection strategy cluster to generate a new selection strategy;
[0009] The evaluation prompts are determined based on a new selection strategy, and evaluation results are generated on a validation set with human evaluations using a large language model.
[0010] Calculate the correlation coefficient between the evaluation results and the manual evaluation to measure the evaluation performance of the new selection strategy;
[0011] Based on the correlation coefficient, the selection strategy in the selection strategy cluster is selected from the current selection strategy cluster and the new selection strategy.
[0012] Optionally, the step of applying a perturbation to each selection strategy in the selection strategy cluster in each iteration to generate a new selection strategy includes:
[0013] In each iteration, a local perturbation method is selected with a probability of 1-ρ, and a global perturbation method is selected with a probability of ρ. Perturbations are applied to each selection strategy in the selection strategy cluster to generate a new selection strategy.
[0014] Optionally, the execution steps of the local perturbation method include:
[0015] Selection and Current Selection Strategy The set T of adjacent selection strategies with only one evaluation prompt word and different design factors adj ;
[0016] Calculate the current selection strategy With the adjacent selection strategy set T adj The difference in the sum of the advantages of each selection strategy across all design factors
[0017] The set of neighbor selection strategies T is calculated using a temperature-controlled softmax function. adj The selection probability of each selection strategy in the set, and based on the selection probability, from the set of adjacent selection strategies T. adj Choose a new selection strategy
[0018] Wherein, the selection probability Calculated using the following formula:
[0019]
[0020] Among them, A ij It is the i-th design factor F i The j-th option f ij Advantages The current option for the i-th design factor in the current selection strategy. The advantage is that t is the current search step number, and M is the search result. ij Option f is ij The number of occurrences throughout the search process; λ and τ are hyperparameters.
[0021] Optionally, the execution steps of the global perturbation method include:
[0022] Calculate the sum of the advantages of each design factor for all unsearched selection strategies during the current search process;
[0023] Choose the strategy that maximizes the total advantage as the new strategy;
[0024] Among them, the new selection strategy T max Determined by the following formula:
[0025]
[0026] Where, {F1, F2, ..., F n} represents design factors. Design factor F i The advantages calculated in the current search process.
[0027] Optionally, it also includes:
[0028] Calculate the advantages of each option in each design factor:
[0029] Among them, the i-th design factor F i The j-th option f ij Advantage A ij Defined by the following formula:
[0030]
[0031] in, Indicator words Performance evaluation on the validation set, m i For F i The number of options; To exclude F from all design factors iExpectation calculations for other factors;
[0032] The advantage is used to adjust the probability of selecting a strategy during the search process, so that options with higher advantage values are more likely to be selected in subsequent iterations than options with lower advantage values.
[0033] Optionally, after generating a new selection strategy using the local perturbation method, the method further includes:
[0034] Calculate design factor F i The j-th option f ij The resulting performance gain: To evaluate the performance of the new selection strategy. Choose a strategy for the current situation Evaluation performance; The current option for the i-th design factor in the current selection strategy. Advantages;
[0035] Update design factor F i The j-th option f ij Advantages:
[0036]
[0037] Normalization is performed so that the same design factor F i The sum of the advantages of all options is 0.
[0038] Where, N ij f ij The number of times the search is conducted.
[0039] Optionally, selecting and updating the selection strategy in the selection strategy cluster from the current selection strategy cluster and the new selection strategy based on the correlation coefficient includes:
[0040] After the maximum number of search steps is reached, the iterative search terminates, and the final selection strategy cluster is output.
[0041] Optionally, the design factors of the evaluation prompts include: rating range, evaluation examples, evaluation criteria, reference answers, output format, evaluation steps, reference questions, and placement order.
[0042] Optionally, selecting and updating the selection strategy in the selection strategy cluster from the current selection strategy cluster and the new selection strategy based on the correlation coefficient includes:
[0043] For dataset And the evaluation dimension 'a', the large language model for evaluation is 'M', and the evaluation prompt words used are... In the i-th sample d of the dataset i The evaluation results are as follows The human evaluation results for the corresponding samples are Search for review prompts To maximize the correlation between the evaluation results of large language models and human evaluation results:
[0044]
[0045] Among them, evaluation prompt words Includes n design factors {F1, F2, ..., F n}, the i-th design factor F i There is m i Options corr(·) is the correlation coefficient. Representative evaluation prompts Evaluation performance on evaluation dimension a of dataset D.
[0046] A second aspect of this application provides a cue word optimization device for a text evaluator, including a memory and a processor, wherein the memory stores a computer program that, when executed by the processor, implements the cue word optimization method for the text evaluator according to any of the above-described methods.
[0047] A third aspect of this application provides a computer-readable storage medium having a computer program stored thereon, which, when executed by a processor, implements the prompt word optimization method of the text evaluator according to any of the above.
[0048] The text evaluator prompt optimization method provided in this application optimizes prompts for multiple design factors. It records a cluster of selection strategies for several currently searched, optimally performing design factors. In each iteration, the selection strategies in the cluster are perturbed to obtain new strategies. For each selection strategy, after determining the evaluation prompt, a large language model is used to generate evaluation results on a validation set with human evaluations. The performance is measured by calculating the correlation coefficient between the generated evaluation results and the human evaluations, and the selection strategies retained in the cluster are updated accordingly. Therefore, this application employs an iterative search method guided by heuristic functions to optimize the selection strategies for each design factor, automatically discovering the optimal prompt combination and improving search performance. Furthermore, this application is not limited to optimizing a single design factor in the prompts but optimizes the selection strategies for multiple design factors within the prompts, expanding the search scope of the prompts, making the evaluation results more correlated with human evaluations, ensuring that the evaluation quality better meets human standards, and significantly improving the evaluation performance of the text evaluator.
[0049] In addition, this application also provides a prompt word optimization device and storage medium for a text evaluator with the above-mentioned technical effects. Attached Figure Description
[0050] To more clearly illustrate the technical solutions in the embodiments of this specification or the prior art, the drawings used in the description of the embodiments or the prior art will be briefly introduced below. Obviously, the drawings described below are only some embodiments recorded in the embodiments of this specification. For those skilled in the art, other drawings can be obtained based on these drawings.
[0051] Figure 1 A flowchart illustrating a specific implementation of the prompt word optimization method for the text evaluator provided in this application;
[0052] Figure 2 This is a flowchart illustrating the execution steps of the local perturbation method used in this application;
[0053] Figure 3 This is a flowchart illustrating the execution steps of the global perturbation method used in this application;
[0054] Figure 4 A flowchart illustrating another specific implementation of the prompt word optimization method for the text evaluator provided in this application;
[0055] Figure 5 A schematic diagram illustrating another specific implementation of the prompt word optimization method for the text evaluator provided in this application;
[0056] Figure 6 This diagram illustrates the performance results of the proposed method (HPSS) and the baseline method (CloserLook+ICL) under different validation set sizes. Figure 1 ;
[0057] Figure 7 This diagram illustrates the performance results of the proposed method (HPSS) and the baseline method (CloserLook+ICL) under different validation set sizes. Figure 2 ;
[0058] Figure 8 A block diagram of the device for optimizing prompts in the text evaluator provided in this application. Detailed Implementation
[0059] To make the objectives, technical solutions, and advantages of the embodiments of this application clearer, the technical solutions of the embodiments of this application will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of this application, not all embodiments. It should be noted that, unless otherwise specified, the implementation methods and features in the implementation methods in this disclosure can be combined, separated, interchanged, and / or rearranged. Based on the embodiments of this application, all other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of this application.
[0060] The terminology used herein is for the purpose of describing particular embodiments and is not intended to be limiting. As used herein, unless the context clearly indicates otherwise, the singular forms “a” and “the” are intended to include the plural forms as well. Furthermore, when the terms “comprising” and / or “including” and variations thereof are used in this specification, it indicates the presence of the stated features, integrals, steps, operations, parts, components, and / or groups thereof, but does not exclude the presence or addition of one or more other features, integrals, steps, operations, parts, components, and / or groups thereof. It should also be noted that, as used herein, the terms “substantially,” “about,” and other similar terms are used as approximate terms rather than as terms of degree, thus explaining the inherent biases in measurements, calculated values, and / or provided values that would be recognized by one of ordinary skill in the art.
[0061] A flowchart of a specific implementation method for the prompt word optimization method of the text evaluator provided in this application is shown below. Figure 1 As shown, the method specifically includes:
[0062] S101: Initialize the selection strategy cluster.
[0063] The selection strategy cluster includes a set of design factor selection strategies for multiple evaluation prompts; each evaluation prompt includes multiple design factors, each design factor has multiple options, and the design factor selection strategy is a set formed by selecting one of the options for each evaluation prompt's design factor.
[0064] Among them, evaluation prompt words It includes n design factors {F1, F2, ..., F...} n}, the i-th design factor F i There is m i Options Available for selection, i.e. Then the evaluation prompt words It can be composed of {F1,F2,…,F n The value of} is determined. The selection strategy for design factors refers to {F1, F2, ..., F}. nA set of values for}, that is, for each design factor, select one of the corresponding options.
[0065] The design factor selection strategy cluster can be used to record several optimal design factor selection strategies that have been found so far. The specific initialization process can be as follows: select existing manual design prompts as the starting point, modify each design factor of the prompts differently to generate multiple prompt combinations (i.e., design factor selection strategies), test the performance of the prompts on the validation set, and select the k best-performing prompt combinations as the initial design factor selection strategy cluster.
[0066] S102: In each iteration, a perturbation is applied to each selection strategy in the selection strategy cluster to generate a new selection strategy.
[0067] Specifically, in each iteration, this application selects a local perturbation method with a probability of 1-ρ and a global perturbation method with a probability of ρ, and applies perturbation to each selection strategy in the selection strategy cluster to generate a new selection strategy.
[0068] The local perturbation method modifies a design factor of the current selection strategy to generate adjacent selection strategies, ensuring local optimization. The global perturbation method calculates the sum of advantages of all unsearched options, selects the optimal strategy, expands the search range, and prevents getting trapped in local optima.
[0069] S103: Determine evaluation prompts based on a new selection strategy and generate evaluation results on a validation set with human evaluations using a large language model.
[0070] By using a large language model, different prompt words are run on a validation set with human evaluation to generate evaluation results.
[0071] S104: Calculate the correlation coefficient between the evaluation results and the manual evaluation to measure the evaluation performance of the new selection strategy.
[0072] Specifically, Large Language Models (LLMs) are pre-trained natural language processing models, and their performance is measured based on the Spearman or Pearson correlation coefficient between the generated evaluation results and the human evaluation results.
[0073] S105: Based on the correlation coefficient, select and update the selection strategy in the selection strategy cluster from the current selection strategy cluster and the new selection strategy.
[0074] Based on the calculated relevance coefficients, the best-performing combination of prompt words is retained, and the search direction is adjusted so that the model gradually approaches the optimal prompt words.
[0075] Specifically, a maximum cluster size is set, for example, to retain a maximum of k optimal selection strategies. Among the current cluster plus strategies generated by new perturbations, the k strategies with the highest correlation coefficients are selected, while poorer strategies are eliminated. After a given number of iterations, the final selection strategy with the highest correlation coefficient in the selection strategy cluster is chosen as the optimization result.
[0076] The text evaluator prompt optimization method provided in this application optimizes prompts for multiple design factors. It records a cluster of selection strategies for several optimal design factors found through current searching. In each iteration, the selection strategies in the cluster are perturbed to obtain new selection strategies. For each selection strategy, after determining the evaluation prompt, an evaluation result is generated on a validation set with human evaluation using a large language model. The performance is measured by calculating the correlation coefficient between the generated evaluation result and the human evaluation, and the selection strategies retained in the cluster are updated accordingly. Therefore, this application uses an iterative search method to optimize the selection strategies for each design factor, automatically discovering the optimal prompt combination and improving search performance. Furthermore, this application is not limited to optimizing a single design factor in the prompts but optimizes the selection strategies for multiple design factors within the prompts, expanding the search scope of the prompts, making the evaluation results more correlated with human evaluations, ensuring that the evaluation quality better conforms to human standards, and significantly improving the evaluation performance of the text evaluator.
[0077] In the above embodiments, such as Figure 2 As shown, the execution steps using the local perturbation method include the following steps:
[0078] S201: Selection and Current Selection Strategy The set T of adjacent selection strategies with only one evaluation prompt word and different design factors adj .
[0079] S202: Calculate the current selection strategy With the adjacent selection strategy set T adj The difference in the sum of the advantages of each selection strategy across all design factors
[0080] S203: Calculate the set of neighbor selection strategies T using a temperature-controlled softmax function. adj The selection probability of each selection strategy in the set, and based on the selection probability, from the set of adjacent selection strategies T. adj Choose a new selection strategy
[0081] Wherein, the selection probability Calculated using the following formula:
[0082]
[0083] Among them, A ij It is the i-th design factor F i The j-th option f ij Advantages The current option for the i-th design factor in the current selection strategy. The advantage is that t is the current search step number, and M is the search result. ij Option f is ij The number of occurrences throughout the search process; λ and τ are hyperparameters.
[0084] The local perturbation approach searches for a better selection strategy near the currently searched strategies, gradually optimizing the suggestion words. Modifying only one design factor helps in understanding the key factors affecting evaluation performance.
[0085] In the above embodiments, such as Figure 3 As shown, the execution steps using the global perturbation method include the following steps:
[0086] S301: Calculate the sum of the advantages of each design factor for all unsearched selection strategies during the current search process.
[0087] S302: Select the strategy that maximizes the total advantage as the new strategy.
[0088] Among them, the new selection strategy T max Determined by the following formula:
[0089]
[0090] Where, {F1,F2,…,F n} represents design factors. Design factor F i The advantages calculated in the current search process.
[0091] The global perturbation approach directly selects the strategy with the greatest sum of advantages among all current factors, thereby escaping local optima and quickly finding a possible global optimal solution.
[0092] This application combines local and global perturbations to ensure the stability of local optimization while avoiding getting trapped in local optima, ultimately finding the optimal prompt word design.
[0093] Based on any of the above embodiments, the design factors of the evaluation prompts in the text evaluator optimization method provided in this application specifically include: scoring range, evaluation examples, evaluation criteria, reference answers, output format, evaluation steps, reference questions, and placement order.
[0094] The corresponding definitions and options for each design factor are as follows:
[0095] (1) Scoring range: The range of scores to be output by the large language model. There are 5 options: 1-3, 1-5, 1-10, 1-50 and 1-100.
[0096] (2) Evaluation Examples: Evaluation examples with human evaluations. There are 4 options: no evaluation examples provided, 3 evaluation examples provided, 5 evaluation examples provided, and 10 evaluation examples provided.
[0097] (3) Evaluation criteria: Definition of the evaluated dimensions and the correspondence between scores and text quality. Three options are available: no evaluation criteria provided, manually written evaluation criteria provided, and evaluation criteria automatically generated by the large language model.
[0098] (4) Reference Answer: A reference answer to the instructions in the sample to be evaluated. There are 3 options: no reference answer provided, a reference answer generated by the large language model, or the large language model is required to generate a reference answer before generating the evaluation result.
[0099] (5) Output format: The output format of the evaluation results. There are 3 options: output the score directly, output the evaluation explanation first and then output the score, and output the score first and then output the evaluation explanation.
[0100] (6) Evaluation steps: Evaluation steps for the evaluated dimension. Two options are provided: no evaluation steps or evaluation steps provided.
[0101] (7) Reference Questions: Reference evaluation questions for the sample to be evaluated. There are two options: no reference questions provided, or reference questions provided.
[0102] (8) Placement Order: The above 7 design factors belong to the 3 main components of the evaluation prompt: 1) Task Description: Includes the definition of the evaluation task and output format requirements (including two design factors: scoring range and output format); 2) Evaluation Rules: Includes the evaluation standards and steps (including two design factors: evaluation standards and evaluation steps); 3) Input Content: Includes the sample to be evaluated and additional information related to the sample (including three design factors: evaluation example, reference answer, and reference question). Placement order refers to the order in which these 3 components are placed in the evaluation prompt. It includes 6 options, representing the full order of these 3 components.
[0103] Compared to existing technologies that are limited to optimizing a single design factor (such as output format or evaluation criteria), resulting in insufficient optimization of prompt words, this application proposes an optimization strategy that employs an iterative search method to select each design factor, including but not limited to the eight key evaluation prompt word design factors mentioned above.
[0104] The optimization objective of this application is formally defined as follows: For the dataset And the evaluation dimension 'a', the large language model for evaluation is 'M', and the evaluation prompt words used are... In the i-th sample d of the dataset i The evaluation results are as follows The human evaluation results for the corresponding samples are Search for review prompts To maximize the correlation between the evaluation results of large language models and human evaluation results:
[0105]
[0106] Among them, evaluation prompt words Includes n design factors {F1, F2, ..., F...} n}, the i-th design factor F i There is m i Options corr(·) is the correlation coefficient. Representative evaluation prompts The evaluation performance is measured on evaluation dimension a of dataset D. During the automatic optimization process, this application uses a validation set with human evaluations to test the evaluation prompts. The performance of [the application / the document / etc.]. Without loss of generality, this application will [continue to apply]. Abbreviated as Use representative evaluation prompts Performance on specific evaluation dimensions of the validation set.
[0107] In the embodiments provided in this application, a cluster containing several currently searched, optimal-performing design factor selection strategies is recorded. In each iteration, the selection strategies in the cluster are perturbed to obtain new selection strategies. For each selection strategy, after determining the evaluation prompts, a large language model is used to generate evaluation results on a validation set. The performance is measured by calculating the correlation coefficient between the generated evaluation results and human evaluations, and the selection strategies retained in the cluster are updated accordingly. In the perturbing step, this application introduces a heuristic function to calculate the selection probability of each option in each design factor, giving higher selection probabilities to options that bring greater gains to the evaluation performance of the large language model, thereby improving the effectiveness of the search. The selection strategy cluster is updated based on the heuristic function, wherein the heuristic function is used to calculate the advantage of each design factor option and adjust the search direction according to the advantage to improve the optimization effect.
[0108] Specifically, the heuristic function is defined as the advantage of each option in each design factor, that is, choosing this option compared to randomly choosing an option for that design factor, and evaluating the prompt words. The mathematical expectation of the performance gain, the i-th factor Fi The j-th option f ij Advantage A ij Calculate using the following formula:
[0109]
[0110] in, Indicator words Performance evaluation on the validation set, m i For F i The number of options; To exclude F from all design factors i Expected calculations for other factors.
[0111] This advantage is used to adjust the probability of choosing a strategy during the search process, so that options with higher advantage values are more likely to be selected in subsequent iterations than options with lower advantage values.
[0112] This application also provides another specific implementation of the prompt word optimization method for text evaluators, referring to... Figure 4 The flowchart shown and Figure 5 The illustrated diagram shows that the process specifically includes:
[0113] S401: Initialize the selection strategy cluster and calculate the initial advantage of each option.
[0114] In one specific implementation, this application starts with commonly used evaluation prompts, such as those used in MT-Bench, and individually modifies the options for each design factor to construct several selection strategies. Subsequently, the performance of these selection strategies is tested on a validation set, and the k best-performing strategies are selected as the initial cluster to proceed to the next step. Simultaneously, based on the aforementioned definition of advantage, the initial advantage of each option within each design factor is calculated.
[0115] like Figure 5 As shown, MT-Bench's design factor selection strategy includes three design factor examples:
[0116] Rating range (Factor 1): 1-3, 1-5, 1-10, 1-50, 1-100;
[0117] Scoring examples (Factor 2): No examples, 3 examples, 5 examples, 10 examples;
[0118] Scoring criteria (Factor 3): None, manually written, model generated.
[0119] Combining different design factors forms an initial selection strategy cluster comprising multiple selection strategies. S402: In each round of iterative search, for each selection strategy in the selection strategy cluster... Perform g perturbations to generate a new selection strategy.
[0120] Specifically, when performing perturbations, a combination of local and global perturbations can be used to avoid local optima.
[0121] Among them, local perturbation, also known as "exploratory" perturbation, will select and use the current selection strategy. Adjacent selection strategy, i.e., the current selection strategy The set of selection strategies T with only one distinct factor adj This application calculates the current selection strategy. and T adj The difference in the sum of the advantages of all factors for each choice strategy is used to calculate T using a temperature-controlled softmax function. adj The probability of choosing each selection strategy.
[0122] Additionally, this application introduces an exploration coefficient to encourage a comprehensive exploration of all options. Formally, it is assumed that the current selection strategy is... Its i-th factor F i The options are T adj Selection strategy in The i-th factor F i The values and Different, for f ij ,but The probability of selection is calculated using the following formula:
[0123]
[0124] Where t is the current search step number, and M ij Option f is ij The number of occurrences throughout the search process; λ and τ are hyperparameters.
[0125] However, a major limitation of the "exploration" perturbation method is that its search scope is limited to the vicinity of already searched selection strategies. To broaden the search scope and avoid getting trapped in local optima, this application uses a "utilization" perturbation method (i.e., a global perturbation method) in addition to "exploration," which directly selects the selection strategy with the greatest advantage from all currently unsearched factors:
[0126]
[0127] In each perturbation, the present invention has a probability of ρ to choose the "utilize" perturbation method and a probability of 1-ρ to choose the "explore" perturbation method. After reaching the maximum number of search steps, the present invention selects the currently searched strategy that has the best performance on the validation set as the final search optimization result. As a specific example, ρ can be 0.2.
[0128] S403: Based on the performance of the new selection strategy on the validation set, update the record of the k best-performing selection strategies for the current cluster.
[0129] Evaluation prompts are determined based on the new selection strategy, and evaluation results are generated on a validation set with human evaluation using a large language model. The correlation coefficient between the evaluation results and the human evaluation is calculated to measure the evaluation performance of the new selection strategy. Based on the correlation coefficient, a selection strategy is selected from the current selection strategy cluster and the new selection strategy to update the selection strategy cluster.
[0130] S404: Update the dominance function.
[0131] Choosing a new selection strategy Subsequently, this application tests its performance on a validation set, and calculates the factor F accordingly. i The option was changed to f ij The resulting performance gain. Subsequently, if the new selection strategy is obtained through the local perturbation method, this application updates f using a moving average of the previous advantage. ij Advantage A ij And factor F i The mean of the advantages of all options is normalized to 0 to achieve a performance where the expected sum is 0. Formally, advantage A will be updated as follows, where N... ij Option f is ij The number of times it has been explored.
[0132]
[0133] By dynamically adjusting the advantage value of each option, the search process is ensured to be stable and optimized. After the update, options with low contribution values are weakened, while options with high contribution values are strengthened, which can improve the search results.
[0134] This application utilizes two large language models, Qwen2.5-14B-Instruct and GPT-4o-mini, to validate the optimization performance on five natural language generation evaluation datasets: the Summeval dataset for text summarization, the Topical-Chat dataset for dialogue generation, the SFHOT and SFRES datasets for data-to-text generation, and the HANNA dataset for story generation. Each dataset was randomly divided into a 50% validation set and a 50% test set. The Spearman correlation coefficient between the evaluation results and human evaluations was used as the performance metric for the evaluator.
[0135] Three types of baselines were selected for the experiment: 1) Non-large language model evaluators: including BLEU-4, BERTSCORE, and UNIEVAL; 2) Large language model-based text evaluators optimized with human prompts: including the starting point of optimization in this application, i.e., the evaluation prompts used in MT-Bench, as well as the prompts used in G-EVAL and CloserLook, and the prompt CloserLook+ICL formed by adding 3 rating examples to the prompts in CloserLook; 3) Other automatic prompt optimization methods for large language model-based text evaluators: including APE, OPRO, and Greedy. For the prompts G-EVAL and CloserLook, the same decoding method as the original work was used, i.e., the large model was required to generate 20 times, the sampling temperature was set to 1.0, and the average score was calculated as the final evaluation result; for other prompts, a greedy search was used for decoding to ensure reproducibility. For all automatic prompt optimization methods, the maximum number of searches was set to 71.
[0136] In the selection of hyperparameters in this application, the cluster size of the selected strategy is k=5, the number of perturbations for each selected strategy in the cluster is g=2, the probability of selecting the "utilize" perturbation method in each perturbation is ρ=0.2, the temperature τ=5 when calculating the softmax function for calculating the sampling probability, and the weight λ=4 for the exploration coefficient.
[0137] The results on the five datasets are shown in Tables 1 and 2. As can be seen from the tables, the method presented in this application significantly improves the evaluation performance of the large language model-based text evaluator: compared to the optimization starting point (i.e., the prompt words used in MT-Bench) with the same number of generation attempts, it achieves an average relative improvement of 29.4% in relevance to human evaluation, significantly surpassing other baseline methods; even with 1 / 20th the number of generation attempts, this application still achieves significantly better evaluation performance than the large language model-based text evaluator optimized with human prompt words.
[0138] Table 1
[0139]
[0140] Table 2
[0141]
[0142]
[0143] Furthermore, this application also tested the performance of the proposed method and the best-performing human-prompted word-optimized large language model-based text evaluator (CloserLook+ICL) using Qwen2.5-14B-Instruct as the evaluation model on the Summeval and Topical-Chat datasets with different validation set sizes. Figure 6 as well as Figure 7 As shown in the attached figure, the horizontal axis represents the size of the validation set (in %), and the vertical axis represents the Spearman correlation coefficient. Experiments revealed that the method described in this application (HPSS in the figure) outperformed the baseline method even when the validation set size was only 10% of the total dataset, demonstrating that this application still exhibits good performance even with a small validation set containing human evaluations.
[0144] In addition, this application also provides a cue word optimization device for a text evaluator, such as... Figure 8 The structural block diagram of the prompt word optimization device for the text evaluator provided in this application shows that the device includes a memory 81 and a processor 82. The memory 81 stores a computer program, which, when executed by the processor 82, implements the prompt word optimization method for the text evaluator according to any of the above-described methods.
[0145] In addition, this application also provides a computer-readable storage medium having a computer program stored thereon, which, when executed by a processor, implements the prompt word optimization method of the text evaluator according to any of the above.
[0146] Computer-readable storage media include both permanent and non-permanent, removable and non-removable media that can store information by any method or technology. Information can be computer-readable instructions, data structures, program modules, or other data. Examples of computer storage media include, but are not limited to, phase-change memory (PRAM), static random access memory (SRAM), dynamic random access memory (DRAM), other types of random access memory (RAM), read-only memory (ROM), electrically erasable programmable read-only memory (EEPROM), flash memory or other memory technologies, CD-ROM, digital versatile optical disc (DVD) or other optical storage, magnetic tape, magnetic magnetic disk storage or other magnetic storage devices, or any other non-transferable medium that can be used to store information accessible by a computing device. As defined herein, computer-readable media does not include transient computer-readable media, such as modulated data signals and carrier waves.
[0147] Those skilled in the art will further recognize that the units and algorithm steps of the various examples described in conjunction with the embodiments disclosed herein can be implemented in electronic hardware, computer software, or a combination of both. To clearly illustrate the interchangeability of hardware and software, the components and steps of the various examples have been generally described in terms of functionality in the foregoing description. Whether these functions are implemented in hardware or software depends on the specific application and design constraints of the technical solution. Those skilled in the art can use different methods to implement the described functions for each specific application, but such implementation should not be considered beyond the scope of this application.
[0148] The steps of the methods or algorithms described in conjunction with the embodiments disclosed herein can be implemented in hardware, a software module executed by a processor, or a combination of both. The software module can be located in random access memory (RAM), main memory, read-only memory (ROM), electrically programmable ROM, electrically erasable programmable ROM, registers, hard disk, removable disk, CD-ROM, or any other form of storage medium known in the art.
[0149] The specific embodiments described above further illustrate the purpose, technical solution, and beneficial effects of this application. It should be understood that the above description is only a specific embodiment of this application and is not intended to limit the scope of protection of this application. Any modifications, equivalent substitutions, improvements, etc., made within the spirit and principles of this application should be included within the scope of protection of this application.
Claims
1. A method of prompt word optimization for a text evaluator, the method comprising: The method comprises: initializing a selection strategy cluster, the selection strategy cluster comprising a plurality of design factor selection strategies for evaluating a prompt; the prompt for evaluation comprises a plurality of design factors, each design factor having a plurality of options, and the design factor selection strategy is a set of selected options for each design factor of the prompt for evaluation; the design factors of the prompt for evaluation include: score range, evaluation example, evaluation standard, reference answer, output format, evaluation step, reference question, and placement order; In each iteration, a perturbation is applied to each selection policy in the selection policy cluster to generate a new selection policy, including: in each iteration, using... The probability of choosing a local perturbation method, in order to The probability-based global perturbation method is used to apply a perturbation to each selection strategy in the selection strategy cluster, thereby generating a new selection strategy. wherein the performing step of the local perturbation manner comprises: selecting a neighboring selection policy set with one design factor different from the current selection policy only one neighboring selection policy set with different design factors of the evaluation prompt word ; calculating the advantage sum of each selection policy in the neighboring selection policy set on all design factors ; calculating the difference value of the advantage sum of each selection policy in the neighboring selection policy set on all design factors ; calculating the selection probability of each selection policy in the neighboring selection policy set through a softmax function with temperature control, and selecting a new selection policy from the neighboring selection policy set based on the selection probability ; and ; wherein the selection probability is calculated by the following equation: wherein, is the first design factor of the first option of the first design factor of the first option of the first design factor of the current option of the current option of the current option is the current search step number, is the number of occurrences of the option in the entire search process, , is a hyperparameter; determining a prompt for evaluation based on the new selection strategy and generating an evaluation result using a large language model on a validation set with human evaluation; calculating the correlation coefficient between the evaluation result and the human evaluation to measure the evaluation performance of the new selection strategy; based on the correlation coefficient, selecting and updating the selection strategies in the selection strategy cluster from the current selection strategy cluster and the new selection strategy. 2.The method of claim 1, wherein, The execution steps of the global disturbance mode include: calculating the advantage sum of each design factor of all unsearched selection strategies in the current search process; selecting the selection strategy with the largest advantage sum as the new selection strategy. wherein the new selection policy is determined by the equation: wherein, denotes a design factor, denotes a design factor Advantages calculated in the current search process. 3.The method of claim 2, wherein, Further comprising: calculating the advantage of each option in each design factor: wherein the first design factor of the first option of the advantages is defined by the following equation: wherein, represents a prompt word evaluating performance on a validation set, is the number of options for is the expected computation for other factors in all design factors except wherein the advantage is used to adjust the probability of selecting a selection strategy in the search process, so that the probability of selecting an option with a higher advantage value is higher than that of an option with a lower advantage value in subsequent iterations. 4.The method of claim 3, wherein, After generating a new selection strategy using the local disturbance mode, further comprising: Calculate design factors The Middle Options The resulting performance gain: ; To evaluate the performance of the new selection strategy. Choose a strategy for the current situation Evaluation performance; For the current selection strategy, the first Current options for each design factor Advantages; Update design factors In the middle of One option Advantages: Normalization is performed so that the sum of the advantages of all options within one design factor is 0, wherein is The number of times explored during the search process.
5. The method of prompt word optimization of a text evaluator according to any one of claims 1 to 4, characterized in that, the selection and updating of the selection strategies in the selection strategy cluster based on the correlation coefficient from the current selection strategy cluster and the new selection strategy includes: after the search step reaches the maximum search step, the iterative search terminates, and the final selection strategy cluster is output.
6. The hint word optimization method of a text evaluator according to any one of claims 1 to 4, characterized in that, the selection and updating of the selection strategies in the selection strategy cluster based on the correlation coefficient from the current selection strategy cluster and the new selection strategy includes: For dataset and evaluation dimensions The large language model for evaluation is Evaluation prompts used In the dataset Sample The evaluation results are as follows The corresponding human evaluation results for the samples are Search for review suggestions To maximize the correlation between the evaluation results of large language models and human evaluation results: wherein the evaluation prompt word comprises design factors , the design factors have options , , correlation coefficients, represent evaluation prompt words evaluation performance on the evaluation dimension of the data set .
7. A prompt word optimization device of a text evaluator characterized by, a memory and a processor, the memory storing a computer program, the computer program being executed by the processor to implement the prompt optimization method of the text evaluator according to any one of claims 1-6.
8. A computer-readable storage medium, characterized in that, a computer program stored thereon, the computer program being executed by a processor to implement the prompt optimization method of the text evaluator according to any one of claims 1-6.
Citation Information
Patent Citations
Self-reflection cue word optimization method and system based on large language model
CN118966208A