Text processing method and device and related equipment
By using multiple extended network components to expand the large language model into multiple words, the problems of wasted computing resources and low accuracy in long text generation are solved, and more efficient text generation is achieved.
Patent Information
- Application Number
- CN202510789737.4
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-06-12
- Publication Date
- 2025-09-19
AI Technical Summary
Existing large language models need to be called repeatedly when generating long texts, resulting in a waste of computing resources and low generation accuracy, making it difficult to maintain text coherence.
The initial description text is expanded with multiple words using multiple extended network components, and the extended description text is generated according to the task requirements through the target business model.
It reduces the waste of computing resources and improves the coherence and accuracy of text generation.
Smart Images

Figure CN120671646A_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of data processing technology, and in particular to text processing methods, devices and related equipment. Background Art
[0002] Currently, when a large language model is applied to a text expansion scenario, the large language model can perform text prediction on the currently input input text word (e.g., text) in a single prediction word output manner to predict and output the next text output word (e.g., text1) of the input text word. Then, a text combination word (e.g., text+text1) composed of the currently input input text word (e.g., text) and the predicted next text output word (e.g., text1) can be used as a new input text word to input the large prediction model, so that the large language model can again perform text prediction on the currently newly input input text word (e.g., text+text1) in a single prediction word output manner to predict and output the next text output word (e.g., text2) of the new input text word. Similarly, the last text output word (e.g., textH, where H is a positive integer greater than 2) can be predicted and output word by word in the single prediction word output manner until the final expanded text (e.g., text+text1+text2+…+textH) is generated.
[0003] However, the inventors found in practice that for such a large language model that only generates one word at a time, when the large language model needs to output a very long extended text (for example, an extended text of hundreds or thousands of words), it is necessary to repeatedly call the large language model to input new input text words, and will indiscriminately predict and output a new text output word for each new input text word in the manner of outputting a single predicted word. This means that for an extended text of hundreds or thousands of words, there may be hundreds or thousands of prediction calculations, so that there is a waste of extended computing resources. However, since the large language model only predicts and outputs one word at a time, this will result in the large language model not having the ability to plan ahead and not being able to express the meaning of "dare to do and dare to take responsibility". For example, when it is necessary to expand an extended text of hundreds or thousands of words, it may predict "dare, love" instead of "dare, do". This will result in further predicting subsequent extended texts according to "dare, love", which will cause the expansion direction of the large language model to be significantly different from the expected direction, thereby reducing the accuracy of text expansion when using the large speech model. Summary of the Invention
[0004] The embodiments of the present application provide a text processing method, apparatus and related equipment. When the target business model performs text expansion on the initial description text according to the task requirements, a multi-word expansion can be performed through multiple expansion network components. The multi-word expansion method can not only avoid the waste of expansion computing resources, but also improve the coherence of the expanded description text, thereby improving the expansion accuracy of the model.
[0005] On the one hand, an embodiment of the present application provides a text processing method, the method comprising:
[0006] Obtaining a task requirement description text associated with a text generation task; the task requirement description text is used to instruct a target business model to perform text expansion on an initial description text in accordance with the task requirement direction; the target business model includes a plurality of extended network components adapted to the text generation task;
[0007] Performing text serialization processing on the initial description text to obtain a first serialization feature of the initial description text;
[0008] Inputting the first serialized feature into a plurality of extended network components, each of the plurality of extended network components performing feature extension processing on the first serialized feature according to a task requirement direction, to obtain a plurality of first serialized extended features associated with the first serialized feature;
[0009] The first serialization feature and multiple first serialization extension features are feature processed to obtain a first serialization processing feature, and an extended description text is output through the first serialization processing feature; the extended description text refers to the text obtained by text expansion of the initial description text according to the task requirements.
[0010] On the one hand, an embodiment of the present application provides a text processing method, the method comprising:
[0011] Acquire training sample data for training an initial business model, the training sample data including reference description text, reference extension directions for the reference description text, and reference extension text related to the reference extension directions; the initial business model includes K extension network components capable of text extension;
[0012] Performing text serialization processing on the reference description text to obtain a first reference serialization feature of the reference description text;
[0013] Inputting the first reference serialization feature into K extended network components, each of the K extended network components performs feature expansion processing on the first reference serialization feature according to the reference expansion direction, obtaining K first predicted serialization extension features corresponding to the K extended network components, and generating predicted extended text containing the reference description text based on the first reference serialization feature and the K first predicted serialization extension features; K is an integer greater than 1;
[0014] The initial business model is trained based on the predicted extended text and the reference extended text, and the initial business model after model training is used as the target business model; the target business model is used to expand the initial description text in the task requirement description text according to the task requirement direction in the task requirement description text when obtaining the task requirement description text associated with the text generation task, so as to obtain the extended description text.
[0015] On the one hand, an embodiment of the present application provides a text processing device, the device comprising:
[0016] A task requirement acquisition unit is used to acquire a task requirement description text associated with a text generation task; the task requirement description text is used to instruct a target business model to perform text expansion on an initial description text in accordance with the task requirement direction; the target business model includes a plurality of extended network components adapted to the text generation task;
[0017] A first serialization processing unit is used to perform text serialization processing on the initial description text to obtain a first serialization feature of the initial description text;
[0018] a first feature extension unit, configured to input the first serialized feature into a plurality of extended network components, and each of the plurality of extended network components performs feature extension processing on the first serialized feature according to a task requirement, to obtain a plurality of first serialized extended features associated with the first serialized feature;
[0019] The feature processing unit is used to perform feature processing on the first serialization feature and multiple first serialization extension features to obtain a first serialization processing feature, and output an extended description text through the first serialization processing feature; the extended description text refers to the text obtained by expanding the initial description text according to the task requirements.
[0020] On the one hand, an embodiment of the present application provides a text processing device, the device comprising:
[0021] A sample data acquisition unit is configured to acquire training sample data for training an initial service model, the training sample data including a reference description text, a reference extension direction for the reference description text, and a reference extension text related to the reference extension direction; the initial service model includes K extension network components capable of text extension;
[0022] A second serialization processing unit is used to perform text serialization processing on the reference description text to obtain a first reference serialization feature of the reference description text;
[0023] a second feature expansion unit, configured to input the first reference serialization feature into K extended network components, and each of the K extended network components performs feature expansion processing on the first reference serialization feature according to a reference expansion direction to obtain K first predicted serialization extension features corresponding to the K extended network components, and generate predicted extended text including the reference description text using the first reference serialization feature and the K first predicted serialization extension features; K is an integer greater than 1;
[0024] The model training unit is used to train the initial business model based on the predicted extended text and the reference extended text, and use the initial business model after model training as the target business model; the target business model is used to expand the initial description text in the task requirement description text according to the task requirement direction in the task requirement description text when obtaining the task requirement description text associated with the text generation task, so as to obtain the extended description text.
[0025] On the one hand, an embodiment of the present application provides a computer device, including a memory and a processor, the memory is connected to the processor, the memory is used to store a computer program, and the processor is used to call the computer program so that the computer device executes the method provided by the embodiment of the present application.
[0026] On the one hand, an embodiment of the present application provides a computer-readable storage medium, which stores a computer program. The computer program is suitable for being loaded and executed by a processor so that a computer device having the processor executes the method provided by the embodiment of the present application.
[0027] In one aspect, an embodiment of the present application provides a computer program product, including a computer program stored in a computer-readable storage medium. A processor of a computer device reads the computer program from the computer-readable storage medium, and the processor executes the computer program so that the computer device performs the method provided in the above aspect.
[0028] According to an embodiment of the present application, after obtaining the task requirement description text associated with the text generation task, the target business model performs text serialization processing on the initial description text to obtain a first serialization feature of the initial description text; the first serialization feature is input into a plurality of extended network components included in the target network model that are adapted to the text generation task, and each of the plurality of extended network components performs feature expansion processing on the first serialization feature according to the task requirement direction to obtain a plurality of first serialization extension features associated with the first serialization feature; the first serialization feature and the plurality of first serialization extension features are feature processed to obtain a first serialization processing feature, and an extended description text is output through the first serialization processing feature. According to this method, when the target business model performs text expansion on the initial description text according to the task requirement direction, a multi-word expansion can be performed through a plurality of extended network components. The multi-word expansion method can not only avoid the waste of expansion computing resources, but also improve the coherence of the extended description text, thereby improving the expansion accuracy of the model. BRIEF DESCRIPTION OF THE DRAWINGS
[0029] In order to more clearly illustrate the technical solutions of the embodiments of the present application, the following is a brief introduction to the drawings required for use in the description of the embodiments. Obviously, the drawings described below are some embodiments of the present application. For ordinary technicians in this field, other drawings can be obtained based on these drawings without any creative work.
[0030] Figure 1 This is a structural diagram of a text processing system provided in an embodiment of the present application;
[0031] Figure 2 This is a scenario diagram of a text processing method provided by an embodiment of the present application;
[0032] Figure 3 This is a flowchart of a text processing method under a drama generation model provided in an embodiment of the present application;
[0033] Figure 4 This is a flowchart of a text processing method under an advertisement generation model provided by an embodiment of the present application;
[0034] Figure 5 This is a flowchart of a text generation method provided in an embodiment of the present application;
[0035] Figure 6 This is a structural diagram of a word segmentation embedding layer and a feature conversion layer provided in an embodiment of the present application;
[0036] Figure 7 is a schematic diagram of an extended network component provided in an embodiment of the present application;
[0037] Figure 8 is a schematic diagram of a merging module provided in an embodiment of the present application;
[0038] Figure 9 This is a schematic diagram of the architecture of a target business model provided by an embodiment of the present application;
[0039] Figure 10 This is a schematic diagram of a training process of a target business model provided in an embodiment of the present application;
[0040] Figure 11 This is a schematic diagram of the architecture of an initial business model provided in an embodiment of the present application;
[0041] Figure 12 This is a schematic diagram of determining model difference data provided by an embodiment of the present application;
[0042] Figure 13 is a structural diagram of a text processing device provided in an embodiment of the present application;
[0043] Figure 14 is a structural diagram of another text processing device provided in an embodiment of the present application;
[0044] Figure 15 It is a structural diagram of a computer device provided in an embodiment of the present application. DETAILED DESCRIPTION
[0045] The following will be combined with the drawings in the embodiments of this application to clearly and completely describe the technical solutions in the embodiments of this application. Obviously, the embodiments described are only part of the embodiments of this application, not all of the embodiments. Based on the embodiments in this application, all other embodiments obtained by ordinary technicians in this field without making creative efforts are within the scope of protection of this application.
[0046] The following is an introduction to some technical terms involved in the embodiments of this application:
[0047] 1. Text generation task: refers to the automatic generation of text content that conforms to grammatical specifications, semantic logic and meets the expected task requirements through the target business model (specifically, it can refer to the large language model). In the embodiment of the present application, the text generation tasks are different for different target business models. For example, when the target business model is a drama generation model, the text generation task is a drama generation task, and the drama generation task is a task that expands the plot according to the initial description information and the task requirement direction and obtains the plot extension text. For another example, when the target business model is an advertisement generation model, the text generation task is an advertisement generation task, and the advertisement generation task is a task that generates advertisement extension text according to the initial description information and the task requirement direction.
[0048] The above-mentioned initial description text is the text information entered by the business object (i.e., the user corresponding to the client that deploys the target business model) in the task entry interface of the client (i.e., the client that deploys the target business model). The above-mentioned task requirement direction is used to indicate the direction in which the target business model expands the initial description text. For example, in the drama generation model, the task requirement direction can be that the female protagonist counterattacks from a commoner to a successful entrepreneur, or that the male protagonist counterattacks from a beggar to a doctoral student, etc. For another example, in the advertisement generation model, the task requirement direction can be the way the protagonists communicate with each other, or the way the protagonists tell stories, etc.
[0049] Based on the initial description text and the task requirement direction, the task requirement description text associated with the text generation task can be determined. The following examples provide a detailed introduction to the initial description text, the task requirement direction, and the task requirement description text:
[0050] For example, a task requirement might be to generate an 8-episode film based on the following plot: "She wore a red wedding dress and burned the letters she had." The required output is a plot description for each episode, and the required plot direction is: "The heroine's journey from victory to becoming a female general." In this task requirement, "She wore a red wedding dress and burned the letters she had" is the initial description, and "The heroine's journey from victory to becoming a female general" is the task requirement direction.
[0051] For example, a task description might ask: "Generate advertising dialogue based on the prompt: 'Protecting the internet environment is everyone's responsibility.'" The requirement is to reflect advertising language and generate dialogue in the direction of: "A heartwarming conversation between a mother and child, expressing mutual concern." In this task description, "Protecting the internet environment is everyone's responsibility" is the initial description, and "A heartwarming conversation between a mother and child, expressing mutual concern" is the task's direction.
[0052] The task requirement description text is determined by a business prompt template. The business prompt template can be a component (or plug-in, or a separate model) independent of the target business model. Its purpose is to generate a standardized model instruction so that the target business model can be textually expanded according to the model instruction.
[0053] 2. Target business model: It is a large language model (LLM). The large language model is a natural language processing system based on deep learning, which is trained through massive text data, and the parameter scale is usually in the billions to trillions. Its core goal is to achieve complex tasks such as text generation, logical reasoning, and knowledge question and answer by understanding language patterns. In an embodiment of the present application, the task of the target business model is to generate an extended description text containing the initial description text based on the task requirement description text associated with the text generation task. Among them, the task requirement description text is the model input of the target business model, and the extended description text is the model output of the target business model. For example, in the drama generation model, the drama generation model generates a drama extended text containing the initial description text based on the task requirement description text; in the advertisement generation model, the advertisement generation model generates an advertisement extended text containing the initial description text based on the task requirement description text.
[0054] 3. NIT (Next token Prediction): refers to a generation method in which a language model predicts the next word based on the current word, and can only predict one word at a time. This method is the basis of a conventional large model. The large language model based on the next word prediction cannot coordinate the model's current prediction with future predictions, and the learning that treats each word the same is quite different from the human understanding system, resulting in the model's answers often being meaningless, inappropriately worded, or not generated smoothly. In addition, when people speak, they often have an idea first, and then each word they say is related to the future word so that the meaning is expressed more fully. In order to solve the above problems, the embodiment of the present application proposes a text generation method for multi-word prediction on this basis (i.e., next word prediction). The method extracts the contextual coherence information of the text through multiple extended network components (the extended network component is a component including multiple language model heads, the language model head is also called the prediction head, which can be represented by LM_head) to obtain different extended texts, thereby improving the coherence of the predicted text.
[0055] 4. Text serialization features: These are features obtained by segmenting, embedding, and encoding text data. In the embodiments of this application, text serialization features are vector representations, which can be represented by embeddings. For example, the first text serialization feature can be abbreviated as emb1, and the second text serialization feature can be abbreviated as emb2.
[0056] 5. Extension Network Component: This refers to the component in the target business model used to expand text to obtain extended text. The extension network component primarily processes serialization features to obtain serialized extension features. Typically, one extension network component outputs one serialized extension feature.
[0057] 6. Training Sample Data: This is the data used to train the initial business model to obtain the target business model. Different training objectives, i.e., different target business models, will result in different corresponding training sample data. For example, if the target business model is a drama generation model, the corresponding training sample data is data related to dramas; if the target business model is an advertisement generation model, the corresponding training sample data is data related to advertisements.
[0058] Among them, it should be noted that, in the application process of the target business model, the target business model performs text expansion on the initial description text in the direction of task requirements to obtain an extended description text; in the process of training the initial business model, the initial business model performs text expansion on the reference description text in the reference expansion direction of the reference description text in the training sample data to obtain a predicted extended text, and then trains the initial business model based on the predicted extended text and the reference extended text included in the training sample data to obtain the target business model.
[0059] See Figure 1 , Figure 1 This is a structural diagram of a text processing system provided by an embodiment of the present application. Figure 1 As shown, the text processing system may include terminal devices (such as device 11a, device 12a, device 13a) and server 100a. It is understandable that Figure 1 The number of terminal devices and servers in the example is merely illustrative; any number of terminal devices and servers may be used depending on implementation requirements. Terminal devices (e.g., device 11a, device 12a, and device 13a) may communicate with servers via a network (i.e., a medium providing a communication link via a wired or wireless communication link or fiber optic cable, etc.) to transmit data.
[0060] It is understood that a client can be run on a terminal device (such as device 11a), and the client can be a program that provides local services to users (also known as business objects, operation objects, etc.). In an embodiment of the present application, a target business model can be deployed in the client so that the target business model can perform text expansion on the initial description text in accordance with the task requirements to obtain an extended description text corresponding to the text generation task. The server 100a can be the server corresponding to the client. In an embodiment of the present application, a target business model can also be deployed in the server 100a so that the target business model can receive the initial description text submitted by the client and perform text expansion on the initial description text in accordance with the task requirements to obtain an extended description text corresponding to the text generation task. It is understood that the client running on the terminal device can also be called an application client, a business client, etc. For example, the client running on the terminal device can be a client for intelligently generating dramas. Then, in some scenarios, the server can send the drama extension text to the terminal device (such as device 11a), and the terminal device can then display the received drama extension text on the screen of the terminal device through the client.
[0061] It is understood that terminal devices (such as device 11a) may include but are not limited to mobile phones, computers, intelligent voice interaction devices, smart home appliances, vehicle-mounted terminals, aircraft, etc., and are not limited here. The server 100a can be an independent physical server, or a server cluster or distributed system composed of multiple physical servers. It can also be a cloud server that provides basic cloud computing services such as cloud services, cloud databases, cloud computing, cloud functions, cloud storage, network services, cloud communications, middleware services, domain name services, security services, CDN, and big data and artificial intelligence platforms, and is not limited here.
[0062] See Figure 2 , Figure 2 This is a scenario diagram of a text processing method provided by an embodiment of the present application. Figure 2 As shown, the target business model corresponding to the text processing method is deployed in the server 100a. In this scenario, the terminal device (such as device 11a) sends the initial description text corresponding to the text generation task to the server 100a through the running client. Optionally, in addition to the initial description text, the task requirement direction is also included. The task requirement direction can also be sent by the client to the server (that is, the task requirement direction can be input by the business object on the client), or the task requirement direction can also be determined by the server 100a based on the text generation task and the initial description text after receiving the initial description text.
[0063] Furthermore, the server 100a determines the task requirement description text associated with the text generation task (i.e., including the initial description text and the task requirement direction) based on the initial description text and the task requirement direction. Alternatively, the task requirement description text can also be sent to the server 100a by the terminal device after being determined based on the initial description text and the task requirement direction. For the target business model deployed in the server 100a, the following steps are mainly performed: S21, receiving the task requirement description text associated with the text generation task. S22, performing text serialization processing on the initial description text through the word segmentation embedding layer and the feature conversion layer to obtain serialization features of the initial description text. For example, the serialization feature obtained for the first time can be called serialization feature 1a, the serialization feature obtained for the second time can be called serialization feature 2a, and so on, the serialization feature obtained for the Nth time can be called serialization feature Na. S23, each of the multiple extended network components adapted to the text generation task in the K extended network components performs feature expansion processing on the serialization feature according to the task requirement direction, to obtain multiple serialization extension features associated with the serialization feature. For example, when the input feature of multiple extended network components is serialized feature 1a, each of the multiple serialized extended features obtained can be called a first serialized extended feature. When the input feature of multiple extended network components is serialized feature 2a, each of the multiple serialized extended features obtained can be called a second serialized extended feature. Similarly, the output corresponding to each input can be determined. S24: Feature splicing is performed on the serialized feature and the multiple serialized extended features to obtain a serialized spliced feature. Extended description text is output through the serialized spliced feature. The extended description text is obtained by textually expanding the initial description text according to the task requirements of the target business model.
[0064] Furthermore, the server 100a sends the obtained extended description text to the terminal device, so that the terminal device can display the extended description text on the display interface of the client.
[0065] In the implementation of this application, when the target business model performs feature expansion, it adopts multiple extended network components included in the target business model, which can realize multi-word expansion at one time. Compared with the solution of expanding only one word at a time, this solution can not only save expansion computing resources through multi-word expansion, but also realize the close association of contexts between texts, so that the obtained extended description text is more in line with the requirements of the text generation task. In other words, by adopting the target business model provided by the embodiment of this application, a more accurate model output (i.e., extended description text) can be obtained for the model input (i.e., the task requirement description text associated with the text generation task).
[0066] To better understand this method, the following are two application scenarios. The target business models corresponding to the two application scenarios are different, as follows:
[0067] The first one: When the target business model is a drama generation model, the corresponding text processing method can be as follows: Figure 3 As shown, based on the initial description text ("She wore a red wedding dress and burned the letter in her hand") and the task requirement direction ("The heroine's journey to become a female general"), the task description text is determined: Based on the following plot: "She wore a red wedding dress and burned the letter in her hand," a 10-episode film and television drama is generated, with the required output of a plot description for each episode. The required plot direction is "The heroine's journey to become a female general." Inputting the task description text into the drama episode generation model yields the expanded description text: Episode 1: She wore a red wedding dress and burned the letter in her hand, XXX; Episode 2: XXXXXX; ...; Episode 10: Finally, XXXX.
[0068] Second: When the target business model is an advertisement generation model, the corresponding text processing method can be as follows: Figure 4 As shown, based on the initial description text ("Protecting the environment is everyone's responsibility") and the task requirement ("A heartwarming conversation between a mother and son expressing mutual care"), the task description text is determined: Based on the following prompt ("Protecting the internet environment is everyone's responsibility"), an advertising dialogue is generated, requiring the language to reflect the advertising style. The generation direction is: "A heartwarming conversation between a mother and son expressing mutual care." Inputting the task description text into the ad generation model yields the expanded description text: Mother: Protecting the environment is everyone's responsibility, XXX; Son: XXXXXX; ...; Mother: XXXX.
[0069] pass Figure 3 and Figure 4 From the example, it can be seen that through the target business model provided by the implementation of this application, the business object only needs to input the initial description text and task requirement direction, and the target business model can automatically output the extended description text expected by the user, thereby improving the user experience of the business object.
[0070] Optionally, the target business model may be a story generation model, a writing model, a lyrics generation model, etc. in addition to the drama generation model and the advertisement generation model.
[0071] It should be noted that the relevant data (including initial description information or task requirement direction) obtained by the client in this application can be input by the business object through a text entry interface related to the text generation task, and its input form includes text, voice and image; wherein, it should be understood that when the input form is voice or image, it is necessary to perform text extraction on the voice or image to obtain text data (such as initial description text and / or task requirements). It should also be understood that before the client obtains the relevant data, the client can display a prompt interface, pop-up window or output a voice prompt message, which is used to prompt the user that its relevant data is currently being collected, so that this application only starts to execute the relevant steps of obtaining user-related data after obtaining the user's confirmation operation on the prompt interface or pop-up window. Otherwise (that is, when the user's confirmation operation on the prompt interface or pop-up window is not obtained), the relevant steps of obtaining user-related data are terminated, that is, the user's relevant data is not obtained. In other words, all user data collected by this application are collected with the user's consent and authorization, and the collection, use and processing of relevant user data need to comply with the relevant laws, regulations and standards of relevant countries and regions.
[0072] It is understood that the above scenarios are merely examples and do not limit the application scenarios of the technical solutions provided in the embodiments of this application. The technical solutions of this application can also be applied to other scenarios. For example, those skilled in the art will appreciate that with the evolution of system architecture and the emergence of new business scenarios, the technical solutions provided in the embodiments of this application will also be applicable to similar technical problems.
[0073] Further, see Figure 5 , Figure 5 1 is a flowchart of a text processing method provided in an embodiment of the present application. The method can be executed by a terminal device (such as the above-mentioned device 11a), or by a server (such as the above-mentioned server 100a), or can be executed by interaction between a terminal device (such as the above-mentioned device 11a) and a server (such as the above-mentioned server 100a), which is not limited here. For ease of understanding, the method is described here using the example of execution in a terminal device. The method can include at least the following steps S101-S104.
[0074] S101: Acquire a task requirement description text associated with a text generation task; the task requirement description text is used to instruct a target business model to perform text expansion on an initial description text according to the task requirement direction; the target business model includes multiple extended network components adapted to the text generation task.
[0075] The text generation task instructs the target business model to process the task requirement description text to generate an extended description text. The text generation task is associated with the target business model. For example, if the target business model is a drama generation model, the text generation task is a drama generation task. For another example, if the target business model is an advertisement generation model, the text generation task is an advertisement generation task.
[0076] Regardless of the type of target business model, before generating the extended description text corresponding to the text generation task (i.e., pre-model preparation), the target business model needs to first obtain the task requirement description text associated with the text generation task (i.e., model input), so that the target business model can obtain the extended description text based on the task requirement description text.
[0077] In an embodiment of the present application, the task requirement description text is determined based on the business prompt template associated with the target business model, and each task requirement description text includes at least an initial description text and a task requirement direction. Regardless of whether the task requirement description text is determined by the server or by the terminal device, it is necessary to first obtain the task entry text associated with the text generation task, and then send the task entry text to the server or terminal device. The task entry text is entered by the business object through the task entry interface associated with the text generation task in the client. Specifically, after the business object starts the client associated with the text generation task, the task entry interface associated with the text generation task is displayed. The business object enters the corresponding task entry text in the task entry interface. The entry method of entering the task entry text includes but is not limited to text entry, voice entry, and image entry, etc. If the entry method is voice entry or image entry, it is necessary to convert the voice data of the voice entry or the image data of the image entry into text to obtain the corresponding task entry text. The client responds to the confirmation operation of the task entry text entered in the task entry interface, that is, the business object clicks the confirmation control (such as Figure 3 The "Movie and TV Series Plot" control in , or Figure 4 ), and obtain the task input text associated with the text generation task.
[0078] If the task entry text directly contains the initial description text and the task requirement direction, then the initial description text and the task requirement direction can be directly sent to the business prompt template associated with the target business model. The business prompt template can then generate a first task requirement description text based on the initial description text and the task requirement direction; the first task requirement description text is a text different from the task entry text. The first task requirement description text is used as the task requirement description text associated with the text generation task. In this case, the obtained initial description text and task requirement direction are directly filled into the business prompt template, and then the corresponding polishing is performed according to the text generation task.
[0079] Optionally, if the task entry text only contains the task requirement direction, at least one randomly generated initial description text is obtained from the business prompt template associated with the target business model, and then the business prompt template generates a third task requirement description text based on the initial description text and the task requirement direction. The third task requirement description text is a text different from the task entry text. The third task requirement description text is used as the task requirement description text associated with the text generation task. In this case, the task entry text input by the business object only has the initial description text, so the business prompt template is required to determine the task requirement direction, and then the task requirement description text is determined based on the initial description text and the task requirement direction.
[0080] Optionally, if the task entry text only contains the initial description text, at least one text expansion direction is obtained from a business prompt template associated with the target business model. The business prompt template or a database associated with the business prompt template stores at least one text expansion direction, each of which is associated with the target business model (and the corresponding text generation task). For example, for a drama generation model, text expansion directions may include: modern urban romance, modern workplace, and ancient farming. The business prompt template can determine a target text expansion direction from the at least one text expansion direction based on the text generation task and the initial description text, and use the target text expansion direction as the task requirement direction adapted to the initial description text. The business prompt template then generates a second task requirement description text based on the initial description text and the task requirement direction. The second task requirement description text is different from the task entry text. This second task requirement description text is used as the task requirement description text associated with the text generation task. In this case, since the task entry text input by the business object only contains the initial description text, the business prompt template is required to determine the task requirement direction, and then determine the task requirement description text based on the initial description text and the task requirement direction.
[0081] It's important to note that a business prompt template is a component (module or standalone model) independent of the target business model. It can be deployed on a terminal device or a server, and its purpose is to generate the task requirement description text associated with the text generation task. The business prompt template rewrites the initial description text and task requirement direction to generate a model instruction, which the target business model can then use to perform text expansion processing.
[0082] Among them, for the same initial description text and task requirement method, the reason why the first task requirement description text and the second task requirement description text are used to describe it is because the generation process of the two is different, so the first and the second are used to distinguish them, but the text content of the task requirement description text finally generated is the same (that is, the data of the output model is the same). In addition, when the business object submits the initial description text and the task requirement direction, the generated task requirement description text is determined; but when the business object only submits the initial description text, the generated task requirement description text can be the same as the aforementioned or different from the aforementioned, because the business prompt template determines a target text extension direction from multiple text extension directions and uses it as the task requirement direction. The determined target text extension direction may be different from the one submitted by the user, so it is more accurate to describe the task requirement description text through the first and the second.
[0083] S102: Perform text serialization processing on the initial description text to obtain a first serialization feature of the initial description text.
[0084] In a feasible embodiment, the target business model includes a first word segmentation embedding layer and a first feature conversion layer. After determining the task requirement description text associated with the text generation task, the task requirement description text is input into the target business model. The target business model performs word segmentation processing on the initial description text through the first word segmentation embedding layer to obtain text segmentation of the initial description text, performs word embedding processing on the text segmentation to obtain word embedding coding features of the text segmentation; determines the text position of the text segmentation in the initial description text, performs position encoding on the text position through the first feature conversion layer to obtain position coding features of the text segmentation; and the first feature conversion layer performs feature serialization processing on the word embedding coding features based on the position coding features to obtain the first serialization features of the initial description text.
[0085] The first word segmentation embedding layer converts text data into a numerical form that the model can process, enabling the model to understand and process natural language. Specifically, the word segmentation embedding layer captures the semantic and grammatical features of vocabulary by mapping it into a continuous vector space, enabling the model to better perform semantic analysis and language understanding. The word segmentation embedding layer first segments the text data and constructs a vocabulary in which each word has a unique index. Then, a word vector matrix is constructed based on these indices, with each word corresponding to a vector of fixed dimension.
[0086] The first feature conversion layer is composed of multiple transformers stacked together. Its main function is to process the output of the first word segmentation embedding layer to obtain the first serialized feature. Figure 6 As shown in FIG. 1 , a structural diagram of a word segmentation embedding layer and a feature conversion layer provided in an embodiment of the present application is shown. Figure 6 As can be seen from the figure, the input of the word segmentation embedding layer is the initial description text, and after being processed by the word segmentation embedding layer and the feature conversion layer, the output is the serialized feature. Figure 6 It can be seen that the feature conversion layer is composed of 32 basic modules (models). Among them, a model structure can be shown in Table 1:
[0087] Table 1
[0088]
[0089] As can be seen from Table 1, each model consists of an input normalization layer (input_layernorm), a self-attention layer (self_attn), an output normalization layer (post_attention_layernorm), and a multi-layer perception mechanism layer (Mlp). After each initial description text is processed by the word segmentation embedding layer, it will undergo 32 such model processes to obtain the serialized features of the initial description text.
[0090] S103: Input the first serialized feature into multiple extended network components, and each of the multiple extended network components performs feature extension processing on the first serialized feature according to the task requirement direction to obtain multiple serialized extended features associated with the first serialized feature.
[0091] Among them, one extended network component corresponds to one output layer. In an embodiment of the present application, different numbers of extended network components can be adapted to different text generation tasks. The multiple extended network components adapted to each text generation task are determined from the K extended network components that can perform text expansion included in the target business model, where K is an integer greater than 1. It can also be understood that in the training process of training the initial business model to obtain the target business model, the number of extended network components can be greater than K, and the K extended network components that can perform text expansion are screened out during the training process. It should be noted that, in order to ensure the continuity of the model output, the K extended network components are connected in sequence, and there is no jump connection. Therefore, it can also be understood that the multiple extended network components adapted to each text generation task are also continuous.
[0092] In one feasible embodiment, the process for determining the multiple extended network components suitable for each text generation task is as follows: based on the task type of the text generation task and the textual content of the task requirement description text, the text complexity of the text generation task is determined; the text complexity is used to determine the number of extended network components suitable for the text generation task. Based on the number of extended network components determined by the text complexity, a continuous plurality of extended network components that matches the number of extended network components is screened from the K extended network components, and the screened continuous plurality of extended network components are determined as the multiple extended network components suitable for the text generation task.
[0093] For example, when the text generation task is a drama generation task, and the text content in the task requirement description text indicates that 10 episodes need to be generated, then the text complexity of the text generation task can be determined to be high complexity, and a first number of extended network components are allocated to the high complexity text generation task, and the first number is an arbitrary value greater than K / 2. For high-complexity text generation tasks, more extended network components are used for processing in order to improve the accuracy of expansion. For another example, when the text generation task is an advertisement generation task, and the text content in the task requirement description text indicates that 4 short-sentence advertisement slogans need to be generated, then the text complexity of the text generation task can be determined to be low complexity, and a second number of extended network components are allocated to the low-complexity text generation task, and the first number is an arbitrary value less than or equal to K / 2. For low-complexity text generation tasks, fewer extended network components are used for processing in order to improve the generation efficiency of the text generation task while ensuring accuracy.
[0094] Specifically, if K is 8 and the text generation task is a complex text generation task, it can be determined that the number of extended network components suitable for the text generation task can be any value between 5 and 8. After receiving the text generation task, the target business model can use any consecutive 5 extended network components for text expansion, or it can use any consecutive 7 extended network components for text expansion.
[0095] In an optional embodiment, the number of extended network components adapted to each text generation task can be customized by the business object. For example, the business object can select the number of extended network components in the task entry interface associated with the text generation task. The number of extended network components selected by the business object is determined from K extended network components to match the number as the extended network components for the text generation task. For example, there is a drop-down box in the task entry interface, through which the number of required extended network components can be selected. For example, if the target business model includes 7 extended network components that can perform text expansion, the number can be selected as any value between 1 and 7.
[0096] In one embodiment, to clearly illustrate how multiple extended network components process a first serialization feature to obtain multiple first serialization extension features associated with the first serialization feature, this embodiment takes any two consecutive extended network components from the multiple extended network components as an example. For any two consecutive first extended network components and second extended network components from the multiple extended network components, the specific process of obtaining the first serialization extension feature corresponding to the first extended network component and the first serialization extension feature corresponding to the second extended network component can be as follows:
[0097] The first serialized feature is input into the first extended network component and the second extended network component respectively, thereby realizing parallel data input. The first extended network component obtains the first serialized input feature through the first serialized feature, and performs a first feature expansion process on the first serialized input feature according to the task requirement to obtain the first serialized extended feature of the first extended network component, and uses the first serialized extended feature of the first extended network component as the first serialized output feature output by the first extended network component. After the first extended network component obtains the output, the second extended network component executes the process, that is, inputs the first serialized output feature into the second extended network component, and performs feature concatenation on the first serialized input feature and the first serialized output feature by the second extended network component, and uses the serialized feature obtained by the feature concatenation as the second serialized input feature. The second extended network component performs a second feature expansion process on the second serialized input feature according to the task requirement to obtain the first serialized extended feature of the second extended network component, and uses the first serialized extended feature of the second extended network component as the second serialized output feature output by the second extended network component. Multiple first serialized extended features associated with the first serialized feature are determined based on the first serialized output feature and the second serialized output feature.
[0098] It should be noted that the second extended network component is the next extended network component of the first extended network component. If the first extended network component is the first extended network component among multiple extended network components, the first extended network component uses the first serialization feature as the first serialization input feature; if the first extended network component is not the first extended network component among multiple extended network components, the extended network component determined from the non-first extended network component to the first extended network component is used as the target processing extended network component with serialization output features, and the first serialization feature and the serialization output feature of the target processing extended network component are feature spliced, and the serialization feature obtained by feature splicing is used as the first serialization input feature. For example, if the first extended network component is the third extended network component among multiple extended network components, the serialization input feature of the extended network component is obtained by feature splicing of the serialization output feature of the first extended network component, the serialization output feature of the second extended network component, and the first serialization.
[0099] If the first extended network component is not the first extended network component among multiple extended network components, the serialized input features corresponding to the extended network component need to be output to the first extended network component. Therefore, feature dimension processing is required while splicing. That is, after the first serialized features and the serialized output features of the target processing extended network component are spliced, the spliced serialized features are aligned according to the feature dimension of the first serialized features, so that the feature dimensions of the first serialized input features and the first serialized features are the same, so that the extended network component can quickly perform text expansion and improve processing efficiency.
[0100] After obtaining the first serialization output feature and the second serialization output feature, multiple first serialization extension features associated with the first serialization feature are determined based on the first serialization output feature and the second serialization output feature. In an embodiment of the present application, a serialization output feature including at least the first serialization output feature and the second serialization output feature can be output through a set text generation window.
[0101] In a feasible embodiment, when the text generation task includes an advertisement generation task and the task requirement direction includes an advertisement generation direction, the advertisement generation direction is used to indicate that a predicted advertisement text matching the number of components of multiple extended network components is generated in an advertisement text generation window associated with the advertisement generation task. In this case, the specific process of determining multiple first serialized extended features associated with the first serialized feature through the first serialized output feature and the second serialized output feature includes: determining the window length of the advertisement text generation window through the number of components of the multiple extended network components, determining the serialized output features used for text prediction through the advertisement text generation window, the determined serialized output features including at least the first serialized output feature and the second serialized output feature; when the number of determined serialized output features is consistent with the window length, constructing multiple first serialized extended features for text prediction through the serialized output features consistent with the window length; wherein each of the multiple first serialized extended features is used to generate predicted advertisement text.
[0102] The above process is further explained, wherein the window length is used to characterize the maximum number of output features of serialized output features that can participate in text prediction; the first serialized output feature is added to the advertising text generation window, and the advertising text generation window performs output feature statistics on the first serialized output feature to obtain a first feature statistical number of serialized output features used for text prediction; when it is detected that the first statistical feature number does not reach the maximum output feature number, the second serialized output feature is added to the advertising text generation window, and the advertising text generation window performs output feature statistics on the first serialized output feature and the second serialized output feature to obtain a second feature statistical number of serialized output features used for text prediction; the second feature statistical number is greater than the first feature statistical number; when the second feature statistical number reaches the maximum output feature number, the first serialized output feature and the second serialized output feature are used as multiple first serialized extended features associated with the first serialized feature; wherein each of the multiple first serialized extended features is used to generate predicted advertising text. Furthermore, if the second feature statistical number still does not reach the maximum output feature number, the third serialized output feature continues to be added to the advertising text generation window, and the advertising text generation window performs output feature statistics on the first serialized output feature, the second serialized output feature and the third serialized output feature to obtain the third feature statistical number of serialized output features used for text prediction, until the feature statistical number is the same as the maximum output feature number, and then multiple first serialized extended features associated with the first serialized feature are output.
[0103] For example, the window size of the advertisement text generation window is 6, which means that the window can accommodate 6 serialized output features. After obtaining the 6 serialized output features, the advertisement text generation window outputs the 6 serialized output features that can participate in text prediction.
[0104] In another feasible embodiment, when the text generation task includes an episode generation task and the task requirement direction includes an episode generation direction, the episode generation direction is used to indicate that a predicted episode text that matches the number of components of multiple extended network components is generated in the episode text generation window associated with the episode generation task. At this time, the specific process of determining multiple first serialized extended features associated with the first serialized feature through the first serialized output feature and the second serialized output feature includes: determining the window length of the episode text generation window through the number of components of multiple extended network components, determining the serialized output features used for text prediction through the episode text generation window, and the determined serialized output features include at least the first serialized output feature and the second serialized output feature; when the number of determined serialized output features is consistent with the window length, multiple first serialized extended features for text prediction are constructed through the serialized output features that are consistent with the window length; wherein each of the multiple first serialized extended features is used to generate episode prediction text.
[0105] To further explain the above process, the above window length is used to characterize the maximum number of output features of serialized output features that can participate in text prediction; the first serialized output feature is added to the drama text generation window, and the drama text generation window performs output feature statistics on the first serialized output feature to obtain the first feature statistical number of serialized output features used for text prediction; when it is detected that the first statistical feature number does not reach the maximum output feature number, the second serialized output feature is added to the drama text generation window, and the drama text generation window performs output feature statistics on the first serialized output feature and the second serialized output feature to obtain the second feature statistical number of serialized output features used for text prediction; the second feature statistical number is greater than the first feature statistical number; when the second feature statistical number reaches the maximum output feature number, the first serialized output feature and the second serialized output feature are used as multiple first serialized extended features associated with the first serialized feature; wherein each of the multiple first serialized extended features is used to generate drama prediction text.
[0106] S104: Process the first serialization feature and multiple first serialization extension features to obtain a first serialization processing feature, and output an extended description text through the first serialization processing feature; the extended description text refers to the text obtained by expanding the initial description text according to the task requirements.
[0107] In an embodiment of the present application, after the first serialization feature is input into multiple extended network components for one-time processing to obtain multiple first serialization extension features associated with the first serialization feature, whether a secondary output is required based on the generation of the multiple first serialization extension features, that is, whether there is an end mark feature related to the generation end mark of the text generation task in the multiple first serialization extension features; or, the multiple first serialization extension features and the first serialization feature can be first subjected to feature processing to obtain the first serialization processing feature, and after obtaining the first serialization processing feature, it is detected whether there is the end mark feature in the first serialization processing feature. If there is an end mark feature, the extended description text is output. Among them, the end mark feature ends with EOS (End of Sequence), which is a key design element for realizing the sequence generation task. For example, the training sample format of the machine translation task is: <sos>Input sentence <eos>arrive <sos>Target sentence <eos>When the model generates EOS, it outputs the target sentence. SOS stands for Start of Sequence, which is the start tag.
[0108] In an embodiment of the present application, the feature processing when performing feature processing on multiple first serialized extended features and the first serialized feature includes feature splicing processing or feature integration processing. Among them, feature splicing processing refers to performing feature splicing processing on multiple first serialized extended features and the first serialized feature, that is, directly splicing the first serialized feature and the multiple first serialized extended features in sequence to obtain a first serialized processing feature; feature integration processing refers to integrating multiple first serialized extended features and the first serialized feature, and the integration processing includes weighting processing and splicing processing, that is, assigning weights to multiple first serialized extended features, multiplying the first serialized extended features and the corresponding weights to obtain each weighted first serialized extended feature (for example, including 3 first serialized extended features: extended feature A, extended feature B and extended feature C, the corresponding weights are a1, a2 and a3 respectively, and the weighted first serialized extended features obtained are a1*extended feature A, a2*extended feature B and a3*extended feature C respectively), and then splicing the first serialized feature and each weighted first serialized extended feature to obtain the first serialized processing feature. For the sake of convenience, the following embodiments are described by taking the feature processing as a splicing processing as an example.
[0109] In this embodiment, when assigning weights to each of the multiple first serialized extension features, the weights can be assigned based on the correlation between the first serialized extension feature and the first serialized feature. The correlation can include output order correlation and semantic correlation. The output order correlation is determined based on the output order of the first serialized extension feature. The closer the output order of the first serialized extension feature is to the first serialized feature, the higher the output order correlation. For example, the three first serialized extension features corresponding to the first serialized feature are extension feature A, extension feature B, and extension feature C, and the output order of the three first serialized extension features is extension feature A, extension feature B, and extension feature C (i.e., extension feature A is output first, then extension feature B, and finally extension feature C). The output order of extension feature A is closest to the first serialized feature, so the weight value is the largest, and the output order of extension feature C is farthest from the first serialized feature, so the weight value is the smallest. The semantic correlation refers to the degree of correlation between the first serialized extension feature and the multiple first serialized extension features at the semantic level, i.e., the higher the semantic correlation, the greater the assigned weight. The reason for assigning weights to the first serialization extension features to obtain the first serialization processing features is to provide a prediction focus when subsequently performing text prediction based on the first serialization processing features, thereby making the obtained predicted text more accurate.
[0110] In one embodiment, the example of detecting whether the end marker feature exists in the first serialization processing feature is used to illustrate. If the end marker feature related to the generation end marker of the text generation task is detected in the first serialization processing feature, the first serialization processing feature carrying the end marker feature is used as the target serialization processing feature, and feature decoding processing is performed on the target serialization processing feature to obtain the extended description text. In other words, in this case, the extended description text is obtained by performing a single processing through multiple extended network components adapted for the text generation task.
[0111] If the end marker feature is not detected in the first serialization processing feature, the second feature dimension of the first serialization processing feature is aligned based on the first feature dimension of the first serialization processing feature to obtain the dimension-aligned first serialization processing feature, and the dimension-aligned first serialization processing feature is determined as the second serialization feature; at this time, the feature dimension of the second serialization feature is also the first feature dimension, that is, it is consistent with the feature dimension of the first serialization feature. Since the feature dimension of the serialization feature is changed during feature splicing, the end marker feature is not detected in the first serialization processing feature, indicating that the second serialization feature determined by the first serialization processing feature needs to be extended through the extended network component, so the feature dimension of the first serialization processing feature needs to be aligned so that the extended network component can quickly process the second serialization feature.
[0112] Furthermore, when the updated first serialized feature is input into multiple extended network components, the second serialized feature is also input into the multiple extended network components. Each of the multiple extended network components performs feature expansion processing on the second serialized feature according to the task requirements, thereby obtaining multiple second serialized extended features associated with the second serialized feature. Feature processing is then performed on the second serialized feature and the multiple second serialized extended features to obtain a second serialized processed feature. The second serialized splicing feature is then checked for an end marker feature. If so, the second serialized splicing feature carrying the end marker feature is used as the target serialized splicing feature. Feature decoding is performed on the target serialized splicing feature to obtain extended description text containing the initial description text. If the end marker feature is not detected in the second serialized splicing feature, feature dimension alignment is performed on the second serialized splicing feature to obtain a third serialized feature with the same feature dimension as the first serialized feature. The first serialized feature is then updated using the third serialized feature to obtain the updated first serialized feature. The updated first serialized feature is then input into the multiple extended network components. Continue processing according to the above logic until the end tag feature is detected and output the extended description text.
[0113] In an optional embodiment, the output extended description text includes the initial description text or the optimized initial description text, and the optimized initial description text is obtained by optimizing the initial description text. The optimization process includes content optimization of the initial description text and format optimization of the initial description text. The content optimization of the initial description text includes changing part of the text in the initial description text. For example, the person in the initial description text is the third person, and the person can be changed to the name of the object indicated; the content optimization of the initial description text also includes changing typos in the initial description text. The format optimization of the initial description text includes segmenting the initial description text, adding punctuation, changing the font, etc. The purpose of the optimization is to make the output extended description text more in line with user needs and, at the same time, enhance the readability of the extended description text.
[0114] In one embodiment, the extended network components are components of the text extension network layer in the target business model. Each extended network component can be composed of a language model header and a merging module. Each merging module includes a splicing submodule and a conversion submodule. The trained target business model includes K extended network components. We use K = 7 as an example to illustrate the network architecture of the extended network components.
[0115] See Figure 7 , is a schematic diagram of an extended network component provided in an embodiment of the present application, such as Figure 7 As shown in the figure, the target business model includes a total of 7 extended network components, each of which consists of a language model head and a merge module. For example, extended network component 1 includes merge1 (merge module 1) and LMh1 (language model head 1), and extended network component 2 includes merge2 (merge module 2) and LMh2 (language model head 2). If the number of extended network components adapted to the text generation task is 7, it means that 7 words need to be predicted at a time. Specifically, after the initial description text is serialized (because the feature conversion layer is directly connected to the extended network component, that is, the output of the feature conversion layer is the input of the text extension network layer, so Figure 7 Only the feature conversion layer is shown in the figure), and the corresponding first serialized feature (emb1) is obtained. emb1 is input into 7 extended network components at the same time to achieve parallel data input. For each extended network component, serial processing is performed. For example, for extended network component 1, emb1 is input into extended network component 1, and feature expansion processing is performed through merge1 and LMh1 to obtain t1. Figure 7 As can be seen from the figure, the output of merge1 is still emb1 because the input of merge1 is only emb1, so no processing is required. For another example, for extended network component 2, merge2 in extended network component 2 merges the received emb1 with the output t1 of extended network component 1, and then LMh1 performs feature expansion on the merged serialized features to obtain t2. Similarly, for extended network component 7, merge7 in extended network component 7 merges the received emb1 with the outputs of the first six extended network components (including the output t1 of extended network component 1, the output t2 of extended network component 2, the output t3 of extended network component 3, the output t4 of extended network component 4, the output t5 of extended network component 5, and the output t6 of extended network component 6). Then LMh7 performs feature expansion on the merged serialized features to obtain t7.
[0116] If there is an end marker feature among the 7 serialized extended features, the extended description text containing the initial description text is output through the output layer of the model. If there is no end marker feature among the 7 serialized extended features, emb1 and the 7 serialized extended features are concatenated and aligned to obtain a new emb1', which is then input into the model again. Figure 7 Feature expansion processing is performed in the 7 extended network components shown until the end tag feature is triggered, and the output contains the initial description text. According to the above logic, the extended description text containing the initial description text is output through the output layer of the model.
[0117] In a feasible embodiment, each merging module in the extended network component includes a splicing submodule and a conversion submodule, wherein, when merging the first serialized input feature and the first serialized output feature to obtain the second serialized feature, the splicing submodule first performs splicing processing on the first serialized input feature and the first serialized output feature, and then the conversion submodule performs feature dimension alignment processing on the spliced serialized features to obtain the second serialized feature.
[0118] like Figure 8 , which is a schematic diagram of a merging module provided in an embodiment of the present application, including a concatenation submodule (concat) and a transformation submodule (transformer). Figure 8 The merge modules shown are Figure 7 merge3 in, the merging module needs to perform feature splicing and feature dimension alignment on emb1, t1 and t2, and then perform feature expansion processing by LMh3 to obtain t3 (serialized extended feature). In an embodiment of the present application, when the merging module performs feature splicing, it splices the output of each extended network component before the merging module and the first serialized feature, rather than directly merging the first serialized feature with the input of the previous extended network component before the merging module. This is because when the latter is adopted, due to the loss of information transmission, directly adopting the subsequent results is prone to single-time prediction error transmission, and the former prediction is more accurate.
[0119] In summary, combined with Figure 6 and Figure 7 , it can be determined that the architecture of the target business model of the embodiment of the present application can be as follows Figure 9 As shown, from Figure 9 As can be seen, the trained target service model includes K extended network components. In actual application, multiple extended network components can be determined from the K extended network components based on the text generation task. For example, this can be any two consecutive extended network components, any six consecutive extended network components, or all of the K extended network components. How to determine the number of extended network components has been explained in the above embodiment and will not be repeated here.
[0120] In the embodiment of the present application, the application process of the target business model is mainly described. Specifically, after obtaining the task requirement description text associated with the text generation task, the target business model performs text serialization processing on the initial description text to obtain the first serialization feature of the initial description text; the first serialization feature is input into the multiple extended network components included in the target network model that are adapted to the text generation task, and each of the multiple extended network components performs feature expansion processing on the first serialization feature according to the task requirement direction to obtain multiple first serialization extension features associated with the first serialization feature; the first serialization feature and the multiple first serialization extension features are feature processed to obtain a first serialization processing feature, and the extended description text is output through the first serialization processing feature. Using this method, when the target business model performs text expansion on the initial description text according to the task requirement direction, a multi-word expansion can be performed through multiple extended network components. The multi-word expansion method can not only avoid the waste of expansion computing resources, but also improve the coherence of the extended description text, thereby improving the expansion accuracy of the model.
[0121] exist Figure 5 In the embodiment shown, the application process of the target business model is described. The training process of the target business model is described below. Figure 10 , is a schematic diagram of a training process for a target business model provided in an embodiment of the present application. The method can be executed by a terminal device (such as the above-mentioned device 11a), or by a server (such as the above-mentioned server 100a), or can be executed by interaction between a terminal device (such as the above-mentioned device 11a) and a server (such as the above-mentioned server 100a), which is not limited here. For ease of understanding, the method is described here using the example of execution in a terminal device. The method can include at least the following steps S201-S204:
[0122] S201: Acquire training sample data for training an initial business model, where the training sample data includes reference description text, reference extension direction for the reference description text, and reference extension text related to the reference extension direction; the initial business model includes K extension network components capable of text extension.
[0123] Different business models are trained with different training sample data. For example, if the target business model to be trained is a drama generation model, the training sample data is associated with the drama, and the process of obtaining the training sample data is as follows: the script information is obtained from the first database, and the script information is processed by episodes to obtain multiple dramas corresponding to the script information and the drama description information of each drama in the multiple dramas; the drama description information of M dramas in the multiple dramas is summarized to obtain the target description information of M dramas and the plot development direction of M dramas; M is an integer greater than or equal to 1; the drama description information of M dramas, the target description information of M dramas and the plot development direction of M dramas are used as training sample data for training the initial business model; wherein the target description information of M dramas is the reference description text, the drama description information of M dramas is the reference extended text, and the plot development direction of M dramas is the reference extended direction of the reference description text.
[0124] For example, the following is a training sample data acquisition process for training an episode generation model. Specifically, before training the initial business model, n1 long video scripts (each episode is over 30 minutes) and n2 short video scripts (each episode is 9-15 minutes) are obtained as the script information training set. One long video script or one short video script can be regarded as a script information. The script information in the script information training set is input into the GPT4 large model (Generative Pre-trained Transformer 4, a large language model) to generate episode plots (i.e., multiple episodes corresponding to each script information and episode description information for each of the multiple episodes). Specifically, any long video s1 from the n1 long video scripts is processed using the GPT4 large model to obtain the episode plot of long video s1 (Episode 1: xxx; Episode 2: xxx; ...; Episode 10: xxx). In other words, after the long video s1 is divided into episodes, 10 episodes and the episode description information of the 10 episodes are obtained.
[0125] Then, M consecutive episodes (for example, M can be any value between 5 and 12) are randomly selected from the multiple episodes corresponding to each script. These M episodes and their episode descriptions are fed into GPT4 to generate a one-sentence summary. This can be based on a question: Please summarize the episode description corresponding to the input plot, requiring output to include specific characters, keywords related to the character's characteristics, verbs related to the character, and keywords set in the script. Based on the question's requirements, the target descriptions of the M episodes and the plot development direction of the M episodes are output.
[0126] For another example, if the target business model to be trained is an advertisement generation model, then the training sample data is associated with advertisements. The process of obtaining the training sample data is as follows: obtain the advertisement generation sample data from the second database, the advertisement generation sample data including advertisement generation input text and advertisement generation output text, wherein the advertisement generation input text includes the advertisement initial description text and the advertisement generation direction; determine the advertisement generation sample data as the training sample data for training the initial business model; wherein the advertisement initial description text is the reference description text, the advertisement generation output text is the reference extension text, and the advertisement generation direction is the reference extension direction of the reference description text.
[0127] S202: Perform text serialization processing on the reference description text to obtain a first reference serialization feature of the reference description text.
[0128] Similar to the application process of the target business model, the initial business model also includes a second word segmentation embedding layer and a second feature conversion layer. When the reference description text is subjected to text serialization processing to obtain the first reference serialization feature of the reference description text, the reference description text is segmented by the second word segmentation embedding layer to obtain the reference text segmentation of the reference description text, and the reference text segmentation is subjected to word embedding processing to obtain the reference word embedding coding feature of the reference text segmentation; the reference text position of the reference text segmentation in the reference description text is determined, and the reference text position is position-encoded by the second feature conversion layer to obtain the reference position coding feature of the reference text segmentation; the second feature conversion layer performs feature serialization processing on the reference word embedding coding feature based on the reference position coding feature to obtain the first reference serialization feature of the reference description text. The structures of the second word segmentation embedding layer and the second feature conversion layer can be found in Figure 6 , I will not go into details here.
[0129] S203: Input the first reference serialization feature into K extended network components, and each of the K extended network components performs feature expansion processing on the first reference serialization feature according to the reference expansion direction to obtain K first predicted serialization extension features corresponding to the K extended network components respectively, and generate predicted extension text containing the reference description text through the first reference serialization feature and the K first predicted serialization extension features; K is an integer greater than 1.
[0130] In one embodiment, for any training sample data, after obtaining the first reference serialization feature of the reference description text in the training sample data, the execution process is as follows: S1, input the first reference serialization feature into K extended network components, and each of the K extended network components performs feature expansion processing on the first reference serialization feature according to the reference expansion direction, and obtains K first predicted serialization extension features corresponding to the K extended network components. S2: Feature processing (which can be feature splicing processing) is performed on the first reference serialization feature and the K first predicted serialization extension features to obtain the first predicted serialization processing feature. S3, determine whether there is a reference end mark feature in the first predicted serialization processing feature. If so, execute S4; if not, execute S5 and S6. S4, use the first predicted serialization processing feature carrying the reference end mark feature as the target predicted serialization processing feature, perform feature decoding processing on the target predicted serialization processing feature, and decode to obtain the predicted extended text containing the reference description text. S5. Based on the third feature dimension of the first reference serialization feature, the fourth feature dimension of the first predicted serialization processing feature is aligned to obtain the dimension-aligned first predicted serialization processing feature, and the dimension-aligned first predicted serialization processing feature is determined as the second reference serialization feature; the feature dimension of the second reference serialization feature is the same as the feature dimension of the first reference serialization feature, both of which are the third feature dimension. S6. The second reference serialization feature is input into K extended network components, and each of the K extended network components performs feature expansion processing on the second reference serialization feature according to the reference expansion direction to obtain K second predicted serialization extension features corresponding to the K extended network components. The second reference serialization feature and the K second predicted serialization extension features are feature processed to obtain the second predicted serialization processing feature; if the reference end marker feature is detected in the second predicted serialization splicing feature, the predicted extended text containing the reference description text is output through the second predicted serialization splicing feature. If the reference end marker feature is not detected in the second predicted serialization concatenation feature, the K second predicted serialization extension features are used as the K first predicted serialization extension features, and steps S2-S6 are repeated until the predicted extension text containing the reference description text is output.
[0131] In an embodiment of the present application, the feature processing of the second reference serialization feature and the K second prediction serialization extension features includes feature splicing processing or feature integration processing. Among them, feature splicing processing refers to performing feature splicing processing on the second reference serialization feature and the K second prediction serialization extension features in sequence to obtain the second prediction serialization processing feature; feature integration processing refers to weighting and splicing processing on the K second prediction serialization extension features and the second reference serialization feature, that is, assigning weights to the K second prediction serialization extension features, multiplying the K second prediction serialization extension features and the corresponding weights to obtain K weighted second prediction serialization extension features, and then splicing the second reference serialization feature and the K weighted second prediction serialization extension features to obtain the second prediction serialization processing feature.
[0132] For example, for the same initial business model that includes 7 extended network components, the processing process is to output the reference description text to the initial model, and then the model obtains the reference serialized feature embedding (denoted as emb3) of the text through basic module learning, and inputs emb3 into the 7 extended network components (predicting 7 future words in parallel); after obtaining the serialized extended features of the 7 words, emb3 and the serialized extended features of the 7 words are feature processed (for example, spliced), and input into the 7 extended network components to continue predicting the 7 words this time, and repeat the cycle until the predicted extended text is output.
[0133] During the training process, any two consecutive extended network components among the K extended network components, such as the first extended network component and the second extended network component, can also be used as examples to illustrate the text expansion process. The second extended network component is the next extended network component of the first extended network component. The process of using the first extended network component and the second extended network component to perform feature expansion processing on the first reference serialized feature can be as follows: the first reference serialized feature is input into the first extended network component and the second extended network component respectively; the first extended network component obtains the first reference serialized input feature through the first reference serialized feature, and performs a first feature expansion processing on the first reference serialized input feature according to the reference expansion direction to obtain the first predicted serialized extended feature of the first extended network component, and uses the first predicted serialized extended feature of the first extended network component as the first predicted serialized output feature output by the second extended network component.
[0134] The first predicted serialized output feature is input into the second extended network component, and the second extended network component performs feature merging on the first reference serialized input feature and the first predicted serialized output feature, and uses the serialized feature obtained by the feature merging as the second reference serialized input feature. The second extended network component performs second feature expansion processing on the second reference serialized input feature according to the reference expansion direction to obtain the first predicted serialized extended feature of the second extended network component, and uses the first predicted serialized extended feature of the second extended network component as the second predicted serialized output feature output by the second extended network component; based on the first predicted serialized output feature and the second predicted serialized output feature, determine the K first predicted serialized extended features corresponding to the K extended network components. Specifically, the first predicted serialized output feature is used as the first predicted serialized extended feature corresponding to the first extended network component, and the second predicted serialized output feature is used as the first predicted serialized extended feature corresponding to the second extended network component.
[0135] S204: Perform model training on the initial business model based on the predicted extended text and the reference extended text, and use the trained initial business model as the target business model; the target business model is used to expand the initial description text in the task requirement description text according to the task requirement direction in the task requirement description text when obtaining the task requirement description text associated with the text generation task, so as to obtain the extended description text.
[0136] In one embodiment, the basic structure of the initial business model is mainly a multi-layer transformer stacking structure, as shown in Table 2 below:
[0137] Table 2
[0138]
[0139] The specific modules included in the decoder layer of the model are shown in Table 1 and are not elaborated here. The decoder layer model is a key component of the larger language model and is primarily used in natural language processing (NLP) tasks. The decoder layer's main function is to gradually generate the target sequence based on the encoder output, that is, to output the first serialized features of the initial description text.
[0140] The initial business model provided in the embodiment of the present application is an improvement on the basic structure of Table 2. The structure shown in Table 2 only has one language model head, that is, it predicts one word at a time. On this basis, we introduced multiple heads, that is, K language model heads. For example, if K is 7, 7 words can be predicted at a time. If there are K language model heads, K words can be predicted at a time, and then the initial business model is trained based on the predicted words and the reference extended text in the training sample data to obtain the target business model.
[0141] In a feasible embodiment, the initial business model is trained by determining the model convergence conditions based on the output of each model, and obtaining the target business model when the model convergence conditions are met. In the embodiment of the present application, the main purpose is to train a target business model that can improve the accuracy of the expansion. Therefore, if the model is trained only by considering the difference between the predicted expansion text and the reference expansion text, all words are treated equally, and it is easy for meaningless words (such as conjunctions, adverbs, auxiliary words, etc.) to drown out the information of keywords. Therefore, in the embodiment of the present application, attention to keywords is introduced, and different weights are assigned according to the importance of each word in the generated predicted expansion text. The initial business model is further trained according to the different weights, thereby avoiding the model from focusing on a large number of words with little effect in the supervised text and improving the model's output of key information. Among them, keywords are measured based on fixed windows. For example, the maximum number of keywords that can be output in a fixed window and the weight data of each keyword are set. The method of keyword screening through a fixed window and multi-word prediction with information emphasis can improve the information utilization rate under the fixed window, and improve the correlation effect of the previous and next words in each answer, avoiding the loss of future information caused by too short windows and too much invalid information caused by too long windows in practice. At the same time, it avoids the problem that the same word weight learning in a fixed window cannot take into account the different previous and next correlation information required for expressions in different contexts in reality.
[0142] Therefore, based on the above analysis, the embodiment of the present application calculates the model difference data of the initial business model through the preset text extension window. Specifically, for the obtained predicted extended text, based on the preset text extension window, the predicted serialization features included in the predicted extended text are divided into N predicted extended text sets; each predicted extended text set includes K predicted serialization extension features, and the window length of the preset text extension window is determined by the number of extended network components included in the initial business model; N is a positive integer. The weight data of the keywords included in each predicted extended text set in the N predicted extended text sets is obtained; that is, the predicted extended text is output multiple times according to the preset text extension window, and a predicted extended text set is obtained by outputting once. Since this application needs to pay attention to the impact of keywords on the model, K predicted serialization extension features are output through the predicted extended text window. At the same time, the predicted serialization extension features belonging to the keywords in the K predicted serialization extension features are output, as well as the weight data corresponding to the predicted serialization extension features of the keywords (i.e., the weight data of the keywords).
[0143] During the initial business model training process, the model can output the weight data of each word based on the contextual relationship. Specifically, for multiple predicted words, based on the contextual association influence of different future words (the 2nd to 7th predicted words) on the current word (the 1st predicted word), the model adjusts the learning focus of these 7 words to determine the keywords among the 7 words and the weight data of the keywords.
[0144] The following example illustrates the analysis of keywords. For example, "The banquet hall, with its brilliantly lit walls, was filled with elites from all walks of life. The guests were whispering to each other while gently holding their goblets. Xiaomei, with her graceful figure, happily sat next to Xiaohuang." Compared to "Xiaomei frowned and sat next to Xiaohuang," the meanings expressed by the two sentences are very different from the subsequent plot development. In this case, "happy" and "frown" are keywords that have a greater impact on the context. "Elite" indicates Xiaomei's (or Xiaohuang's) status or identity, but its impact on the context is not as great as "frown." Therefore, the weights of "frown" and "elite" can be (0.9, 0.2), respectively. For the initial business model, after inputting the reference description text into the initial business model, the following instructions can be generated: Given the plot outline of a film or TV series in the direction of xxx, please provide 0 to 3 keywords and keyword scores for each sentence (based on the preset text expansion window). The score range is required to be between 0 and 1, and the result should be {[keyword, score]} in JSON format. For example, if (xxxx frowns xxx) returns {1: [frown, 0.9], 2: [elite, 0.2]}. This way, the initial business model can output keywords and keyword weights in addition to the predicted expanded text.
[0145] Furthermore, model difference data of the initial business model is determined based on the predicted serialized extension features included in the N predicted extension text sets, the reference extended serialized features corresponding to the reference extension texts, and the weight data of the keywords included in each predicted extension text set. The initial business model is trained based on the model difference data, and the trained initial business model is used as the target business model. The model difference data of the initial business model includes two parts: one part is the first difference data between the predicted extension text and the reference extension text, and the other part is the difference data corresponding to the keywords in the predicted extension text.
[0146] Therefore, based on the predicted serialized extension features included in the N predicted extended text sets, the reference extended serialized features corresponding to the reference extended text, and the weight data of the keywords included in each predicted extended text set, the model difference data of the initial business model is determined, including: based on the predicted serialized extension features in each predicted extended text set in the N predicted extended text sets and the reference extended serialized features corresponding to the reference extended text, determining the first difference data of each predicted extended text set. The first difference data (also referred to as loss1) here can be a cross-entropy loss, which is the cross-entropy loss calculated for the predicted extended text set in units of the predicted extended text set. For any predicted extended text set i included in the N predicted extended text sets, where i is an integer greater than or equal to 1 and less than or equal to N, obtain the reference extended serialization features corresponding to the reference extended text and the reference label of each reference extended serialization feature; obtain the predicted probability of each predicted serialization extended feature in the predicted extended text set i matching the reference extended serialization feature, and obtain the reference label of each predicted serialization extended feature in the reference extended serialization feature; determine the difference data of each predicted serialization extended feature based on the predicted probability of each predicted serialization extended feature and the reference label of each predicted serialization extended feature; and determine the first difference data of the predicted extended text set i based on the difference data of each predicted serialization extended feature. The calculation process of the first difference data of each predicted extended text set in the N predicted extended text sets can be referred to the predicted extended text set i, and the first difference data of other predicted extended text sets will not be elaborated in detail here.
[0147] In an optional embodiment, the calculation process of the cross entropy loss can be as follows:
[0148]
[0149] Among them, y i represents the reference label (also known as one-hot label) of the i-th word in the reference extended serialization feature, that is, when the current label of the i-th word matches the reference of the i-th word in the reference extended serialization feature, y i is 1, otherwise it is 0. i is the correct probability of the position of the i-th word at the position corresponding to the reference extended serialization feature. If the predicted extended text set includes 7 predicted words (i.e., 7 predicted serialization extended features), the cross entropy loss of the 7 predicted words is calculated separately, and then the sum is divided by 7 to obtain the first difference data of the predicted extended text set.
[0150] In addition, obtain the reference extended serialization features corresponding to the reference extended text and the reference tags of the keywords in the reference extended serialization features; obtain the predicted probability of the keywords matching the reference extended serialization features, and determine the first difference data of the keywords based on the predicted probability of the keywords and the reference tags of the keywords in the reference extended serialization features; determine the second difference data of each predicted extended text set based on the weight data of the keywords included in each predicted extended text set and the first difference data of the keywords. In other words, for each predicted extended text set, it is necessary to calculate the second difference data (also called loss2), the second difference data is the keyword loss, and the keyword loss is the weight data of the keyword multiplied by the cross entropy loss of the keyword. For a predicted extended text set including multiple keywords, the weight data of each keyword is multiplied by the cross entropy loss of the keyword and then added together. The calculation of keyword loss can be as follows:
[0151]
[0152] Among them, L wordi is the first difference data of the i-th keyword (i.e. the cross entropy loss mentioned above), w i is the weight data of the i-th keyword. For example, after each forward pass (i.e., under the premise of 7 extended network components), 7 predicted words are obtained. When calculating the first difference data of the 7 words, if there is a keyword among them, the keyword loss corresponding to the keyword contained in it is calculated using formula (2). It is also possible that there is no keyword among the 7 predicted words. In this case, the keyword loss is 0.
[0153] Finally, in order to balance the impact of the two types of difference data on the model parameters, it is also necessary to obtain the first weight of the first difference data and the second weight of the second difference data. Based on the first difference data, the first difference data of each predicted extended text set, the first weight data and the second difference data of each predicted extended text set, the difference data of each predicted extended text set is determined; based on the difference data of each predicted extended text set, the model difference data of the initial business model is determined.
[0154] The calculation of the difference data of each predicted expanded text set can be as follows:
[0155] loss=a*loss1+(2-a)*loss2 (3)
[0156] Among them, loss1 is the first difference data (i.e., the cross entropy loss of each predicted word), loss2 is the second difference data (i.e., keyword loss), a is the first weight, and 2-a is the second weight. Taking into account the context effect, this application calculates the cross entropy loss for all predicted words, and then performs a secondary loss calculation for the keywords. Set the sum ratio of the total loss to 2, the sum ratio of the cross entropy loss calculated for all predicted words to a (a=0.9), and the keyword loss ratio to 2-a. First, normalize the weights of the large model to a sum of 2-a. Taking into account the superimposed calculation of keyword losses, a cannot be too large, otherwise the keyword loss will be too large and affect the normal generation of basic text conjunctions, etc.
[0157] During training, the model parameters of the initial business model are initialized. A sample dataset consisting of X training examples (i.e., N question-and-answer sequences) is then fed into the model in batches for forward computation to determine the model difference. Stochastic Gradient Descent (SGD) is then used to calculate the gradients of the model parameters and update the parameters, completing a batch of sample updates. Training continues with the next batch, completing an epoch after completing all X training examples. The target business model is obtained after 10 epochs of training, or when the model difference no longer decreases.
[0158] like Figure 11 As shown, it is a structural diagram of an initial business model disclosed in an embodiment of the present application, and the initial business model includes a word segmentation embedding layer, a model conversion layer and a text extension network layer, and the text extension network layer includes 7 extension network components. The training sample data (including reference description text and reference extension text) is input into the initial business model, and the reference description text is processed by the word segmentation embedding layer and the feature conversion layer to obtain the corresponding reference serialization feature. Each time the reference serialization feature is subjected to feature expansion processing through these 7 extension network components, 7 predicted serialization extension features (i.e., a predicted extension text set) can be obtained. A total loss (i.e., model difference data of a predicted extension text set) can be obtained based on each 7 predicted serialization extension features, and the total loss includes predicted word loss and keyword loss, wherein. Figure 11 Only the prediction word loss is shown in . That is, for N predicted extended text sets, there are N prediction word losses, that is Figure 11 Loss 1, loss 2, ..., total loss N in the equation are: Loss 1 is calculated by using cross-entropy loss on the word segmentation corresponding to the predicted serialized extended features (t11-t17) and the word segmentation corresponding to the reference extended text; Loss 2 is calculated by using cross-entropy loss on the word segmentation corresponding to the predicted serialized extended features (t21-t27) and the word segmentation corresponding to the reference extended text; and so on, Loss N is calculated by using cross-entropy loss on the word segmentation corresponding to the predicted serialized extended features (tN1-tN7) and the word segmentation corresponding to the reference extended text. Loss 1, loss 2, ..., loss N are added together to obtain the predicted word loss (i.e., the first difference data).
[0159] See Figure 12 , is a schematic diagram of determining model difference data provided by an embodiment of the present application, Figure 12 The following is an example of a predicted extended text set, which is to use the predicted serialized extended features (t11-t17) and the corresponding reference serialized features (t11'-t17') in the reference extended text. Among them, t11-t17 is the predicted data in the predicted extended text, and t11'-t17' is the reference data in the reference extended text. The loss of each predicted word can be determined based on the reference extended text and the predicted extended text, that is, the loss of t11 can be determined based on t11' and t11, and the loss of t12 can be determined based on t12' and t12. By analogy, the loss of each predicted word can be determined. Figure 12 As shown, the 7 predicted word losses are added together to obtain the first difference data (loss1); in addition, if there are two keywords t12 and t15 in t11-t17, the keyword loss of t12 can be obtained according to the weight of t12 and the loss of t12 (prediction word loss), and the keyword loss of t15 can be obtained according to the weight of t15 and the loss of t15 (prediction word loss). The keyword loss of t12 and the keyword loss of t15 are added together to obtain the second difference data (loss2). Finally, the first difference data and the second difference data are weighted and summed to obtain the model difference data, that is, the total loss of the predicted expanded text set. For each predicted expanded text set, Figure 12 The loss is calculated based on the idea of the initial business model, thereby obtaining the model difference data of the initial business model, and adjusting the parameters of the initial business model according to the model difference data.
[0160] The embodiment of the present application is used to describe the process of training the initial business model using training sample data to obtain the target business model. After obtaining the training sample data for training the initial business model, the reference description text is serialized to obtain the first reference serialization feature of the reference description text; the first reference serialization feature is input into K extended network components, and each of the K extended network components performs feature expansion processing on the first reference serialization feature according to the reference extension direction to obtain K first prediction serialization extension features corresponding to the K extended network components. Through the first reference serialization feature and the K first prediction serialization extension features, a predicted extension text containing the reference description text is generated. According to the predicted extension text and the reference extension text, the initial business model is trained, and the initial business model after model training is used as the target business model. Based on the description in the embodiment, it can be known that during model training, the embodiment of the present application not only takes into account the loss of multiple predicted words themselves, but also introduces attention to keywords during the training process, thereby ensuring the accuracy and coherence of the model output, but also improving the generation and output of key information by the model, avoiding the presence of too much useless text in the output.
[0161] See Figure 13 , Figure 13 This is a structural diagram of a text processing device provided by an embodiment of the present application. Figure 13 As shown, the text processing device 10 can be a computer program running on a terminal device (for example, the above-mentioned device 11a), or a computer program running on a server 100a. For example, the text processing device 10 is an application software. It is understandable that the text processing device 10 can be used to execute the corresponding steps of the text processing method provided in the embodiment of the present application. Figure 13 As shown, the text processing device 10 may include: a task requirement acquisition unit 11, a first serialization processing unit 12, a first feature expansion unit 13, and a feature processing unit 14;
[0162] The task requirement acquisition unit 11 is used to acquire a task requirement description text associated with the text generation task; the task requirement description text is used to instruct the target business model to perform text expansion on the initial description text according to the task requirement direction; the target business model includes multiple extended network components adapted to the text generation task;
[0163] A first serialization processing unit 12 is used to perform text serialization processing on the initial description text to obtain a first serialization feature of the initial description text;
[0164] A first feature expansion unit 13 is configured to input the first serialized feature into a plurality of extended network components, and each of the plurality of extended network components performs feature expansion processing on the first serialized feature according to a task requirement, thereby obtaining a plurality of first serialized extended features associated with the first serialized feature;
[0165] The feature processing unit 14 is used to perform feature processing on the first serialization feature and multiple first serialization extension features to obtain a first serialization processing feature, and output an extended description text through the first serialization processing feature; the extended description text refers to the text obtained by expanding the initial description text according to the task requirements.
[0166] In one embodiment, the task requirement description text includes a first task requirement description text. When the task requirement acquisition unit 11 is used to acquire the task requirement description text associated with the text generation task, it is specifically used to:
[0167] Obtaining task input text associated with the text generation task;
[0168] If the task entry text contains an initial description text and a task requirement direction, a first task requirement description text is generated based on the initial description text and the task requirement direction through a business prompt template associated with the target business model; the first task requirement description text is a text different from the task entry text.
[0169] In one embodiment, the task requirement description text includes a second task requirement description text. When the task requirement acquisition unit 11 is used to acquire the task requirement description text associated with the text generation task, it is specifically used to:
[0170] Obtaining task input text associated with the text generation task;
[0171] If the task input text contains an initial description text, obtaining at least one text expansion direction from a business prompt template associated with the target business model;
[0172] Determining a target text expansion direction from at least one text expansion direction according to the text generation task and the initial description text, and using the target text expansion direction as a task requirement direction adapted to the initial description text;
[0173] The business prompt template generates a second task requirement description text based on the initial description text and the task requirement direction; the second task requirement description text is a text different from the task entry text.
[0174] In one embodiment, the target business model further includes a first word segmentation embedding layer and a first feature conversion layer. When the first serialization processing unit 12 is used to perform text serialization processing on the initial description text to obtain the first serialization feature of the initial description text, it is specifically used to:
[0175] Perform word segmentation processing on the initial description text through the first word segmentation embedding layer to obtain text segmentation of the initial description text, perform word embedding processing on the text segmentation to obtain word embedding coding features of the text segmentation;
[0176] Determine the text position of the text segmentation word in the initial description text, and perform position encoding on the text position through the first feature conversion layer to obtain the position encoding feature of the text segmentation word;
[0177] The first feature conversion layer performs feature serialization processing on the word embedding encoding feature based on the position encoding feature to obtain the first serialization feature of the initial description text.
[0178] In one embodiment, the plurality of extended network components are components of K extended network components, the K extended network components are components configured in the target service model that can perform text expansion; K is an integer greater than 1;
[0179] The text processing device 10 further includes: a text complexity determination unit 16 and a network component determination unit 17;
[0180] The text complexity determination unit 16 is specifically configured to:
[0181] Determine the text complexity of the text generation task based on the task type and task requirement description text content; the text complexity is used to determine the number of extended network components adapted to the text generation task;
[0182] The network component determination unit 17 is specifically configured to:
[0183] According to the number of extended network components determined by the text complexity, a plurality of continuous extended network components that match the number of extended network components are screened from the K extended network components, and the screened plurality of continuous extended network components are determined as a plurality of extended network components suitable for the text generation task.
[0184] In one embodiment, any two consecutive extended network components in the plurality of extended network components include a first extended network component and a second extended network component, and the second extended network component is a subsequent extended network component of the first extended network component;
[0185] When the first feature extension unit 13 is used to input the first serialization feature into a plurality of extended network components, and each of the plurality of extended network components performs feature extension processing on the first serialization feature according to the task requirement direction, to obtain a plurality of first serialization extended features associated with the first serialization feature, the first feature extension unit 13 is specifically used to:
[0186] inputting the first serialized feature into the first extended network component and the second extended network component, respectively;
[0187] The first extended network component obtains a first serialized input feature through the first serialized feature, performs a first feature expansion process on the first serialized input feature according to the task requirement, obtains a first serialized extended feature of the first extended network component, and uses the first serialized extended feature of the first extended network component as a first serialized output feature output by the first extended network component;
[0188] Inputting the first serialized output feature into the second extended network component, the second extended network component performs feature merging on the first serialized input feature and the first serialized output feature, and using the serialized feature obtained by the feature merging as the second serialized input feature;
[0189] The second extended network component performs a second feature expansion process on the second serialized input feature according to the task requirement to obtain a first serialized extended feature of the second extended network component, and uses the first serialized extended feature of the second extended network component as the second serialized output feature output by the second extended network component;
[0190] A plurality of first serialization extension features associated with the first serialization feature are determined through the first serialization output feature and the second serialization output feature.
[0191] In one embodiment, when the first feature expansion unit 13 is used to execute the first extended network component to obtain the first serialized input feature through the first serialized feature, it is specifically used to:
[0192] If the first extended network component is the first extended network component among the plurality of extended network components, the first extended network component uses the first serialization feature as the first serialization input feature;
[0193] If the first extended network component is not the first extended network component among multiple extended network components, the extended network component determined from the non-first extended network component to the first extended network component is used as the target processing extended network component with serialized output characteristics, the first serialization characteristic and the serialization output characteristic of the target processing extended network component are feature merged, and the serialization characteristic obtained by the feature merging is used as the first serialization input feature.
[0194] In one embodiment, the feature processing unit 14 is configured to perform feature processing on the first serialization feature and the plurality of first serialization extension features to obtain the first serialization processing feature, and output the extended description text using the first serialization processing feature, specifically configured to:
[0195] Performing feature concatenation processing on the first serialization feature and the plurality of first serialization extension features to obtain a first serialization processing feature;
[0196] If an end mark feature related to the generation end mark of the text generation task is detected in the first serialization processing feature, the first serialization processing feature carrying the end mark feature will be used as the target serialization splicing feature, and the target serialization splicing feature will be feature decoded to obtain the extended description text.
[0197] In one embodiment, the feature dimension of the first serialization feature is a first feature dimension, the feature dimension of the first serialization processing feature is a second feature dimension, and the second feature dimension is greater than the first feature dimension;
[0198] The text processing device 10 further includes: a first dimension alignment unit 18;
[0199] The first dimension alignment unit 18 is specifically configured to:
[0200] If the end marker feature is not detected in the first serialization processing feature, then based on the first feature dimension, the second feature dimension of the first serialization processing feature is aligned to obtain the dimension-aligned first serialization processing feature, and the dimension-aligned first serialization processing feature is determined as the second serialization feature; the feature dimension of the second serialization feature is the first feature dimension;
[0201] The first serialization feature is updated by using the second serialization feature to obtain the first serialization feature after the feature update, and the first serialization feature after the feature update is input into multiple extended network components.
[0202] In one embodiment, the first feature expansion unit 13 is further configured to input the second serialized feature into the multiple extended network components when inputting the first serialized feature after the feature update into the multiple extended network components, and each of the multiple extended network components performs feature expansion processing on the second serialized feature according to the task requirement direction, to obtain multiple second serialized extended features associated with the second serialized feature;
[0203] The feature processing unit 14 is also used to perform feature splicing processing on the second serialization feature and multiple second serialization extension features to obtain a second serialization splicing feature; if an end mark feature is detected in the second serialization processing feature, the extended description text containing the initial description text is output through the second serialization processing feature.
[0204] It can be understood that the functions of each functional unit of the text processing device 10 provided in the embodiment of the present application can be specifically implemented according to the method in the above method embodiment. The specific implementation process can refer to the relevant description in the above method embodiment, and will not be repeated here.
[0205] In a feasible embodiment, the text processing device 10 provided in the embodiment of the present application can be implemented in software. The text processing device 10 can be stored in a memory. It can be software in the form of programs and plug-ins, and includes a series of units, including a task requirement acquisition unit 11, a first serialization processing unit 12, a first feature expansion unit 13, and a feature processing unit 14; wherein the task requirement acquisition unit 11, the first serialization processing unit 12, the first feature expansion unit 13, and the feature processing unit 14 are used to implement the text processing method provided in the embodiment of the present application.
[0206] See Figure 14 , Figure 14 This is a structural diagram of another text processing device provided by an embodiment of the present application. Figure 14 As shown, the text processing device 20 can be a computer program running on a terminal device (for example, the above-mentioned device 11a), or a computer program running on a server 100a. For example, the text processing device 20 is an application software. It is understandable that the text processing device 20 can be used to execute the corresponding steps of the text processing method provided in the embodiment of the present application. Figure 14 As shown, the text processing device 20 may include: a sample data acquisition unit 21, a second serialization processing unit 22, a second feature expansion unit 23, and a model training unit 24;
[0207] The sample data acquisition unit 21 is configured to acquire training sample data for training an initial service model, wherein the training sample data includes a reference description text, a reference extension direction for the reference description text, and a reference extension text related to the reference extension direction; the initial service model includes K extension network components capable of text extension;
[0208] A second serialization processing unit 22 is configured to perform text serialization processing on the reference description text to obtain a first reference serialization feature of the reference description text;
[0209] The second feature expansion unit 23 is configured to input the first reference serialization feature into K extended network components, and each of the K extended network components performs feature expansion processing on the first reference serialization feature according to the reference expansion direction to obtain K first predicted serialization extension features corresponding to the K extended network components, and generate predicted extended text including the reference description text based on the first reference serialization feature and the K first predicted serialization extension features; K is an integer greater than 1;
[0210] The model training unit 24 is used to perform model training on the initial business model based on the predicted extended text and the reference extended text, and use the initial business model after model training as the target business model; the target business model is used to expand the initial description text in the task requirement description text according to the task requirement direction in the task requirement description text when obtaining the task requirement description text associated with the text generation task, so as to obtain the extended description text.
[0211] In one embodiment, when the model training unit 24 is used to perform model training on the initial business model based on the predicted extended text and the reference extended text, and use the trained initial business model as the target business model, it is specifically used to:
[0212] Based on a preset text extension window, the first predicted serialization feature included in the predicted extension text is divided into N predicted extension text sets; each predicted extension text set includes K predicted serialization extension features, and the window length of the preset text extension window is determined by the number of extended network components included in the initial business model; N is a positive integer;
[0213] Obtaining weight data of keywords included in each of the N predicted expanded text sets;
[0214] Determining model difference data of the initial business model based on the predicted serialized extension features included in the N predicted extended text sets, the reference extended serialized features corresponding to the reference extended texts, and weight data of keywords included in each predicted extended text set;
[0215] The initial business model is trained based on the model difference data, and the initial business model after model training is used as the target business model.
[0216] In one embodiment, the text processing apparatus 20 further includes: a difference data determining unit 25;
[0217] When the difference data determining unit 25 is used to determine the model difference data of the initial business model based on the predicted serialized extension features included in the N predicted extended text sets, the reference extended serialized features corresponding to the reference extended texts, and the weight data of the keywords included in each predicted extended text set, it is specifically used to:
[0218] determining first difference data for each predicted extended text set according to the predicted serialized extended feature in each predicted extended text set in the N predicted extended text sets and the reference extended serialized feature corresponding to the reference extended text;
[0219] determining second difference data for each predicted expanded text set based on weight data of the keywords included in each predicted expanded text set and the first difference data of the keywords;
[0220] Obtaining first weight data of the first difference data and second weight data of the second difference data, and determining difference data of each predicted extended text set based on the first difference data, the first difference data of each predicted extended text set, the first weight data, and the second difference data of each predicted extended text set;
[0221] Model difference data of the initial business model is determined according to the difference data of each predicted extended text set.
[0222] In one embodiment, the N predicted expanded text sets include a predicted expanded text set i, where i is an integer greater than or equal to 1 and less than or equal to N;
[0223] The difference data determining unit 25 is configured to determine first difference data for each predicted extended text set based on the predicted serialization extension feature in each of the N predicted extended text sets and the reference extended serialization feature corresponding to the reference extended text, specifically:
[0224] Obtain the reference extension serialization feature corresponding to the reference extension text and the reference tag of each reference extension serialization feature;
[0225] Obtain the predicted probability of each predicted serialized extension feature in the predicted extended text set i matching the reference extended serialized feature, and obtain the reference label of each predicted serialized extension feature in the reference extended serialized feature;
[0226] Determining difference data of each predicted serialization extension feature according to the predicted probability of each predicted serialization extension feature and the reference label of each predicted serialization extension feature;
[0227] According to the difference data of each predicted serialized extension feature, first difference data of the predicted extension text set i is determined.
[0228] In one embodiment, when the difference data determining unit 25 is used to determine the second difference data of each predicted expanded text set based on the weight data of the keywords included in each predicted expanded text set and the first difference data of the keywords, it is specifically used to:
[0229] Obtain the reference extension serialization feature corresponding to the reference extension text and the reference tag of the keyword in the reference extension serialization feature;
[0230] Obtaining a predicted probability of a match between the keyword and the reference extended serialization feature, and determining first difference data for the keyword based on the predicted probability of the keyword and a reference tag of the keyword in the reference extended serialization feature;
[0231] Second difference data for each predicted expanded text set is determined based on weight data of the keywords included in each predicted expanded text set and the first difference data of the keywords.
[0232] It can be understood that the functions of each functional unit of the text processing device 20 provided in the embodiment of the present application can be specifically implemented according to the method in the above method embodiment. The specific implementation process can refer to the relevant description in the above method embodiment, and will not be repeated here.
[0233] In a feasible embodiment, the text processing device 20 provided in the embodiment of the present application can be implemented in software. The text processing device 20 can be stored in a memory. It can be software in the form of programs and plug-ins, and includes a series of units, including a sample data acquisition unit 21, a second serialization processing unit 22, a second feature expansion unit 23, and a model training unit 24; wherein the sample data acquisition unit 21, the second serialization processing unit 22, the second feature expansion unit 23, and the model training unit 24 are used to implement the text processing method provided in the embodiment of the present application.
[0234] See Figure 15 , Figure 15 1 is a schematic diagram of the structure of a computer device provided in an embodiment of the present application. For example, the computer device may be the terminal device or server mentioned above. For ease of understanding, the computer device is described here as an example of a terminal device. Figure 15 As shown, the computer device 1000 may include: a processor 1001, a network interface 1004 and a memory 1005. In addition, the above-mentioned computer device 1000 may also include: a user interface 1003, and at least one communication bus 1002. The communication bus 1002 is used to realize the connection and communication between these components. Optionally, the user interface 1003 may include a display screen (Display), a keyboard (Keyboard), and optionally, the user interface 1003 may also include a standard wired interface and a wireless interface. The network interface 1004 may optionally include a standard wired interface and a wireless interface (such as a WI-FI interface). The memory 1005 may be a high-speed RAM memory, or a non-volatile memory (non-volatile memory), such as at least one disk memory. The memory 1005 may optionally also be at least one storage device located away from the aforementioned processor 1001. As Figure 15 As shown, the memory 1005 as a computer-readable storage medium may include an operating system, a network communication module, a user interface module, and a device control application.
[0235] In such Figure 15 In the illustrated computer device 1000, the network interface 1004 provides network communication functionality; the user interface 1003 primarily provides an interface for user input; and the processor 1001 can be used to invoke a device control application stored in the memory 1005 to execute the image processing method described in any of the corresponding embodiments above, which will not be repeated here. Furthermore, the beneficial effects of employing the same method will not be repeated here.
[0236] In addition, it should be pointed out here that: the embodiment of the present application also provides a computer-readable storage medium, and the computer-readable storage medium stores a computer program executed by the text processing device 10 or the text processing device 20 mentioned above, and the computer program includes program instructions. When the processor executes the program instructions, it can execute the description of the image processing method in the above embodiment. Therefore, it will not be repeated here. In addition, the description of the beneficial effects of using the same method will not be repeated. For technical details not disclosed in the computer-readable storage medium embodiment involved in this application, please refer to the description of the method embodiment of this application.
[0237] The computer-readable storage medium may be the text processing apparatus provided in any of the aforementioned embodiments or the internal storage unit of the computer device, such as the hard disk or memory of the computer device. The computer-readable storage medium may also be an external storage device of the computer device, such as a plug-in hard disk, a smart media card (SMC), a secure digital (SD) card, a flash card, etc. equipped on the computer device. Furthermore, the computer-readable storage medium may include both the internal storage unit of the computer device and an external storage device. The computer-readable storage medium is used to store the computer program and other programs and data required by the computer device. The computer-readable storage medium may also be used to temporarily store data that has been output or is to be output.
[0238] In addition, it should be noted that the embodiments of the present application also provide a computer program product, including a computer program, the computer program being stored in a computer-readable storage medium, and the computer program being suitable for being read and executed by a processor, so that a computer device having a processor performs the method provided in any of the corresponding embodiments described above. In addition, the description of the beneficial effects of adopting the same method will not be repeated. For technical details not disclosed in the computer program product or computer program embodiments involved in this application, please refer to the description of the method embodiments of this application.
[0239] The terms "first," "second," and the like in the description, claims, and drawings of the embodiments of this application are used to distinguish between different objects, rather than to describe a specific order. Furthermore, the terms "comprises" and "comprising" and any variations thereof are intended to cover non-exclusive inclusions. For example, a process, method, apparatus, product, or device comprising a series of steps or units is not limited to the listed steps or modules, but may optionally include steps or modules not listed, or may optionally include other steps and units inherent to such process, method, apparatus, product, or device.
[0240] Those skilled in the art will appreciate that the units and algorithm steps of each example described in conjunction with the embodiments disclosed herein can be implemented in electronic hardware, computer software, or a combination of the two. In order to clearly illustrate the interchangeability of hardware and software, the composition and steps of each example have been generally described in terms of function in the above description. Whether these functions are performed in hardware or software depends on the specific application and design constraints of the technical solution. Professional and technical personnel can use different methods to implement the described functions for each specific application, but such implementation should not be considered to be beyond the scope of this application.
[0241] The above disclosure is only a preferred embodiment of the present application, and certainly cannot be used to limit the scope of rights of the present application. Therefore, equivalent changes made according to the claims of the present application are still within the scope covered by the present application.< / eos> < / sos> < / eos> < / sos>
Claims
1. A text processing method, characterized in that: The method comprises: Obtaining a task requirement description text associated with a text generation task; the task requirement description text is used to instruct a target business model to perform text expansion on an initial description text in accordance with the task requirement direction; the target business model includes a plurality of extended network components adapted to the text generation task; Performing text serialization processing on the initial description text to obtain a first serialization feature of the initial description text; Inputting the first serialization feature into the multiple extended network components, and having each of the multiple extended network components perform feature extension processing on the first serialization feature according to the task requirement direction, to obtain multiple first serialization extension features associated with the first serialization feature; The first serialization feature and the multiple first serialization extension features are feature processed to obtain a first serialization processing feature, and an extended description text is output through the first serialization processing feature; the extended description text refers to the text obtained by text expansion of the initial description text according to the task requirement direction.
2. The method according to claim 1, characterized in that The task requirement description text includes a first task requirement description text; The step of obtaining a task requirement description text associated with the text generation task includes: Obtaining task input text associated with the text generation task; If the task entry text contains the initial description text and the task requirement direction, the first task requirement description text is generated according to the initial description text and the task requirement direction through the business prompt template associated with the target business model; the first task requirement description text is a text different from the task entry text.
3. The method according to claim 1, characterized in that The task requirement description text includes a second task requirement description text; The step of obtaining a task requirement description text associated with the text generation task includes: Obtaining task input text associated with the text generation task; If the task input text includes the initial description text, obtaining at least one text expansion direction from a business prompt template associated with the target business model; Determining a target text expansion direction from the at least one text expansion direction according to the text generation task and the initial description text, and using the target text expansion direction as a task requirement direction adapted to the initial description text; The business prompt template generates the second task requirement description text according to the initial description text and the task requirement direction; the second task requirement description text is a text different from the task entry text.
4. The method according to claim 1, wherein The target business model further includes a first word segmentation embedding layer and a first feature conversion layer; The performing text serialization processing on the initial description text to obtain a first serialization feature of the initial description text includes: Performing word segmentation processing on the initial description text through the first word segmentation embedding layer to obtain text segmentations of the initial description text, and performing word embedding processing on the text segmentations to obtain word embedding coding features of the text segmentations; Determining a text position of the text segmentation word in the initial description text, and performing position encoding on the text position through the first feature conversion layer to obtain a position encoding feature of the text segmentation word; The first feature conversion layer performs feature serialization processing on the word embedding encoding feature based on the position encoding feature to obtain a first serialization feature of the initial description text.
5. The method according to claim 1, wherein The multiple extended network components are components in K extended network components, and the K extended network components are components capable of performing text expansion and configured in the target service model; K is an integer greater than 1; The method further comprises: Determining the text complexity of the text generation task based on the task type of the text generation task and the text content of the task requirement description text; The text complexity is used to determine the number of extended network components adapted to the text generation task; According to the number of extended network components determined by the text complexity, a continuous plurality of extended network components that matches the number of extended network components is screened from the K extended network components, and the screened continuous plurality of extended network components are determined as the multiple extended network components adapted for the text generation task.
6. The method according to claim 1, characterized in that Any two consecutive extended network components among the plurality of extended network components include a first extended network component and a second extended network component, wherein the second extended network component is a next extended network component of the first extended network component; The step of inputting the first serialization feature into the multiple extended network components, and each of the multiple extended network components performing feature extension processing on the first serialization feature according to the task requirement direction, to obtain multiple first serialization extension features associated with the first serialization feature, includes: inputting the first serialization feature into the first extended network component and the second extended network component respectively; The first extended network component obtains a first serialized input feature through the first serialized feature, performs a first feature expansion process on the first serialized input feature according to the task requirement, obtains a first serialized extended feature of the first extended network component, and uses the first serialized extended feature of the first extended network component as a first serialized output feature output by the first extended network component; Inputting the first serialized output feature into the second extended network component, and having the second extended network component merge the first serialized input feature and the first serialized output feature, and using the serialized feature obtained by the feature merging as the second serialized input feature; The second extended network component performs a second feature expansion process on the second serialized input feature according to the task requirement direction to obtain a first serialized extended feature of the second extended network component, and uses the first serialized extended feature of the second extended network component as a second serialized output feature output by the second extended network component; A plurality of first serialization extension features associated with the first serialization feature are determined according to the first serialization output feature and the second serialization output feature.
7. The method according to claim 6, characterized in that The first extended network component obtaining the first serialized input feature through the first serialized feature includes: If the first extended network component is the first extended network component among the multiple extended network components, the first extended network component uses the first serialization feature as the first serialization input feature; If the first extended network component is not the first extended network component among the multiple extended network components, then the extended network component determined from the non-first extended network component to the first extended network component is used as the target processing extended network component with a serialized output feature, the first serialization feature and the serialization output feature of the target processing extended network component are feature merged, and the serialization feature obtained by the feature merging is used as the first serialization input feature.
8. The method according to claim 1, characterized in that The step of performing feature processing on the first serialization feature and the plurality of first serialization extension features to obtain a first serialization processing feature, and outputting an extended description text using the first serialization processing feature includes: Performing feature concatenation processing on the first serialization feature and the plurality of first serialization extension features to obtain a first serialization processing feature; If an end mark feature related to the generation end mark of the text generation task is detected in the first serialization processing feature, the first serialization processing feature carrying the end mark feature will be used as the target serialization processing feature, and the target serialization processing feature will be subjected to feature decoding processing to obtain an extended description text.
9. The method according to claim 8, characterized in that The feature dimension of the first serialization feature is a first feature dimension, the feature dimension of the first serialization processing feature is a second feature dimension, and the second feature dimension is greater than the first feature dimension; The method further comprises: If the end marker feature is not detected in the first serialization processing feature, then, based on the first feature dimension, perform feature dimension alignment on the second feature dimension of the first serialization processing feature to obtain a dimension-aligned first serialization processing feature, and determine the dimension-aligned first serialization processing feature as the second serialization feature; the feature dimension of the second serialization feature is the first feature dimension; The first serialization feature is updated by using the second serialization feature to obtain a first serialization feature after the feature update, and the first serialization feature after the feature update is input into the multiple extended network components.
10. The method according to claim 9, characterized in that The method further comprises: When the first serialized feature after the feature update is input into the multiple extended network components, the second serialized feature is input into the multiple extended network components, and each extended network component in the multiple extended network components performs feature extension processing on the second serialized feature according to the task requirement direction, to obtain multiple second serialized extended features associated with the second serialized feature; Performing feature processing on the second serialization feature and the plurality of second serialization extension features to obtain a second serialization processing feature; If the end mark feature is detected in the second serialization processing feature, the extended description text is output through the second serialization processing feature.
11. A text processing method, characterized in that: The method comprises: Acquire training sample data for training an initial business model, the training sample data including a reference description text, a reference extension direction for the reference description text, and a reference extension text related to the reference extension direction; the initial business model includes K extension network components capable of performing text extension; Performing text serialization processing on the reference description text to obtain a first reference serialization feature of the reference description text; Inputting the first reference serialization feature into the K extended network components, each of the K extended network components performing feature expansion processing on the first reference serialization feature according to the reference expansion direction, obtaining K first predicted serialization extension features corresponding to the K extended network components, and generating predicted extended text containing the reference description text based on the first reference serialization feature and the K first predicted serialization extension features; K is an integer greater than 1; The initial business model is trained based on the predicted extended text and the reference extended text, and the initial business model after model training is used as the target business model; the target business model is used to expand the initial description text in the task requirement description text according to the task requirement direction in the task requirement description text when obtaining the task requirement description text associated with the text generation task, so as to obtain the extended description text.
12. The method according to claim 11, characterized in that The performing model training on the initial business model according to the predicted extended text and the reference extended text, and using the trained initial business model as the target business model, includes: Based on a preset text extension window, the first predicted serialization feature included in the predicted extended text is divided into N predicted extended text sets; each predicted extended text set includes K predicted serialization extended features, and the window length of the preset text extension window is determined by the number of extended network components included in the initial business model; N is a positive integer; Obtaining weight data of keywords included in each of the N predicted expanded text sets; determining model difference data of the initial business model based on the predicted serialized extension features included in the N predicted extended text sets, the reference extended serialized features corresponding to the reference extended texts, and weight data of keywords included in each predicted extended text set; The initial business model is trained according to the model difference data, and the initial business model after model training is used as the target business model.
13. The method according to claim 12, characterized in that The determining of the model difference data of the initial business model based on the predicted serialized extension features included in the N predicted extended text sets, the reference extended serialized features corresponding to the reference extended texts, and the weight data of the keywords included in each predicted extended text set includes: determining first difference data for each of the N predicted extended text sets based on a predicted serialization extension feature in each of the N predicted extended text sets and a reference extended serialization feature corresponding to the reference extended text; determining second difference data for each predicted expanded text set according to weight data of keywords included in each predicted expanded text set and first difference data of the keywords; Obtaining first weight data of the first difference data and second weight data of the second difference data, and determining difference data of each predicted extended text set based on the first difference data, the first difference data of each predicted extended text set, the first weight data, and the second difference data of each predicted extended text set; The model difference data of the initial business model is determined according to the difference data of each predicted extended text set.
14. The method according to claim 13, characterized in that The N predicted expanded text sets include a predicted expanded text set i, where i is an integer greater than or equal to 1 and less than or equal to N; The determining, based on the predicted serialization extension feature in each of the N predicted extended text sets and the reference extended serialization feature corresponding to the reference extended text, first difference data of each predicted extended text set includes: Obtaining a reference extended serialization feature corresponding to the reference extended text and a reference tag of each reference extended serialization feature; Obtaining a predicted probability that each predicted serialized extension feature in the predicted extended text set i matches the reference extended serialized feature, and obtaining a reference tag of each predicted serialized extension feature in the reference extended serialized feature; Determining difference data of each predicted serialization extension feature according to the predicted probability of each predicted serialization extension feature and the reference label of each predicted serialization extension feature; The first difference data of the predicted extended text set i is determined according to the difference data of each predicted serialized extended feature.
15. The method according to claim 13, characterized in that The determining, based on the weight data of the keywords included in each predicted expanded text set and the first difference data of the keywords, of the second difference data of each predicted expanded text set comprises: Obtaining a reference extended serialization feature corresponding to the reference extended text and a reference tag of the keyword in the reference extended serialization feature; Obtaining a predicted probability of the keyword matching the reference extended serialization feature, and determining first difference data for the keyword based on the predicted probability of the keyword and a reference tag of the keyword in the reference extended serialization feature; The second difference data of each predicted expanded text set is determined according to the weight data of the keywords included in each predicted expanded text set and the first difference data of the keywords.
16. A text processing device, characterized in that: The device comprises: A task requirement acquisition unit is used to acquire a task requirement description text associated with a text generation task; the task requirement description text is used to instruct a target business model to perform text expansion on an initial description text in accordance with the task requirement direction; the target business model includes a plurality of extended network components adapted to the text generation task; A first serialization processing unit, configured to perform text serialization processing on the initial description text to obtain a first serialization feature of the initial description text; a first feature extension unit, configured to input the first serialization feature into the plurality of extended network components, and each of the plurality of extended network components performs feature extension processing on the first serialization feature according to the task requirement direction, to obtain a plurality of first serialization extended features associated with the first serialization feature; A feature processing unit is used to perform feature processing on the first serialization feature and the multiple first serialization extension features to obtain a first serialization processing feature, and output an extended description text through the first serialization processing feature; the extended description text refers to the text obtained by text expansion of the initial description text according to the task requirement direction.
17. A text processing device, characterized in that: The device comprises: a sample data acquisition unit, configured to acquire training sample data for training an initial business model, the training sample data comprising a reference description text, a reference extension direction for the reference description text, and a reference extension text related to the reference extension direction; the initial business model comprising K extended network components capable of text extension; A second serialization processing unit is configured to perform text serialization processing on the reference description text to obtain a first reference serialization feature of the reference description text; a second feature expansion unit, configured to input the first reference serialization feature into the K extended network components, and have each of the K extended network components perform feature expansion processing on the first reference serialization feature according to the reference expansion direction to obtain K first predicted serialization extension features corresponding to the K extended network components, and generate predicted extended text containing the reference description text based on the first reference serialization feature and the K first predicted serialization extension features; K is an integer greater than 1; The model training unit is used to perform model training on the initial business model based on the predicted extended text and the reference extended text, and use the initial business model after model training as the target business model; the target business model is used to, when obtaining the task requirement description text associated with the text generation task, perform text expansion on the initial description text in the task requirement description text according to the task requirement direction in the task requirement description text to obtain the extended description text.
18. A computer device, characterized in that: including memory and processor; The memory is connected to the processor, the memory is used to store a computer program, and the processor is used to call the computer program so that the computer device executes the method according to any one of claims 1 to 15.
19. A computer-readable storage medium, characterized in that The computer-readable storage medium stores a computer program, which is suitable for being loaded and executed by a processor, so that a computer device having the processor executes the method according to any one of claims 1 to 15.
20. A computer program product, characterized in that The invention comprises a computer program product, wherein the computer program is stored in a computer-readable storage medium, and the computer program is suitable for being read and executed by a processor, so that a computer device having the processor executes the method according to any one of claims 1 to 15.