Prompt optimization method and system based on multi-task gradient induction and pareto screening
Patent Information
- Application Number
- CN202611282116.8
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2026-08-24
- Publication Date
- 2026-10-27
- Estimated Expiration
- 2046-08-24
AI Technical Summary
[0004]尽管现有自动提示优化方法在一定程度上缓解了人工设计效率低、稳定性差的问题,但现有方法大多基于单任务设定,其优化过程仅依赖某一特定任务上的局部反馈信号,无法从多个不同任务中提炼共享的提示改进规律
本发明通过多任务梯度归纳与摘要处理,从多个不同任务中提炼共享的通用优化方向,有效捕捉跨任务的共性改进规律;采用帕累托支配关系直接处理多维性能向量,并引入容忍因子实现鲁棒筛选,使得通用提示不会过度偏向某一特定任务,在多任务间形成更加均衡的性能分布。
Smart Images

Figure CN122796094B_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the fields of artificial intelligence and natural language processing, and in particular to a suggestion optimization method and system based on multi-task gradient induction and Pareto selection. Background Technology
[0002] Large Language Models (LLMs) have demonstrated strong capabilities in tasks such as natural language understanding, question answering, and text generation. However, in complex knowledge reasoning scenarios, they often encounter problems such as insufficient factual basis, unstable reasoning processes, and limited reliability of results. The key to these problems lies not only in the model's capabilities themselves, but also in the fact that the input context received by the model in specific tasks often fails to provide reasoning guidance and knowledge information that matches the problem-solving process. As a result, the model struggles to stably activate existing knowledge and obtain high-quality external support.
[0003] Automatic suggestion optimization methods automatically generate or optimize suggestion content through methods such as searching, learning, or iterative rewriting. One approach utilizes gradient information to automatically search for discrete suggestion words, triggering the model's target behavior. Automatic suggestion optimization methods based on natural language "gradient" feedback summarize errors in current suggestions and iteratively rewrite them, achieving an optimization process similar to gradient descent. Methods that treat the large language model itself as an optimizer guide the model to iteratively generate better suggestions by retaining historical candidate suggestions and their scores. Furthermore, methods that incorporate intermediate reasoning steps into suggestions to guide the model in generating a step-by-step reasoning process significantly improve performance on complex tasks such as mathematical and symbolic reasoning.
[0004] While existing automatic suggestion optimization methods have alleviated the problems of low efficiency and poor stability of manual design to some extent, most of these methods are based on single-task settings. Their optimization process relies only on local feedback signals from a specific task and cannot extract shared suggestion improvement patterns from multiple different tasks. When the task changes, the model needs to re-execute the entire suggestion search and optimization process, resulting in high computational cost and low efficiency.
[0005] When suggestion optimization is extended to multi-task scenarios, the performance of candidate suggestions changes from a single scalar to a multi-dimensional score vector. Existing methods based on single scalar sorting or bundle search cannot directly handle the performance conflicts and trade-offs between multiple tasks.
[0006] Existing natural language feedback-based suggestion optimization methods generate optimization signals with strong task specificity. Directly mixing local optimization signals from different tasks can easily lead to conflicting optimization directions. In new task scenarios, existing methods need to perform suggestion search from scratch, failing to utilize optimization experience accumulated from previous tasks, resulting in slow convergence, a tendency to get trapped in local optima, and an inability to handle performance trade-offs between multiple tasks in single-task scenarios. Summary of the Invention
[0007] This invention aims to address at least one of the technical problems existing in related technologies. To this end, this invention provides a cue optimization method and system based on multi-task gradient induction and Pareto selection. Through multi-task gradient induction, Pareto policy selection, and a two-stage pre-training-adaptation architecture, it achieves high-quality, universal cue learning across tasks, improving the model's ability to stably activate and consistently invoke internal knowledge.
[0008] This invention provides a hint optimization method based on multi-task gradient induction and Pareto selection, comprising: S1: Construct a multi-task natural language training set, where each task contains a set of questions and a set of corresponding standard answers; S2: For each task, the current prompt word is combined with the task question and input into the target large language model to obtain the large language model inference output; the large language model inference output is compared with the standard answer of the task to generate a natural language loss description; the natural language loss description is converted into improvement suggestions for prompt word updates, and the improvement suggestions for each task are normalized and summarized to obtain a general gradient signal; S3: Generate multiple new candidate prompts based on the current prompt word, the general gradient signal, and the historical optimization trajectory; S4: Define a scoring function, apply the new candidate prompts to the training set, and use the scoring function to calculate the score of each new candidate prompt on each task to obtain a multi-dimensional score vector; S5: Construct an adaptive tolerance factor based on the multidimensional score vector, determine the Pareto dominance relationship based on the adaptive tolerance factor, and select the Pareto optimal prompt word from the new candidate prompt words based on the Pareto dominance relationship. Constructing an adaptive tolerance factor based on a multidimensional score vector includes: Calculate the first The average score of each new candidate prompt word on each task during each round of iteration; Calculate the coefficient of variation of performance between tasks, which is the ratio of the standard deviation of the average score of each task to the mean. Calculate the adaptive tolerance factor based on the coefficient of variation of performance between tasks; S6: Preset the number of iteration rounds. If the current number of iteration rounds has not reached the preset number of iteration rounds, then use the current Pareto optimal prompt word as the new current prompt word and repeat steps S2 to S5. If the current number of iteration rounds has reached the preset number of iteration rounds, then output the current Pareto optimal prompt word and obtain the Pareto optimal general prompt set.
[0009] Furthermore, the tasks in the natural language multi-task training set cover at least two of the following: causal judgment, ambiguity resolution, formal logic, language structure understanding, color reasoning, and salient information translation. The initial value of the current prompt is a neutral natural language instruction without any prior task information.
[0010] Furthermore, the generated natural language loss description is implemented through an evaluator based on a large language model, and the improvement suggestion is implemented through a gradient estimator based on a large language model. The underlying large language model used by the evaluator and the gradient estimator based on the large language model is different from the target large language model.
[0011] Furthermore, the historical optimization trajectory includes Pareto optimal cue words generated and retained in all previous rounds, expressed as a natural language sequence.
[0012] Furthermore, the normalization and summarization of improvement suggestions for each task include: By using additional cue words to guide the large language model, the improvement suggestions for each task are rewritten into general expressions that are independent of the task, and redundant information is compressed to obtain a general gradient signal.
[0013] Furthermore, the formula for calculating the adaptive tolerance factor is: in, For the first Round-by-round iterative adaptive tolerance factor As the initial tolerance factor, To preset the total number of iterations, The decay exponent, The fluctuation sensitivity coefficient For the first The coefficient of variation of the performance scores of each task in the round.
[0014] Furthermore, determining the Pareto dominance relationship based on the adaptive tolerance factor includes: For all tasks satisfy: And there exists at least one task satisfy: in, New candidate suggestions In the mission The score on New candidate suggestions In the mission The score on For the first Round-by-round iterative adaptive tolerance factor To find the function with the maximum value, New candidate suggestions In the mission The score on New candidate suggestions In the mission The score on; Then new candidate suggestions Pareto dominance new candidate prompts All non-dominated candidates are retained for the next iteration.
[0015] Furthermore, it also includes downstream task adaptation. For the target downstream task, its dataset, and the scoring function, a general prompt word is selected from the Pareto optimal set of general prompts as the current prompt word. Steps S2 to S4 are repeated. The candidate prompt word with the highest score on the target downstream task is selected as the current prompt word for iterative optimization to obtain the task-specific prompt word.
[0016] Furthermore, it also includes zero-shot transfer, which selects a general cue word from the Pareto-optimal set of general cue words and applies it directly to inference on a new task that has not participated in multi-task training.
[0017] This invention also provides a hint optimization system based on multi-task gradient induction and Pareto screening, for executing the aforementioned hint optimization method based on multi-task gradient induction and Pareto screening, comprising: The training set construction module constructs a natural language multi-task training set, where each task contains a set of questions and a corresponding set of standard answers. The multi-task gradient induction module combines the current prompt word with the task question for each task and inputs it into the target large language model to obtain the large language model inference output; compares the large language model inference output with the standard answer of the task to generate a natural language loss description; converts the natural language loss description into improvement suggestions for prompt word updates; and normalizes and summarizes the improvement suggestions for each task to obtain a general gradient signal. The new candidate prompt word generation module generates multiple new candidate prompt words based on the current prompt word, the general gradient signal, and the historical optimization trajectory. A multidimensional score vector calculation module defines a scoring function, applies new candidate prompts to the training set, and uses the scoring function to calculate the score of each new candidate prompt on each task to obtain a multidimensional score vector. The Pareto filtering module constructs an adaptive tolerance factor based on a multidimensional score vector, determines the Pareto dominance relationship based on the adaptive tolerance factor, and filters the Pareto optimal suggestion word from the new candidate suggestion words based on the Pareto dominance relationship. Constructing an adaptive tolerance factor based on a multidimensional score vector includes: Calculate the first The average score of each new candidate prompt word on each task during each round of iteration; Calculate the coefficient of variation of performance between tasks, which is the ratio of the standard deviation of the average score of each task to the mean. Calculate the adaptive tolerance factor based on the coefficient of variation of performance between tasks; The iterative optimization module has a preset number of iteration rounds. If the current iteration round has not reached the preset number of iteration rounds, the current Pareto optimal prompt word is used as the new current prompt word, and steps S2 to S5 are repeated. If the current iteration round has reached the preset number of iteration rounds, the current Pareto optimal prompt word is output to obtain the Pareto optimal general prompt set.
[0018] The above-described one or more technical solutions in the embodiments of the present invention have at least one of the following technical effects: This invention extracts shared general optimization directions from multiple different tasks through multi-task gradient induction and summarization, effectively capturing common improvement patterns across tasks; it directly processes multi-dimensional performance vectors using Pareto dominance relations and introduces tolerance factors to achieve robust screening, ensuring that general prompts do not overly favor a particular task, resulting in a more balanced performance distribution across multiple tasks.
[0019] This invention explicitly transforms local feedback scattered across different tasks into general optimization knowledge, providing a structured information bridge for cross-task migration. It adopts a two-stage architecture of pre-training and adaptation to reduce the optimization cost of new tasks. The prompts produced by the general prompt pre-training can serve as high-quality initialization for new tasks, significantly reducing the number of iterations required for downstream task adaptation, and ultimately outperforming the results of optimization starting from manual prompts.
[0020] This invention does not rely on accessing model parameters, has strong versatility and deployment flexibility. The entire optimization process only requires the model's standard inference API (Application Programming Interface), without needing to access the model's internal parameters or gradients, and can be applied to various black-box large language model services.
[0021] The adaptive tolerance factor enables dynamic and intelligent Pareto screening thresholding. This invention calculates the adaptive tolerance factor based on iteration cycle decay and task performance variation coefficient, and eliminates the influence of differences in the dimensions of different task scoring functions on the tolerance boundary through normalization terms. This allows the tolerance factor to automatically maintain a large value in the early stage of optimization to maintain population diversity, and to automatically decrease in the later stage of optimization to achieve fine convergence. This avoids the tedious manual parameter tuning and enhances the robustness and generalization ability of the method under different task configurations and different optimization stages.
[0022] Additional aspects and advantages of the invention will be set forth in part in the description which follows, and in part will be obvious from the description, or may be learned by practice of the invention. Attached Figure Description
[0023] To more clearly illustrate the technical solutions in this invention or the prior art, the drawings used in the description of the embodiments or the prior art will be briefly introduced below. Obviously, the drawings described below are some embodiments of this invention. For those skilled in the art, other drawings can be obtained from these drawings without creative effort.
[0024] Figure 1 This is a flowchart illustrating a suggestion optimization method based on multi-task gradient induction and Pareto screening provided by the present invention.
[0025] Figure 2 This is a schematic diagram of the structure of a prompt optimization system based on multi-task gradient induction and Pareto screening provided by the present invention.
[0026] Figure label: 101. Training set construction module; 102. Multi-task gradient induction module; 103. New candidate prompt word generation module; 104. Multi-dimensional score vector calculation module; 105. Pareto selection module; 106. Iterative optimization module. Detailed Implementation
[0027] To make the objectives, technical solutions, and advantages of this invention clearer, the technical solutions of this invention will be clearly and completely described below. Obviously, the described embodiments are only some, not all, of the embodiments of this invention. Based on the embodiments of this invention, all other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of this invention. The following embodiments are used to illustrate this invention but cannot be used to limit the scope of this invention.
[0028] In the description of this specification, the references to terms such as "one embodiment," "some embodiments," "example," "specific example," or "some examples," etc., refer to specific features, structures, materials, or characteristics described in connection with that embodiment or example, which are included in at least one embodiment or example of the present invention. In this specification, the illustrative expressions of the above terms do not necessarily refer to the same embodiment or example. Furthermore, the specific features, structures, materials, or characteristics described may be combined in any suitable manner in one or more embodiments or examples. Moreover, without contradiction, those skilled in the art can combine and integrate the different embodiments or examples described in this specification, as well as the features of different embodiments or examples.
[0029] The following is combined with Figures 1 to 2 This invention describes a suggestion optimization method and system based on multi-task gradient induction and Pareto selection, which addresses the knowledge control problem of large language models without updating parameters. Through multi-task gradient induction and Pareto selection mechanism, it learns a high-quality general suggestion initialization with cross-task generalization ability and achieves rapid adaptation in downstream tasks.
[0030] like Figure 1 As shown, a hint optimization method based on multi-task gradient induction and Pareto selection includes: S1: Construct a multi-task natural language training set, where each task contains a set of questions and a set of corresponding standard answers; Smaller subsets are extracted from multiple natural language datasets of different domains and task types to form a multi-task natural language training set. , , For the first task training set, For the training set of the second task, For the first Training sets for each task; dataset for each task It contains a set of questions and a set of corresponding standard answers.
[0031] The tasks in the Natural Language Multitask Training Set cover at least two types of tasks: causal judgment, ambiguity resolution, formal logic, language structure comprehension, color reasoning, and salient information translation.
[0032] Preferably, the tasks in the natural language multi-task training set are selected from the BIG-Bench Hard benchmark (BBH high difficulty benchmark).
[0033] S2: For each task, the current prompt word is combined with the task question and input into the target large language model to obtain the large language model inference output; the large language model inference output is compared with the standard answer of the task to generate a natural language loss description; the natural language loss description is converted into improvement suggestions for prompt word updates, and the improvement suggestions for each task are normalized and summarized to obtain a general gradient signal; For the current prompt word The system needs to extract effective signals from multi-task feedback to guide prompt updates. Since prompt words are natural language sequences, numerical gradients cannot be obtained through backpropagation. Therefore, this invention introduces a nonparametric gradient induction mechanism based on a large language model.
[0034] Specifically, for each task The current prompt word With the task Input problem Combining inputs to target large language models Obtain the inference output of the large language model .
[0035] Then, through an evaluator based on a large language model. Will Compared with the standard answer The comparison generates a natural language loss description, and the calculation expression is as follows: in, This is a description of natural language loss.
[0036] Natural language loss descriptions, in textual form, point out problems with the current prompt word in terms of inference steps, task understanding, or output specification. For example, the current prompt word fails to guide the model to perform step-by-step inference, resulting in missing intermediate steps.
[0037] The initial value of the current prompt is a neutral natural language instruction without task priors, such as Let's solve the problem.
[0038] Next, a gradient estimator based on a large language model is used. The natural language loss description can be transformed into improvement suggestions oriented towards prompt word updates, for example, by adding guiding statements such as "Please break down the problem first, and then reason step by step" to the prompt words. The resulting gradient information has strong task specificity, and direct use of it can lead to conflicts in optimization directions between different tasks.
[0039] The evaluator based on the large language model Gradient estimator based on large language model It adopts a different underlying model than the target large language model.
[0040] To integrate multiple task directions, the improvement suggestions for each task were normalized and summarized, including: By using additional cue words to guide the large language model, improvement suggestions for each task are rewritten into task-independent general expressions, and redundant information is compressed to obtain a general gradient signal. .
[0041] Specifically, suggestions for improvement for all tasks. The input is a large language model, with a preset summary prompt instruction. The summary prompt instruction includes the following elements: (a) requiring the improvement suggestions for each task to be abstracted into a general expression that does not depend on the specific task semantics; (b) requiring the identification and deletion of redundant expressions with repeated content or similar semantics in the improvement suggestions of different tasks; and (c) requiring the compression of the retained effective optimization information into coherent and concise natural language paragraphs.
[0042] The large language model processes the input improvement suggestions based on the summary prompt instructions and outputs a single, general gradient signal. The general gradient signal contains One optimization direction It is less than the total number of optimization directions in each task gradient, and each optimization direction is expressed in a task-independent natural language form.
[0043] In some specific embodiments of the present invention, the summary prompt instruction may take the form of the following template: "You are a suggestion optimization expert. Below are several improvement suggestions generated for different tasks, each beginning with '[Task Name]:'. Please do the following:" (1) Remove the content related to specific task names, domain terms or data formats from each suggestion, and retain its optimization direction at the general level, such as prompt structure, reasoning guidance method, output format constraints; (2) Delete entries that appear repeatedly in different suggestions or that are essentially the same but differ only in wording; (3) The remaining optimization directions are categorized by topic and output in concise and coherent natural language paragraphs, with each optimization direction starting with "•".
[0044] Operation (1) in the above template corresponds to the abstract function of element (a), operation (2) corresponds to the redundancy removal function of element (b), and operation (3) corresponds to the compression and summary function of element (c).
[0045] The large language model processes the input improvement suggestions based on the above summary prompts and outputs a single, general gradient signal. .
[0046] For example, when the input contains multiple task-specific suggestions such as "Causal Judgment Task: The model should be guided to distinguish between causal relationships and correlational relationships" and "Formal Logic Task: The model should be required to verify each step of the reasoning chain step by step", the general gradient signal output after the summarization mechanism can be: "General Gradient Signal: • The model should be guided to explicitly verify and explain each step in the reasoning process; • The model should be required to distinguish between different types of logical relationships and clearly mark the basis for judgment."
[0047] This general gradient signal is no longer confined to specific tasks, but focuses on how prompt words can improve their overall expression, reasoning guidance ability, and knowledge activation effect.
[0048] S3: Generate multiple new candidate prompts based on the current prompt word, the general gradient signal, and the historical optimization trajectory; After obtaining the general gradient signal, the system needs to generate new prompts based on the optimization direction and select the result with better overall performance from multiple candidates.
[0049] The prompt optimizer Optim is based on the current prompt word. General gradient signal and historical optimization trajectory Generate k new candidate prompt words. , This is the initial prompt word. The first prompt word is "step-by-step". Current suggestion word, new candidate suggestion word ;in, This is the first new candidate suggestion word. This is the second new candidate suggestion word. For the first A new candidate suggestion.
[0050] The purpose of introducing historical optimization trajectories is to enable the optimizer to refer to previously explored directions, avoid repeatedly generating similar candidates, and improve the diversity and continuity of the generated results.
[0051] The historical optimization trajectory It contains Pareto optimal cue words generated and retained from all previous rounds, expressed as a natural language sequence, which the optimizer analyzes to avoid repeated search directions.
[0052] S4: Define a scoring function, apply the new candidate prompts to the training set, and use the scoring function to calculate the score of each new candidate prompt on each task to obtain a multi-dimensional score vector; Define the set of scoring functions as follows , , for The corresponding scoring function, for The corresponding scoring function, for The corresponding scoring function; the scoring function is used to evaluate the model's performance on the task (such as exact matching accuracy). For exact matching tasks, the scoring function can be specifically expressed as follows: in, This is an indicator function.
[0053] Using neutral, general natural language instructions as initial prompts, such as "Let's solve the problem.", these initial prompts are neutral instructions without task-specific prior constraints and do not contain domain-specific semantic bias. They provide a starting point for subsequent optimization without obvious prior bias. These initial prompts are applied to a multi-task natural language training set, and the target large language model L is used for inference on each task's data. A scoring function is then used to calculate the score for each task, resulting in a multi-dimensional initial performance vector composed of these task scores. , , Let the first dimension be the initial performance vector. This is the second-dimensional initial performance vector. For the first dimensional initial performance vector, This reflects the performance differences of the current prompts across different tasks, providing a benchmark for subsequent multi-target prompt optimization.
[0054] For each newly generated candidate prompt word, the system is retrained on the natural language multi-task training set. The above evaluates the candidate prompts by matching them with the question sets for each task. Combining inputs to target large language models Obtain the output results, and then use the set of scoring functions. Calculate the performance metrics for each task to obtain the corresponding multidimensional score vector. , Each component This indicates that the prompt word is in the [number]th [section]. Scores on each task .
[0055] S5: Construct an adaptive tolerance factor based on the multidimensional score vector, determine the Pareto dominance relationship based on the adaptive tolerance factor, and select the Pareto optimal prompt word from the new candidate prompt words based on the Pareto dominance relationship. Because the data distribution, problem complexity, and scoring functions differ across tasks, the numerical scale and optimization objective direction (such as accuracy, F1 score, BLEU score, etc.) of each component in the multidimensional score vector also vary. Directly using linear weighted summation or simple Euclidean distance for multidimensional comparisons is insufficient to objectively reflect the overall performance of prompts across different tasks and can easily lead to an over-biased optimization process towards tasks with larger numerical scales. Therefore, this invention employs a multi-objective evaluation strategy based on Pareto dominance, determining the relative merits of candidate prompts by comparing them item by item across each task dimension.
[0056] Strict Pareto dominance requires that new suggestions be no worse than original suggestions on all tasks. This condition is too stringent in multi-task scenarios, easily leading to the incorrect elimination of many potential intermediate candidates, hindering the effective progress of the optimization process. To address this issue, this invention introduces a tolerance factor into the Pareto dominance relation, allowing for a slight performance degradation of candidate suggestions on individual tasks in exchange for performance improvements on other tasks, thereby softening the dominance decision boundary.
[0057] The multidimensional performance score vector of each candidate prompt word on the multi-task training set is evaluated; Pareto dominance relation with tolerance factor is used for screening; the tolerance factor is not a fixed constant preset by humans, but is dynamically adjusted according to the state of the optimization process.
[0058] Adaptive tolerance factor in the 1st In the round of iteration, it is represented as The calculation process includes: For the Wheel generation A new candidate keyword, placed in the first... The score for each task is recorded as follows: Calculate the average score on this task: in, For the first The first task The average score of the rounds of iterations, For the first The first task Score for each new candidate suggestion; Calculate the coefficient of variation (COP) for performance between tasks, which is the ratio of the standard deviation to the mean of the average score for each task. The calculation expression is as follows: in, For the first The coefficient of variation of the performance scores of each task in the round. For the number of tasks, For the first The average value of each task in the round; The adaptive tolerance factor is calculated based on the coefficient of variation in performance between tasks. The calculation expression is as follows: in, For the first Round-by-round iterative adaptive tolerance factor As the initial tolerance factor, To preset the total number of iterations, The decay exponent, The fluctuation sensitivity coefficient For the first Coefficient of variation of the performance scores of each task in the round; First item The tolerance decreases with each iteration, allowing the optimization to smoothly transition from "early extensive exploration" to "late-stage fine convergence"; the second term In The coefficient of variation is the performance score of each task. When the performance of each task differs significantly, the tolerance boundary is automatically increased to retain diverse candidates. When the performance tends to be consistent, the boundary is automatically tightened to approach the true Pareto front.
[0059] Typical values for each parameter are: =0.08, =1.0, =1.0. The above parameters can be adjusted within the following ranges according to specific application scenarios: , , .
[0060] Taking the experimental configuration in the embodiment of the present invention as an example ( =5, =8), in the second iteration ( =2), if the coefficient of variation of the average score of each task at this time (2) = 0.08, then (2) = 0.08 × (1 - 1 / 4) 1.0×(1+1.0×0.08)=0.0648; in the 4th iteration ( =4), if (4) = 0.05, then (4) = 0.08 × (1 - 3 / 4) 1.0 ×(1+1.0×0.05)=0.021. This dynamic range covers the fixed optimal value of 0.05, which is in high agreement with the experimental data of this invention.
[0061] Based on the aforementioned adaptive tolerance factor, for candidate prompt words and candidate prompts In its first The scores for each task are as follows: and ,but Pareto Domination The determination criteria are: For all tasks satisfy: And there exists at least one task satisfy: in, New candidate suggestions In the mission The score on New candidate suggestions In the mission The score on For the first Round-by-round iterative adaptive tolerance factor To find the function with the maximum value, New candidate suggestions In the mission The score on New candidate suggestions In the mission The score on; Then new candidate suggestions Pareto dominance new candidate prompts All non-dominated candidates are retained for the next iteration.
[0062] During the judgment process, This term is used to normalize the dimensional differences of the scoring functions for different tasks. Since the accuracy, F1 score, and other scoring metrics used for each task have different value ranges (some are in the [0,1] interval, and some may be greater than 1), it is directly used... Using this as a tolerance boundary benchmark can lead to excessive compression of the tolerance boundary on low-scoring tasks and excessive relaxation on high-scoring tasks. Ensure the tolerance boundary is at least 1 or the larger of the absolute value of the current score, so that the adaptive tolerance factor has a consistent moderating effect across scoring functions of different dimensions. If the candidate scores no worse than (allowed) on all tasks... Fluctuations), and at least on one task, it is strictly superior to (more than) If the candidate is not dominant, then the candidate is compared. All non-dominated candidates are retained for the next round. This adaptive mechanism avoids manual parameter tuning and makes... Under typical optimization conditions, it automatically converges to the range of 0.02 to 0.10.
[0063] The number of new candidate prompts generated in each round is 2 to 5, with a typical value of 3; the number of iterations for the multi-task pre-training is 3 to 8, with a typical value of 5; the number of iterations for downstream task adaptation is 2 to 6, with a typical value of 3 to 5.
[0064] In some specific embodiments of the present invention The value range is 0.06~0.12, with a typical value of 0.08. The value range is 0.5~1.5, with a typical value of 1.0. The value range is 0.5 to 2.0, with a typical value of 1.0.
[0065] , and The value of satisfies the following constraints: In the first third of the optimization process ( ≤ / 3). ≥0.06 to maintain sufficient search diversity; In the last third of the optimization process ( ≥2 / 3). ≤0.04 to achieve a refined Pareto front approximation.
[0066] S6: Set the preset number of iteration rounds. If the current iteration round has not reached the preset number of iteration rounds, use the current Pareto optimal cue word as the new current cue word and repeat steps S2 to S5. If the current iteration round has reached the preset number of iteration rounds, output the current Pareto optimal cue word to obtain the Pareto optimal general cue set. .
[0067] This collection contains multiple tips that each have their own advantages on different tasks, and overall it has good multi-tasking balance performance.
[0068] Through the aforementioned multi-task prompt pre-training process, this invention has obtained a general prompt with strong comprehensive capabilities. However, while the general prompt can cover the common requirements of multiple tasks, it still lacks the domain knowledge or specific expressions required for certain tasks. Therefore, a downstream task adaptation module was designed.
[0069] For specific downstream tasks, The general hint in the process is to initialize and switch the multi-task framework to single-task mode: still using the same evaluator and gradient estimator, but the candidate selection is changed to directly compare single-task scores, and task-specific hints are obtained after iterative optimization.
[0070] Specifically, for the target downstream task and its dataset Scoring function ,from Select a general prompt word as the current prompt word. Repeat steps S2 to S4, using the single-task score on the target downstream task as the filtering criterion, and select the candidate prompt word with the highest score as the current prompt word for iterative optimization to obtain the task-specific prompt word. .
[0071] Unlike the multi-task phase, each candidate cue here corresponds to a scalar score on a single task. Therefore, comparisons between candidate cuees no longer rely on Pareto dominance but can be directly filtered based on the improvement in task score. After a few iterations (typically 3 to 5 rounds), task-specific cue words are obtained. .
[0072] The task-specific prompt words This serves as the optimal hint for the downstream task, which is then used for reasoning by the target large language model.
[0073] Downstream task adaptation uses the same evaluator, gradient estimator, and cue optimizer as the pre-training phase, but the selection criteria have been changed from Pareto dominance to comparison of single-task score improvement.
[0074] Zero-shot transfer from A general prompt word is selected and directly applied to inference on a new task that has not participated in multi-task training, without the need for downstream task adaptation.
[0075] In zero-shot transfer scenarios, it can be used directly. Use the clues to make inferences.
[0076] like Figure 2 As shown, a hint optimization system based on multi-task gradient induction and Pareto sieving is used to execute the aforementioned hint optimization method based on multi-task gradient induction and Pareto sieving, comprising: Training set construction module 101 constructs a natural language multi-task training set, where each task contains a set of questions and a corresponding set of standard answers; For each task, the multi-task gradient induction module 102 combines the current prompt word with the task question and inputs it into the target large language model to obtain the large language model inference output; it compares the large language model inference output with the standard answer of the task to generate a natural language loss description; it converts the natural language loss description into improvement suggestions for prompt word updates, and normalizes and summarizes the improvement suggestions for each task to obtain a general gradient signal. The new candidate prompt word generation module 103 generates multiple new candidate prompt words based on the current prompt word, the general gradient signal, and the historical optimization trajectory; The multidimensional score vector calculation module 104 defines a scoring function, applies new candidate prompts to the training set, and uses the scoring function to calculate the score of each new candidate prompt on each task to obtain a multidimensional score vector. The Pareto screening module 105 constructs an adaptive tolerance factor based on the multidimensional score vector, determines the Pareto dominance relationship based on the adaptive tolerance factor, and selects the Pareto optimal suggestion word from the new candidate suggestion words based on the Pareto dominance relationship. Constructing an adaptive tolerance factor based on a multidimensional score vector includes: Calculate the first The average score of each new candidate prompt word on each task during each round of iteration; Calculate the coefficient of variation of performance between tasks, which is the ratio of the standard deviation of the average score of each task to the mean. Calculate the adaptive tolerance factor based on the coefficient of variation of performance between tasks; The iterative optimization module 106 presets the number of iteration rounds. If the current iteration round does not reach the preset number of iteration rounds, the current Pareto optimal prompt word is used as the new current prompt word, and steps S2 to S5 are repeated. If the current iteration round reaches the preset number of iteration rounds, the current Pareto optimal prompt word is output, and the Pareto optimal general prompt set is obtained.
[0077] This invention extracts shared general optimization directions from multiple different tasks through multi-task gradient induction and summarization, effectively capturing common improvement patterns across tasks; it directly processes multi-dimensional performance vectors using Pareto dominance relations and introduces tolerance factors to achieve robust screening, ensuring that general prompts do not overly favor a particular task, resulting in a more balanced performance distribution across multiple tasks.
[0078] This invention explicitly transforms local feedback scattered across different tasks into general optimization knowledge, providing a structured information bridge for cross-task migration. It adopts a two-stage architecture of pre-training and adaptation to reduce the optimization cost of new tasks. The prompts produced by the general prompt pre-training can serve as high-quality initialization for new tasks, significantly reducing the number of iterations required for downstream task adaptation, and ultimately outperforming the results of optimization starting from manual prompts.
[0079] This invention does not rely on accessing model parameters, has strong versatility and deployment flexibility. The entire optimization process only requires the model's standard inference API, without needing to access the model's internal parameters or gradients, and can be applied to various black-box large language model services.
[0080] The adaptive tolerance factor enables dynamic and intelligent Pareto screening thresholding. This invention calculates the adaptive tolerance factor based on iteration cycle decay and task performance variation coefficient, and eliminates the influence of differences in the dimensions of different task scoring functions on the tolerance boundary through normalization terms. This allows the tolerance factor to automatically maintain a large value in the early stage of optimization to maintain population diversity, and to automatically decrease in the later stage of optimization to achieve fine convergence. This avoids the tedious manual parameter tuning and enhances the robustness and generalization ability of the method under different task configurations and different optimization stages.
[0081] To verify the overall performance of the present invention in a multi-tasking scenario and to compare the differences between the present invention and existing automatic prompting engineering methods.
[0082] Eight representative tasks from the BIG-Bench Hard (BBH) benchmark were used: Causal Judgement, Disambiguation, Dyck Languages, Formal Fallacies, Hyperbaton, Logical Five, Color Reasoning, and Salient Translation. Comparison methods included Human Prompts, OPRO, EvoPrompt, and PHASEEVO. PPPO represents general prompts (without downstream adaptation), and PPPO* represents the result after downstream adaptation. GPT-4o-mini was used as the target model, and GPT-4o was used as the estimator and gradient estimator. The benchmark was fixed. =0.05, 3 candidates are generated in each round, and 5 rounds are iterated. The experimental results are shown in Table 1.
[0083] Table 1. Main experimental results (accuracy) on 8 representative tasks.
[0084] As shown in Table 1, the PPPO (General Hints) method of this invention achieves an average accuracy of 72.2% without introducing any task-specific information. This not only surpasses the average performance of all baseline methods but also exhibits a more balanced performance distribution across tasks (the highest being EvoPrompt's average accuracy of 72.1%). This verifies that the General Hints method has good cross-task generalization ability in multi-task scenarios. After downstream task adaptation (PPPO*), the average accuracy further increases to 79.2%, representing a 9.85% improvement compared to the best result among all baseline methods. The most significant improvement is observed on the Disambiguation task, where PPPO* improves by 28.8% compared to the best baseline (EvoPrompt's 0.584). On the Dyck Languages task, the performance of PPPO* (0.488) is slightly lower than PHASEEVO (0.496), a decrease of 1.61%.
[0085] Four sensitive tasks—Disambiguation, Logical Five, Color Reasoning, and Salient Translation—were selected for initialization strategy ablation experiments. Human prompts and general prompts (PPPO) were used as initialization methods, respectively. The results after adaptation are shown in Table 2. The aim was to verify the effectiveness of general prompts as an initialization strategy and to compare its differences with existing automatic prompting engineering methods.
[0086] Table 2. Results of ablation experiments using the initialization strategy
[0087] As shown in Table 2, the optimization results based on general prompt initialization are superior to the corresponding results based on human prompts on all four tasks, with performance improvements of 3.3%, 4.8%, 7.0%, and 1.1%, respectively. The gain is most significant on the Color Reasoning task, indicating that this task is more sensitive to the reasoning guidance structure in the prompts, while the general prompts have accumulated sufficient reasoning patterns during multi-task training.
[0088] By comparing PPPO and PPPO* in Table 1, the performance of general prompts improved by an average of 9.7% after adaptation; compared with Human and Human* in Table 2, the performance of manual prompts improved by an average of 15.4% after adaptation. This shows that the prompt optimization process constructed in this invention is not only effective for general prompts, but also significantly improves the performance of traditional manual prompts, and has strong versatility.
[0089] Finally, it should be noted that the above embodiments are only used to illustrate the technical solutions of the present invention, and not to limit them; although the present invention has been described in detail with reference to the foregoing embodiments, those skilled in the art should understand that modifications can still be made to the technical solutions described in the foregoing embodiments, or equivalent substitutions can be made to some of the technical features; and these modifications or substitutions do not cause the essence of the corresponding technical solutions to deviate from the spirit and scope of the technical solutions of the embodiments of the present invention.
Claims
1. A suggestion optimization method based on multi-task gradient induction and Pareto selection, characterized in that, include: S1: Construct a multi-task natural language training set, where each task contains a set of questions and a set of corresponding standard answers; S2: For each task, the current prompt word is combined with the task question and input into the target large language model to obtain the large language model inference output; the large language model inference output is compared with the standard answer of the task to generate a natural language loss description; the natural language loss description is converted into improvement suggestions for prompt word updates, and the improvement suggestions for each task are normalized and summarized to obtain a general gradient signal; S3: Generate multiple new candidate prompts based on the current prompt word, the general gradient signal, and the historical optimization trajectory; S4: Define a scoring function, apply the new candidate prompts to the training set, and use the scoring function to calculate the score of each new candidate prompt on each task to obtain a multi-dimensional score vector; S5: Construct an adaptive tolerance factor based on the multidimensional score vector, determine the Pareto dominance relationship based on the adaptive tolerance factor, and select the Pareto optimal prompt word from the new candidate prompt words based on the Pareto dominance relationship. Constructing an adaptive tolerance factor based on a multidimensional score vector includes: Calculate the first The average score of each new candidate prompt word on each task during each round of iteration; Calculate the coefficient of variation of performance between tasks, which is the ratio of the standard deviation of the average score of each task to the mean. Calculate the adaptive tolerance factor based on the coefficient of variation of performance between tasks; S6: Preset the number of iteration rounds. If the current number of iteration rounds has not reached the preset number of iteration rounds, then use the current Pareto optimal prompt word as the new current prompt word and repeat steps S2 to S5. If the current number of iteration rounds has reached the preset number of iteration rounds, then output the current Pareto optimal prompt word and obtain the Pareto optimal general prompt set.
2. The suggestion optimization method based on multi-task gradient induction and Pareto selection according to claim 1, characterized in that, The tasks in the natural language multi-task training set cover at least two of the following: causal judgment, ambiguity resolution, formal logic, language structure comprehension, color reasoning, and salient information translation. The initial value of the current prompt is a neutral natural language instruction without any prior task information.
3. The suggestion optimization method based on multi-task gradient induction and Pareto selection according to claim 1, characterized in that, The generated natural language loss description is implemented through an evaluator based on a large language model, and the improvement suggestion is implemented through a gradient estimator based on a large language model. The underlying large language model used by the evaluator and the gradient estimator based on the large language model is different from the target large language model.
4. The suggestion optimization method based on multi-task gradient induction and Pareto selection according to claim 1, characterized in that, The historical optimization trajectory contains Pareto optimal cue words generated and retained in all previous rounds, expressed as a natural language sequence.
5. The suggestion optimization method based on multi-task gradient induction and Pareto selection according to claim 1, characterized in that, The normalization and summary processing of improvement suggestions for each task includes: By using additional cue words to guide the large language model, the improvement suggestions for each task are rewritten into general expressions that are independent of the task, and redundant information is compressed to obtain a general gradient signal.
6. The suggestion optimization method based on multi-task gradient induction and Pareto screening according to claim 1, characterized in that, The formula for calculating the adaptive tolerance factor is: in, For the first Round-by-round iterative adaptive tolerance factor As the initial tolerance factor, To preset the total number of iterations, The decay exponent, The fluctuation sensitivity coefficient For the first The coefficient of variation of the performance scores of each task in the round.
7. The suggestion optimization method based on multi-task gradient induction and Pareto selection according to claim 1, characterized in that, Determining Pareto dominance based on the adaptive tolerance factor includes: For all tasks satisfy: And there exists at least one task satisfy: in, New candidate suggestions In the mission The score on New candidate suggestions In the mission The score on For the first Round-by-round iterative adaptive tolerance factor To find the function with the maximum value, New candidate suggestions In the mission The score on New candidate suggestions In the mission The score on; Then new candidate suggestions Pareto dominance new candidate prompts All non-dominated candidates are retained for the next iteration.
8. The suggestion optimization method based on multi-task gradient induction and Pareto selection according to claim 1, characterized in that, It also includes downstream task adaptation. For the target downstream task, its dataset, and scoring function, a general prompt word is selected from the Pareto optimal set of general prompts as the current prompt word. Steps S2 to S4 are repeated. The candidate prompt word with the highest score on the target downstream task is selected as the current prompt word for iterative optimization to obtain the task-specific prompt word.
9. The suggestion optimization method based on multi-task gradient induction and Pareto selection according to claim 1, characterized in that, It also includes zero-shot transfer, which selects a general cue word from the Pareto-optimal set of general cue words and applies it directly to inference on a new task that has not participated in multi-task training.
10. A suggestion optimization system based on multi-task gradient induction and Pareto sieving, characterized in that, To perform a hint optimization method based on multi-task gradient induction and Pareto sieving as described in any one of claims 1 to 9, comprising: The training set construction module constructs a natural language multi-task training set, where each task contains a set of questions and a corresponding set of standard answers. The multi-task gradient induction module combines the current prompt word with the task question for each task and inputs it into the target large language model to obtain the large language model inference output; compares the large language model inference output with the standard answer of the task to generate a natural language loss description; converts the natural language loss description into improvement suggestions for prompt word updates; and normalizes and summarizes the improvement suggestions for each task to obtain a general gradient signal. The new candidate prompt word generation module generates multiple new candidate prompt words based on the current prompt word, the general gradient signal, and the historical optimization trajectory. A multidimensional score vector calculation module defines a scoring function, applies new candidate prompts to the training set, and uses the scoring function to calculate the score of each new candidate prompt on each task to obtain a multidimensional score vector. The Pareto filtering module constructs an adaptive tolerance factor based on a multidimensional score vector, determines the Pareto dominance relationship based on the adaptive tolerance factor, and filters the Pareto optimal suggestion word from the new candidate suggestion words based on the Pareto dominance relationship. Constructing an adaptive tolerance factor based on a multidimensional score vector includes: Calculate the first The average score of each new candidate prompt word on each task during each round of iteration; Calculate the coefficient of variation of performance between tasks, which is the ratio of the standard deviation of the average score of each task to the mean. Calculate the adaptive tolerance factor based on the coefficient of variation of performance between tasks; The iterative optimization module has a preset number of iteration rounds. If the current iteration round has not reached the preset number of iteration rounds, the current Pareto optimal prompt word is used as the new current prompt word, and steps S2 to S5 are repeated. If the current iteration round has reached the preset number of iteration rounds, the current Pareto optimal prompt word is output to obtain the Pareto optimal general prompt set.
Citation Information
Patent Citations
Low-carbon energy fine tuning data set generation method and system based on Pareto multi-model collaborative evaluation mechanism
CN119918656A
Large language model cue word automatic optimization method
CN120542583A