Generative pre-training language model text generation method based on auxiliary model
Patent Information
- Application Number
- CN202410862577.7
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-06-28
- Publication Date
- 2025-12-30
AI Technical Summary
[0005]本申请实施例提供了一种基于辅助模型的生成式预训练语言模型文本生成方法和装置、存储介质及电子装置,以至少解决相关技术中生成答复文本的时延较大等问题
[0046]In the process of converting a text segment by using a plurality of first text segments in the embodiment of the present application, text unit information of a target text slot to be converted is obtained, wherein the text unit information is used to indicate the distribution of text units on the target text slot of the plurality of first text segments, the plurality of first text segments are generated by a plurality of auxiliary models using a language model in a plurality of rounds of self-decoding from a second text segment that has been output by the language model, the second text segment is used to reply to a target question received by the language model, and the plurality of auxiliary models are used to perform a plurality of rounds of self-decoding on input data from different decoding dimensions; the first text unit on the target text slot is converted for the language model according to the text unit information; the target matching degree of the first text unit and the target question is detected; in the case that the target matching degree does not satisfy a preset matching degree condition, a third text segment is sent to the language model for verification, and a fourth text segment that passes the verification is obtained, wherein the third text segment includes text units on other text slots before the target text slot that have been converted for the language model; and the fourth text segment is output as the reply text of the target question, that is, a plurality of auxiliary models are configured for the language model, the plurality of auxiliary models are used to perform a plurality of rounds of self-decoding on input data from a plurality of different decoding dimensions, and a plurality of first text segments generated by the plurality of auxiliary models using a second text segment that has been output by the language model are used to convert a text segment to be verified by the language model, and then in the process of converting a text segment by using a plurality of first text segments, the conversion is sequentially performed according to the order of text slots in the first text segment, and the text unit on the target text slot to be converted is converted according to the text information of the plurality of first text segments on the target text slot, thereby improving the accuracy of the text unit on the converted text slot, and in the case that the matching degree of the first text unit on the converted target text slot and the target question does not satisfy the preset matching condition, the conversion operation on the text units of the text slots after the target text slot is ended, and the third text segment obtained by conversion is verified by the language model, thereby realizing the determination of the length of the third text segment converted by the plurality of first text segments according to the accuracy of the converted text, reducing the pressure of the language model on the verification of the third text while ensuring the accuracy of the output third text. The above technical solution solves the problem of large delay in generating reply text in related technologies, and achieves the technical effect of reducing the delay in generating reply text.
Smart Images

Figure CN121234914A_ABST
Abstract
Description
TECHNICAL FIELD
[0001] The present application relates to the technical field of smart home, in particular, to a generative pre-training language model text generation method and device based on an auxiliary model, a storage medium and an electronic device. BACKGROUND
[0002] With the continuous iteration and upgrading of large language models (LLM), large models have achieved remarkable results in natural language processing, image recognition and other fields. However, large models still face problems such as long time consumption, high memory bandwidth occupation, and communication bottlenecks in the process of inference code, which severely restrict their performance in real-time applications and high-concurrency scenarios. Therefore, research on large model inference code optimization and acceleration technology has important practical significance and application value.
[0003] To alleviate high latency and improve the utilization of computing resources, some research has proposed an autoregressive decoding method based on speculative sampling. This method uses two models, one is the original model itself, and the other is an auxiliary model with a much smaller number of parameters than the original model. The core idea of this method is to first let the auxiliary model do multiple rounds of inference decoding according to a fixed decoding round, and then let the large model verify the results generated by the auxiliary model. If the verification is wrong, the auxiliary model will re-infer and verify. Since the time for the auxiliary model to generate tokens is negligible compared to the large model, the worst-case scenario is that all tokens generated by the auxiliary model fail, and the large model will generate each token again. This is close to the time consumption of the large model inference only. Since the output of the auxiliary model is a probabilistic event when decoding, the model will output a text segment with inaccurate results with a high probability. At this time, the auxiliary model can only repeat the autoregressive operation and cannot effectively reduce the latency of the generated text segment.
[0004] The related art has not yet proposed an effective solution to the problem of large latency in generating reply text. SUMMARY
[0005] The embodiments of the present application provide a generative pre-training language model text generation method and device based on an auxiliary model, a storage medium and an electronic device to at least solve the problem of large latency in generating reply text in the related art.
[0006] According to an embodiment of the present application, a generative pre-training language model text generation method based on an auxiliary model is provided, comprising:
[0007] In the process of converting the text segments by using the plurality of first text segments for the language model, text unit information of a target text slot to be converted is acquired, wherein the text unit information is used to indicate a text unit distribution of the target text slot in the plurality of first text segments, the plurality of first text segments are generated by using a plurality of auxiliary models of the language model to perform multi-round autoregressive decoding on a second text segment that has been output by the language model, the second text segment is used to reply to a target question received by the language model, and the plurality of auxiliary models are used to perform multi-round autoregressive decoding on input data from different decoding dimensions;
[0008] A first text unit on the target text slot is converted for the language model according to the text unit information;
[0009] A target matching degree between the first text unit and the target question is detected;
[0010] In a case where the target matching degree does not satisfy a preset matching degree condition, a third text segment is sent to the language model for verification, and a fourth text segment that passes the verification is obtained, wherein the third text segment includes text units on other text slots before the target text slot that have been converted for the language model;
[0011] The fourth text segment is output as a reply text of the target question.
[0012] As an optional implementation, the detection of the target matching degree between the first text unit and the target question includes:
[0013] A fifth text segment in which the target text slot is the first text unit is screened out from the plurality of first text segments;
[0014] A first text parameter output by a reference auxiliary model for outputting the fifth text segment in the plurality of auxiliary models is matched with a target parameter, wherein the first text parameter is used to indicate an association between the first text unit output by the reference auxiliary model for the target text slot and the target question;
[0015] In a case where the first text parameter is less than or equal to the target parameter, it is determined that the target matching degree between the first text and the target question is less than or equal to the target threshold.
[0016] As an optional implementation, the matching of the first text parameter output by the reference auxiliary model for outputting the fifth text segment in the plurality of auxiliary models with the target parameter includes:
[0017] In a case where the number of the fifth text segments is multiple, a second text parameter with a maximum value is selected from the first text parameters output by the multiple reference auxiliary models;
[0018] The second text parameter is matched with the target parameter.
[0019] As an optional implementation, before the first text parameter output by the reference auxiliary model used for outputting the fifth text segment among the multiple auxiliary models is matched with the target parameter, the method further includes:
[0020] Text units in each text slot of a sixth text segment output by the reference auxiliary model are matched with text units in corresponding text slots in the second text segment, to obtain a reference matching degree, wherein the reference matching degree is used to indicate a proportion of a candidate text slot included in the sixth text segment in the sixth text segment, the second text segment and the sixth text segment store the same text units in the candidate text slot, and the language model is used to perform self-recursive decoding on text units with an accuracy lower than a reference threshold in the sixth text segment to obtain the second text segment;
[0021] A target correction coefficient corresponding to the reference matching degree is determined from the matching degrees and the correction coefficients with the corresponding relationship;
[0022] The target correction coefficient is used to correct initial parameters configured for the auxiliary model, to obtain the target parameter.
[0023] As an optional implementation, the third text segment is sent to the language model for verification, to obtain a fourth text segment that passes the verification, including:
[0024] The language model is invoked to verify an accuracy of text units included in the third text segment, to obtain a second text unit in the third text segment, wherein the second text unit is a text unit with an accuracy lower than a reference threshold among the text units included in the third text segment;
[0025] The language model is invoked to perform self-recursive decoding on a third text unit in the third text segment, to obtain a fourth text segment, wherein the third text unit includes the second text unit and a text unit located after the second text unit in the third text segment.
[0026] As an optional implementation, the language model is invoked to verify the accuracy of the text units included in the third text segment, to obtain the second text unit in the third text segment, including:
[0027] construct a decoding input text corresponding to each text slot in the third text segment using a plurality of text units included in the second text segment and the third text segment;
[0028] perform autoregressive decoding on the decoding input text by calling the language model to obtain a plurality of fourth text units output by the language model for the corresponding text slot and a third text parameter corresponding to each fourth text unit, wherein the third text parameter is used to indicate an association between the corresponding fourth text unit and the target question;
[0029] determine the accuracy of the text unit of each text slot in the third text segment according to the fourth text unit and the third text parameter corresponding to the fourth text unit;
[0030] determine the second text unit as the text unit in the third text segment that first appears with an accuracy lower than a preset accuracy.
[0031] As an optional implementation, the determining the accuracy of the text unit of each text slot in the third text segment according to the fourth text unit and the third text parameter corresponding to the fourth text unit comprises:
[0032] filter a fourth text parameter from a plurality of third text parameters output by the language model for the current text slot, wherein the fourth text parameter corresponds to the fourth text unit that is the same as the text unit recorded in the current text slot of the third text segment;
[0033] calculate a difference degree between the fourth text parameter and a fifth text parameter of a text unit output by a candidate auxiliary model for the current text slot, wherein the text unit output by the candidate auxiliary model for the current text slot in the first text segment is the same as the text unit in the current text slot in the third text segment;
[0034] in a case where the difference degree is greater than or equal to a target difference degree, determine that the accuracy of the text unit stored in the current text slot in the third text segment is lower than the reference threshold.
[0035] As an optional implementation, the converting the first text unit on the target text slot for the language model according to the text unit information comprises:
[0036] in a case where the text unit information is used to indicate that a plurality of fifth text units of different types are included on the target text slot of a plurality of first text segments, obtain a repetition rate of each type of fifth text unit on the target text slot of a plurality of first text segments;
[0037] determining the fifth text unit with the repetition rate greater than or equal to the target threshold as the first text unit.
[0038] According to another embodiment of the embodiment of the present application, a text generation device based on an auxiliary model of a generative pre-training language model is further provided, comprising:
[0039] An acquisition module is configured to acquire text unit information of a target text slot to be converted in a process of converting text segments by using a plurality of first text segments for a language model, wherein the text unit information is used to indicate a text unit distribution on the target text slot of the plurality of first text segments, the plurality of first text segments are generated by a plurality of auxiliary models of the language model in a plurality of rounds of self-recurrent decoding according to a second text segment that has been output by the language model, the second text segment is used to reply to a target question received by the language model, and the plurality of auxiliary models are used to perform a plurality of rounds of self-recurrent decoding on input data from different decoding dimensions.
[0040] A conversion module is configured to convert a first text unit on the target text slot for the language model according to the text unit information.
[0041] A detection module is configured to detect a target matching degree of the first text unit and the target question.
[0042] A sending module is configured to send a third text segment to the language model for verification in a case where the target matching degree does not satisfy a preset matching degree condition, to obtain a fourth text segment that passes the verification, wherein the third text segment includes text units that have been converted for the language model on other text slots before the target text slot.
[0043] An output module is configured to output the fourth text segment as a reply text of the target question.
[0044] According to still another aspect of the embodiment of the present application, a computer readable storage medium having a computer program stored therein is further provided, wherein the computer program is set to execute the above-mentioned text generation method based on an auxiliary model of a generative pre-training language model when running.
[0045] According to still another aspect of the embodiment of the present application, an electronic device is further provided, comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor executes the above-mentioned text generation method based on an auxiliary model of a generative pre-training language model through the computer program.
[0046] In the process of converting a text segment by using a plurality of first text segments in the embodiment of the present application, text unit information of a target text slot to be converted is obtained, wherein the text unit information is used to indicate the distribution of text units on the target text slot of the plurality of first text segments, the plurality of first text segments are generated by a plurality of auxiliary models using a language model in a plurality of rounds of self-decoding from a second text segment that has been output by the language model, the second text segment is used to reply to a target question received by the language model, and the plurality of auxiliary models are used to perform a plurality of rounds of self-decoding on input data from different decoding dimensions; the first text unit on the target text slot is converted for the language model according to the text unit information; the target matching degree of the first text unit and the target question is detected; in the case that the target matching degree does not satisfy a preset matching degree condition, a third text segment is sent to the language model for verification, and a fourth text segment that passes the verification is obtained, wherein the third text segment includes text units on other text slots before the target text slot that have been converted for the language model; and the fourth text segment is output as the reply text of the target question, that is, a plurality of auxiliary models are configured for the language model, the plurality of auxiliary models are used to perform a plurality of rounds of self-decoding on input data from a plurality of different decoding dimensions, and a plurality of first text segments generated by the plurality of auxiliary models using a second text segment that has been output by the language model are used to convert a text segment to be verified by the language model, and then in the process of converting a text segment by using a plurality of first text segments, the conversion is sequentially performed according to the order of text slots in the first text segment, and the text unit on the target text slot to be converted is converted according to the text information of the plurality of first text segments on the target text slot, thereby improving the accuracy of the text unit on the converted text slot, and in the case that the matching degree of the first text unit on the converted target text slot and the target question does not satisfy the preset matching condition, the conversion operation on the text units of the text slots after the target text slot is ended, and the third text segment obtained by conversion is verified by the language model, thereby realizing the determination of the length of the third text segment converted by the plurality of first text segments according to the accuracy of the converted text, reducing the pressure of the language model on the verification of the third text while ensuring the accuracy of the output third text. The above technical solution solves the problem of large delay in generating reply text in related technologies, and achieves the technical effect of reducing the delay in generating reply text. BRIEF DESCRIPTION OF DRAWINGS
[0047] The accompanying drawings, which are incorporated herein and form part of the specification, illustrate embodiments consistent with the present application and, together with the description, further serve to explain the principles of the application.
[0048] To more clearly illustrate the technical solutions in the embodiments of this application or the prior art, the drawings used in the description of the embodiments or the prior art will be briefly introduced below. Obviously, for those skilled in the art, other drawings can be obtained based on these drawings without creative effort.
[0049] Figure 1 This is a schematic diagram of the hardware environment for a generative pre-trained language model text generation method based on an auxiliary model, according to an embodiment of this application.
[0050] Figure 2 This is a flowchart of a generative pre-trained language model text generation method based on an auxiliary model, according to an embodiment of this application;
[0051] Figure 3 This is a flowchart of a dual-knob dynamic balance inference decoding acceleration method based on an auxiliary model forest, according to an embodiment of this application;
[0052] Figure 4 This is a schematic diagram of a correct token prefix according to an embodiment of this application;
[0053] Figure 5 This is an illustration of a method for generating a token sequence based on an auxiliary model according to an embodiment of this application. Figure 1 ;
[0054] Figure 6 This is an illustration of a method for generating a token sequence based on an auxiliary model according to an embodiment of this application. Figure 2 ;
[0055] Figure 7 This is a schematic diagram of a token sequence inferred by an auxiliary model according to an embodiment of this application;
[0056] Figure 8 This is a timing diagram of a dual-knob dynamic equilibrium inference decoding acceleration method based on an auxiliary model forest according to an embodiment of this application;
[0057] Figure 9 This is a structural block diagram of a dual-knob dynamic balancing inference decoding acceleration method based on an auxiliary model forest according to an embodiment of this application;
[0058] Figure 10 This is a structural block diagram of a generative pre-trained language model text generation device based on an auxiliary model, according to an embodiment of this application. Detailed Implementation
[0059] To enable those skilled in the art to better understand the present application, the technical solutions in the embodiments of the present application will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of the present application, and not all embodiments. Based on the embodiments in the present application, all other embodiments obtained by those of ordinary skill in the art without creative effort should fall within the scope of protection of the present application.
[0060] It should be noted that the terms "first," "second," etc., in the specification, claims, and accompanying drawings of this application are used to distinguish similar objects and are not necessarily used to describe a specific order or sequence. It should be understood that such data can be interchanged where appropriate so that the embodiments of this application described herein can be implemented in orders other than those illustrated or described herein. Furthermore, the terms "comprising" and "having," and any variations thereof, are intended to cover non-exclusive inclusion; for example, a process, method, system, product, or apparatus that comprises a series of steps or units is not necessarily limited to those steps or units explicitly listed, but may include other steps or units not explicitly listed or inherent to such processes, methods, products, or apparatus.
[0061] According to one aspect of the embodiments of this application, a generative pre-trained language model text generation method based on an auxiliary model is provided. This method is widely applicable to whole-house intelligent digital control application scenarios such as smart homes, smart home ecosystems, and intelligence house ecosystems. Optionally, in this embodiment, the above method can be applied to, for example... Figure 1 The hardware environment shown consists of terminal device 102 and server 104. For example... Figure 1 As shown, server 104 is connected to terminal device 102 via a network and can be used to provide services (such as application services) to the terminal or clients installed on the terminal. A database can be set up on the server or independently of the server to provide data storage services for server 104. Cloud computing and / or edge computing services can be configured on the server or independently of the server to provide data processing services for server 104.
[0062] The aforementioned network may include, but is not limited to, at least one of the following: wired network, wireless network. The aforementioned wired network may include, but is not limited to, at least one of the following: wide area network, metropolitan area network, local area network. The aforementioned wireless network may include, but is not limited to, at least one of the following: Wi-Fi (Wireless Fidelity), Bluetooth. The terminal device 102 may not be limited to PC, mobile phone, tablet computer, smart air conditioner, smart range hood, smart refrigerator, smart oven, smart stove, smart washing machine, smart water heater, smart washing equipment, smart dishwasher, smart projector, smart TV, smart clothes rack, smart curtains, smart audio-visual equipment, smart socket, smart speaker, smart speaker box, smart fresh air equipment, smart kitchen and bathroom equipment, smart bathroom equipment, smart robot vacuum cleaner, smart window cleaning robot, smart mopping robot, smart air purifier, smart steam oven, smart microwave oven, smart water heater, smart air purifier, smart water dispenser, smart door lock, etc.
[0063] This embodiment provides a generative pre-trained language model text generation method based on an auxiliary model, applied to the aforementioned device terminal. Figure 2 This is a flowchart of a generative pre-trained language model text generation method based on an auxiliary model, according to an embodiment of this application. Figure 2 As shown, the process includes the following steps:
[0064] Step S202: During the process of using multiple first text segments to convert text segments for the language model, text unit information of the target text slot to be converted is obtained. The text unit information is used to indicate the distribution of text units in the target text slot of the multiple first text segments. The multiple first text segments are generated by multiple auxiliary models of the language model through multiple rounds of autoregressive decoding based on the second text segments already output by the language model. The second text segments are used to answer the target question received by the language model. The multiple auxiliary models are used to perform multiple rounds of autoregressive decoding on the input data from different decoding dimensions.
[0065] Step S204: Based on the text unit information, convert the first text unit in the target text slot for the language model;
[0066] Step S206: Detect the target matching degree between the first text unit and the target question;
[0067] Step S208: If the target matching degree does not meet the preset matching degree condition, the third text segment is sent to the language model for verification to obtain the fourth text segment that has passed the verification. The third text segment includes text units that have been converted by the language model in other text slots before the target text slot.
[0068] Step S210: Output the fourth text segment as the answer text to the target question.
[0069] Through the above steps, multiple auxiliary models are configured for the language model. These auxiliary models are used to perform multiple rounds of autoregressive decoding on the input data using multiple different decoding dimensions. Multiple auxiliary models are used to generate multiple first text segments from the second text segment already output by the language model, transforming them into text segments to be verified by the language model. The transformation of text segments from multiple first text segments is performed sequentially according to the order of the text slots within the first text segments. The text units in the target text slots are transformed based on the text information of the multiple first text segments in the target text slots, thereby improving the accuracy of the transformed text units in the target text slots. Furthermore, if the matching degree between the transformed first text unit in the target text slot and the target problem does not meet the preset matching conditions, the transformation operation on the text units in the text slots following the target text slot ends. The language model is then used to verify the transformed third text segment, thus determining the length of the third text segment transformed from multiple first text segments based on the accuracy of the transformed text. This ensures the accuracy of the output third text segment while reducing the pressure on the language model to verify the third text. By adopting the above technical solution, the problem of large delay in generating response text in related technologies is solved, and the technical effect of reducing the delay in generating response text is achieved.
[0070] The language model and auxiliary model in this application may be, but are not limited to, autoregressive language models (such as Transformer).
[0071] In the technical solution provided in step S202 above, the auxiliary model is a model with the same decoding logic as the language model. The model size of the auxiliary model is smaller than that of the language model, and thus the time required for the auxiliary model to perform autoregressive decoding is less than the time required for the language model to perform autoregressive decoding.
[0072] Optionally, in this embodiment, when the language model performs multiple rounds of autoregressive decoding, the result of each round of autoregressive decoding is based on the decoding result of the previous round of autoregressive decoding. That is, in the first round of autoregressive decoding, the first text segment is used as the input decoding data, and the input decoding data is input to the auxiliary model to obtain the decoding result. Then, the decoding result and the input decoding data are merged to obtain the merged input decoding data, which is used as the input for the next round of autoregressive decoding. In this embodiment, the output result of each round of autoregressive decoding may be, but is not limited to, a text unit. By performing multiple rounds of autoregressive decoding based on the first text segment, the text segment to be output after the first text segment is obtained. In this embodiment, the number of rounds of autoregressive decoding performed by the auxiliary model each time can be a pre-set fixed value, or it can be determined based on the matching relationship between the reference text units output in each round of decoding and the target question. That is, if the matching relationship between the reference text unit and the target question satisfies the preset matching relationship, the next round of autoregressive decoding is performed. If the matching relationship between the reference text unit and the target question does not satisfy the preset matching relationship, the next round of autoregressive decoding is stopped, and the autoregressive decoding results of the current round and the previous rounds are used as the second text segment output by the auxiliary model. This method determines the decoding round of autoregressive decoding based on the matching relationship between the output text segment and the target question, avoiding the time waste caused by repeatedly performing autoregressive decoding when the decoding result is inaccurate. Further, in this embodiment, the matching relationship between the reference text unit and the target question can be determined by detecting the text segment parameters output by the auxiliary model in the current year's decoding round. The text segment parameters indicate the probability that the reference text unit output in the current decoding round is used as the text unit to answer the target question. Then, if the text segment parameters are greater than or equal to the target threshold, it is determined that the matching relationship between the reference text unit and the target question satisfies the preset matching relationship.
[0073] Optionally, in the embodiments of this application, the text unit information may include, but is not limited to, the reference text unit in the target text slot of each first text segment, the repetition frequency of the reference text unit in the target text slot of different first text segments, the accuracy of the text unit in the target text slot of each first text segment, etc. This solution does not limit this.
[0074] In the technical solution provided in step S204 above, the method of using multiple first text segments to convert text segments for the language model is to use the text units in different text segments of the same text slot to convert the candidate text units of that text slot, and then arrange the candidate text units on the converted text slots in order according to the text slot order to obtain the converted text.
[0075] Optionally, in this embodiment, the first text unit may be a text unit selected from the text units of multiple first text segments in the target text slot based on the text unit information, or it may be a text unit generated by merging the text units of multiple first text segments in the target text slot based on the text unit information. This solution does not limit this.
[0076] In the technical solution provided in step S206 above, the way to detect the matching degree between the first text unit and the target question can be to detect the text parameter of the first text unit in the output text slot of the auxiliary model, wherein the text parameter is used to indicate the probability that the first text unit is the answer to the target question in the current slot. Then, when the text parameter is greater than or equal to the target threshold, it can be determined that the target matching degree between the first text unit and the target text meets the preset matching degree condition.
[0077] In the technical solution provided in step S208 above, the process of the language model verifying the third text segment and outputting the fourth text segment can be as follows: The language model verifies the accuracy of each text unit in the third text segment starting from the beginning position. After identifying the first candidate text unit in the third text segment with an accuracy lower than the target accuracy, this candidate text unit and all subsequent text units in the third text segment are deleted, thus obtaining the fourth text segment. Alternatively, the language model can verify the accuracy of each text unit in the third text segment starting from the beginning position. After identifying the first candidate text unit in the third text segment with an accuracy lower than the target accuracy, the language model is then used to re-perform autoregressive decoding on the candidate text unit and all subsequent text units in the third text segment, thus obtaining the fourth text segment. This solution does not limit the specific method used.
[0078] As an optional implementation, detecting the target matching degree between the first text unit and the target question includes:
[0079] The target text slot is selected as the fifth text segment of the first text unit from the plurality of first text segments;
[0080] The first text parameter output by the reference auxiliary model used to output the fifth text segment in the plurality of auxiliary models is matched with the target parameter, wherein the first text parameter is used to indicate the association between the first text unit output by the reference auxiliary model for the target text slot and the target question;
[0081] If the first text parameter is less than or equal to the target parameter, the target matching degree between the first text and the target question is determined to be less than or equal to the target threshold.
[0082] Optionally, in the embodiments of this application, the language model and the auxiliary model may be, but are not limited to, an autoregressive language model (such as a Transformer decoder). After performing autoregressive decoding on the input decoding data, the model generates multiple text units for the text slot, as well as text parameters corresponding to each text unit. The text parameters are used to indicate the probability that the current text slot will use the corresponding text unit as the response content. Then, the appropriate text unit for the slot can be selected from the multiple text units output by the model based on the text parameters.
[0083] Optionally, in this embodiment, the target parameter can be a fixed parameter value configured according to requirements. When the first text parameter is less than or equal to the target parameter, it can be determined that the target matching degree between the first text and the first question does not meet the preset matching degree condition. Alternatively, the target parameter can be accurately generated based on the results of the usage phase output by the auxiliary model before the current time. This solution does not limit this.
[0084] As an optional implementation, matching the first text parameters output by the reference auxiliary model used to output the fifth text segment among the plurality of auxiliary models with the target parameters includes:
[0085] When there are multiple fifth text segments, the second text parameter with the largest value is selected from the first text parameters output by the multiple reference auxiliary models;
[0086] Match the second text parameter with the target parameter.
[0087] As an optional implementation, before matching the first text parameters output by the reference auxiliary model used to output the fifth text segment among the plurality of auxiliary models with the target parameters, the method further includes:
[0088] The text units in each text slot of the sixth text segment output by the reference auxiliary model are matched with the text units in the corresponding text slots of the second text segment to obtain a reference matching degree. The reference matching degree is used to indicate the proportion of the candidate text slots included in the sixth text segment. The second text segment and the sixth text segment store the same text units in the candidate text slots. The language model is used to re-perform autoregressive decoding on the text units in the sixth text segment whose accuracy is lower than the reference threshold to obtain the second text segment.
[0089] The target correction coefficient corresponding to the reference matching degree is determined from the matching degree and correction coefficient that have a corresponding relationship;
[0090] The target parameters are obtained by correcting the initial parameters configured for the auxiliary model using the target correction coefficient.
[0091] Optionally, in this embodiment, by matching the text units in the text slots of the sixth text segment output by the auxiliary model with the text units corresponding to the second text segment, a reference matching degree is obtained. Then, a correction coefficient for correcting the initial parameters of the auxiliary model is determined based on the reference matching degree. This allows the initial parameters of the auxiliary model to be corrected based on the accuracy of the auxiliary model's output. Furthermore, the number of autoregressive decoding execution rounds of the auxiliary model can be adjusted based on the accuracy of the auxiliary model's output, avoiding repeated execution of inaccurate autoregressive decoding rounds and reducing unnecessary autoregressive time consumption.
[0092] As an optional implementation, sending the third text segment to the language model for verification to obtain a fourth text segment that passes verification includes:
[0093] The language model is invoked to verify the accuracy of the text units included in the third text segment, thereby obtaining the second text unit in the third text segment, wherein the second text unit is the text unit whose accuracy is lower than a reference threshold among the text units included in the third text segment;
[0094] The language model is invoked to re-perform autoregressive decoding on the third text unit in the third text segment to obtain the fourth text segment, wherein the third text unit includes the second text unit and the text unit in the third text segment that is located after the second text unit.
[0095] Optionally, in this embodiment, the method of calling the language model to verify the accuracy of the text unit can be to obtain the decoded input data input by the auxiliary model when generating the text unit of the current slot, input the decoded input data into the language model to obtain the target text unit output by the language model, and then detect the difference between the target text unit and the text unit output by the auxiliary model for the text slot. If the difference is greater than the target difference, it is determined that the accuracy of the current text unit does not meet the preset accuracy condition. If the difference is less than or equal to the target difference, it is determined that the accuracy of the current text unit meets the preset accuracy condition.
[0096] Optionally, in this embodiment, the second text segment includes multiple text units. Each time the auxiliary model performs autoregressive decoding, it generates a text unit. Then, the multiple text units are sequentially sorted according to the order of the text units output by the auxiliary model during autoregressive decoding to obtain the second text segment output by the auxiliary model.
[0097] Optionally, in this embodiment, the fourth text segment is a text segment composed of text units in the third text segment whose accuracy meets a preset accuracy condition and text units obtained by the language model re-decoding the third text units.
[0098] Optionally, in this embodiment, before calling the language model to re-decode the third text unit in the third text segment, the number of the third text unit can be detected first. If the number of the third text unit is greater than or equal to the target number, the auxiliary model is controlled to re-decode and generate the first text segment, and the generated first text segment is reused to convert the third text segment. If the number of the third text unit is less than the target number, the language model is used to re-decode the third text segment. The scheme is not limited in this respect.
[0099] As an optional implementation, the step of calling the language model to verify the accuracy of the text units included in the third text segment, and obtaining the second text unit in the third text segment, includes:
[0100] The decoded input text corresponding to each text slot in the third text segment is constructed using the multiple text units included in the second and third text segments;
[0101] The language model is invoked to perform autoregressive decoding on the decoded input text to obtain multiple fourth text units output by the language model for the corresponding text slots and a third text parameter corresponding to each fourth text unit. The third text parameter is used to indicate the correlation between the corresponding fourth text unit and the target question.
[0102] The accuracy of the text unit in each text slot in the third text segment is determined based on the fourth text unit and the third text parameter corresponding to the fourth text unit.
[0103] The text unit whose accuracy is lower than the preset accuracy for the first occurrence in the third text segment is determined as the second text unit.
[0104] Optionally, in this embodiment, the decoded input text for each text slot is obtained by adding the reference text units of all text slots before the current text slot after the first text segment.
[0105] Optionally, in the embodiments of this application, the method of determining the accuracy of the corresponding slot text unit based on the third text parameter may be, but is not limited to, by calculating the dispersion of the first text parameter of the text unit of the corresponding slot in the auxiliary model. When the dispersion is greater than or equal to the target dispersion, it is determined that the accuracy does not meet the preset accuracy condition. When the dispersion is less than the target dispersion, it is determined that the accuracy meets the preset accuracy condition.
[0106] As an optional implementation, determining the accuracy of the text unit in each text slot of the third text segment based on the fourth text unit and the third text parameter corresponding to the fourth text unit includes:
[0107] A fourth text parameter is selected from multiple third text parameters output by the language model for the current text slot, wherein the fourth text unit corresponding to the fourth text parameter is the same as the text unit recorded in the current text slot of the third text segment;
[0108] Calculate the difference between the fourth text parameter and the fifth text parameter of the text unit output by the candidate auxiliary model for the current text slot, wherein the text unit in the current text slot in the first text segment output by the candidate auxiliary model is the same as the text unit in the current text slot in the third text segment;
[0109] If the difference is greater than or equal to the target difference, the accuracy of the text unit stored in the current text slot in the third text segment is determined to be lower than the reference threshold.
[0110] Optionally, in this embodiment, the accuracy of the text unit is reflected by calculating the difference between the fourth text parameter and the fifth text parameter of the text unit output by the auxiliary model for the current text slot, thereby making the calculated accuracy of the text unit more objective and reliable. This solution does not limit this.
[0111] As an optional implementation, the step of converting the first text unit in the target text slot for the language model based on the text unit information includes:
[0112] In the case where the text unit information is used to indicate that the target text slots of the plurality of first text segments include multiple different types of fifth text units, the repetition rate of each type of fifth text unit in the target text slots of the plurality of first text segments is obtained;
[0113] The fifth text unit whose repetition rate is greater than or equal to the target threshold is determined as the first text unit.
[0114] To better understand the above process, the following description will be based on optional embodiments, but these are not intended to limit the technical solutions of the embodiments of this application.
[0115] As an optional implementation, this application also provides a dual-knob dynamic balanced inference decoding acceleration method based on auxiliary model forest. When a user inputs a question into the large model, the large model first needs to convert the text into computer speech (encoding). After learning the output result through the large model, it decodes (generates tokens) and sends it back to the user. The number of tokens generated can be controlled by parameter tuning and should generally not be too many. Figure 3 This is a flowchart of a dual-knob dynamic balancing inference decoding acceleration method based on an auxiliary model forest, according to an embodiment of this application. Figure 3 As shown, the method includes the following steps:
[0116] Step 301: Based on the user's question, some correct decoding results have been obtained, which we call the token prefix (i.e., the second text segment). This invention first uses the existing token prefix to perform inference decoding of multiple auxiliary models in parallel using an auxiliary model forest. Each auxiliary model generates a new token sequence, and the auxiliary models do not affect each other.
[0117] Step 302: Based on the generated sequence of p tokens, a voting method is used to sequentially select the final result for each token, forming the final token sequence. There are two stopping conditions for token selection: 1. Set the first knob α, select a token using the voting method, calculate the maximum value of the token's probability distribution, compare it with α, and if it is greater than α, continue generating the next token; otherwise, stop the auxiliary model's current round of inference and decoding. 2. If the auxiliary model generates p possible answers, randomly select a token whose maximum probability distribution value is greater than α and stop voting.
[0118] Step 303: The original model verifies the final token sequence generated by the speculative inference forest model one by one. Set the second knob β and compare the KL divergence of each token from 1 to n tokens generated by the auxiliary model in this round. Find the first token that exceeds β and record its sequence number as m.
[0119] Step 304: Re-infer the tokens from m to n using the original model, correcting the decoding results of the auxiliary model. Then use the auxiliary model for the next round of inference.
[0120] Optional, Figure 4 This is a schematic diagram of an optional token prefix according to an embodiment of this application. The function of this prefix is to establish prior conditions for the subsequent reasoning results. Figure 5 This is an illustration of a method for generating a token sequence based on an auxiliary model according to an embodiment of this application. Figure 1 , Figure 6This is an illustration of a method for generating a token sequence based on an auxiliary model according to an embodiment of this application. Figure 2 ,like Figure 5 As shown, the auxiliary model forest, consisting of n auxiliary models, decodes their respective token sequences based on existing token prefixes. Now, assuming n = 3, there are 3 auxiliary models. According to the voting method, the final token sequence generated is as follows: Figure 5 As shown: 621, 721, 1895, 2024.
[0121] When encountering a situation where 3 auxiliary models generate 3 token results ( Figure 5 (As shown in slots 4 and 5), the speculative reasoning forest will randomly select a token that meets the conditions and stop voting for subsequent slots. That is, after selecting a token in slot 4, the reasoning stops, and slot 5 is not selected.
[0122] Figure 7 This is a schematic diagram of a token sequence inferred by an auxiliary model according to an embodiment of this application. Let the probability distributions of the auxiliary model and the original model generating the i-th token be respectively... and Where P i ={p i,1 ,p i,2 ,p i,3 ,...,p i,z}, i∈[1,n], p i,1 +p i,2 +p i,3 +...+p i,z =1. Because the probability distribution of the i-th token is generated based on the previous 1 to i-1 tokens, we define this token set as x. 1:i-1 ={x1,...,x i-1 Therefore, the probability distribution of the i-th token is P. i =P(x i |x 1:i-1 Let MAX(P) i The probability is the highest probability in the probability distribution, and each generated token also takes the value corresponding to the highest probability. Let the first knob be α (α∈[0,1]) (i.e., the preset matching degree condition). When... If this happens, the inference and decoding of the auxiliary model will stop. For example... Figure 7 As shown, if α = 0.5, then when reasoning to the 5th token, since p5 = 0.49 < α, reasoning stops, and only 4 tokens are generated in the end.
[0123] Then, set the second knob β (β∈[0,+∞]) (i.e., the target difference), and calculate the probability distributions of the original model and the auxiliary model with respect to the 1st to i-1th tokens, i.e., the set x. 1:i-1 ={x1,...,x i-1}, and calculate the KL divergence, assuming Because the final step of the original model always uses matrices to calculate probabilities, it actually leverages the parallelism of matrix computation to calculate the probability distribution of each token in one step. Let β = 1.0, and let m be the index of the first token that does not satisfy β. Since KL3 = 1.3 > β, m = 3 here. Tokens with indices in the interval [m, i-1] need to be re-inferred by the original model. Figure 7 The 3rd and 4th tokens need to be re-inferred by the original model (even though the KL4 of the 4th token is <β). Originally, these 4 tokens should have been inferred 4 times by the original model, but due to the introduction of the auxiliary model, only 2 inferences are needed by the original model (for the 3rd and 4th tokens). Moreover, the inference time of the auxiliary model is much shorter than that of the original model, which greatly shortens the inference time of the original model and reduces runtime latency.
[0124] Therefore, for a reasoning task with n tokens, the worst-case scenario is that the original model has to reason n times, so the advantages of this invention are obvious.
[0125] It's important to note that adjusting the two knobs creates a trade-off between inference efficiency and quality. A larger α indicates stricter quality requirements, resulting in greater inference latency; conversely, a larger β indicates more relaxed quality requirements, leading to lower latency. Users can dynamically adjust the knobs to suit their inference task needs. The most extreme case is when α = 1 and β = 0. In this case, all n tokens inferred by the auxiliary model are incorrect, requiring the original model to re-execute n inferences. This achieves the highest inference quality but also the lowest efficiency. When α = 0 and β = +∞, no correction to the original model is needed, resulting in the highest inference efficiency, but the quality of the auxiliary model's output is difficult to guarantee.
[0126] Figure 8 This is a timing diagram of a dual-knob dynamic balancing inference decoding acceleration method based on an auxiliary model forest according to an embodiment of this application. First, in step 801, the auxiliary model adjusts the first knob α, and performs token inference based on the threshold limit until it falls below the threshold.
[0127] Step 802: In the inference sequence generated above, set the second knob β. The original model generates the probability distribution of each token in the original model based on the token generation results of the auxiliary model, and calculates the KL divergence with the probability distribution of each token in the auxiliary model.
[0128] Step 803: Find the first token whose KL divergence is less than β, and let the original model re-infer all subsequent tokens.
[0129] Step 804: The original model returns the rollback and repair results to the auxiliary model. If the inference task has not been completed, step 804 is executed; otherwise, step 805 is executed.
[0130] Figure 9 This is a structural block diagram of a dual-knob dynamic balancing inference decoding acceleration method based on an auxiliary model forest according to an embodiment of this application. The specific implementation steps are as follows:
[0131] Step 1, Auxiliary Model Decoding Module: Based on the threshold setting of α, the auxiliary model is used to perform decoding inference until the probability of the largest probability in the probability distribution is less than α.
[0132] Step 2, Original Model Rollback Module: Based on the β threshold setting, the original model calculates the probability distribution of each token in parallel with the token inference results of the auxiliary model. Then, it calculates the KL divergence by combining the probability distribution of each token in the original model with that of the auxiliary model, finds the token subsequences with excessively large KL divergence differences, and corrects them.
[0133] Step 3: After the iteration is complete, output the complete reasoning answer.
[0134] Through the above description of the embodiments, those skilled in the art can clearly understand that the methods according to the above embodiments can be implemented by means of software plus necessary general-purpose hardware platforms. Of course, they can also be implemented by hardware, but in many cases the former is a better implementation method. Based on this understanding, the technical solution of this application, in essence, or the part that contributes to the prior art, can be embodied in the form of a software product. This computer software product is stored in a storage medium (such as ROM / RAM, magnetic disk, optical disk) and includes several instructions to cause a terminal device (which may be a mobile phone, computer, server, or network device, etc.) to execute the methods of the various embodiments of this application.
[0135] Figure 10 This is a structural block diagram of a generative pre-trained language model text generation device based on an auxiliary model, according to an embodiment of this application; as shown... Figure 10 As shown, it includes:
[0136] The acquisition module 1002 is used to acquire text unit information of the target text slot to be converted during the process of converting multiple first text segments into text segments for a language model. The text unit information is used to indicate the distribution of text units in the target text slot of the multiple first text segments. The multiple first text segments are generated by multiple auxiliary models of the language model through multiple rounds of autoregressive decoding based on the second text segments already output by the language model. The second text segments are used to answer the target question received by the language model. The multiple auxiliary models are used to perform multiple rounds of autoregressive decoding on the input data from different decoding dimensions.
[0137] The conversion module 1004 is used to convert the first text unit in the target text slot for the language model according to the text unit information;
[0138] Detection module 1006 is used to detect the target matching degree between the first text unit and the target question;
[0139] The sending module 1008 is used to send the third text segment to the language model for verification when the target matching degree does not meet the preset matching degree condition, and obtain the fourth text segment that has passed the verification. The third text segment includes text units that have been converted by the language model in other text slots before the target text slot.
[0140] The output module 1010 is used to output the fourth text segment as the answer text to the target question.
[0141] Through the above embodiments, multiple auxiliary models are configured for the language model. These auxiliary models are used to perform multiple rounds of autoregressive decoding on the input data using multiple different decoding dimensions. Multiple auxiliary models are used to convert multiple first text segments generated from the second text segment already output by the language model into text segments to be verified by the language model. In the process of converting the text segments from the multiple first text segments, the text slots within the first text segments are processed sequentially. The text units in the target text slots are converted based on the text information of the multiple first text segments in the target text slots, thereby improving the accuracy of the converted text units. Furthermore, if the matching degree between the converted first text unit in the target text slot and the target problem does not meet the preset matching conditions, the conversion operation on the text units in the text slots following the target text slot ends. The language model is then used to verify the converted third text segment, thus determining the length of the third text segment converted from the multiple first text segments based on the accuracy of the converted text. This ensures the accuracy of the output third text segment while reducing the pressure on the language model to verify the third text. By adopting the above technical solution, the problem of large delay in generating response text in related technologies is solved, and the technical effect of reducing the delay in generating response text is achieved.
[0142] As an optional implementation, the conversion module includes:
[0143] A filtering unit is used to filter out the target text slot as the fifth text segment of the first text unit from the plurality of first text segments;
[0144] The first matching unit is used to match the first text parameter output by the reference auxiliary model used to output the fifth text segment among the multiple auxiliary models with the target parameter, wherein the first text parameter is used to indicate the association between the first text unit output by the reference auxiliary model for the target text slot and the target question;
[0145] The first determining unit is configured to determine that the target matching degree between the first text and the target question is less than or equal to the target threshold when the first text parameter is less than or equal to the target parameter.
[0146] As an optional implementation, the first matching unit is further configured to:
[0147] When there are multiple fifth text segments, the second text parameter with the largest value is selected from the first text parameters output by the multiple reference auxiliary models;
[0148] Match the second text parameter with the target parameter.
[0149] As an optional implementation, the conversion module further includes:
[0150] The second matching unit is used to match the text units in each text slot of the sixth text segment output by the reference auxiliary model with the text units in the corresponding text slots of the second text segment to obtain a reference matching degree. The reference matching degree is used to indicate the proportion of the candidate text slots included in the sixth text segment. The second text segment and the sixth text segment store the same text units in the candidate text slots. The language model is used to re-perform autoregressive decoding on the text units in the sixth text segment whose accuracy is lower than the reference threshold to obtain the second text segment.
[0151] The second determining unit is used to determine the target correction coefficient corresponding to the reference matching degree from the matching degree and correction coefficient that have a corresponding relationship;
[0152] The correction unit is used to correct the initial parameters configured for the auxiliary model using the target correction coefficient to obtain the target parameters.
[0153] As an optional implementation, the sending module includes:
[0154] The first calling unit is used to call the language model to verify the accuracy of the text units included in the third text segment, and obtain the second text unit in the third text segment, wherein the second text unit is the text unit whose accuracy is lower than a reference threshold among the text units included in the third text segment;
[0155] The second calling unit is used to call the language model to re-perform autoregressive decoding on the third text unit in the third text segment to obtain the fourth text segment, wherein the third text unit includes the second text unit and the text unit in the third text segment that is located after the second text unit.
[0156] As an optional implementation, the first calling unit is further configured to:
[0157] The decoded input text corresponding to each text slot in the third text segment is constructed using the multiple text units included in the second and third text segments;
[0158] The language model is invoked to perform autoregressive decoding on the decoded input text to obtain multiple fourth text units output by the language model for the corresponding text slots and a third text parameter corresponding to each fourth text unit. The third text parameter is used to indicate the correlation between the corresponding fourth text unit and the target question.
[0159] The accuracy of the text unit in each text slot in the third text segment is determined based on the fourth text unit and the third text parameter corresponding to the fourth text unit.
[0160] The text unit whose accuracy is lower than the preset accuracy for the first occurrence in the third text segment is determined as the second text unit.
[0161] As an optional implementation, the first calling unit is further configured to:
[0162] A fourth text parameter is selected from multiple third text parameters output by the language model for the current text slot, wherein the fourth text unit corresponding to the fourth text parameter is the same as the text unit recorded in the current text slot of the third text segment;
[0163] Calculate the difference between the fourth text parameter and the fifth text parameter of the text unit output by the candidate auxiliary model for the current text slot, wherein the text unit in the current text slot in the first text segment output by the candidate auxiliary model is the same as the text unit in the current text slot in the third text segment;
[0164] If the difference is greater than or equal to the target difference, the accuracy of the text unit stored in the current text slot in the third text segment is determined to be lower than the reference threshold.
[0165] As an optional implementation, the conversion module further includes:
[0166] The acquisition unit is configured to acquire the repetition rate of each type of fifth text unit in the target text slots of the plurality of first text segments when the text unit information is used to indicate that the target text slots of the plurality of first text segments include a plurality of different types of fifth text units;
[0167] The third determining unit is used to determine the fifth text unit whose repetition rate is greater than or equal to the target threshold as the first text unit.
[0168] Embodiments of this application also provide a storage medium including a stored program, wherein the program, when executed, performs the generative pre-trained language model text generation method based on the auxiliary model described above.
[0169] Optionally, in this embodiment, the storage medium may be configured to store program code for performing the following steps:
[0170] S1, during the process of using multiple first text segments to convert text segments for the language model, the text unit information of the target text slot to be converted is obtained. The text unit information is used to indicate the distribution of text units in the target text slot of the multiple first text segments. The multiple first text segments are generated by multiple auxiliary models of the language model through multiple rounds of autoregressive decoding based on the second text segments already output by the language model. The second text segments are used to answer the target question received by the language model. The multiple auxiliary models are used to perform multiple rounds of autoregressive decoding on the input data from different decoding dimensions.
[0171] S2, based on the text unit information, convert the first text unit in the target text slot for the language model;
[0172] S3, Detect the target matching degree between the first text unit and the target question;
[0173] S4, if the target matching degree does not meet the preset matching degree condition, the third text segment is sent to the language model for verification, and a fourth text segment that passes the verification is obtained. The third text segment includes text units that have been converted by the language model in other text slots before the target text slot.
[0174] S5, output the fourth text segment as the answer text to the target question.
[0175] Embodiments of this application also provide an electronic device including a memory and a processor, the memory storing a computer program, the processor being configured to run the computer program to perform the steps in any of the embodiments of the generative pre-trained language model text generation method based on the auxiliary model described above.
[0176] Optionally, the electronic device may further include a transmission device and an input / output device, wherein the transmission device is connected to the processor and the input / output device is connected to the processor.
[0177] Optionally, in this embodiment, the processor can be configured to perform the following steps via a computer program:
[0178] S1, during the process of using multiple first text segments to convert text segments for the language model, the text unit information of the target text slot to be converted is obtained. The text unit information is used to indicate the distribution of text units in the target text slot of the multiple first text segments. The multiple first text segments are generated by multiple auxiliary models of the language model through multiple rounds of autoregressive decoding based on the second text segments already output by the language model. The second text segments are used to answer the target question received by the language model. The multiple auxiliary models are used to perform multiple rounds of autoregressive decoding on the input data from different decoding dimensions.
[0179] S2, based on the text unit information, convert the first text unit in the target text slot for the language model;
[0180] S3, Detect the target matching degree between the first text unit and the target question;
[0181] S4, if the target matching degree does not meet the preset matching degree condition, the third text segment is sent to the language model for verification, and a fourth text segment that passes the verification is obtained. The third text segment includes text units that have been converted by the language model in other text slots before the target text slot.
[0182] S5, output the fourth text segment as the answer text to the target question.
[0183] Optionally, in this embodiment, the storage medium may include, but is not limited to, various media capable of storing program code, such as USB flash drives, read-only memory (ROM), random access memory (RAM), portable hard drives, magnetic disks, or optical disks.
[0184] Optionally, specific examples in this embodiment can refer to the examples described in the above embodiments and optional implementations, and will not be repeated here.
[0185] Obviously, those skilled in the art should understand that the modules or steps of this application described above can be implemented using general-purpose computing devices. They can be centralized on a single computing device or distributed across a network of multiple computing devices. Optionally, they can be implemented using computer-executable program code, thereby storing them in a storage device for execution by a computing device. In some cases, the steps shown or described can be performed in a different order than those presented here, or they can be fabricated as separate integrated circuit modules, or multiple modules or steps can be fabricated as a single integrated circuit module. Thus, this application is not limited to any particular combination of hardware and software.
[0186] The above description is only a preferred embodiment of this application. It should be noted that for those skilled in the art, several improvements and modifications can be made without departing from the principle of this application, and these improvements and modifications should also be considered within the scope of protection of this application.
Claims
1. An auxiliary model-based generative pre-training language model text generation method, characterized in that, The method comprises the following steps: In the process of converting text segments by using a plurality of first text segments for a language model, text unit information of a target text slot to be converted is obtained, wherein the text unit information is used to indicate the distribution of text units on the target text slot of the plurality of first text segments, the plurality of first text segments are generated by a plurality of auxiliary models using the language model through multi-round autoregressive decoding based on a second text segment that has been output by the language model, the second text segment is used to answer a target question received by the language model, and the plurality of auxiliary models are used to perform multi-round autoregressive decoding on input data from different decoding dimensions; According to the text unit information, a first text unit on the target text slot is converted for the language model; The target matching degree between the first text unit and the target question is detected; If the target matching degree does not satisfy a preset matching degree condition, a third text segment is sent to the language model for verification, and a fourth text segment that passes the verification is obtained, wherein the third text segment includes text units on other text slots before the target text slot that have been converted for the language model; The fourth text segment is output as the answer text of the target question.
2. The method of claim 1, wherein, The detection of the target matching degree between the first text unit and the target question comprises: A fifth text segment in which the target text slot is the first text unit is screened out from the plurality of first text segments; A first text parameter output by a reference auxiliary model for outputting the fifth text segment is matched with a target parameter, wherein the first text parameter is used to indicate the association between the first text unit output by the reference auxiliary model for the target text slot and the target question; If the first text parameter is less than or equal to the target parameter, it is determined that the target matching degree between the first text and the target question is less than or equal to the target threshold.
3. The method of claim 2, wherein, The matching of the first text parameter output by the reference auxiliary model for outputting the fifth text segment with the target parameter comprises: If the number of the fifth text segments is multiple, a second text parameter with the maximum value is screened out from the first text parameters output by the plurality of reference auxiliary models; The second text parameter is matched with the target parameter.
4. The method of claim 2, wherein, Before the matching of the first text parameter output by the reference auxiliary model for outputting the fifth text segment with the target parameter, the method further comprises: match the text units in each text slot of a sixth text segment output by the reference auxiliary model with the text units in the corresponding text slot in the second text segment, to obtain a reference matching degree, wherein the reference matching degree is used to indicate a proportion of a candidate text slot included in the sixth text segment in the sixth text segment, the second text segment and the sixth text segment store the same text units in the candidate text slot, and the language model is used to perform autoregressive decoding on the text units in the sixth text segment with accuracy lower than a reference threshold to obtain the second text segment; determine a target correction coefficient corresponding to the reference matching degree from the matching degrees and correction coefficients with corresponding relationships; correct the initial parameters configured for the auxiliary model using the target correction coefficient to obtain the target parameters.
5. The method of claim 1, wherein, The sending of the third text segment to the language model for verification to obtain a fourth text segment that passes the verification includes: calling the language model to verify the accuracy of the text units included in the third text segment to obtain a second text unit in the third text segment, wherein the second text unit is a text unit with accuracy lower than a reference threshold among the text units included in the third text segment; calling the language model to perform autoregressive decoding on a third text unit in the third text segment to obtain a fourth text segment, wherein the third text unit includes the second text unit and the text units in the third text segment after the second text unit.
6. The method of claim 5, wherein, The calling of the language model to verify the accuracy of the text units included in the third text segment to obtain a second text unit in the third text segment includes: using the second text segment and the plurality of text units included in the third text segment to construct a decoding input text corresponding to each text slot in the third text segment; calling the language model to perform autoregressive decoding on the decoding input text to obtain a plurality of fourth text units output by the language model for the corresponding text slot and a third text parameter corresponding to each fourth text unit, wherein the third text parameter is used to indicate an association between the corresponding fourth text unit and a target question; determining the accuracy of the text units of each text slot in the third text segment according to the fourth text units and the third text parameters corresponding to the fourth text units; determining the accuracy of the text units of each text slot in the third text segment according to the fourth text units and the third text parameters corresponding to the fourth text units; 7. The method of claim 6, wherein, determining the accuracy of the text units of each text slot in the third text segment according to the fourth text units and the third text parameters corresponding to the fourth text units; determining a fourth text parameter from the plurality of third text parameters output by the language model for the current text slot, wherein the fourth text parameter corresponds to the fourth text unit that is the same as the text unit recorded in the current text slot of the third text segment; calculate a difference degree between the fourth text parameter and a fifth text parameter of a text unit output by a candidate auxiliary model for the current text slot, wherein the text unit on the current text slot in the first text segment output by the candidate auxiliary model is the same as the text unit on the current text slot in the third text segment; in a case where the difference degree is greater than or equal to a target difference degree, determine that the accuracy of the text unit stored in the current text slot in the third text segment is lower than the reference threshold.
8. The method of claim 1, wherein, the first text unit on the target text slot is converted for the language model according to the text unit information, including: in a case where the text unit information indicates that the target text slot of the plurality of first text segments includes fifth text units of multiple types, obtaining a repetition rate of each type of the fifth text unit on the target text slot of the plurality of first text segments; determining the fifth text unit with a repetition rate greater than or equal to a target threshold as the first text unit. 9.A text generation apparatus of an auxiliary model-based generative pre-training language model, characterized by, The method comprises the following steps: a conversion module is configured to convert a first text unit on the target text slot for the language model according to the text unit information; a detection module is configured to detect a target matching degree of the first text unit and the target question; a sending module is configured to send a third text segment to the language model for verification in a case where the target matching degree does not satisfy a preset matching degree condition, and obtain a fourth text segment that passes the verification, wherein the third text segment includes text units on other text slots before the target text slot that have been converted for the language model; an output module is configured to output the fourth text segment as a reply text to the target question.
10. A computer readable storage medium, characterized in that, The computer-readable storage medium comprises a stored program, wherein the program executes the method of any one of claims 1 to 8 when running. 11.An electronic device comprising a memory and a processor, the electronic device characterized by, The memory stores a computer program, and the processor is configured to execute the method of any one of claims 1 to 8 by using the computer program. The memory stores a computer program, and the processor is configured to execute the method of any one of claims 1 to 8 by using the computer program.