Text task cue word updating method based on text processing task and related equipment
By iteratively optimizing the prompt word sampling strategy parameters and output transformation matrix, the problem of large language models being unable to optimize prompt words in a black-box environment was solved, achieving more accurate text processing task output.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- JILIN UNIVERSITY
- Filing Date
- 2025-11-28
- Publication Date
- 2026-04-21
AI Technical Summary
Large language models cannot accurately optimize prompt words to complete downstream text processing tasks without access to their internal structure, especially when the required labels are not in the large model's vocabulary or the labels have inconsistent meanings, leading to prompt word optimization failure.
By obtaining the cue word sampling strategy parameters and the output transformation mapping matrix, the cue words are iteratively optimized to match the target output of the text processing task. These parameters are updated using the gradient descent algorithm and regularization function until the update conditions are met.
It effectively bridges the gap between the actual output of the language model and the target output of the task, optimizes the prompt words, and improves the accuracy and efficiency of the large language model in text processing tasks.
Smart Images

Figure CN121902802A_ABST
Abstract
Description
Technical Field
[0001] This specification relates to the field of computer technology, and in particular to a method, apparatus, storage medium, and computer device for updating text task prompts based on text processing tasks. Background Technology
[0002] Black-box Discrete Prompt Learning (BDPL) refers to a technical approach that optimizes prompt words to enable a large language model (LLM) to better perform downstream tasks, without being able to view the internal structure of the LLM.
[0003] This method predefines a label vocabulary. The labels defined in the label vocabulary are the result identifiers that the large language model is expected to output, matching the task objective of the text processing task. The label vocabulary must be a subset of the large model vocabulary. In black-box discrete prompt learning, the computer device generates prompt words and inputs the concatenated text sample and prompt words into the large language model. Since the label exists in the large model vocabulary, the large language model can output the probability that each label in the label vocabulary belongs to the correct answer. Then, this method optimizes the prompt words based on the difference between this probability and the actual labeled label of the text sample.
[0004] However, when the required labels for the task are not present in the large model vocabulary, or when the meanings of the labels required for the task are inconsistent with those in the large model vocabulary, the large language model cannot accurately output the probability, thus preventing the optimization of prompt words. Summary of the Invention
[0005] This specification provides a method, apparatus, storage medium, and computer device for updating text task prompts based on text processing tasks. The technical solution is as follows: In a first aspect, embodiments of this application provide a method for updating text task prompts based on text processing tasks, including: Obtain the first prompt word sampling strategy parameters and the first output transformation mapping matrix for the text processing task, and obtain the text sample for the text processing task; Based on the first prompt word sampling strategy parameters, prompt words are sampled in a preset large model prompt word library to obtain the first text processing task prompt word. The text sample is then concatenated with the first text processing task prompt word to obtain the first task query text for the text processing task. The first task query text is input into the target large language model for task processing to obtain the first output probability, which is the output probability of each candidate word in the large model vocabulary of the target large language model. The first output probability is transformed into a vector space using the first output transformation mapping matrix to obtain the first task processing output result; Based on the output of the first task and the sample task output label of the text sample, the first prompt word sampling strategy parameters and the first output transformation mapping matrix are updated until the update end condition is met, and the target prompt word sampling strategy parameters and the target output transformation mapping matrix after the update are obtained.
[0006] In some embodiments, the first prompt word sampling strategy parameters and the first output transformation mapping matrix are updated based on the first task processing output result and the sample task output labels of the text sample until the update termination condition is met, resulting in the target prompt word sampling strategy parameters and the target output transformation mapping matrix after the update is completed, including: Based on the output result of the first task processing and the output label of the sample task, the first prompt word sampling strategy parameters are updated to obtain the second prompt word sampling strategy parameters; Based on the parameters of the second prompt word sampling strategy, prompt words are sampled in the large model prompt word library to obtain the second text processing task prompt words; The text sample is concatenated with the second text processing task prompt to obtain the second task query text for the text processing task. The second task query text is input into the target large language model for task processing to obtain the second output probability; The second output probability is transformed into a vector space using the first output transformation mapping matrix to obtain the second task processing output result; The first output transformation mapping matrix is updated based on the output result of the second task and the sample task output label of the text sample to obtain the second output transformation mapping matrix; The second output transformation mapping matrix and the second prompt word sampling strategy parameter are respectively used as the first output transformation mapping matrix and the first prompt word sampling strategy parameter, and the step of obtaining the text processing task sample for the text processing task is executed until the update end condition is met, so as to obtain the target prompt word sampling strategy parameter and the target output transformation mapping matrix after the update is completed.
[0007] In some embodiments, the first output transformation mapping matrix is updated based on the output result of the second task processing and the sample task output label of the text sample to obtain the second output transformation mapping matrix, including: The mapping loss value is determined based on the output result of the second task and the output label of the sample task, and the gradient operation is performed based on the mapping loss value to obtain the first gradient value. Based on the first gradient value, the first output transformation mapping matrix is subjected to a preset gradient descent solution to obtain the second output transformation mapping matrix; The preset gradient descent solution process satisfies the first calculation formula: ; Among them, the For the first The first output transformation mapping matrix in the round update, the For the first The second output transformation mapping matrix in the round update, the Update the learning rate to the preset output transformation mapping matrix. For the first The second prompt word sampling strategy parameters in the round update, the The sample set of the text samples, the In the The objective function on For the first The first gradient value in the round of updates; The Satisfies the second calculation formula: ; Among them, the = The Let be the matrix to be solved. For regularization functions; Indicates that solving makes Get the minimum value A set of.
[0008] In some embodiments, the first text processing task prompt includes The target word units are concatenated in order, the The integer is greater than or equal to 1; the step of sampling prompt words in a preset large model prompt word library according to the first prompt word sampling strategy parameters to obtain the first text processing task prompt word includes: Based on the parameters of the first prompt word sampling strategy, each candidate word in the large model prompt word library is selected as the first... The probability of a target word, the Less than or equal to the Positive integers; Based on the aforementioned large model prompt word library, each candidate word was selected as the first... The probability of the nth target word is sampled from the large model prompt lexicon to obtain the nth target word. One target word element; Based on the first The target lexical units determine the prompt words for the first text processing task.
[0009] In some embodiments, each candidate word in the large model prompt word library is selected as the first prompt word based on the parameters of the first prompt word sampling strategy. The probability of each target word includes: Based on the first prompt word sampling strategy parameters and the third calculation formula, each candidate word element in the large model prompt word library is selected as the first... The probability of a target word; The third calculation formula is as follows: ; The The first word in the large model's suggestion lexicon is... The candidate lexical unit was selected as the first... The probability of each target word; Belonging to the first prompt word sampling strategy parameters, the Used to control the first in the large model prompt word library The candidate terminology was selected as the first... The probability of each target word; Used to control the first in the large model prompt word library The candidate terminology was selected as the first... The probability of each target word; and stated It is random noise; For the preset temperature coefficient, the The number of candidate lexical units in the large model's lexicon is indicated. It is an exponential function.
[0010] In some embodiments, updating the first prompt word sampling strategy parameters based on the first task processing output result and the sample task output label of the text sample includes: Calculate the sampling loss value based on the output result of the first task and the output label of the sample task; The gradient is calculated based on the sampling loss value and the fourth calculation formula to obtain the second gradient value; The fourth calculation formula is as follows: ; The For the The corresponding second gradient value, the For use in the first In each round of updates, each candidate lexical unit in the large model prompt word library is controlled as the first text processing task prompt word. The probability distribution of each target word; Belonging to the The For the first The first prompt word sampling strategy parameters in the round of updates; The For the first The first output transformation mapping matrix in the round update; the The preset number of times for sampling prompt words; In the first The first sampled during the round of updates The first text processing task prompt word; the For the first Each text sample obtained during the round of updates; the For use , In the The sampling loss value calculated above; The For use The average sampling loss value calculated from the first text processing task prompt word sampled in the second sampling; Based on the The calculated large model suggests the sampling probability of each candidate word in the vocabulary; for Regarding parameters The gradient; The parameters of the first prompt word sampling strategy are updated according to the preset gradient descent formula and the second gradient value.
[0011] In some embodiments, the text task prompt word update method based on text processing tasks further includes: Obtain the text to be processed for the text processing task; Based on the target prompt word sampling strategy, prompt words are sampled in the large model prompt word library to obtain target prompt words; The target prompt and the text to be processed are concatenated to obtain the target query text; The target query text is input into the target large language model for task processing to obtain the target output probability. Based on the target output transformation mapping matrix and the target output probability, the task output result of the text to be processed is obtained.
[0012] Secondly, embodiments of this application also provide a text task prompt word updating device based on a text processing task, comprising: The data acquisition module is used to acquire the first prompt word sampling strategy parameters and the first output transformation mapping matrix for the text processing task, and to acquire text samples for the text processing task. The text concatenation module is used to sample prompt words in a preset large model prompt word library according to the first prompt word sampling strategy parameters to obtain the first text processing task prompt word, and concatenate the text sample with the first text processing task prompt word to obtain the first task query text for the text processing task. The task processing module is used to input the first task query text into the target large language model for task processing and obtain the first output probability. The first output probability is the output probability of each candidate word in the large model vocabulary of the target large language model. The vector mapping module is used to perform vector space transformation processing on the first output probability through the first output transformation mapping matrix to obtain the first task processing output result; The parameter update module is used to update the first prompt word sampling strategy parameters and the first output transformation mapping matrix based on the first task processing output result and the sample task output label of the text sample until the update end condition is met, so as to obtain the target prompt word sampling strategy parameters and the target output transformation mapping matrix after the update is completed.
[0013] Thirdly, embodiments of this application also provide a computer device, the computer device comprising: One or more processors; Memory; and One or more applications, wherein the one or more applications are stored in the memory and configured to be executed by the processor to implement the text task prompt word update method described above for text processing tasks.
[0014] Fourthly, embodiments of this application also provide a computer-readable storage medium having a computer program stored thereon, the computer program being loaded by a processor to perform the steps in the text task prompt word update method based on text processing tasks as described above.
[0015] The beneficial effects of the technical solutions provided in some embodiments of this specification include at least the following: This application embodiment is configured with a first prompt word sampling strategy parameter and a first output transformation mapping matrix. The first prompt word sampling strategy parameter is used to control the sampling strategy of the prompt word. The first output transformation mapping matrix can map the output probability of the large language model to the target output space where the data task is located, so as to meet the target output requirements of the task and effectively bridge the distance between the actual output of the language model and the target output of the task. Thus, the sampling effect of the first prompt word sampling strategy parameter and the mapping effect of the first output transformation mapping matrix can be effectively measured based on the prediction results and labels. The first prompt sampling strategy and the first output transformation mapping matrix are updated collaboratively to achieve the optimization of the prompt word. Attached Figure Description
[0016] To more clearly illustrate the technical solutions in the embodiments or prior art of this specification, the drawings used in the description of the embodiments or prior art will be briefly introduced below. Obviously, the drawings described below are only some embodiments of this specification. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort.
[0017] Figure 1 This is a flowchart illustrating a text task prompt word update method based on a text processing task, as provided in the embodiments of this specification.
[0018] Figure 2 This is a flowchart of the sub-steps of step 107 provided in the embodiments of this specification.
[0019] Figure 3 This is a flowchart of a text task prompt word update method for text question answering tasks provided in the embodiments of this specification.
[0020] Figure 4 This is a schematic diagram of the framework of the text task prompt word update device based on text processing tasks provided in the embodiments of this specification.
[0021] Figure 5 This is a schematic diagram of the structure of the computer device provided in the embodiments of this specification. Detailed Implementation
[0022] The technical solutions in the embodiments of this specification will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of this specification, and not all embodiments. Based on the embodiments in this specification, all other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of this specification.
[0023] In the description of this specification, it should be understood that the terms "first," "second," etc., are used for descriptive purposes only and should not be construed as indicating or implying relative importance. In the description of this specification, it should be noted that, unless otherwise expressly specified and limited, "comprising" and "having," and any variations thereof, are intended to cover non-exclusive inclusion. For example, a process, method, system, product, or device that includes a series of steps or units is not limited to the listed steps or units, but may optionally include steps or units not listed, or may optionally include other steps or units inherent to these processes, methods, products, or devices. Those skilled in the art can understand the specific meaning of the above terms in this specification based on the specific circumstances. Furthermore, in the description of this specification, unless otherwise stated, "multiple" means two or more. "And / or" describes the relationship between related objects, indicating that three relationships can exist. For example, A and / or B can represent: A alone, A and B simultaneously, and B alone. The character " / " generally indicates that the preceding and following related objects are in an "or" relationship.
[0024] The technical terms used in the embodiments of this application are explained below.
[0025] Token: A token, also known as a label, is a basic language unit that converts text into a processable numerical form.
[0026] Large model vocabulary: This is the "basic dictionary" used by large language models to understand and generate text. It contains all the tags that the large language model can recognize and their corresponding numerical codes (IDs). Each tag corresponds to a unique numerical code for the large language model to perform mathematical calculations. For example, the RoBERTa-large model includes 50,265 tags, and the Llama3 model includes 128,256 tags.
[0027] Black-box discrete prompting learning refers to a technical approach that optimizes prompt words to enable a large language model to better perform downstream tasks, without being able to view the internal structure of the large language model.
[0028] In the black-box discrete prompting learning method, a label vocabulary can be predefined. The labels defined in the label vocabulary are the result identifiers that the large language model is expected to output and that match the task objective of the text processing task. The label vocabulary can be understood as a discrete set of symbols that represent the range of correct answers that the large language model needs to output for the text processing task.
[0029] Generally, the label vocabulary needs to be a subset of the large model vocabulary so that the large language model can understand and generate labels in the label vocabulary, thereby enabling the output of the large language model to meet the task objectives of downstream text processing tasks.
[0030] The steps of black-box discrete cue learning include: First, generating cue words and inputting the concatenated text sample and cue words into a large language model. Since the label exists in the large model's vocabulary, the large language model can understand the label and output the probability that each label in the label vocabulary belongs to the correct answer. Then, based on the difference between the probability and the actual labeled label of the text sample, the cue words are optimized.
[0031] However, when the large model vocabulary does not contain the labels required for the text processing task, or when the labels required for the task are inconsistent with the meanings of the lexical units in the large model vocabulary, the large language model cannot understand the labels in the label vocabulary, making it difficult to accurately output the probability that each label belongs to the correct answer. Consequently, it cannot measure the difference between this probability and the actual labeled labels of the text sample, resulting in the inability to optimize the prompt words.
[0032] For example, a large language model may fail to recognize certain numerical labels, making it difficult for the large language model to accurately output the probability corresponding to the numerical label.
[0033] For example, shopping websites may add half-star tags such as "2.5 stars" and "4.5 stars" based on real-time data. If these tags are not in the vocabulary of the large model, the large language model will not be able to output probabilities for them.
[0034] For example, suppose a shopping website has a numerical rating of "3 stars". A large language model may break it down into the characters "3" and "star", but this is irrelevant to the semantics of the rating and cannot accurately reflect the meaning of "3 stars represents a medium rating". Even if the large language model outputs a probability value, it may still be inaccurate.
[0035] In view of the above, embodiments of this application provide a method, apparatus, computer device, and computer-readable storage medium for updating text task prompts based on text processing tasks.
[0036] The present specification will now be described in detail with reference to specific embodiments.
[0037] In one embodiment, such as Figure 1 As shown, a text task prompt word update method based on text processing tasks is proposed. This method can be implemented using a computer program and can run on a text task prompt word update device based on the von Neumann architecture. This computer program can be integrated into applications or run as a standalone utility application.
[0038] The text task prompt update device can be a standalone server, or a server network or server cluster. For example, the text task prompt update device described in the embodiments of this application includes, but is not limited to, a computer, a network host, a single network server, a set of multiple network servers, or a cloud server composed of multiple servers. The cloud server consists of a large number of computers or network servers based on cloud computing.
[0039] refer to Figure 1 As shown, this text task prompt word update method based on text processing tasks includes: Step 101: Obtain the first prompt word sampling strategy parameters and the first output transformation mapping matrix for the text processing task.
[0040] The text processing task can be a classification task, a machine translation task, or a dialogue task, but is not limited to these.
[0041] The first prompt word sampling strategy parameter can be used to control the probability that each candidate word in the large model prompt word library is selected as the target word at a certain position in the prompt word.
[0042] Specifically, the parameters of the first prompt word sampling strategy may include One probability control parameter, N represents the number of lexical units included in the prompt words for the first text processing task (i.e., the number of target lexical units), and N is the number of candidate lexical units in the large model prompt word library. Each probability control parameter can be denoted as... , Used to control the first in the large model prompt word library The candidate terminology was selected as the first... The probability of a target word.
[0043] The large model prompt word library can be the large model vocabulary or a subset thereof, and can be configured according to the actual needs for prompt words. This application embodiment does not limit this.
[0044] The first output transformation mapping matrix is used for vector space transformation processing.
[0045] In the text task prompt word update method provided in this application embodiment, the first prompt word sampling strategy parameter and the first output conversion mapping matrix will be updated at least once. During the first round of update, the computer device can initialize the first prompt word sampling strategy parameter and the first output conversion mapping matrix. For example, the computer device randomly generates the prompt word sampling strategy parameter as the first prompt word sampling strategy parameter in the first round of update, and randomly generates the output conversion mapping matrix as the first output conversion mapping matrix in the first round of update.
[0046] During the first update, the initial first prompt word sampling strategy parameters can be denoted as: .
[0047] The first output transformation mapping matrix can be denoted as: As the first output transformation mapping matrix is iteratively updated, it can gradually transform the first output probability into a vector representation that conforms to the label vocabulary. That is, in each round of iterative updates, the output of the first task can gradually approach the vector representation of the labels in the label vocabulary.
[0048] Step 102: Obtain text samples for the text processing task.
[0049] For example, a training dataset for a text processing task can be pre-configured. (It can also be referred to as a sample set) ), will train the dataset The text is split into several small batches of samples, and the size of each small batch of samples is denoted as . In each round of updates, a set of small-batch text samples is selected from several small-batch text samples as the text samples used in this round of training (i.e., as the text samples for the text processing task obtained in step 102).
[0050] Assuming the text processing task is machine translation, the training dataset D includes multiple text samples for the machine translation task. In step 102, the computer device can acquire... A text sample for a text processing task.
[0051] Step 103: Sample prompt words in the preset large model prompt word library according to the first prompt word sampling strategy parameters to obtain the first text processing task prompt words.
[0052] In some embodiments, the first text processing task prompt includes The target word units are concatenated in order, the For integers greater than or equal to 1, step 103 can be implemented using the following a1~a3: Step a1: The computer device determines, based on the parameters of the first prompt word sampling strategy, that each candidate word element in the large model prompt word library is selected as the first... The probability of a target word, the Less than or equal to the Positive integers.
[0053] In some embodiments, step 103 can be implemented in the following manner: First, the computer device determines, based on the first prompt word sampling strategy parameters and the third calculation formula, that each candidate word in the large model prompt word library is selected as the first... The probability of a target word; The third calculation formula is as follows: ; The first word in the large model's suggestion lexicon is... The candidate lexical unit was selected as the first... The probability of a target word.
[0054] Belonging to the first prompt word sampling strategy parameters, the Used to control the first in the large model prompt word library The candidate terminology was selected as the first... The probability of a target word.
[0055] Used to control the first in the large model prompt word library The candidate terminology was selected as the first... The probability of a target word.
[0056] In response to random noise, From Obtained from distributed sampling.
[0057] In response to random noise, From Obtained from distributed sampling.
[0058] The preset temperature coefficient, Provide the large model with the number of candidate lexical units in the vocabulary; It is an exponential function.
[0059] Through step a1 above, the computer device can determine the probability distribution of candidate words corresponding to each target word position. By connecting the probability distributions of candidate words corresponding to each target word position, the category distribution can be obtained. ,in, Refers to the adoption of the first First prompt word sampling strategy parameters in round update The calculated probability distribution of candidate lexical units corresponding to each target lexical unit position. The current update iteration round is for the first output transformation mapping matrix and the first prompt word sampling strategy parameters.
[0060] Step a2: The computer device selects each candidate word from the large model's suggestion lexicon as the first... The probability of the nth target word is sampled from the large model prompt lexicon to obtain the nth target word. One target word.
[0061] For example, regarding the first The target word is determined by step a1 above, which calculates N candidate word elements from the large model's suggestion lexicon. These N candidate word elements are then selected as the target word. The probability of the i-th target word is obtained by calculating the probability distribution of N candidate words being selected as the i-th target word. Then, sampling is performed based on this probability distribution to obtain the probability of the i-th target word. One target word.
[0062] Step a3, the computer device can be based on the first The target lexical units determine the prompt words for the first text processing task.
[0063] For example, after obtaining the first to the nth target words based on the above steps, these target words can be concatenated in sequence to obtain the first text processing task prompt word.
[0064] Electrons are distributed according to category through steps a2 and a3 above. From the large model suggestion lexicon Subsequent cue word sampling yields the cue word sequence. , For the first In the current update, the first The first text processing task prompt word obtained from the second sampling.
[0065] Once the computer device determines the first text processing task prompt word mentioned above, it can execute the following step 104.
[0066] Step 104: Concatenate the text sample with the first text processing task prompt to obtain the first task query text for the text processing task.
[0067] Step 105: Input the first task query text into the target large language model for task processing to obtain the first output probability.
[0068] Wherein, the first output probability is the output probability of each candidate word in the large model vocabulary of the target large language model, and the first output probability is the original probability output of the target large language model.
[0069] The probability of the first output in round t can be denoted as... This refers to the update in the t-th round, targeting a small batch of text samples. and the first text processing task prompt word set The calculated first output probability Step 106: Perform vector space transformation on the first output probability using the first output transformation mapping matrix to obtain the first task processing output result.
[0070] For example, a computer device can transform a first output into a mapping matrix. With the first output probability Matrix multiplication is performed to transform the vector space, thereby obtaining the output of the first task. .
[0071] Step 107: Based on the output results of the first task processing and the sample task output labels of the text samples, update the first prompt word sampling strategy parameters and the first output transformation mapping matrix to obtain the second prompt word sampling strategy parameters and the second output transformation mapping matrix.
[0072] In some embodiments, the computer device may be based on an objective function. The first task processing output result and the sample task output label of the text sample are used to update the first prompt word sampling strategy parameters and the first output transformation mapping matrix to obtain the second prompt word sampling strategy parameters and the second output transformation mapping matrix.
[0073] The formula for optimizing the prompt word sampling strategy parameters and the output transformation mapping matrix based on the objective function is shown below: ; in, For the objective function , Representation Solving Hint Word Sampling Strategy Parameters and output transformation mapping matrix , making Minimum.
[0074] [.] refers to the expectation operation. Used to indicate based on The sampled text processing task prompts, For cue word sampling strategy parameters The calculated large model suggests the sampling probability of each candidate word in the vocabulary.
[0075] For the output transformation mapping matrix Parameters of prompt word sampling strategy and text samples loss function This is a regularization term.
[0076] Further, refer to Figure 2 As shown, step 107 can be achieved through the following steps 1071 to 1076: Step 1071: Update the first prompt word sampling strategy parameters based on the first task processing output and the sample task output labels to obtain the second prompt word sampling strategy parameters.
[0077] In some embodiments, step 1071 can be implemented by the following steps B1 to B3: Step B1: The computer device calculates the sampling loss value based on the output result of the first task processing and the output label of the sample task.
[0078] For example, the computer device compares the one-hot encodings of the first task's output with the one-hot encodings of the sample task's output labels. The difference between the model's prediction and the true label is calculated using a preset loss function to determine the sampling loss value. .
[0079] Specifically, the computer device can target each first text processing task prompt word. First output transformation mapping matrix and small batches of text samples Calculate loss , thereby obtaining including The sampled loss sequence of each sampled loss value .
[0080] Step B2: Calculate the gradient based on the sampling loss value and the fourth calculation formula to obtain the second gradient value.
[0081] The fourth calculation formula is as follows: ; For the The corresponding second gradient value.
[0082] For use in the first In each round of updates, each candidate lexical unit in the large model prompt word library is controlled as the first text processing task prompt word. The probability distribution of each target word; Belonging to the .
[0083] For the first The parameters of the first prompt word sampling strategy in the round of updates.
[0084] For the first The first output transformation mapping matrix in the round of updates.
[0085] The preset number of times for sampling prompt words; In the first The first sampled during the round of updates The first text processing task prompt word.
[0086] For the first Text samples obtained during each update cycle.
[0087] For use , In the The sampling loss value calculated above.
[0088] For use The average sampling loss value calculated from the first text processing task prompt word sampled. .
[0089] Based on the The calculated large model suggests the sampling probability of each candidate word in the vocabulary; for Regarding parameters The gradient.
[0090] The method for calculating the second gradient value in this embodiment uses the difference between the historical sample average gradient and the current mini-batch sample gradient to correct for variance caused by sampling fluctuations, thereby accelerating convergence. In other embodiments, other gradient descent methods, such as stochastic gradient descent, may also be used, and this embodiment does not limit this approach.
[0091] Step B3: Update the first prompt word sampling strategy parameters according to the preset gradient descent formula and the second gradient value to obtain the second prompt word sampling strategy parameters.
[0092] The gradient descent formula is shown below: = - .
[0093] Belongs to the The second prompt word sampling strategy parameters in the round of updates.
[0094] The learning rate is the parameter for the prompt word sampling strategy.
[0095] This is the second gradient value.
[0096] Step 1072: Based on the second prompt word sampling strategy parameters, prompt words are sampled in the large model prompt word library to obtain the second text processing task prompt words.
[0097] For example, computer devices can sample strategy parameters based on second cue words. Determine the category distribution ,in, Based on The generated probability distribution is then sorted according to the category distribution. Sampling from a large model-suggested vocabulary Next, the sequence of prompt words for the second text processing task is obtained. .
[0098] Step 1073: Concatenate the text sample with the second text processing task prompt to obtain the second task query text for the text processing task.
[0099] Step 1074: Input the second task query text into the target large language model for task processing to obtain the second output probability.
[0100] Step 1075: Perform vector space transformation on the second output probability using the first output transformation mapping matrix to obtain the second task processing output result.
[0101] Steps 1072 to 1075 are largely the same as steps 103 to 106, and will not be repeated here.
[0102] Step 1076: Update the first output transformation mapping matrix based on the output results of the second task and the sample task output labels of the text samples to obtain the second output transformation mapping matrix.
[0103] In some embodiments, step 1076 can be implemented as follows: Step C1: The computer device determines the mapping loss value based on the output result of the second task processing and the output label of the sample task, and performs gradient calculation based on the mapping loss value to obtain the first gradient value.
[0104] Computer devices can provide prompts for each second text processing task. First output transformation mapping matrix and the Small batches of text samples obtained during round updates Calculate loss , thereby obtaining including Loss sequence of mapping loss .
[0105] Then, the mean of the loss sequence is calculated using the mapping loss. The formula for calculating the mean of the loss sequence is as follows: Mean of loss sequence = .
[0106] The gradient is calculated using the mean of the loss sequence based on the mapping loss to obtain the first gradient value. The calculation formula is as follows: = 。
[0107] Step C2: The computer device performs a preset gradient descent solution on the first output transformation mapping matrix based on the first gradient value to obtain the second output transformation mapping matrix.
[0108] The preset gradient descent solution process satisfies the first calculation formula: ; in, For the first The first output transformation mapping matrix in the round of updates.
[0109] For the first The second output transformation mapping matrix in the round update.
[0110] Update the learning rate for the preset output transformation mapping matrix.
[0111] For the first The second prompt word sampling strategy parameters in the round of updates.
[0112] The sample set of the text samples. In the The objective function on For the first The first gradient value in the round of updates.
[0113] Satisfies the second calculation formula: ; Among them, the = The Let be the matrix to be solved. For regularization functions; Indicates that solving makes Get the minimum value A set of.
[0114] The gradient update method in this application maintains the idea of gradient update while ensuring the mathematical feasibility of non-smooth regularization terms.
[0115] Step 108: Determine whether the update termination condition is met.
[0116] The update termination condition can be set to reaching a preset number of iterations, or the first output transformation mapping matrix, and / or the convergence of the first prompt word sampling strategy parameters. This application embodiment does not limit this to any particular condition.
[0117] If the update termination condition is not met, proceed to the next iteration, i.e., execute step 109.
[0118] If the update termination condition is met, proceed to step 110.
[0119] Step 109: Use the second prompt word sampling strategy parameter as the first prompt word sampling strategy parameter, and use the second output transformation mapping matrix as the first output transformation mapping matrix. Then, re-execute step 102.
[0120] Step 110: Use the second prompt word sampling strategy parameter as the target prompt word sampling strategy parameter, and use the second output transformation mapping matrix as the target output transformation mapping matrix.
[0121] The text task prompt word update method based on text processing tasks provided in the above embodiments can be applied to various types of text processing tasks, such as text translation, text classification (e.g., text sentiment classification), and question answering. The following combines... Figure 3 This document describes the steps involved in applying the text task prompt update method to a text question-and-answer task.
[0122] First, the computer device can obtain the first prompt word sampling strategy parameters and the first output transformation mapping matrix for the text processing task (such as a text question-and-answer task), and obtain the task sample (such as a question-and-answer task sample) for the text processing task.
[0123] Then, the computer device can sample prompt words in a preset large model prompt word library according to the first prompt word sampling strategy parameters to obtain the first text processing task prompt word (such as the first question and answer task prompt word). The question and answer task sample is concatenated with the first question and answer task prompt word to obtain the first task query text (such as the first question and answer task query text) for the text question and answer task.
[0124] After obtaining the query text for the first question-answering task, the computer device can input the query text into the target large language model for question-answering task processing to obtain the first output probability. The first output probability is the output probability of each candidate word in the large vocabulary of the target large language model. Then, the first output probability is transformed into vector space through the first output transformation mapping matrix to obtain the output result of the first question-answering task processing.
[0125] Next, the computer device can update the first prompt word sampling strategy parameters and the first output transformation mapping matrix based on the output results of the first question-and-answer task and the sample task output labels of the text sample until the update end condition is met, and obtain the target prompt word sampling strategy parameters and the target output transformation mapping matrix after the update is completed.
[0126] In some embodiments, after obtaining the target output transformation mapping matrix and the target prompt word sampling strategy parameters, the computer device can perform a text processing task using the target output transformation mapping matrix and the target prompt word sampling strategy parameters. The computer device performing the text processing task and the device performing steps 101-110 can be the same device or different devices; this embodiment does not limit this.
[0127] Specifically, the computer device may perform the following steps: the computer device acquires the text to be processed for the text processing task, for example, the computer device may acquire the text to be processed for a text translation task.
[0128] Then, the computer device can sample prompt words in a preset large model prompt word library based on the target prompt word sampling strategy to obtain the target prompt word; the target prompt word and the text to be processed are concatenated to obtain the target query text.
[0129] Next, the computer device can input the target query text into the target large language model for task processing to obtain the target output probability. Based on the target output transformation mapping matrix and the target output probability, the task output result of the text to be processed can be obtained. For example, the computer device can obtain the text translation result for a text translation task.
[0130] This application embodiment configures a first prompt word sampling strategy parameter and a first output transformation mapping matrix. The first prompt word sampling strategy parameter is used to control the sampling strategy of the prompt word, and the first output transformation mapping matrix is used to map the output probability of the language model to the target output space where the data task is located, so as to meet the target output requirements of the task and effectively bridge the distance between the actual output of the language model and the target output of the task. Thus, the sampling effect of the first prompt word sampling strategy parameter and the mapping effect of the first output transformation mapping matrix can be effectively measured based on the prediction results and labels, and the first prompt sampling strategy and the first output transformation mapping matrix can be updated collaboratively to achieve the optimization of the prompt word.
[0131] The following will combine Figure 4 This specification provides a detailed description of the text task prompt word updating device based on text processing tasks, as provided in the embodiments. It should be noted that... Figure 4 The text task prompt word update device shown is used to execute the instructions in this specification. Figures 1-3 The methods shown in the embodiments are illustrated for ease of explanation, showing only the parts related to the embodiments of this specification. For specific technical details not disclosed, please refer to this specification. Figures 1-3 The example shown.
[0132] Please see Figure 4 This diagram illustrates the structure of a text task prompt update device based on a text processing task according to an embodiment of this specification. This text task prompt update device can be implemented as all or part of a computer device through software, hardware, or a combination of both. According to some embodiments, the text task prompt update device includes a data acquisition module 401, a text concatenation module 402, a task processing module 403, a vector mapping module 404, and a parameter update module 405, specifically used for: The data acquisition module 401 is used to acquire the first prompt word sampling strategy parameters and the first output transformation mapping matrix for the text processing task, and to acquire text samples for the text processing task. The text concatenation module 402 is used to sample prompt words in a preset large model prompt word library according to the first prompt word sampling strategy parameters to obtain the first text processing task prompt word, and concatenate the text sample with the first text processing task prompt word to obtain the first task query text for the text processing task. Task processing module 403 is used to input the first task query text into the target large language model for task processing and obtain a first output probability. The first output probability is the output probability of each candidate word in the large model vocabulary of the target large language model. The vector mapping module 404 is used to perform vector space transformation processing on the first output probability through the first output transformation mapping matrix to obtain the first task processing output result. The parameter update module 405 is used to update the first prompt word sampling strategy parameters and the first output transformation mapping matrix based on the first task processing output result and the sample task output label of the text sample until the update end condition is met, so as to obtain the target prompt word sampling strategy parameters and the target output transformation mapping matrix after the update is completed.
[0133] In some embodiments, the first prompt word sampling strategy parameters and the first output transformation mapping matrix are updated based on the first task processing output result and the sample task output labels of the text sample until the update termination condition is met, resulting in the target prompt word sampling strategy parameters and the target output transformation mapping matrix after the update is completed, including: Based on the output result of the first task processing and the output label of the sample task, the first prompt word sampling strategy parameters are updated to obtain the second prompt word sampling strategy parameters; Based on the parameters of the second prompt word sampling strategy, prompt words are sampled in the large model prompt word library to obtain the second text processing task prompt words; The text sample is concatenated with the second text processing task prompt to obtain the second task query text for the text processing task. The second task query text is input into the target large language model for task processing to obtain the second output probability; The second output probability is transformed into a vector space using the first output transformation mapping matrix to obtain the second task processing output result; The first output transformation mapping matrix is updated based on the output result of the second task and the sample task output label of the text sample to obtain the second output transformation mapping matrix; The second output transformation mapping matrix and the second prompt word sampling strategy parameter are respectively used as the first output transformation mapping matrix and the first prompt word sampling strategy parameter, and the step of obtaining the text processing task sample for the text processing task is executed until the update end condition is met, so as to obtain the target prompt word sampling strategy parameter and the target output transformation mapping matrix after the update is completed.
[0134] In some embodiments, the first output transformation mapping matrix is updated based on the output result of the second task processing and the sample task output label of the text sample to obtain the second output transformation mapping matrix, including: The mapping loss value is determined based on the output result of the second task and the output label of the sample task, and the gradient operation is performed based on the mapping loss value to obtain the first gradient value. Based on the first gradient value, the first output transformation mapping matrix is subjected to a preset gradient descent solution to obtain the second output transformation mapping matrix; The preset gradient descent solution process satisfies the first calculation formula: ; Among them, the For the first The first output transformation mapping matrix in the round update, the For the first The second output transformation mapping matrix in the round update.
[0135] The Update the learning rate for the preset output transformation mapping matrix.
[0136] The For the first The second prompt word sampling strategy parameters in the round of updates.
[0137] The The sample set of the text samples, the In the The objective function on For the first The first gradient value in the round of updates.
[0138] The Satisfies the second calculation formula: ; Among them, the = The Let be the matrix to be solved. For regularization functions; Indicates that solving makes Get the minimum value A set of.
[0139] In some embodiments, the first text processing task prompt includes The target word units are concatenated in order, the The integer is greater than or equal to 1; the step of sampling prompt words in a preset large model prompt word library according to the first prompt word sampling strategy parameters to obtain the first text processing task prompt word includes: Based on the parameters of the first prompt word sampling strategy, each candidate word in the large model prompt word library is selected as the first... The probability of a target word, the Less than or equal to the Positive integers; Based on the aforementioned large model prompt word library, each candidate word was selected as the first... The probability of the nth target word is sampled from the large model prompt lexicon to obtain the nth target word. One target word element; Based on the first The target lexical units determine the prompt words for the first text processing task.
[0140] In some embodiments, each candidate word in the large model prompt word library is selected as the first prompt word based on the parameters of the first prompt word sampling strategy. The probability of each target word includes: Based on the first prompt word sampling strategy parameters and the third calculation formula, each candidate word element in the large model prompt word library is selected as the first... The probability of a target word; The third calculation formula is as follows: ; The The first word in the large model's suggestion lexicon is... The candidate lexical unit was selected as the first... The probability of each target word; Belonging to the first prompt word sampling strategy parameters, the Used to control the first in the large model prompt word library The candidate terminology was selected as the first... The probability of each target word; Used to control the first in the large model prompt word library The candidate terminology was selected as the first... The probability of each target word; and stated It is random noise; For the preset temperature coefficient, the The number of candidate lexical units in the large model's lexicon is indicated. It is an exponential function.
[0141] In some embodiments, updating the first prompt word sampling strategy parameters based on the first task processing output result and the sample task output label of the text sample includes: Calculate the sampling loss value based on the output result of the first task and the output label of the sample task; The gradient is calculated based on the sampling loss value and the fourth calculation formula to obtain the second gradient value; The fourth calculation formula is as follows: ; The For the The corresponding second gradient value, the For use in the first In each round of updates, each candidate lexical unit in the large model prompt word library is controlled as the first text processing task prompt word. The probability distribution of each target word; Belonging to the The For the first The first prompt word sampling strategy parameters in the round of updates; The For the first The first output transformation mapping matrix in the round update; the The preset number of times for sampling prompt words; In the first The first sampled during the round of updates The first text processing task prompt word; the For the first Each text sample obtained during the round of updates; the For use , In the The sampling loss value calculated above; The For use The average sampling loss value calculated from the first text processing task prompt word sampled in the second sampling; Based on the The calculated large model suggests the sampling probability of each candidate word in the vocabulary; for Regarding parameters The gradient; The parameters of the first prompt word sampling strategy are updated according to the preset gradient descent formula and the second gradient value.
[0142] In some embodiments, the method further includes: Obtain the text to be processed for the text processing task; Based on the target prompt word sampling strategy, prompt words are sampled in the large model prompt word library to obtain target prompt words; The target prompt and the text to be processed are concatenated to obtain the target query text; The target query text is input into the target large language model for task processing to obtain the target output probability. Based on the target output transformation mapping matrix and the target output probability, the task output result of the text to be processed is obtained.
[0143] It should be noted that the text task prompt update device provided in the above embodiments is only illustrated by the division of the above functional modules when executing the text task prompt update method. In practical applications, the above functions can be assigned to different functional modules as needed, that is, the internal structure of the device can be divided into different functional modules to complete all or part of the functions described above. In addition, the text task prompt update device and the text task prompt update method embodiments provided in the above embodiments belong to the same concept, and the implementation process is detailed in the method embodiments, which will not be repeated here.
[0144] The example numbers in this specification are for descriptive purposes only and do not represent the superiority or inferiority of the examples.
[0145] This specification also provides a computer storage medium that can store multiple instructions adapted to be loaded and executed by a processor as described above. Figures 1-3 The text task prompt word update method based on text processing tasks described in the embodiment shown can be found in the following document for a detailed execution process: Figures 1-3 The specific details of the illustrated embodiments will not be elaborated here.
[0146] This specification also provides a computer program product that stores at least one instruction, said at least one instruction being loaded and executed by the processor as described above. Figures 1-3 The text task prompt word update method based on text processing tasks described in the embodiment shown can be found in the following document for a detailed execution process: Figures 1-3 The specific details of the illustrated embodiments will not be elaborated here.
[0147] Please refer to Figure 5 This is a structural block diagram of a computer device provided in an embodiment of this specification. The computer device in this specification may include one or more of the following components: a processor 1010, a memory 1020, an input device 1030, an output device 1040, and a bus 1050. The processor 1010, memory 1020, input device 1030, and output device 1040 may be connected to each other via the bus 1050.
[0148] Processor 1010 may include one or more processing cores. Processor 1010 connects to various parts of the computer device using various interfaces and lines, and performs various functions and processes data by running or executing instructions, programs, code sets, or instruction sets stored in memory 1020, and by calling data stored in memory 1020. Optionally, processor 1010 may be implemented using at least one hardware form of digital signal processing (DSP), field-programmable gate array (FPGA), or programmable logic array (PLA). Processor 1010 may integrate one or more of a central processing unit (CPU), graphics processing unit (GPU), and modem. The CPU primarily handles the operating system, user interface, and applications; the GPU is responsible for rendering and drawing the displayed content; and the modem handles wireless communication. It is understood that the modem may also not be integrated into processor 1010 and may be implemented separately through a communication chip.
[0149] The memory 1020 may include random access memory (RAM) or read-only memory (ROM). Optionally, the memory 1020 may include non-transitory computer-readable storage medium. The memory 1020 may be used to store instructions, programs, code, code sets, or instruction sets.
[0150] The input device 1030 is used to receive input instructions or data, and includes, but is not limited to, a keyboard, mouse, camera, microphone, or touch device. The output device 1040 is used to output instructions or data, and includes, but is not limited to, a display device and a speaker. In this embodiment, the input device 1030 can be a temperature sensor for acquiring the operating temperature of the computer device. The output device 1040 can be a speaker for outputting audio signals.
[0151] In addition, those skilled in the art will understand that the structure of the computer device shown in the above figures does not constitute a limitation on the computer device. The computer device may include more or fewer components than shown, or combine certain components, or have different component arrangements. For example, the computer device may also include radio frequency circuits, input units, sensors, audio circuits, wireless fidelity (WIFI) modules, power supplies, Bluetooth modules, etc., which will not be described in detail here.
[0152] In the embodiments of this specification, the executing entity for each step can be the computer device described above. Optionally, the executing entity for each step can be the operating system of the computer device. The operating system can be Android, iOS, or other operating systems; this specification does not limit this.
[0153] exist Figure 5 In the computer device, the processor 1010 can be used to call a program stored in the memory 1020 and execute it to implement the text task prompt word update method based on text processing task as described in the various method embodiments of this specification.
[0154] Those skilled in the art will understand that all or part of the processes in the above embodiments can be implemented by a computer program instructing related hardware. The program can be stored in a computer-readable storage medium, and when executed, it can include the processes of the embodiments of the above methods. The storage medium can be a magnetic disk, optical disk, read-only memory, or random access memory, etc.
[0155] The above-disclosed embodiments are merely preferred embodiments of this specification and should not be construed as limiting the scope of this specification. Therefore, any equivalent variations made in accordance with the claims of this specification shall still fall within the scope of this specification.
Claims
1. A method for updating text task prompts based on text processing tasks, characterized in that, include: Obtain the first prompt word sampling strategy parameters and the first output transformation mapping matrix for the text processing task, and obtain the text sample for the text processing task; Based on the first prompt word sampling strategy parameters, prompt words are sampled in a preset large model prompt word library to obtain the first text processing task prompt word. The text sample is then concatenated with the first text processing task prompt word to obtain the first task query text for the text processing task. The first task query text is input into the target large language model for task processing to obtain the first output probability, which is the output probability of each candidate word in the large model vocabulary of the target large language model. The first output probability is transformed into a vector space using the first output transformation mapping matrix to obtain the first task processing output result; Based on the output of the first task and the sample task output label of the text sample, the first prompt word sampling strategy parameters and the first output transformation mapping matrix are updated until the update end condition is met, and the target prompt word sampling strategy parameters and target output transformation mapping matrix after the update are obtained.
2. The text task prompt word update method according to claim 1, characterized in that, The process of updating the first prompt word sampling strategy parameters and the first output transformation mapping matrix based on the first task processing output result and the sample task output labels of the text sample, until the update termination condition is met, to obtain the target prompt word sampling strategy parameters and the target output transformation mapping matrix after the update, includes: Based on the output result of the first task processing and the output label of the sample task, the first prompt word sampling strategy parameters are updated to obtain the second prompt word sampling strategy parameters; Based on the parameters of the second prompt word sampling strategy, prompt words are sampled in the large model prompt word library to obtain the second text processing task prompt words; The text sample is concatenated with the second text processing task prompt to obtain the second task query text for the text processing task. The second task query text is input into the target large language model for task processing to obtain the second output probability; The second output probability is transformed into a vector space using the first output transformation mapping matrix to obtain the second task processing output result; The first output transformation mapping matrix is updated based on the output result of the second task and the sample task output label of the text sample to obtain the second output transformation mapping matrix; The second output transformation mapping matrix and the second prompt word sampling strategy parameter are respectively used as the first output transformation mapping matrix and the first prompt word sampling strategy parameter, and the step of obtaining the text processing task sample for the text processing task is executed until the update end condition is met, so as to obtain the target prompt word sampling strategy parameter and the target output transformation mapping matrix after the update is completed.
3. The text task prompt word update method according to claim 2, characterized in that, The step of updating the first output transformation mapping matrix based on the output result of the second task processing and the sample task output labels of the text sample to obtain the second output transformation mapping matrix includes: The mapping loss value is determined based on the output result of the second task and the output label of the sample task, and the gradient operation is performed based on the mapping loss value to obtain the first gradient value. Based on the first gradient value, the first output transformation mapping matrix is subjected to a preset gradient descent solution to obtain the second output transformation mapping matrix; The preset gradient descent solution process satisfies the first calculation formula: ; Among them, the For the first The first output transformation mapping matrix in the round update, the For the first The second output transformation mapping matrix in the round update, the Update the learning rate to the preset output transformation mapping matrix. For the first The second prompt word sampling strategy parameters in the round update, the The sample set of the text samples, the In the The objective function on, For the first The first gradient value in the round of updates; The Satisfies the second calculation formula: ; Among them, the = The Let be the matrix to be solved. For regularization functions; Indicates that solving makes Get the minimum value A set of.
4. The text task prompt word update method as described in claim 1, characterized in that, The first text processing task prompt includes The target word units are concatenated in order, the The integer is greater than or equal to 1; the step of sampling prompt words in a preset large model prompt word library according to the first prompt word sampling strategy parameters to obtain the first text processing task prompt word includes: Based on the parameters of the first prompt word sampling strategy, each candidate word in the large model prompt word library is selected as the first... The probability of a target word, the Less than or equal to the Positive integers; Based on the aforementioned large model prompt word library, each candidate word was selected as the first... The probability of the nth target word is sampled from the large model prompt word library to obtain the nth target word. One target word element; Based on the first The target lexical units determine the prompt words for the first text processing task.
5. The text task prompt word update method as described in claim 4, characterized in that, The candidate word units in the large model prompt word library determined based on the parameters of the first prompt word sampling strategy are selected as the first... The probability of each target word includes: Based on the first prompt word sampling strategy parameters and the third calculation formula, each candidate word element in the large model prompt word library is selected as the first... The probability of a target word; The third calculation formula is as follows: ; The The first word in the large model's suggestion lexicon is... The candidate lexical unit was selected as the first... The probability of each target word; Belonging to the first prompt word sampling strategy parameters, the Used to control the first in the large model prompt word library The candidate terminology was selected as the first... The probability of each target word; Used to control the first in the large model prompt word library The candidate terminology was selected as the first... The probability of each target word; and stated It is random noise; For the preset temperature coefficient, the The number of candidate lexical units in the large model's lexicon is indicated. It is an exponential function.
6. The text task prompt word update method as described in claim 1, characterized in that, The parameters of the first prompt word sampling strategy are updated based on the output of the first task and the sample task output labels of the text sample, including: Calculate the sampling loss value based on the output result of the first task and the output label of the sample task; The gradient is calculated based on the sampling loss value and the fourth calculation formula to obtain the second gradient value; The fourth calculation formula is as follows: ; The For the The corresponding second gradient value, the For use in the first In each round of updates, each candidate lexical unit in the large model prompt word library is controlled as the first text processing task prompt word. The probability distribution of each target word; Belonging to the The For the first The first prompt word sampling strategy parameters in the round of updates; The For the first The first output transformation mapping matrix in the round update; the The preset number of times for sampling prompt words; In the first The first sampled during the round of updates The first text processing task prompt word; the For the first Each text sample obtained during the round of updates; the For use , In the The sampling loss value calculated above; The For use The average sampling loss value calculated from the first text processing task prompt word sampled in the second sampling; Based on the The calculated large model suggests the sampling probability of each candidate word in the vocabulary; for Regarding the above The gradient; The parameters of the first prompt word sampling strategy are updated according to the preset gradient descent formula and the second gradient value.
7. The text task prompt word update method as described in claim 1, characterized in that, The method further includes: Obtain the text to be processed for the text processing task; Based on the target prompt word sampling strategy, prompt words are sampled in a preset large model prompt word library to obtain the target prompt words; The target prompt and the text to be processed are concatenated to obtain the target query text; The target query text is input into the target large language model for task processing to obtain the target output probability. Based on the target output transformation mapping matrix and the target output probability, the task output result of the text to be processed is obtained.
8. A text task prompt word updating device based on text processing tasks, characterized in that, include: The data acquisition module is used to acquire the first prompt word sampling strategy parameters and the first output transformation mapping matrix for the text processing task, and to acquire text samples for the text processing task. The text concatenation module is used to sample prompt words in a preset large model prompt word library according to the first prompt word sampling strategy parameters to obtain the first text processing task prompt word, and concatenate the text sample with the first text processing task prompt word to obtain the first task query text for the text processing task. The task processing module is used to input the first task query text into the target large language model for task processing and obtain the first output probability. The first output probability is the output probability of each candidate word in the large model vocabulary of the target large language model. The vector mapping module is used to perform vector space transformation processing on the first output probability through the first output transformation mapping matrix to obtain the first task processing output result; The parameter update module is used to update the first prompt word sampling strategy parameters and the first output transformation mapping matrix based on the first task processing output result and the sample task output label of the text sample until the update end condition is met, so as to obtain the target prompt word sampling strategy parameters and the target output transformation mapping matrix after the update is completed.
9. A computer device, characterized in that, The computer device includes: One or more processors; Memory; and One or more applications, wherein the one or more applications are stored in the memory and configured to be executed by the processor to implement the text task prompt word update method based on any one of claims 1 to 7.
10. A computer-readable storage medium, characterized in that, It stores a computer program, which is loaded by a processor to perform the steps in the text task prompt word update method based on any one of claims 1 to 7.