Data prediction method, prediction large model training method and related device
By constructing multiple input data and using prediction models to perform target prediction tasks, the problem of slow inference speed of large language models is solved, and the data prediction efficiency is significantly improved.
Patent Information
- Application Number
- CN202510242434.0
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-03-03
- Publication Date
- 2025-03-28
- Estimated Expiration
- 2045-03-03
AI Technical Summary
When responding to user requests, existing large language models only infer one data unit at a time, resulting in slow inference speed. How to improve the inference speed of large language models is a technical problem that needs to be solved urgently.
By constructing multiple input data, each input data includes currently predicted data and indicates the location of the data unit to be predicted. The prediction model uses the prediction model to perform the target prediction task based on each input data, obtain multiple predicted data units, and add them to the currently predicted data, and repeat this process until the data prediction is completed.
The efficiency of data prediction is significantly improved, so that the prediction model outputs multiple prediction data units at different locations at a time. Compared with the prior art, the method of outputting only one prediction data unit at a time has higher efficiency.
Smart Images

Figure CN119721215A_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of artificial intelligence technology, and in particular to a data prediction method, a prediction large model training method, and related devices. Background Art
[0002] In recent years, large language models (LLMs) have demonstrated excellent performance in multiple application scenarios, such as natural language processing, machine translation, and text generation. Among them, large language models (large models) are used to reason about user requests in order to respond to user requests. In the prior art, when responding to user requests, large language models only infer one data unit at a time, resulting in a slow reasoning speed of large language models. Therefore, how to improve the reasoning speed of large language models is a technical problem that needs to be solved urgently. Summary of the invention
[0003] The main technical problem solved by the present application is to provide a data prediction method, a large prediction model training method and related devices, which can improve the prediction efficiency of data.
[0004] To solve the above technical problems, a technical solution adopted in the present application is: to provide a data prediction method, the method comprising: constructing n input data of this time, wherein each input data includes the current predicted data and indicates the position of a data unit to be predicted this time, the current predicted data includes the data unit predicted by the prediction large model when performing the target prediction task before this time, the position indicated by each input data is different, and n is greater than one; using the prediction large model to perform the target prediction task based on each input data respectively, to obtain n predicted data units; adding the n predicted data units to the current predicted data to obtain updated current predicted data, wherein the position of each predicted data unit in the current predicted data matches the position indicated by the corresponding input data sequence; repeating the above steps until the data prediction completion condition is met, and the prediction result of the target prediction task is obtained based on the latest current predicted data.
[0005] Among the n pieces of input data, the i-th piece of input data also includes i-1 placeholders, where i is an integer in a closed interval between 1 and n; and the position indicated by each piece of input data is after the last element in the input data.
[0006] Among them, the prediction big model is used to perform the target prediction task based on each input data to obtain n prediction data units, including: the prediction big model is used to perform the target prediction task based on each input data to obtain n output data corresponding to the n input data respectively, wherein each output data includes a prediction data unit corresponding to the position indicated by the input data.
[0007] Among the n output data, the jth output data includes the current predicted data, j-1 placeholders, and a predicted data unit, wherein j is an integer in a closed interval between 1 and n, and the predicted data unit is the last element of the output data.
[0008] The data prediction completion condition includes that the last data unit of the currently predicted data is a terminator or the length of the currently predicted data reaches an upper limit of the prediction length.
[0009] Among them, the current predicted data also includes a prompt word, and the prompt word is used to prompt the prediction large model to perform the target prediction task; and / or, the prediction result of the target prediction task is obtained based on the latest current predicted data, including: when the current predicted data does not contain the prompt word, the latest current predicted data is used as the prediction result of the target prediction task; when the current predicted data contains the prompt word, the latest current predicted data is used as the prediction result of the target prediction task, or, after deleting the prompt word in the latest current predicted data, it is used as the prediction result of the target prediction task.
[0010] The method further includes the following steps of training a large prediction model: obtaining original training data, wherein the original training data includes a plurality of sample data units; dividing the plurality of sample data units into blocks to obtain a plurality of data blocks, wherein the plurality of data blocks include at least one standard data block, and the standard data block includes n sample data units; selecting at least one target data block from the plurality of data blocks, wherein at least one target data block includes a standard data block; for each target data block, constructing m-1 new training data of the target data block, wherein m is the number of sample data units in the target data block, the new training data is obtained by replacing the target data block in the original training data with a replacement data block, and the replacement data blocks in the m-1 new training data are respectively composed of 1 to m-1 placeholders; and training the large prediction model using the original training data and the new training data of each target data block.
[0011] Among them, the original training data and the new training data include sample prompt words, and the sample prompt words are used to prompt the prediction large model to perform sample prediction tasks based on the original training data or the new training data; and / or, all data blocks except the last data block in a number of data blocks are standard data blocks, and the last data block is a standard data block or the number of sample data units is less than n; and / or, at least one target data block is selected from a number of data blocks, including: all data blocks are used as target data blocks.
[0012] To solve the above technical problems, another technical solution adopted by the present application is: to provide a prediction large model training method, the method comprising: obtaining original training data, wherein the original training data includes multiple sample data units; dividing the multiple sample data units into blocks to obtain several data blocks, wherein the several data blocks include at least one standard data block, and the standard data block includes n sample data units; selecting at least one target data block from the several data blocks, wherein at least one target data block includes a standard data block; for each target data block, constructing m-1 new training data of the target data block, wherein m is the number of sample data units in the target data block, the new training data is to replace the target data block in the original training data with a replacement data block, and the replacement data blocks in the m-1 new training data are respectively composed of 1 to m-1 placeholders; using the original training data and the new training data of each target data block to train the prediction large model.
[0013] In order to solve the above technical problems, another technical solution adopted by the present application is: to provide a data prediction device, including: a construction module, a task execution module, a data update module and a prediction module. The construction module is used to construct the n input data of this time, wherein each input data includes the current predicted data and indicates the position of a data unit to be predicted this time, and the current predicted data includes the data unit predicted by the prediction large model when performing the target prediction task before this time, and the position indicated by each input data is different, and n is greater than one; the task execution module is used to use the prediction large model to perform the target prediction task based on each input data respectively, and obtain n predicted data units; the data update module is used to add n predicted data units to the current predicted data to obtain the updated current predicted data, wherein the position of each predicted data unit in the current predicted data matches the position indicated by the corresponding input data sequence; the prediction module is used to repeat the above steps until the data prediction completion condition is met, and the prediction result of the target prediction task is obtained based on the latest current predicted data.
[0014] To solve the above technical problems, another technical solution adopted by the present application is: to provide a prediction large model training device, including: an acquisition module, a data segmentation module, a data selection module, a data construction module and a training module; the acquisition module is used to acquire original training data, wherein the original training data includes multiple sample data units; the data segmentation module is used to segment multiple sample data units into blocks to obtain a number of data blocks, wherein the multiple data blocks include at least one standard data block, and the standard data block includes n sample data units; the data selection module is used to select at least one target data block from the multiple data blocks, wherein at least one target data block includes a standard data block; the data construction module is used to construct m-1 new training data of the target data block for each target data block, wherein m is the number of sample data units in the target data block, the new training data is to replace the target data block in the original training data with a replacement data block, and the replacement data blocks in the m-1 new training data are respectively composed of 1 to m-1 placeholders; the training module is used to train the prediction large model using the original training data and the new training data of each target data block.
[0015] To solve the above technical problems, another technical solution adopted in the present application is: to provide an electronic device, comprising a memory and a processor coupled to each other, the memory storing program instructions; the processor is used to execute the program instructions stored in the memory to implement the above method.
[0016] In order to solve the above technical problem, another technical solution adopted by the present application is: providing a computer-readable storage medium for storing program instructions, which can be executed to implement the above method.
[0017] In the above scheme, the number of input data for each prediction model is n, and each input data includes an indication of the position of a data unit to be predicted this time, and the position indicated by each input data is different. Therefore, when the prediction model is used to perform the target prediction task based on each input data, n prediction data units at different positions can be predicted based on each input data. Compared with the existing method of outputting only one prediction data unit each time by the prediction model, the above-mentioned method of constructing n input data this time so that the prediction model outputs n prediction data units at different positions each time can significantly improve the efficiency of data prediction. BRIEF DESCRIPTION OF THE DRAWINGS
[0018] Figure 1 It is a flow chart of an embodiment of a data prediction method provided by the present application; Figure 2 It is a flowchart of an embodiment of a large prediction model training method provided by the present application; Figure 3It is a schematic diagram of the framework of an embodiment of a data prediction device provided by the present application; Figure 4 It is a schematic diagram of the framework of an embodiment of a large prediction model training device provided by the present application; Figure 5 It is a schematic diagram of a framework of an embodiment of an electronic device provided by the present application; Figure 6 It is a schematic diagram of the framework of the computer-readable storage medium provided by this application. DETAILED DESCRIPTION
[0019] In order to make the purpose, technical solution and effect of the present application clearer and more specific, the present application is further described in detail below with reference to the accompanying drawings and examples.
[0020] In addition, if there are descriptions involving "first", "second", etc. in the embodiments of the present application, the descriptions of "first", "second", etc. are only used for descriptive purposes and cannot be understood as indicating or suggesting their relative importance or implicitly indicating the number of technical features indicated. Therefore, the features defined as "first" and "second" may explicitly or implicitly include at least one of the features. In addition, the technical solutions between the various embodiments can be combined with each other, but they must be based on the ability of ordinary technicians in the field to implement them. When the combination of technical solutions is contradictory or cannot be implemented, it should be deemed that such combination of technical solutions does not exist and is not within the scope of protection required by this application.
[0021] It should be noted that the prediction model is generally inferred in an autoregressive manner. The so-called autoregressive method means that at any time step , given an input sequence P, , , ... When (where P represents the prompt word), the model needs to predict Thus, when the prediction model needs to predict a sequence of length n, a total of n+1 time steps are required, and the last extra time step is used to predict the end of the sequence, i.e. EOS.
[0022] Among them, in this method, when the prediction model predicts at each time step (each time), only one data unit will be predicted, resulting in low prediction efficiency of the prediction model. In order to improve the data prediction efficiency of the prediction model, the present application creatively proposes to construct multiple input data for the prediction model at each time step (each time), and each input data includes the current predicted data and indicates the position of a data unit to be predicted this time, so that the prediction model can predict the same number of data units as the number of input data at each time step, so as to improve the data prediction efficiency of the prediction model.
[0023] Specifically, see Figure 1 , Figure 1 is a flow chart of an embodiment of the data prediction method provided by the present application. It should be noted that if there are substantially the same results, this embodiment does not Figure 1 The process sequence shown is limited. Figure 1 As shown, this embodiment includes: S11: Construct n pieces of input data for this time, wherein each piece of input data includes the currently predicted data and indicates the position of a data unit to be predicted this time, and the currently predicted data includes the data units predicted by the large prediction model when performing the target prediction task before this time, and each piece of input data indicates a different position, and n is greater than one.
[0024] It should be noted that when the prediction large model of this embodiment performs the target prediction task, it is generally carried out in an autoregressive manner, that is, after predicting n prediction data units based on the n input data constructed this time, the n prediction data units are added to the current predicted data to obtain the updated current predicted data, and steps S11-S14 are repeated until the data prediction completion conditions are met.
[0025] Specifically, the updated current predicted data can be used to construct the next n input data, and the prediction large model can be used to perform the target prediction task based on each newly constructed input data to obtain n prediction data units, which are added to the current predicted data to obtain the updated current predicted data until the data prediction completion conditions are met, and the prediction result of the target prediction task is obtained based on the latest current predicted data.
[0026] The data prediction completion condition includes that the last data unit of the currently predicted data is an end symbol or the length of the currently predicted data reaches the upper limit of the prediction length. The end symbol can be any symbol that indicates the end of the prediction, for example <eos>, the specific upper limit of the predicted length can be pre-set according to actual needs.
[0027] In some embodiments, among the n pieces of input data constructed, the i-th piece of input data also includes i-1 placeholders, that is, the number of placeholders included in each piece of input data is different, wherein i is an integer in a closed interval between 1 and n; the position indicated by each piece of input data is after the last element in the input data. That is, the position of a data unit to be predicted in this embodiment is after the last element in the input data.
[0028] For example, the first n input data are as follows: ="Please help me write a poem:" Please help me write a poem: <m>” Please help me write a poem: <m> <m>” Please help me write a poem: <m> <m> <m>” Please help me write a poem: <m> <m> <m> <m>” Please help me write a poem: <m> <m> <m> <m> <m>” Among them, "Please help me write a poem" is a prompt word, which is used to prompt the prediction model to predict a poem; <m>Indicates a placeholder, the first input data in the example = "Please help me write a poem:" does not contain placeholders, the second input data Please help me write a poem: <m>" includes a placeholder <m>, the third input data Please help me write a poem: <m> <m> <m>" includes 3 placeholders <m>, and the position indicated by each input data is after the last element in the corresponding input data, where each placeholder in each input data <m>is an element in the input data.
[0029] It should be noted that the placeholder is used to tell the prediction model that there is a data unit at the position occupied by the placeholder, and to tell the prediction model the position of the data unit to be predicted. In one embodiment, the position of the data unit predicted by the prediction model is located after the last placeholder in the input data.
[0030] Of course, in other embodiments, among the n input data constructed, the i-th input data may include i placeholders, where i is an integer in a closed interval between 1 and n; the position indicated by each input data is the last element in the corresponding input data, that is, the position indicated by each input data is the position of the last placeholder in the corresponding input data.
[0031] S12: Utilize the large prediction model to perform target prediction tasks based on each piece of input data, and obtain n prediction data units.
[0032] In this embodiment, the target prediction task may be, but is not limited to, natural language processing, machine translation, or text generation, etc., and may also be image generation, etc. The specific data unit is related to the target prediction task. For example, if the target prediction task is related to text generation, the data unit may be a character (such as a word, a phrase, or a symbol) in the text. If the target prediction task is related to image generation, the data unit may be a pixel in the image, or a frame of image. The specific data unit may be predefined according to actual needs.
[0033] For the sake of ease of description, the following text will be used as an example to explain the present application scheme, and the scope of protection of the present application shall not be limited thereby.
[0034] In one implementation scenario, the prediction large model has the ability to handle multiple tasks. In order to make the model aware of the target prediction task to be performed, when constructing the n input data of the prediction large model for the first time or each time, each constructed input data can include a prompt word, so as to use the prompt word to prompt the prediction large model to perform the target prediction task.
[0035] In one embodiment, the currently predicted data in each piece of input data includes a prompt word for prompting the large prediction model to perform a target prediction task.
[0036] In some embodiments, step S12 uses the prediction big model to perform the target prediction task based on each input data respectively to obtain n prediction data units, including: using the prediction big model to perform the target prediction task based on each input data respectively to obtain n output data corresponding to the n input data respectively, wherein each output data includes a prediction data unit corresponding to the position indicated by the input data.
[0037] In summary, in this embodiment, the number of constructed input data is the same as the number of output data of the prediction model, and each output data includes a prediction data unit corresponding to the position indicated by the input data.
[0038] In some embodiments, among the n output data output by the prediction large model, the jth output data includes the current predicted data, j-1 placeholders, and a prediction data unit, where j is an integer in the closed interval between 1 and n, and the prediction data unit is the last element of the output data.
[0039] For example, the n output data output by the prediction model are as follows: = "Please help me write a poem: Bai" Please help me write a poem: <m>day" Please help me write a poem: <m> <m>according to" Please help me write a poem: <m> <m> <m>Mountain" Please help me write a poem: <m> <m> <m> <m>" Please help me write a poem: <m> <m> <m> <m> <m>," Please help me write a poem as the prompt word. The currently predicted data includes the prompt word. For the first output data = "Please help me write a poem: White", the predicted data unit is "White", for the second output data Please help me write a poem: <m>Day", the forecast data unit is "day", placeholder <m>The number is 1, for the fifth output data Please help me write a poem: <m> <m> <m> <m>"end", the predicted data unit is "end", placeholder <m>The number of is 4.
[0040] S13: adding n prediction data units to the current predicted data to obtain updated current predicted data, wherein the position of each prediction data unit in the current predicted data matches the position indicated by the corresponding input data sequence.
[0041] Exemplarily, the n predicted data units output by the prediction model are "white", "sun", "depend on", "mountain", "end" and "," in the following example, and "white sun depends on the mountain and ends," is added to the current predicted data to obtain the updated current predicted data "Please help me write a poem: The white sun depends on the mountain and ends,".
[0042] = "Please help me write a poem: Bai" Please help me write a poem: <m>day" Please help me write a poem: <m> <m>according to" Please help me write a poem: <m> <m> <m>Mountain" Please help me write a poem: <m> <m> <m> <m>" Please help me write a poem: <m> <m> <m> <m> <m>," Furthermore, using the currently predicted data "Please help me write a poem: The sun sets over the mountains," construct new n input data as follows: = "Please help me write a poem: The sun sets over the mountains," Please help me write a poem: The sun sets over the mountains, <m>” Please help me write a poem: The sun sets over the mountains, <m> <m>” Please help me write a poem: The sun sets over the mountains, <m> <m> <m>” Please help me write a poem: The sun sets over the mountains, <m> <m> <m> <m>” Please help me write a poem: The sun sets over the mountains, <m> <m> <m> <m> <m>” S14: Repeat the above steps until the data prediction completion condition is met, and the prediction result of the target prediction task is obtained based on the latest currently predicted data.
[0043] In some embodiments, step S14 obtains the prediction result of the target prediction task based on the latest currently predicted data, including the following two cases: Case 1: When the current predicted data does not contain the prompt word, the latest current predicted data is used as the prediction result of the target prediction task.
[0044] Case 2: When the current predicted data contains the prompt word, the latest current predicted data is used as the prediction result of the target prediction task, or the prompt word in the latest current predicted data is deleted and used as the prediction result of the target prediction task.
[0045] In summary, the second situation is that it is hoped that the prediction result of the final target prediction task can contain the prompt word or not.
[0046] Among them, in step S12, the prediction large model is used to perform the target prediction task based on each of the input data respectively. Before obtaining n prediction data units, the prediction large model needs to be trained.
[0047] Specifically, see Figure 2 , Figure 2 This is a flow chart of an embodiment of the prediction large model training method provided by this application. Figure 2 As shown, the prediction large model training method includes: S21: Acquire original training data, wherein the original training data includes a plurality of sample data units.
[0048] The sample data unit in this embodiment can be understood as a token, such as a character, a pixel or a frame of image. The specific sample data unit can be defined in advance.
[0049] For example, the original training data is: X=P, , , ... , where P represents the sample prompt word, , , ... represents the expected output sequence of length n, , , ... Each of is a sample data unit.
[0050] S22: Divide the multiple sample data units into blocks to obtain a number of data blocks, wherein the number of data blocks includes at least one standard data block, and the standard data block includes n sample data units.
[0051] In this embodiment, the plurality of data blocks include at least one standard data block, and the standard data block includes n sample data units.
[0052] In one embodiment, all data blocks except the last data block in the plurality of data blocks are standard data blocks, and the last data block is a standard data block or the number of sample data units is less than n. In summary, in this embodiment, the plurality of data blocks are obtained by evenly dividing a plurality of sample data units, for example, dividing the number of sample data units in the expected output sequence by n to obtain each divided data block; wherein the number of sample data units in the last data block is less than or equal to n, and if the number of sample data units in the last data block is n, then the last data block is also a standard data block.
[0053] For example, the original training data is P="Please help me write a poem:", ="The moonlight shines brightly in front of my bed, I wonder if it is frost on the ground. I look up at the moon and think of my hometown. <eos>The expected output sequence includes 24 sample data units in total, and the expected number of sample data units included in the standard data block is 6. Then, the data blocks obtained by evenly dividing the multiple sample data units are: data block 1 = "moonlight in front of the bed", data block 2 = "I wonder if it is frost on the ground", data block 3 = "Look up at the moon", data block 4 = "Look down and think of my hometown <eos>”.
[0054] In this example, each line of poetry is followed by a comma or <eos>, which is exactly 6 characters, that is, each data block obtained by segmentation is a standard data block.
[0055] In one embodiment, the number of sample data units included in the expected standard data block can be preset as a fixed value or a range, and then a suitable value can be selected from the range using a relevant algorithm. For example, a hyperparameter search method can be used to search for the best value from the set range.
[0056] It should be noted that the above method of evenly dividing a plurality of sample data units into a plurality of data blocks can make the number of sample data units contained in each data block except the last data block the same, which is conducive to efficient use of computing resources.
[0057] Of course, in other embodiments, when the utilization efficiency of computing resources is within an allowable range, the above-mentioned average block division method may not be used to obtain each data block. For example, random block division may be used for block processing.
[0058] S23: Select at least one target data block from a plurality of data blocks, wherein the at least one target data block includes a standard data block.
[0059] The purpose of selecting the target data block is to use the selected target data block to construct new training data to expand the amount of training data. Therefore, in order to obtain more new training data in the future, all data blocks can be used as target data blocks.
[0060] Since the prediction large model is generally obtained by fine-tuning the existing model, and the prediction large model has the ability to handle multiple tasks, in order to enable the prediction large model to be trained to clearly identify the tasks to be performed, the original training data and the newly added training data can be set to include sample prompt words to prompt the prediction large model to perform sample prediction tasks based on the original training data or the new training data.
[0061] S24: For each target data block, construct m-1 new training data of the target data block, wherein m is the number of sample data units in the target data block, and the new training data is to replace the target data block in the original training data with a replacement data block, and the replacement data blocks in the m-1 new training data are respectively composed of 1 to m-1 placeholders.
[0062] For example, using the above data block 1 = "Bright moonlight in front of the bed," as the target data block, m-1 new training data of the target data block are constructed as follows: Please help me write a poem: <m>The bright moonlight in front of me, I thought it was frost on the ground. I looked up at the bright moon and lowered my head to think of my hometown. <eos>” Please help me write a poem: <m> <m>The moonlight is so bright that I wonder if it is frost on the ground. I look up at the moon and think of my hometown. <eos>” Please help me write a poem: <m> <m> <m>The moonlight looks like frost on the ground. I look up at the bright moon and think of my hometown. <eos>” Please help me write a poem: <m> <m> <m> <m>The light is like frost on the ground. I look up at the bright moon and think of my hometown. <eos>” Please help me write a poem: <m> <m> <m> <m> <m>, I thought it was frost on the ground, I looked up at the bright moon, and lowered my head to think of my hometown <eos>” Wherein, m represents the number of sample data units in the target data block "Bedside Moonlight," specifically 6, and the number of new training data constructed based on the target data block is 5, wherein each new training data is the original training data "P="Please help me write a poem:", =”The moonlight shines brightly in front of my bed, I wonder if it is frost on the ground. I look up at the moon and think of my hometown. <eos>" is replaced by a replacement data block. Specifically, it is replaced by " <m>The moonlight in front of me, <m> <m>Bright Moonlight, <m> <m> <m>moonlight,"," <m> <m> <m> <m>Light "Peace" <m> <m> <m> <m> <m>,”.
[0063] The above method of using any of data blocks 2-4 as the target data block to construct the corresponding new training data is the same as that of data block 1. Taking data block 4 as an example, the constructed new training data is as follows: Please help me write a poem: The moonlight shines brightly in front of my bed, I wonder if it is frost on the ground, I look up at the moon, <m>Tousi Hometown <eos>” Please help me write a poem: The moonlight shines brightly in front of my bed, I wonder if it is frost on the ground, I look up at the moon, <m> <m>Homesickness <eos>” Please help me write a poem: The moonlight shines brightly in front of my bed, I wonder if it is frost on the ground, I look up at the moon, <m> <m> <m>home <eos>” Please help me write a poem: The moonlight shines brightly in front of my bed, I wonder if it is frost on the ground, I look up at the moon, <m> <m> <m> <m>Township <eos>” Please help me write a poem: The moonlight shines brightly in front of my bed, I wonder if it is frost on the ground, I look up at the moon, <m> <m> <m> <m> <m> <eos>” S25: Train the prediction model using the original training data and the new training data of each target data block.
[0064] After the new training data of each target data block is obtained in the above construction, for each original training data, the original training data and the new training data constructed based on each target data block in the original training data are used as a training sample data to train the prediction model. In the actual training process, it is necessary to construct multiple training sample data so as to train the prediction model until convergence.
[0065] Among them, each training sample data contains several training data, and the corresponding prediction model will also output the same number of prediction data as the training data (predicting what the data unit after the last element in the input data is). The differences between the prediction data and the sample annotations of each training data in the training sample data can be integrated to obtain the comprehensive difference, and then the comprehensive difference can be used to adjust the network parameters of the prediction model.
[0066] It should be noted that the prediction large model training method provided by the present application will construct corresponding multiple (m-1) new training data based on each data block in each original training data, and the replacement data block in each new training data is composed of 1 to m-1 placeholders, that is, the number of placeholders in each new training data constructed based on each data block is different, and the corresponding positions of sample data units that need to be predicted by the prediction large model based on each training data are also different. It can be understood that for each target data block, the prediction large model is trained using the new training data constructed based on the target data block, and the prediction large model can be trained to obtain the ability to predict data units at different positions in the target data block in parallel.
[0067] In the above scheme, the number of input data for each prediction model is n, and each input data includes an indication of the position of a data unit to be predicted this time, and the position indicated by each input data is different. Therefore, when the prediction model is used to perform the target prediction task based on each input data, n prediction data units at different positions can be predicted based on each input data. Compared with the existing method of outputting only one prediction data unit each time by the prediction model, the above-mentioned method of constructing n input data this time so that the prediction model outputs n prediction data units at different positions each time can significantly improve the efficiency of data prediction.
[0068] See also Figure 3 , Figure 3 It is a schematic diagram of a framework of an embodiment of a data prediction device provided by the present application. In this embodiment, the data prediction device 30 includes a construction module 31, a task execution module 32, a data update module 33 and a prediction module 34. The construction module 31 is used to construct n input data of this time, wherein each input data includes the current predicted data and indicates the position of a data unit to be predicted this time respectively. The current predicted data includes the data unit predicted by the prediction large model when performing the target prediction task before this time. The position indicated by each input data is different, and n is greater than one; the task execution module 32 is used to use the prediction large model to perform the target prediction task based on each input data respectively, and obtain n predicted data units; the data update module 33 is used to add n predicted data units to the current predicted data to obtain the updated current predicted data, wherein the position of each predicted data unit in the current predicted data matches the position indicated by the corresponding input data sequence; the prediction module 34 is used to repeat the above steps until the data prediction completion condition is met, and the prediction result of the target prediction task is obtained based on the latest current predicted data.
[0069] In some embodiments, among the n input data constructed by the construction module 31, the i-th input data also includes i-1 placeholders, where i is an integer in the closed interval between 1 and n; the position indicated by each input data is after the last element in the input data.
[0070] In some embodiments, the task execution module 32 uses the prediction big model to execute the target prediction task based on each input data respectively, and obtains n prediction data units, including: using the prediction big model to execute the target prediction task based on each input data respectively, and obtains n output data corresponding to the n input data respectively, wherein each output data includes a prediction data unit corresponding to the position indicated by the input data.
[0071] In some embodiments, among n output data, the jth output data includes current predicted data, j-1 placeholders, and a predicted data unit, where j is an integer in the closed range of 1 and n, and the predicted data unit is the last element of the output data.
[0072] In some embodiments, the data prediction completion condition includes that the last data unit of the currently predicted data is a terminator or the length of the currently predicted data reaches an upper limit of the prediction length.
[0073] In some embodiments, the current predicted data also includes a prompt word, which is used to prompt the prediction large model to perform the target prediction task; and / or, the prediction module 34 obtains the prediction result of the target prediction task based on the latest current predicted data, including: when the current predicted data does not include the prompt word, the latest current predicted data is used as the prediction result of the target prediction task; when the current predicted data includes the prompt word, the latest current predicted data is used as the prediction result of the target prediction task, or, after deleting the prompt word in the latest current predicted data, it is used as the prediction result of the target prediction task.
[0074] In some embodiments, the following prediction large model training steps are also included: obtaining original training data, wherein the original training data includes multiple sample data units; dividing the multiple sample data units into blocks to obtain several data blocks, wherein the several data blocks include at least one standard data block, and the standard data block includes n sample data units; selecting at least one target data block from the several data blocks, wherein at least one target data block includes a standard data block; for each target data block, constructing m-1 new training data of the target data block, wherein m is the number of sample data units in the target data block, and the new training data is to replace the target data block in the original training data with a replacement data block, and the replacement data blocks in the m-1 new training data are respectively composed of 1 to m-1 placeholders; using the original training data and the new training data of each target data block to train the prediction large model.
[0075] In some embodiments, the original training data and the new training data include sample prompt words, and the sample prompt words are used to prompt the prediction large model to perform a sample prediction task based on the original training data or the new training data; and / or, all data blocks except the last data block in a number of data blocks are standard data blocks, and the last data block is a standard data block or the number of sample data units is less than n; and / or, at least one target data block is selected from a number of data blocks, including: all data blocks are taken as target data blocks.
[0076] See also Figure 4 , Figure 4 4 is a schematic diagram of a framework of an embodiment of a prediction large model training device provided by the present application. In this embodiment, the prediction large model training device 40 includes an acquisition module 41, a data block module 42, a data selection module 43 and a training module 44. The acquisition module 41 is used to acquire original training data, wherein the original training data includes multiple sample data units; the data segmentation module 42 is used to segment the multiple sample data units into blocks to obtain a number of data blocks, wherein the several data blocks include at least one standard data block, and the standard data block includes n sample data units; the data selection module 43 is used to select at least one target data block from the several data blocks, wherein at least one target data block includes a standard data block; the data construction module is used to construct m-1 new training data of the target data block for each target data block, wherein m is the number of sample data units in the target data block, and the new training data is to replace the target data block in the original training data with a replacement data block, and the replacement data blocks in the m-1 new training data are respectively composed of 1 to m-1 placeholders; the training module 44 is used to train the prediction large model using the original training data and the new training data of each target data block.
[0077] See also Figure 5 , Figure 5 1 is a schematic diagram of a framework of an electronic device according to an embodiment of the present application. In this embodiment, the electronic device 50 includes a memory 51 and a processor 52 coupled to each other.
[0078] The memory 51 stores program instructions, and the processor 52 is used to execute the program instructions stored in the memory 51 to implement the steps of any of the above method implementations. In a specific implementation scenario, the electronic device 50 may include, but is not limited to: a microcomputer, a server, and in addition, the electronic device 50 may also include a mobile device such as a laptop computer and a tablet computer, which is not limited here.
[0079] Specifically, the processor 52 is used to control itself and the memory 51 to implement the steps of any of the above-mentioned embodiments. The processor 52 can also be called a CPU (Central Processing Unit). The processor 52 may be an integrated circuit chip with signal processing capabilities. The processor 52 can also be a general-purpose processor, a digital signal processor (Digital Signal Processor, DSP), an application-specific integrated circuit (Application Specific Integrated Circuit, ASIC), a field-programmable gate array (Field-Programmable Gate Array, FPGA) or other programmable logic devices, discrete gates or transistor logic devices, discrete hardware components. The general-purpose processor can be a microprocessor or the processor can also be any conventional processor, etc. In addition, the processor 52 can be implemented by an integrated circuit chip.
[0080] See also Figure 6 , Figure 6 It is a schematic diagram of the framework of the computer-readable storage medium provided by the present application. The computer-readable storage medium 60 of the embodiment of the present application stores a program instruction 61, and when the program instruction 61 is executed, the method provided by any embodiment of the above method and any non-conflicting combination is implemented. Among them, the program instruction 61 can form a program file and be stored in the above-mentioned computer-readable storage medium 60 in the form of a software product, so that a computer device (which can be a personal computer, a server, or a network device, etc.) executes all or part of the steps of the methods of each implementation method of the present application. The aforementioned computer-readable storage medium 60 includes: various media that can store program codes, such as a USB flash drive, a mobile hard disk, a read-only memory (ROM, Read-Only Memory), a random access memory (RAM, Random Access Memory), a disk or an optical disk, or a terminal device such as a computer, a server, a mobile phone, and a tablet.
[0081] In the above scheme, the number of input data for each prediction model is n, and each input data includes an indication of the position of a data unit to be predicted this time, and the position indicated by each input data is different. Therefore, when the prediction model is used to perform the target prediction task based on each input data, n prediction data units at different positions can be predicted based on each input data. Compared with the existing method of outputting only one prediction data unit each time by the prediction model, the above-mentioned method of constructing n input data this time so that the prediction model outputs n prediction data units at different positions each time can significantly improve the efficiency of data prediction.
[0082] In some embodiments, the functions or modules included in the device provided by the embodiments of the present disclosure can be used to execute the method described in the above method embodiments. The specific implementation can refer to the description of the above method embodiments, and for the sake of brevity, it will not be repeated here.
[0083] The above description of various embodiments tends to emphasize the differences between the various embodiments. The same or similar aspects can be referenced to each other, and for the sake of brevity, they will not be repeated herein.
[0084] In the several embodiments provided in the present application, it should be understood that the disclosed methods and devices can be implemented in other ways. For example, the device implementation described above is only schematic. For example, the division of modules or units is only a logical function division. There may be other division methods in actual implementation, such as multiple units or components can be combined or integrated into another system, or some features can be ignored or not executed. Another point is that the mutual coupling or direct coupling or communication connection shown or discussed can be through some interfaces, and the indirect coupling or communication connection of devices or units can be electrical, mechanical or other forms.
[0085] The units described as separate components may or may not be physically separated, and the components shown as units may or may not be physical units, that is, they may be located in one place or distributed on multiple network units. Some or all of the units may be selected according to actual needs to achieve the purpose of the present embodiment.
[0086] In addition, each functional unit in each embodiment of the present application may be integrated into one processing unit, or each unit may exist physically separately, or two or more units may be integrated into one unit. The above-mentioned integrated unit may be implemented in the form of hardware or in the form of software functional units.
[0087] If the integrated unit is implemented in the form of a software functional unit and sold or used as an independent product, it can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of the present application is essentially or the part that contributes to the prior art or all or part of the technical solution can be embodied in the form of a software product. The computer software product is stored in a storage medium, including several instructions to enable a computer device (which can be a personal computer, server, or network device, etc.) or a processor to execute all or part of the steps of each implementation method of the present application. The aforementioned storage medium includes: U disk, mobile hard disk, read-only memory (ROM, Read-Only Memory), random access memory (RAM, Random Access Memory), disk or optical disk and other media that can store program code.
[0088] The above description is only an implementation method of the present application, and does not limit the patent scope of the present application. Any equivalent structure or equivalent process transformation made using the contents of the present application specification and drawings, or directly or indirectly used in other related technical fields, are also included in the patent protection scope of the present application.< / eos> < / m> < / m> < / m> < / m> < / m> < / eos> < / m> < / m> < / m> < / m> < / eos> < / m> < / m> < / m> < / eos> < / m> < / m> < / eos> < / m> < / m> < / m> < / m> < / m> < / m> < / m> < / m> < / m> < / m> < / m> < / m> < / m> < / m> < / m> < / m> < / eos> < / eos> < / m> < / m> < / m> < / m> < / m> < / eos> < / m> < / m> < / m> < / m> < / eos> < / m> < / m> < / m> < / eos> < / m> < / m> < / eos> < / m> < / eos> < / eos> < / eos> < / m> < / m> < / m> < / m> < / m> < / m> < / m> < / m> < / m> < / m> < / m> < / m> < / m> < / m> < / m> < / m> < / m> < / m> < / m> < / m> < / m> < / m> < / m> < / m> < / m> < / m> < / m> < / m> < / m> < / m> < / m> < / m> < / m> < / m> < / m> < / m> < / m> < / m> < / m> < / m> < / m> < / m> < / m> < / m> < / m> < / m> < / m> < / m> < / m> < / m> < / m> < / m> < / m> < / m> < / m> < / m> < / m> < / m> < / m> < / m> < / m> < / m> < / m> < / m> < / m> < / m> < / m> < / m> < / m> < / m> < / m> < / m> < / m> < / m> < / m> < / eos>
Claims
1. A data prediction method, characterized in that: include: Constructing n pieces of input data for this time, wherein each piece of input data includes currently predicted data and indicates the position of a data unit to be predicted this time, the currently predicted data includes data units predicted by the prediction big model when performing the target prediction task before this time, the position indicated by each piece of input data is different, and n is greater than one; Utilizing the large prediction model to perform the target prediction task based on each piece of the input data, respectively, to obtain n prediction data units; Adding the n predicted data units to the current predicted data to obtain updated current predicted data, wherein the position of each predicted data unit in the current predicted data matches the position indicated by the corresponding input data sequence; Repeat the above steps until the data prediction completion condition is met, and obtain the prediction result of the target prediction task based on the latest currently predicted data.
2. The method according to claim 1, characterized in that Among the n pieces of input data, the i-th piece of input data further includes i-1 placeholders, where i is an integer in a closed interval between 1 and n; and the position indicated by each piece of input data is after the last element in the input data.
3. The method according to claim 1, characterized in that The method of using the large prediction model to perform the target prediction task based on each piece of the input data to obtain n prediction data units includes: The target prediction task is performed based on each of the input data using the prediction large model to obtain n output data corresponding to the n input data respectively, wherein each of the output data includes a prediction data unit corresponding to the position indicated by the input data.
4. The method according to claim 3, characterized in that: Among the n output data, the j-th output data includes the current predicted data, j-1 placeholders, and a predicted data unit, wherein j is an integer in a closed interval between 1 and n, and the predicted data unit is the last element of the output data.
5. The method according to claim 1, characterized in that The data prediction completion condition includes that the last data unit of the currently predicted data is a terminator or the length of the currently predicted data reaches an upper limit of the prediction length.
6. The method according to claim 1, characterized in that The currently predicted data also includes a prompt word, and the prompt word is used to prompt the prediction large model to perform the target prediction task; And / or, obtaining the prediction result of the target prediction task based on the latest currently predicted data includes: In the case that the currently predicted data does not contain the prompt word, taking the latest currently predicted data as the prediction result of the target prediction task; In the case that the current predicted data includes a prompt word, the latest current predicted data is used as the prediction result of the target prediction task, or after deleting the prompt word in the latest current predicted data, it is used as the prediction result of the target prediction task.
7. The method according to claim 1, characterized in that The method also includes the following steps of training the prediction model: Acquire original training data, wherein the original training data includes a plurality of sample data units; Divide the plurality of sample data units into blocks to obtain a plurality of data blocks, wherein the plurality of data blocks include at least one standard data block, and the standard data block includes n of the sample data units; Selecting at least one target data block from the plurality of data blocks, wherein the at least one target data block includes the standard data block; For each of the target data blocks, construct m-1 new training data of the target data block, wherein m is the number of the sample data units in the target data block, the new training data is obtained by replacing the target data block in the original training data with a replacement data block, and the replacement data blocks in the m-1 new training data are respectively composed of 1 to m-1 placeholders; The prediction large model is trained using the original training data and the new training data of each target data block.
8. The method according to claim 7, characterized in that The original training data and the new training data include sample prompt words, and the sample prompt words are used to prompt the prediction model to perform a sample prediction task based on the original training data or the new training data; And / or, all data blocks except the last data block among the plurality of data blocks are standard data blocks, the last data block is the standard data block or the number of the sample data units is less than n; And / or, selecting at least one target data block from the plurality of data blocks comprises: All the data blocks are taken as the target data blocks.
9. A method for training a large prediction model, characterized in that: include: Acquire original training data, wherein the original training data includes a plurality of sample data units; Divide the plurality of sample data units into blocks to obtain a plurality of data blocks, wherein the plurality of data blocks include at least one standard data block, and the standard data block includes n of the sample data units; Selecting at least one target data block from the plurality of data blocks, wherein the at least one target data block includes the standard data block; For each of the target data blocks, construct m-1 new training data of the target data block, wherein m is the number of the sample data units in the target data block, the new training data is obtained by replacing the target data block in the original training data with a replacement data block, and the replacement data blocks in the m-1 new training data are respectively composed of 1 to m-1 placeholders; The prediction large model is trained using the original training data and the new training data of each target data block.
10. A data prediction device, characterized in that: include: A construction module, used to construct n pieces of input data this time, wherein each piece of the input data includes currently predicted data and indicates the position of a data unit to be predicted this time, the currently predicted data includes a data unit predicted by the prediction big model when performing the target prediction task before this time, the position indicated by each piece of the input data is different, and n is greater than one; A task execution module, used for executing the target prediction task based on each piece of input data using the prediction large model to obtain n prediction data units; a data updating module, configured to add the n predicted data units to the current predicted data to obtain updated current predicted data, wherein the position of each predicted data unit in the current predicted data matches the position indicated by the corresponding input data sequence; The prediction module is used to repeat the above steps until the data prediction completion condition is met, and obtain the prediction result of the target prediction task based on the latest currently predicted data.
11. A prediction large model training device, characterized in that: include: An acquisition module, used to acquire original training data, wherein the original training data includes a plurality of sample data units; A data block module, configured to block the plurality of sample data units to obtain a plurality of data blocks, wherein the plurality of data blocks include at least one standard data block, and the standard data block includes n of the sample data units; A data selection module, used to select at least one target data block from the plurality of data blocks, wherein the at least one target data block includes the standard data block; A data construction module, configured to construct, for each of the target data blocks, m-1 new training data of the target data block, wherein m is the number of the sample data units in the target data block, the new training data is obtained by replacing the target data block in the original training data with a replacement data block, and the replacement data blocks in the m-1 new training data are respectively composed of 1 to m-1 placeholders; A training module is used to train the prediction large model using the original training data and the new training data of each target data block.
12. An electronic device, characterized in that: comprising a memory and a processor coupled to each other, The memory stores program instructions; The processor is used to execute program instructions stored in the memory to implement the method according to any one of claims 1 to 9.
13. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores program instructions that can be run by a processor, and the program instructions can be executed by the processor to implement the method according to any one of claims 1 to 9.
Citation Information
Patent Citations
Language model training and natural language task processing method and device and related equipment
CN115186675A
Text recognition method and device, text recognition model training method and device and storage medium
CN115909376A
Model training method, device and equipment and storage medium
CN117216536A
Model training method and device, model application method and device, equipment and storage medium
CN117574979A
Data processing method and device
CN118364915A