Text generation method, text model training method, electronic equipment, storage medium and program product

Text requests are generated through the topic and style information entered by the user, and fine-tuning training is used for use with a general generative basic model, which solves the problem that LLM cannot generate and meet user style requirements, and realizes the personalized needs of text generation.

CN119090002APending Publication Date: 2024-12-06UC MOBILE CHINA CO LTD
View PDF 0 Cites 1 Cited by

Patent Information

Application Number
CN202410963796.4
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-07-17
Publication Date
2024-12-06

AI Technical Summary

Technical Problem

Existing large language models (LLMs) cannot accurately generate text that meets user style requirements and cannot provide text with a certain style under personalized needs.

Method used

The text generation request is generated through the topic information and style requirements information entered by the user. The text generation model based on the general generative basic model is trained, and the model is fine-tuned to generate text that meets a specific style.

Benefits of technology

It realizes the accurate generation of text that meets the predefined style requirements based on user needs, and meets users' personalized needs for text generation.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119090002A_ABST
    Figure CN119090002A_ABST
Patent Text Reader

Abstract

The embodiment of the invention provides a text generation method, a text model training method, electronic equipment, a storage medium and a program product. The text generation method comprises the steps that a text generation request is generated according to input data of a user and sent to a server side, and theme information of a to-be-generated text and style requirement information of the to-be-generated text are carried in the text generation request; receiving a text generated by a text generation model of the server in response to the text generation request, the text being a text which is generated by the text generation model with theme information in the input data as a theme and has a text style meeting a style indicated by the style requirement information, the text generation model is obtained based on a general generation type basic model. According to the scheme, the text meeting the style requirement can be accurately generated.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The embodiments of the present application relate to the field of computer technology, and in particular to a text generation method, a text generation model training method, an electronic device, a computer storage medium, and a computer program product. Background Art

[0002] At present, machine learning models, such as LLM (Large Language Model), are playing an increasingly important role in people's work and life.

[0003] LLM is a model trained based on massive text data that can not only generate natural language text, but also deeply understand the meaning of text and handle various natural language tasks, such as text summarization, question answering, translation, etc. Although LLM itself has strong processing capabilities, its capabilities are generalized and cannot meet the personalized needs of users at certain times. For example, in some scenarios, users want to use LLM to generate text with a certain style, or generate text with different styles to meet different needs, etc. However, the current LLM and models similar to LLM cannot meet this demand.

[0004] Therefore, how to accurately generate text that meets style requirements has become an urgent problem to be solved. Summary of the invention

[0005] In view of this, embodiments of the present application provide a text generation method, a text generation model training method, an electronic device, a computer storage medium, and a computer program product to at least partially solve the above-mentioned problems.

[0006] According to a first aspect of an embodiment of the present application, a text generation method is provided, comprising: using user input data to generate a text generation request, and sending it to a server, wherein the text generation request carries subject information of a text to be generated and style requirement information of the text to be generated; receiving text generated by a text generation model of the server in response to the text generation request, wherein the text is a text generated by the text generation model with the subject information in the input data as the subject and a text style that satisfies the style indicated by the style requirement information, and the text generation model is obtained by training based on a general generative basic model.

[0007] According to a second aspect of an embodiment of the present application, a text generation method is provided, comprising: obtaining subject information of a text to be generated and style requirement information of the text to be generated from a text generation request sent by a user device, and generating prompt information; inputting the prompt information into a text generation model, so as to generate a text with the subject information as the subject and a style satisfying the style indicated by the style requirement information through the text generation model; wherein the text generation model is obtained based on training of a general generative basic model.

[0008] According to a third aspect of an embodiment of the present application, a method for training a line of text generation model is provided, comprising: obtaining training samples for model training, the training samples comprising prompt information samples and corresponding reply data samples, the prompt information samples containing style requirement information of a text to be generated, and the text style of the reply data sample matches the style indicated by the style requirement information; inputting the prompt information sample into a universal generative basic model so that the universal generative basic model generates text based on the prompt information sample to obtain a text generation data sample; and fine-tuning the universal generative basic model at least according to the difference between the text style of the text generation data sample and the text style of the reply data sample to obtain a text generation model that can generate text of a corresponding style according to the style requirement information.

[0009] According to a fourth aspect of an embodiment of the present application, there is provided an electronic device, comprising: a processor, a communication interface, a memory and a communication bus, wherein the processor, the communication interface and the memory communicate with each other via the communication bus; the memory is used to store a computer program; the processor is used to execute any one of the methods described in the first, second and third aspects above by running the computer program stored in the memory.

[0010] According to a fifth aspect of an embodiment of the present application, a computer storage medium is provided, on which a computer program is stored. When the computer program is executed by a processor, the method described in any one of the first aspect, the second aspect, and the third aspect is implemented.

[0011] According to a sixth aspect of an embodiment of the present application, a computer program product is provided, including a computer program, which, when executed by a processor, implements the method described in any one of the first aspect, the second aspect, and the third aspect.

[0012] According to the text generation scheme provided by the embodiment of the present application, a text generation request can be generated according to the user's input data and sent to the server. The text generation request carries the subject information of the text to be generated and the style requirement information of the text to be generated. Then, the text generated by the text generation model obtained based on the general generative basic model on the server in response to the text generation request is received. The text is a text generated by the text generation model with the subject information in the input data as the subject and the style of the text meeting the style indicated by the style requirement information. Therefore, the scheme of the embodiment of the present application can use the text generation model to more accurately generate text that meets the predetermined style requirements, thereby better meeting the user's needs for text generation. BRIEF DESCRIPTION OF THE DRAWINGS

[0013] In order to more clearly illustrate the embodiments of the present application or the technical solutions in the prior art, the drawings required for use in the embodiments or the description of the prior art will be briefly introduced below. Obviously, the drawings described below are only some embodiments recorded in the embodiments of the present application. For ordinary technicians in this field, other drawings can also be obtained based on these drawings.

[0014] Figure 1 A schematic diagram of an exemplary system applicable to the embodiment scheme of the present application.

[0015] Figure 2 The present invention is a flowchart of the steps of a text generation model training method according to an embodiment of the present application.

[0016] Figure 3 This is an optional flowchart of a method for obtaining training samples in step S202 of an embodiment of the present application.

[0017] Figure 4 This is an optional flowchart of step S204 of an embodiment of the present application.

[0018] Figure 5 This is a flowchart of the steps of a text generation method according to an embodiment of the present application.

[0019] Fig. 6A for Figure 5 A schematic diagram of a human-computer interaction interface on a user device side in the illustrated embodiment.

[0020] Figure 6B for Figure 5 A schematic diagram of another human-computer interaction interface on the user equipment side in the illustrated embodiment.

[0021] Figure 6C for Figure 5 A schematic diagram of a human-computer interaction interface on a user device side in another embodiment is shown.

[0022] Figure 7 This is a flowchart of the steps of another text generation method according to an embodiment of the present application.

[0023] Figure 8 for Figure 7 An optional flow chart of step S704 in the illustrated embodiment.

[0024] Fig. 9 This is a scene example diagram according to an embodiment of the present application.

[0025] Fig.10 It is a schematic diagram of the structure of an electronic device according to an embodiment of the present application. DETAILED DESCRIPTION

[0026] In order to enable those skilled in the art to better understand the technical solutions in the embodiments of the present application, the technical solutions in the embodiments of the present application will be clearly and completely described below in conjunction with the drawings in the embodiments of the present application. Obviously, the described embodiments are only part of the embodiments of the present application, not all of the embodiments. All other embodiments obtained by ordinary technicians in this field based on the embodiments in the embodiments of the present application should fall within the scope of protection of the embodiments of the present application.

[0027] Figure 1 An exemplary system applicable to the embodiment of the present application is shown. Figure 1 As shown, the system 100 may include a cloud service end 102, a communication network 104 and / or one or more user devices 106. Figure 1 The example in FIG. 1 is a plurality of user devices.

[0028] The cloud service end 102 may be any suitable device for storing information, data, programs and / or any other suitable type of content, including but not limited to distributed storage system devices, server clusters, computing cloud service end clusters, etc. In some embodiments, the cloud service end 102 may perform any suitable function. For example, in some embodiments, the cloud service end 102 may generate text with a certain style. For example, the cloud service end 102 may obtain the subject information and style requirement information of the text to be generated from the received text generation request; and then generate prompt information based on the subject information and style requirement information, so that the text generation model generates text that meets the style indicated by the style requirement information based on the prompt information. As an optional example, in some embodiments, a text generation model is deployed in the cloud service end 102, and the text generation model is obtained based on a general generative basic model. In some embodiments, the cloud service end 102 may also train the general generative basic model to obtain a text generation model that can generate text of a corresponding style according to the style requirement information. As an optional example, in some embodiments, when the cloud service end 102 performs model training, it can first obtain training samples for model training, the training samples include prompt information samples and corresponding reply data samples, the prompt information samples contain style requirement information of the text to be generated, and the text style of the reply data samples matches the style indicated by the style requirement information; then, the prompt information samples are input into the general generative basic model, so that the general generative basic model generates text based on the prompt information samples, and obtains the text generation data samples; then, at least according to the difference between the text style of the text generation data samples and the text style of the reply data samples, the general generative basic model is fine-tuned and trained to obtain a text generation model that can generate text of the corresponding style according to the style requirement information. Optionally, after generating the text, the cloud service end 102 can return the generated text to the user device 106.

[0029] In some embodiments, the communication network 104 can be any suitable combination of one or more wired and / or wireless networks. For example, the communication network 104 can include any one or more of the following: the Internet, an intranet, a wide area network (WAN), a local area network (LAN), a wireless network, a digital subscriber line (DSL) network, a frame relay network, an asynchronous transfer mode (ATM) network, a virtual private network (VPN) and / or any other suitable communication network. The user device 106 can be connected to the communication network 104 via one or more communication links (e.g., communication link 112), and the communication network 104 can be linked to the cloud service end 102 via one or more communication links (e.g., communication link 114). The communication link can be any communication link suitable for transmitting data between the user device 106 and the cloud service end 102, such as a network link, a dial-up link, a wireless link, a hard-wired link, any other suitable communication link, or any suitable combination of such links.

[0030] The user device 106 may include any one or more user devices suitable for presenting text, interacting with a user, etc. As an optional example, in some embodiments, the user device 106 may first generate a text generation request based on the user's input data, and send it to the cloud service end 102, the text generation request carrying the subject information of the text to be generated and the style requirement information of the text to be generated; receive the text generated by the text generation model of the cloud service end 102 in response to the text generation request, the text is a text generated by the text generation model with the subject information in the input data as the subject, and the text style meets the style indicated by the style requirement information. In some embodiments, the user device 106 may include any suitable type of device. For example, in some embodiments, the user device 106 may include a mobile device, a tablet computer, a laptop computer, a desktop computer and / or any other suitable type of user device. Optionally, a predetermined client program (such as a browser, etc.) may be installed on the user device 106, and the user's input data may be received through its human-computer interaction interface, so as to generate a text generation request based on the user's input data, and send it to the cloud service end 102 through the client program.

[0031] Based on the above system, the embodiments of the present application provide a text generation scheme and a text generation model training scheme, which are described below through multiple embodiments.

[0032] To facilitate the description of the embodiments of the present application, the training method of the text generation model is first described here. Figure 2 1 is a flowchart of the steps of a text generation model training method according to an embodiment of the present application. Figure 2 As shown, the text generation model training method includes steps S202, S204 and S206. Specifically:

[0033] S202: Obtain training samples for model training.

[0034] The training samples include prompt information samples and corresponding reply data samples. The prompt information samples contain style requirement information of the text to be generated, and the text style of the reply data samples matches the style indicated by the style requirement information.

[0035] In the embodiment of the present application, the style of the text refers to the writing style of the text, which is the writing characteristics of the writer presented in the text, such as a collection of unique personality, language habits, expression methods, and emotional colors, which can be reflected in multiple aspects such as language characteristics, narrative methods, emotional colors, and cultural background. In the embodiment of the present application, the prompt information sample contained in the training sample contains the style requirement information of the text to be generated, that is, the information of the writing style of the text that the user wants to generate. For example, the writing style is easy to understand, lively and interesting, professional and rigorous, etc. The embodiment of the present application does not limit the specific style type.

[0036] The training sample may come from a training sample set, and a training sample includes a pair of a prompt information sample and a response data sample.

[0037] In an embodiment of the present application, during the model training process, the prompt information sample in the training sample is also called a prompt sample, which can enable the model to be trained to generate text to generate text in the style indicated by the style requirement information contained in the prompt information sample. The prompt information sample may include historical prompt information, or the prompt information sample may be generated in a certain manner. Optionally, the style requirement information in the prompt information sample may be embodied in any style, which may specify a specific style, or may specify several styles. For example, as an example for easy understanding, the style requirement information may include "business style" or "casual style" in addition to the aforementioned examples.

[0038] In the embodiment of the present application, during the model training process, the reply data sample in the training sample can be used as a supervised condition for supervised training, so as to calculate the loss with the text generation data sample generated by the model prediction, and then perform model training based on the calculation results, including but not limited to adjusting the model parameters, etc. The text style of the reply data sample matches the style indicated by the style requirement information in the prompt information sample. For example, if the style requirement information of the above prompt information sample is "business style", the text style of the corresponding reply data sample can be business style; if the style requirement information of the above prompt information sample is "lively and interesting", the text style of the corresponding reply data sample can be lively and interesting style. On this basis, the prompt information sample in the training sample can be input into the general generative basic model for text generation, and then according to the preset loss function, based on the text style of the generated text (i.e., the text generation data sample) and the text style of the reply data sample, the loss value, i.e., the difference between the two, is calculated, and the model parameters are adjusted according to the loss value. This process is iteratively executed until the training termination condition is met, such as reaching a preset number of training times, or the loss value reaches a preset threshold, etc. Among them, the loss function used in the embodiments of the present application can be set by technical personnel in this field according to actual needs, including but not limited to the cross entropy loss function, etc. The embodiments of the present application do not limit the specific implementation of the loss function.

[0039] In some optional embodiments, a general generative basic model is used as a basis to obtain the required text generation model by fine-tuning it. In some implementations, the general generative basic model can adopt a large language model (Large Language Model, LLM for short). The large language model LLM itself has powerful text understanding and generation capabilities, and after proper training, it can effectively meet the text generation requirements. In the embodiment of the present application, the general generative basic model is trained by inputting training samples, and after the training is completed, a text generation model that can generate text that meets the style requirements is obtained.

[0040] For training samples, although the model can be trained based on paired prompt information samples and corresponding response data samples in one training sample at a time, in order to make the model more sensitive to style requirement information, in a feasible way, the model can also be trained by using training sample groups.

[0041] Optionally, refer to Figure 3 As shown in the flowchart, the method of obtaining training samples in step S202 may include steps S2021 and S2022, specifically:

[0042] S2021: Obtain training sample groups from a training sample set used for model training, each training sample group includes multiple training samples, and the multiple training samples include multiple prompt information samples and multiple reply data samples corresponding to the multiple prompt information samples. Among the multiple prompt information samples in the same group, except for the style requirement information, other information is the same.

[0043] The training sample set may include multiple training sample groups. Optionally, for any training sample group, each of the multiple training samples includes a prompt information sample and a reply data sample corresponding to the prompt information sample. In the training sample group, the multiple prompt information samples have the same information except for the style requirement information. For example, the other information may include the subject information of the text to be generated or the content requirement information.

[0044] In a specific example, suppose a training sample group contains 3 training samples, and the subject information in the 3 training samples is the same, but the style requirement information is different. For example, training sample 01 is "Please help me write an annual summary article, the requirement is business style"; training sample 02 is "Please help me write an annual summary article, the requirement is lively and interesting style"; training sample 03 is "Please help me write an annual summary article, the requirement is professional and rigorous style". It can be seen that in this group of training samples, the style requirement information is different, but the other information is the same.

[0045] In this way, the model can learn the style indicated by the style requirement information more effectively, and the cost and efficiency of obtaining training samples are reduced.

[0046] S2022: Taking the training sample group as a unit, sequentially obtain multiple training samples in the same training sample group for training the general generative basic model.

[0047] The obtained training sample group can be used for subsequent model training. An exemplary method can be referred to the relevant description in step S204 below, which will not be described in detail here.

[0048] It should be understood that based on the optional implementation methods of steps S2021 to S2022 above, in the present application, multiple training samples in the same training sample group can be obtained in sequence based on the training sample group, so as to facilitate subsequent model training. Among the multiple prompt information samples in the same group of training samples, except for the different style requirement information, other information is the same. Therefore, in the subsequent model training process, multiple training samples in the same training sample group can be used in sequence, and the general generative basic model can be trained in a targeted manner with different style requirement information by controlling variables, so that when the trained text generation model is used to generate text, text that meets the predetermined style requirements can be generated more accurately, thereby meeting the user's needs for text generation and reducing the cost and efficiency of obtaining training samples.

[0049] S204: Inputting the prompt information sample into the general generative basic model, so that the general generative basic model generates text based on the prompt information sample to generate a text generation data sample.

[0050] Optionally, after obtaining a training sample for model training, the prompt information sample in the training sample can be input into the general generative basic model, so that the general generative basic model generates text based on the prompt information sample to generate a text generation data sample.

[0051] Optionally, multiple training samples in the same training sample group can be obtained in sequence, and the prompt information samples in the training samples can be input into the general generative basic model in sequence, so that the general generative basic model generates text based on the prompt information samples in the training samples, and obtains corresponding text generation data samples. As mentioned above, because continuous training is performed in units of training sample groups, the model can learn information related to text style more effectively.

[0052] For example, taking training sample groups A1 and A2 as examples, for training sample group A1, n training samples in training sample group A1 can be obtained in sequence, and the general generative basic model can be trained by using multiple prompt sample information of style requirement information X1, ..., Xn and the response data samples C1, ..., Cn corresponding to the multiple prompt sample information in sequence; and for training sample group A2, m training samples in training sample group A2 can be obtained in sequence, and the general generative basic model can be trained by using multiple prompt sample information of style requirement information Y1, ..., Ym and the response data samples D1, ..., Dm corresponding to the multiple prompt sample information in sequence. Where n and m are both positive integers equal to or greater than 2.

[0053] For example, taking the above-mentioned training sample groups A1 and A2 as examples, for the training sample group A1, the prompt sample information including the style requirement information X1, ..., Xn can be obtained in sequence, and the information can be input into the general generative basic model in sequence. The general generative basic model generates text generation data samples P1, ..., Pn in sequence based on the prompt sample information including the style requirement information X1, ..., Xn; for the training sample group A2, the prompt sample information including the style requirement information Y1, ..., Yn can be obtained in sequence, and the information can be input into the general generative basic model in sequence. The general generative basic model generates text generation data samples Q1, ..., Qm in sequence based on the prompt sample information including the style requirement information Y1, ..., Ym.

[0054] Although the above simple style types can be used to describe style requirement information, in some scenarios, users may not be able to accurately determine the text style they want. In this case, users may upload style text samples, such as an article or file that the user believes meets their style requirements. Based on this, the training samples also take this situation into full consideration. In a feasible way, the prompt information sample includes a style text sample.

[0055] In this case, in some optional embodiments, reference is made to Figure 4 As shown in the flowchart, the above step S204 may include the following steps S2041 to S2043, specifically:

[0056] S2041: Perform text style analysis on the style text sample in the prompt information sample to obtain a text style corresponding to the style text sample.

[0057] In one feasible manner, a machine learning model for performing text style analysis on text may be set up in the cloud server, such as a convolutional neural network model, a recurrent neural network model, etc. The embodiment of the present application does not set the specific implementation form of the model.

[0058] In another feasible way, based on LLM's powerful text understanding and analysis capabilities, text style analysis of style text samples can also be performed by LLM. In this case, the cloud service end can first extract the style text sample from the prompt information sample and generate prompt information for instructing to perform text style analysis.

[0059] For example, the original prompt information sample is "Please help me write an article describing daily life, using the same style as the following: 'XXXXXXXX'", where "XXXXXXXX" represents the text content of the style text sample. Based on this, the cloud service extracts the above-mentioned data related to the style text sample, and generates a prompt for instructing to perform a text style analysis on the style text sample, such as "Please perform a writing style analysis on the following text content, 'XXXXXXXX'". LLM performs text analysis based on the prompt information and obtains the corresponding analysis result, that is, the text style corresponding to the style text sample, for example, "witty and humorous". Furthermore, the text style can be used as style requirement information, and together with the original information in the prompt information sample except the style text sample, new prompt information can be generated, such as "write an article describing daily life, using a humorous style".

[0060] S2042: Using the obtained text style as style requirement information and the information in the prompt information sample other than the style text sample, new prompt information is generated.

[0061] As mentioned above, after obtaining the text style corresponding to the style text sample, it can be used as style requirement information to generate new prompt information, such as "write an article describing daily life, using a humorous style."

[0062] S2043: Input the new prompt information into the general generative basic model, so that the general generative basic model generates text based on the new prompt information to generate a text generation data sample.

[0063] As mentioned above, LLM has powerful text understanding and analysis capabilities. Therefore, in this example, the same LLM can be used for text style analysis and text generation. In this way, there is no need to deploy an additional model for text style analysis, saving the cost of implementing the solution.

[0064] LLM generates text based on the new prompt information, and generates text that meets the style requirement information in the new prompt information. Still taking the above example, LLM will generate an article describing daily life in a humorous style.

[0065] S206: Fine-tune the general generative basic model at least according to the difference between the text style of the text generation data sample and the text style of the response data sample to obtain a text generation model that can generate text of a corresponding style according to the style requirement information.

[0066] After the general generative basic model generates a text generation data sample, a text style analysis can be performed on it. For example, the text style analysis can be performed in the same or similar manner as the text style analysis performed on the style text sample described above. That is, the text style analysis is performed on the text generation data sample to obtain the corresponding text style; and the general generative basic model is fine-tuned according to the difference between the text style of the text generation data sample and the text style of the response data sample.

[0067] When fine-tuning the general generative base model according to the difference between the text style of the text generation data sample and the text style of the reply data sample, exemplarily, the loss value (i.e., the difference between the text style of the text generation data sample and the text style of the reply data sample) can be calculated through a preset loss function such as a cross entropy loss function based on the analysis of the text style of the text generation data sample and the text style of the reply data sample, and then the general generative base model can be fine-tuned based on the loss value.

[0068] According to the difference between the text style of the text generation data sample and the text style of the reply data sample, the general generative basic model is fine-tuned to adjust at least the model parameters of the general generative basic model. After the training end condition is met, a text generation model that can generate text of the corresponding style according to the style requirement information is obtained.

[0069] Optionally, the training end condition can be set as needed. For example, the training end condition can be that when the number of training times reaches a predetermined number, the training end condition can be considered to be met, thereby terminating the model training process. Alternatively, the training end condition can also be that when the loss value calculated by a preset loss function is within a preset loss value range, the training end condition can be considered to be met, thereby terminating the model training process.

[0070] Based on this, an optional implementation method of the above steps S202 to S206 in the embodiment of the present application is to obtain training samples for model training, the training samples include prompt information samples and corresponding reply data samples, the prompt information samples contain style requirement information of the text to be generated, and the text style of the reply data sample matches the style indicated by the style requirement information, and then input the prompt information sample into the general generative basic model to enable the general generative basic model to generate text based on the prompt information sample to obtain a text generation data sample, and then fine-tune the general generative basic model at least according to the difference between the text style of the text generation data sample and the text style of the reply data sample, so as to obtain a text generation model that can generate text of the corresponding style according to the style requirement information. Using this text generation model, text that meets the predetermined style requirements can be generated more accurately, thereby better meeting the user's needs for text generation.

[0071] In some optional embodiments, the text generation model training method of the embodiment of the present application further includes: updating the style requirement information in the prompt information sample according to the text style of the text generation data sample; and generating a new training sample based on the prompt information sample and the text generation data sample after the style requirement information is updated. This method can be effectively adapted to the situation where the type of text style is used as the style requirement information.

[0072] Optionally, the prompt information sample after the style requirement information is updated can be determined as a new prompt information sample, and the text generation data sample can be determined as a new reply data sample. Then, the new prompt information sample and the new reply data sample can be determined as new training samples, and the model training can be continued through the new training samples. In this way, the effective expansion of training samples is achieved, and the generated data of the model can be utilized. The style requirement information of the generated training samples is relatively accurate, which greatly reduces the cost of obtaining training samples.

[0073] Based on this, in the present application, the style requirement information in the prompt information sample is updated according to the style of the text generation data sample, and new training samples are generated based on the prompt information sample and the text generation data sample after the style requirement information is updated. On the one hand, the training samples can be enriched and the effect of model training can be improved; on the other hand, the new training samples obtained can be used to realize adversarial training of the general generative basic model. The training process is conducive to gradually improving the accuracy of the general generative basic model in generating texts that meet the preset style requirements, so that the text generation model obtained after the training is able to more accurately generate texts that meet the predetermined style requirements in the inference stage, thereby better meeting the user's needs for text generation.

[0074] It is understandable that the above description of the text generation model training method is only an exemplary description of the present application and does not constitute any limitation to the present application.

[0075] The text generation method of the embodiment of the present application is described below. Figure 5 As shown in the flowchart, this embodiment describes the text generation method from the perspective of the user device. The text generation method of this embodiment includes the following steps S502 and S504, specifically:

[0076] S502: Generate a text generation request using the user's input data and send it to the server. The text generation request carries the subject information of the text to be generated and the style requirement information of the text to be generated.

[0077] The text generation method of the embodiment of the present application can be used for user equipment. The above-mentioned input data may include relevant information such as the user's requirements for the subject and style of the text to be generated. After receiving the user's input data, the user equipment can generate a corresponding text generation request based on the input data, so that the text generation request carries the subject information of the text to be generated and the style requirement information of the text to be generated. After obtaining the text generation request, the text generation request can be sent to the server (which can be a cloud server), and the server generates text in response to the text generation request.

[0078] The user may input the above input data in any manner. Optionally, a predetermined client program may be installed on the user device, and a human-computer interaction interface for inputting data may be provided in the client program, and the user may input the above input data in the human-computer interaction interface by means including but not limited to typing input, voice input, copy and paste input, etc.

[0079] Optionally, the subject information of the text to be generated may indicate the subject of the text to be generated, which is the central idea of ​​the text to be generated and can describe the main content of the text to be generated.

[0080] In some optional embodiments, the implementation method of using the user's input data to generate a text request in step S502 may include: receiving input data input by the user through a text input box in a human-computer interaction interface, which contains subject information and style requirement information of the text to be generated, and generating a text generation request based on the input data.

[0081] For example, refer to Fig. 6A The human-computer interaction interface of the example can be understood as the human-computer interaction interface of a client program on a user device, which includes a text input box. The user can input input data containing subject information and style requirement information of the text to be generated into the text input box by typing, voice input, copying and pasting, etc. After the input is completed, the user device can obtain the input data and generate a corresponding text generation request based on the input data.

[0082] For example, in an easy-to-understand example, if the user wants to generate a text with a professional and rigorous style and the main content is "The application of artificial intelligence in new media creation", he can Fig. 6AThe text input box inputs something like: "Please generate an article with the theme of "Application of Artificial Intelligence in New Media Creation" in a professional and rigorous style", thereby completing the input of the input information. When the user clicks the "Generate Article Directly" button in the interface, the text will be generated directly based on the above input data in accordance with the requirements of a professional and rigorous style. If the user clicks the "Generate Reference Outline" in the interface, a text outline will be generated first, and after the user confirms, a long text in a professional and rigorous style will be generated based on the text outline. Of course, this example does not serve as any limitation to this application.

[0083] Based on this, through the above-mentioned optional method, it is convenient for users to input input data containing the subject information and style requirement information of the text to be generated through the text input box, so that the text generation request generated according to the input data can effectively carry the subject information of the text to be generated and the style requirement information of the text to be generated, so as to facilitate the subsequent generation of text that meets the predetermined style requirements, thereby better meeting the user's needs for text generation.

[0084] In other optional embodiments, the implementation method of generating a text request based on user input data in step S502 may include: receiving input data containing subject information of the text to be generated, which is input by the user through a text input box in a human-computer interaction interface, and receiving style requirement information, which is input by the user through a style interaction control displayed in the human-computer interaction interface; and generating a text generation request based on the input data and the style requirement information.

[0085] Among them, the style interaction control can be implemented in any appropriate form that is convenient for users to operate. In one feasible way, the style interaction control can be a style option, such as an interactive label or interactive button for selecting a style, on which the corresponding text style information is displayed. This method is convenient for users to operate and improves the efficiency of users determining the text style. However, it is not limited to this. The interactive label or interactive button can also be a label or button that allows users to customize the text style. That is, when the user selects this label or button, the desired text style can be manually input to provide users with greater flexibility in style selection.

[0086] In addition, as mentioned above, in some cases, the user may not be able to clearly determine the text style he needs. In this case, in another feasible way, the style interaction control can be implemented in the form of a text input box or a file upload option. Thus, the user can input the text of the style text sample through the text input box, so that the server can help him determine the required text style; or, the user can upload the file of the corresponding style text sample through the file upload option, so that the server can analyze the text content in the file and determine the text style required by the user. Thus, the user's way of determining the text style is expanded, and the user experience is improved.

[0087] Based on this, in a feasible manner, input data including subject information of the text to be generated inputted by the user through the text input box in the human-computer interaction interface is received, and style requirement information inputted by the user through the style interaction control in the human-computer interaction interface is received; and generating a text generation request according to the input data and the style requirement information can be implemented as follows:

[0088] Method 1: receiving input data including subject information of a text to be generated, which is input by a user through a text input box in a human-computer interaction interface, and receiving a selection operation of a plurality of style options displayed in the human-computer interaction interface by the user, and determining style requirement information of the text to be generated according to the selection operation; and generating a text generation request according to the input data and the style requirement information.

[0089] As mentioned above, style options can be implemented in the form of interactive labels or interactive buttons, etc. By selecting them, users can determine the desired text style and the corresponding style requirement information, thereby improving the efficiency of users in determining text style.

[0090] Method 2: receiving input data including subject information of the text to be generated input by the user through the text input box in the human-computer interaction interface, and receiving custom style requirement information input by the user through the style information input control in the human-computer interaction interface; generating a text generation request based on the input data and the custom style requirement information.

[0091] As mentioned above, the interactive label or interactive button can be implemented as a label or button that allows users to customize the text style. When the user selects this label or button, the user can manually enter the desired text style to provide the user with greater flexibility in style selection.

[0092] Method three: receiving input data containing subject information of the text to be generated input by the user through the text input box in the human-computer interaction interface, and receiving a style text sample input by the user through the style information input control in the human-computer interaction interface; generating a text generation request based on the input data and the style text sample.

[0093] As mentioned above, in this way, the style interaction control can be implemented in the form of a text input box or a file upload option. Thus, the user can input the text of the style text sample through the text input box, or upload the file of the corresponding style text sample through the file upload option, so that the server can determine the text style required by the user. Thus, the user's way of determining the text style is expanded, and the user experience is improved.

[0094] For example, refer to Figure 6BThe human-computer interaction interface of the example in the figure can be a human-computer interaction interface of a client program on the user device 106, which includes an input text input box (such as Figure 6B ), multiple style options including custom styles (such as Figure 6B ), and a text input box for entering sample style text (such as Figure 6B ), and an upload option for uploading a style text sample file (such as Figure 6B "Upload a sample style text file" as indicated by the "+" sign in the figure.

[0095] The user can input the input data containing the subject information of the text to be generated into the text input box by typing, voice input, copying and pasting, etc., and then select the style required for the text to be generated from multiple style options. The user device 106 can determine the style requirement information of the text to be generated based on the style option selected by the user. Then, the user device 106 can generate a text generation request based on the input data and the style requirement information.

[0096] Optionally, the plurality of style options may include fixed style options (eg Figure 6B The options shown in the figure include “professional and rigorous”, “vivid and interesting”, “easy to understand”, “emotional resonance”, etc.), and can also include options for intelligent style matching by LLM based on the subject information (for example Figure 6B ), and can also include custom style input options (e.g. Figure 6B Custom Style option shown).

[0097] For example, in an easy-to-understand example, if the user wants to generate a text with a professional and rigorous style and the main content is "The application of artificial intelligence in new media creation", he can Figure 6B Enter the text input box of the subject information similar to: "Application of artificial intelligence in new media creation" and click Figure 6B The "professional and rigorous" style option is selected to complete the input of input data and style requirement information. Of course, this example is not intended to limit the present application in any way.

[0098] For another example, in an easy-to-understand example, if the user wants to generate a text with the main content of "Application of artificial intelligence in new media creation", but is not sure what style he needs, he can Figure 6B Enter the text input box of the subject information similar to: "Application of artificial intelligence in new media creation" input data, and then Figure 6BIn the text input box of "Sample Text", input or paste the text content of the style text sample, so that the server can determine the style requirement information for it. Of course, this example does not serve as any limitation to the present application.

[0099] Based on this, through the above-mentioned optional method, it is convenient for users to input input data containing the subject information of the text to be generated through the text input box, and it is convenient for users to input style requirement information by operating the style options, so that the text generation request generated according to the input data and style requirement information can effectively carry the subject information of the text to be generated and the style requirement information of the text to be generated, so as to facilitate the subsequent generation of text that meets the predetermined style requirements, thereby better meeting the user's needs for text generation.

[0100] S504: receiving text generated by the text generation model of the server in response to the text generation request, the text being a text generated by the text generation model with the subject information in the input data as the subject and the style of the text satisfying the style indicated by the style requirement information.

[0101] Among them, as mentioned above, the text generation model is obtained by fine-tuning training based on the general generative basic model.

[0102] In the embodiment of the present application, the server (including but not limited to Figure 1 After receiving the text generation request sent by the user device, the cloud service end shown in the figure can generate the corresponding text in response to the text generation request through the text generation model. When generating text, the text generation model generates the content of the text based on the subject information carried in the text generation request, and generates text that meets the style indicated by the style requirement information based on the style requirement information carried in the text generation request, so that the text that meets the predetermined style requirements and subject requirements of the user can be accurately generated, and the user's demand for text generation can be better met.

[0103] Optionally, the server may generate prompt information based on at least the subject information of the text to be generated and the style requirement information of the text to be generated carried in the text generation request sent by the user device; and then input the prompt information into the text generation model to generate text with the subject information as the subject and the style satisfying the style indicated by the style requirement information through the text generation model. Afterwards, the server may send the generated text to the user device.

[0104] Based on this, through the text generation method of the above steps S502 to S504, a text generation request can be generated according to the user's input data, and sent to the server, the text generation request carries the subject information of the text to be generated and the style requirement information of the text to be generated, and then the text generated by the text generation model of the server in response to the text generation request is received, and the text is a text generated by the text generation model with the subject information in the input data as the subject and the style meeting the style indicated by the style requirement information. Therefore, through this solution, the text generation model can be used to more accurately generate text that meets the predetermined style requirements, thereby better meeting the user's needs for text generation.

[0105] Optionally, the text generation method in the embodiment of the present application also includes: receiving text material associated with the subject information input by the user. Optionally, the text material can be of any type, and can adopt text materials of any type including but not limited to word, pdf, txt, ppt, excel, etc., and the text material can also adopt pictures including text in image content, etc. The text material records the text content related to the subject information, which can assist the text generation model in text generation. For example, the text generation model can generate text based on the text content in the text material. The text content in the text material can be passed to the text generation model by directly splicing with the input data, such as by carrying the prompt information. But not limited to this, other methods that can be passed to the text generation model are also applicable.

[0106] In some other optional embodiments, the implementation method of using the user's input data to generate a text request in step S502 may include: using the user's input data and text material to generate a text generation request. On this basis, the text generated by the server may be a text generated by a text generation model based on the subject information in the input data and the text material, and the text style meets the style indicated by the style requirement information.

[0107] Optionally, refer to Figure 6C The human-computer interaction interface of the example can be understood as the human-computer interaction interface of the client program on the user device 106, which also includes a material input box. The user can add text materials through the material input box (the text materials can be added by dragging them in, or by clicking and selecting them), and can also input the above-mentioned input data in any optional way to generate a text generation request based on the user's input data and text materials.

[0108] Optionally, the server may generate prompt information based on at least the subject information, style requirement information and text material carried in the text generation request sent by the user device, and then input the prompt information into the text generation model to generate text with the subject information as the subject, generated based on the text material, and the text style meeting the style indicated by the style requirement information through the text generation model. Afterwards, the server may send the generated text to the user device.

[0109] For example, an example application scenario of generating text through text materials may be that the user wishes to generate text containing the main internal part or semantic information or key information of a certain article, and then some reference example articles may be found and input as text materials associated with the subject information to generate a text generation request, so that the text generation model realizes text generation according to the subject information, text materials, and style requirement information. It should be understood that this example application scenario does not serve as any limitation to the embodiments of the present application.

[0110] It should be understood that in the present application, the text material associated with the subject information input by the user can enable the text generation model to take the subject information in the input data as the subject, and refer to the content of the text material to generate text that meets the style indicated by the style requirement information, so that the generated text can not only meet the predetermined style requirements, but also be more consistent with the text material in content, thereby better meeting the user's needs for text generation.

[0111] Optionally, the text generation method in the embodiment of the present application further includes: receiving writing requirement information input by the user. Optionally, the writing requirement information can indicate the writing requirements of the text to be generated, which is intended to indicate a series of regulations, guidelines or expected standards that need to be followed in the text to be generated. It can include other writing requirements besides style requirements, which can be used as limiting conditions for generating text. For example, the generated text is required to have clear logic, a certain timeliness of content, and the core ideas are supported by necessary data and factual evidence, etc. Figure 6C As shown in , the user can input the writing requirements through the writing requirements input box in the human-computer interaction interface of the client program on the user device 106 .

[0112] In some further optional embodiments, the implementation of using the user's input data to generate a text request in step S502 may include: using the user's input data and writing requirement information to generate a text generation request. On this basis, the text generated by the server may be a text generated by a text generation model with the subject information in the input data as the subject, and in accordance with the writing requirement information and the style requirement information.

[0113] Optionally, the user can input writing requirement information through the text input box of the human-computer interaction interface. Figure 6C The human-computer interaction interface can be understood, and the input data and writing requirement information can be input into the text input box to generate a text generation request according to the user's input data and writing requirement information.

[0114] Optionally, the server may generate prompt information based on at least the subject information, style requirement information, and writing requirement information carried in the text generation request sent by the user device, and then input the prompt information into the text generation model to generate text based on the subject information and the writing requirement information and style requirement information through the text generation model. Afterwards, the server may send the generated text to the user device.

[0115] For example, an example application scenario of generating text through writing requirement information may be that the user wishes to generate text with other requirements in addition to style, such as requiring that "character names are not allowed" and "at least three famous quotes" in the text, etc., which can be input as writing requirement information as needed to generate a text generation request, so that the text generation model can realize text generation according to the topic information, writing requirement information, and style requirement information. It should be understood that this example application scenario does not serve as any limitation to the embodiments of the present application.

[0116] It should be understood that in the present application, through the user inputting writing requirement information, the text generation model can take the subject information in the input data as the subject, and refer to the writing requirement information to generate a text with a style that meets the style indicated by the style requirement information, so that the generated text can not only meet the predetermined style requirements, but also be more consistent with other writing requirements indicated by the writing requirement information in terms of content, thereby better meeting the user's needs for text generation.

[0117] Reference Figure 7 As shown in the flowchart, the present application embodiment provides another text generation method, which focuses on explaining the reasoning application of the generated text generation model from the perspective of a server such as a cloud server. The text generation method includes the following steps S702 and S704, specifically:

[0118] S702: Obtaining subject information of the text to be generated and style requirement information of the text to be generated from the text generation request sent by the user device, and generating prompt information.

[0119] Regarding the text generation request, please refer to the description of the relevant parts in the above embodiment, which will not be repeated here.

[0120] In step S702 of the embodiment of the present application, after the user device sends a text generation request to the server, the server can generate prompt information based on the subject information of the text to be generated and the style requirement information of the text to be generated carried in the text generation request. The prompt information can be used for understanding by the text generation model for text generation.

[0121] S704: Input the prompt information into a text generation model, so as to generate a text with the theme information as the theme and a style satisfying the style indicated by the style requirement information through the text generation model.

[0122] Among them, the text generation model is obtained based on the general generative basic model, and text generation can be effectively realized through the text generation model. It should be understood that the text generation model can be obtained by training the general generative basic model in any way. For example, the general generative basic model can be trained in the manner described in the above-mentioned text generation model training method embodiment. The details can be understood by referring to the above-mentioned embodiment, and will not be repeated here.

[0123] Based on this, in the embodiment of the present application, the text generation method through the above steps S702 to S704 can generate prompt information based on at least the subject information of the text to be generated and the style requirement information of the text to be generated carried in the text generation request sent by the user device, and then input the prompt information into the text generation model to generate a text with the subject information as the theme and the style satisfying the style indicated by the style requirement information through the text generation model, so as to accurately generate the text with the predetermined style requirements and subject requirements required by the user, thereby better meeting the user's needs for text generation.

[0124] Optionally, the text generation request also carries text material associated with the subject information. In some optional embodiments, the above step S702 may include: obtaining subject information, style requirement information and text material from the text generation request sent by the user device, and generating prompt information; the above step S704 may include: inputting the prompt information into the text generation model, so as to generate a text with the subject information as the subject, generated based on the text material, and the style satisfying the style indicated by the style requirement information through the text generation model. The specific implementation thereof may refer to the relevant description in the above text generation method embodiment, and will not be repeated here.

[0125] It should be understood that in the embodiments of the present application, prompt information is generated based on the subject information, style requirement information and text material carried in the text generation request sent by the user device, and the text generation model is input, so that the text generation model can take the subject information as the subject, and refer to the content of the text material to generate a text whose style satisfies the style indicated by the style requirement information, so that the generated text can not only meet the predetermined style requirements, but also be more consistent with the text material in terms of content, thereby better meeting the user's needs for text generation.

[0126] Optionally, the text generation request also carries writing requirement information. In some optional embodiments, the above step S702 may include: obtaining subject information, style requirement information and writing requirement information from the text generation request sent by the user device, and generating prompt information; the above step S704 may include: inputting the prompt information into the text generation model, so as to generate a text with the subject information as the subject and generated according to the writing requirement information and the style requirement information through the text generation model. The specific implementation thereof may refer to the relevant description in the above text generation method embodiment, and will not be repeated here.

[0127] Optionally, when the style requirement information carried in the text generation request is a style text sample, in some optional embodiments, the above step S702 may include: performing text style analysis on the style text sample carried in the text generation request sent by the user device to obtain corresponding text style information; and generating prompt information according to the topic information and the text style information. The specific implementation thereof may refer to the relevant description in the above text generation method embodiment, which will not be repeated here.

[0128] It should be understood that in the embodiments of the present application, prompt information is generated based on the subject information, style requirement information and writing requirement information carried in the text generation request sent by the user device, and the text generation model is input, so that the text generation model can take the subject information in the input data as the subject, and refer to the writing requirement information to generate a text whose style satisfies the style indicated by the style requirement information, so that the generated text can not only meet the predetermined style requirements, but also be more consistent with other writing requirements indicated by the writing requirement information in terms of content, thereby better meeting the user's needs for text generation.

[0129] In some optional embodiments, referring to Figure 8 As shown in the flowchart, any implementation of the above step S704 may include the following steps S7041, S7042 and S7043, specifically:

[0130] S7041: Input the prompt information into the text generation model to generate text outline data matching the topic information through the text generation model.

[0131] Optionally, the text outline data may briefly describe the contents of each part of the text to be generated. Since the text generation model has a powerful text generation capability, it can randomly generate text outline data of various styles. Therefore, it is possible to select appropriate text outline data as needed to generate new prompt information to achieve text generation.

[0132] For ease of understanding, in some examples, assuming that the subject information is information indicating the generation of a computer principle paper, a text outline data matching the subject information generated by the text generation model according to the prompt information may be:

[0133] “

[0134] 1. History of Computer Development

[0135] 1.1XXXXX

[0136] 1.2XXXXXX ......

[0138] 2. Components of a computer

[0139] 2.1XXXXX

[0140] 2.2XXXXXXX ......

[0142] ”

[0143] As can be seen from the above example, the text outline data is similar to a directory, which can briefly describe the contents of each part of the text to be generated. The text outline data facilitates the subsequent text generation.

[0144] S7042: Generate new prompt information using text outline data, subject information, and style requirement information.

[0145] After obtaining the text outline data, new prompt information may be generated according to the text outline data, the subject information and the style requirement information, so as to input the new prompt information into the text generation model for use in text generation.

[0146] In some optional embodiments, step S7042 may include: receiving text outline data modified by a user; and generating new prompt information according to the modified text outline data, subject information, and style requirement information.

[0147] It should be understood that in the above embodiment, the user is allowed to modify the text outline data generated in step S7041, and generate new prompt information based on the modified text outline data, subject information and style requirement information, so that the generated text can meet the predetermined preset style requirements and better meet the user's needs for the generated text.

[0148] Optionally, after generating text outline data in step S7041, the server (cloud server 102) may send the text outline data to the user device 106 and display it through an interactive control such as an interactive text display control. The user of the user device 106 may modify the text outline data as needed. After the modification is completed, the user device 106 sends the modified text outline data to the server. The server receives the modified text outline data and can generate new prompt information based on the modified text outline data, subject information and style requirement information for subsequent text generation.

[0149] Of course, in other optional embodiments, if the user is satisfied with the text outline data generated in step S7041, the text outline data may not be modified. The server may directly generate new prompt information based on the text outline data, subject information and style requirement information generated in step S7041 for subsequent text generation.

[0150] S7043: Input the new prompt information into the text generation model, so that the text generation model generates a text with the theme information as the theme and the style satisfying the style indicated by the style requirement information according to the text outline data.

[0151] Based on this, in this application, through the optional implementation method of the above steps S7041 to S7043, by inputting prompt information into the text generation model to generate text outline data matching the subject information through the text generation model, and then generating new prompt information based on the text outline data, subject information and style requirement information, and then inputting the new prompt information into the text generation model, it is possible to conveniently and effectively generate a text with the subject information as the theme and the style satisfying the style indicated by the style requirement information through the text generation model according to the text outline data. This can effectively ensure the correspondence between the content of the generated text that meets the predetermined style requirements and the subject, and better meet the user's needs for the generated text.

[0152] Fig. 9 A schematic diagram of a scenario example of the text generation solution of the embodiment of the present application. Fig. 9 The text generation scheme in the embodiment of the present application is shown as a whole. It should be noted that it should be understood that Fig. 9The example scenarios shown are only used to facilitate understanding of the embodiments of the present application and are not intended to be any limitation to the present application.

[0153] like Fig. 9 As shown in , it is assumed that the user inputs "Please help me write a paper on computer principles, using a professional and rigorous style" (i.e., input data) through the human-computer interaction interface of the user device. The user device generates a corresponding text generation request based on the input data and sends it to the cloud server. After receiving the text generation request, the cloud server parses the input data therein and generates a corresponding prompt message prompt based on the input data. The prompt message includes the information "Please help me write a paper on computer principles, using a professional and rigorous style". The prompt message prompt will be input into the text generation model of the cloud server, which is shown as the LLM after fine-tuning training in this example. After receiving the prompt message, the LLM prompt generates and outputs a paper on computer principles in accordance with the style requirement information of "professional and rigorous style".

[0154] Furthermore, the cloud service end may send the generated text to the user device so as to be displayed to the user through the user device.

[0155] It can be seen that through the text generation model in this example, text can be effectively generated in the style required by the user.

[0156] An embodiment of the present application also provides an electronic device, comprising: a processor, a communication interface, a memory and a communication bus, wherein the processor, the communication interface and the memory communicate with each other through the communication bus; the memory is used to store a computer program; and the processor is used to execute any method described in the aforementioned multiple method embodiments by running the computer program stored in the memory.

[0157] Fig.10 1000 is a block diagram of an optional electronic device in an embodiment of the present application. The present application embodiment does not limit the specific implementation of the electronic device 1000. Fig.10 The electronic device 1000 provided in the embodiment of the present application includes: a processor 1002, a communication interface 1004, a memory 1006, and a communication bus 1008. Among them:

[0158] The processor 1002 , the communication interface 1004 , and the memory 1006 communicate with each other via a communication bus 1008 .

[0159] The communication interface 1004 is used to communicate with other electronic devices or servers.

[0160] The processor 1002 is used to execute the computer program 1010, and specifically can execute the relevant steps of any method embodiment in the aforementioned multiple method embodiments.

[0161] Specifically, the computer program 1010 may include program codes, which include computer operation instructions.

[0162] The processor 1002 may be a CPU, or a GPU (Graphic Processing Unit), or an ASIC (Application Specific Integrated Circuit), or one or more integrated circuits configured to implement the embodiments of the present application. The one or more processors included in the smart device may be processors of the same type, such as one or more CPUs; or may be processors of different types, such as one or more CPUs and one or more ASICs.

[0163] The memory 1006 is used to store the computer program 1010. The memory 1006 may include a high-speed RAM memory, and may also include a non-volatile memory (non-volatile memory), such as at least one disk memory.

[0164] The computer program 1010 may be specifically configured to enable the processor 1002 to execute a method of any one of the foregoing method embodiments.

[0165] The specific implementation of each step in the computer program 1010 can refer to the corresponding description of the corresponding steps and units in any of the above-mentioned multiple method embodiments, which will not be repeated here. Those skilled in the art can clearly understand that for the convenience and simplicity of description, the specific working process of the above-described devices and modules can refer to the corresponding process description in the above-mentioned method embodiments, which will not be repeated here.

[0166] In addition, the embodiment of the present application further provides a computer storage medium on which a computer program is stored, and when the computer program is executed by a processor, the method of any of the aforementioned multiple method embodiments is implemented. The computer storage medium includes, but is not limited to: a compact disc read-only memory (CD-ROM), a random access memory (RAM), a floppy disk, a hard disk, or a magneto-optical disk, etc.

[0167] An embodiment of the present application further provides a computer program product, including a computer program, which, when executed by a processor, implements a method as in any one of the above-mentioned multiple method embodiments.

[0168] In addition, it should be noted that the user-related information (including but not limited to user device information, user personal information, etc.) and data (including but not limited to sample data used to train the model, data used for analysis, stored data, displayed data, etc.) involved in the embodiments of the present application are all information and data authorized by the user or fully authorized by all parties, and the collection, use and processing of relevant data need to comply with the relevant laws, regulations and standards of the relevant countries and regions, and provide corresponding operation entrances for users to choose to authorize or refuse.

[0169] It should be pointed out that, according to the needs of implementation, the various components / steps described in the embodiments of the present application can be split into more components / steps, or two or more components / steps or partial operations of components / steps can be combined into new components / steps to achieve the purpose of the embodiments of the present application.

[0170] The above-mentioned method according to the embodiment of the present application can be implemented in hardware, firmware, or implemented as software or computer code that can be stored in a recording medium (such as a CD-ROM, RAM, floppy disk, hard disk or magneto-optical disk), or implemented as a computer code originally stored in a remote recording medium or a non-temporary machine-readable medium downloaded through a network and stored in a local recording medium, so that the method described herein can be stored in such software processing on a recording medium using a general-purpose computer, a dedicated processor or programmable or dedicated hardware (such as an application-specific integrated circuit (ASIC) or a field programmable gate array (FPGA)). It can be understood that a computer, a processor, a microprocessor controller or programmable hardware includes a storage component (e.g., a random access memory (RAM), a read-only memory (ROM), a flash memory, etc.) that can store or receive software or computer code, and when the software or computer code is accessed and executed by a computer, a processor or hardware, the method described herein is implemented. In addition, when a general-purpose computer accesses the code for implementing the method shown here, the execution of the code converts the general-purpose computer into a dedicated computer for executing the method shown here.

[0171] Those of ordinary skill in the art will appreciate that the units and method steps of each example described in conjunction with the embodiments disclosed herein can be implemented in electronic hardware, or a combination of computer software and electronic hardware. 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 specific applications, but such implementation should not be considered to be beyond the scope of the embodiments of the present application.

[0172] The term "including" and its variations used in this document are open inclusions, that is, "including but not limited to". The term "based on" means "based at least in part on". The term "one embodiment" means "at least one embodiment"; the term "another embodiment" means "at least one other embodiment"; the term "some embodiments" means "at least some embodiments". It should be noted that the concepts of "first", "second", etc. mentioned in the embodiments of the present application are only used to distinguish different devices, modules or units, and are not used to limit the order or interdependence of the functions performed by these devices, modules or units. It should be noted that the modifications of "one" and "multiple" mentioned in the embodiments of the present application are illustrative rather than restrictive. Those skilled in the art should understand that unless otherwise clearly indicated in the context, it should be understood as "one or more".

[0173] The above implementation methods are only used to illustrate the embodiments of the present application, and are not limitations on the embodiments of the present application. Ordinary technicians in the relevant technical field can make various changes and modifications without departing from the spirit and scope of the embodiments of the present application. Therefore, all equivalent technical solutions also belong to the scope of the embodiments of the present application. The scope of patent protection of the embodiments of the present application should be limited by the claims.

Claims

1. A text generation method, include: Using the user's input data, a text generation request is generated and sent to the server, wherein the text generation request carries the subject information of the text to be generated and the style requirement information of the text to be generated; Receive text generated by the text generation model of the server in response to the text generation request, wherein the text is a text generated by the text generation model with the subject information in the input data as the subject and the text style meets the style indicated by the style requirement information, and the text generation model is obtained based on the training of a general generative basic model.

2. The method according to claim 1, in, The step of using the user's input data to generate a text generation request includes: Receiving input data input by a user through a text input box in a human-computer interaction interface, which includes subject information and style requirement information of a text to be generated, and generating the text generation request according to the input data; or, Receive input data containing subject information of the text to be generated, which is input by the user through a text input box in a human-computer interaction interface, and receive style requirement information, which is input by the user through a style interaction control in the human-computer interaction interface; and generate the text generation request according to the input data and the style requirement information.

3. The method according to claim 2, in, The receiving of input data including subject information of the to-be-generated text inputted by the user through a text input box in the human-computer interaction interface, and the receiving of style requirement information inputted by the user through a style interaction control in the human-computer interaction interface; Generating the text generation request according to the input data and the style requirement information includes: Receiving input data including subject information of a text to be generated, which is input by a user through a text input box in a human-computer interaction interface, and receiving a selection operation of a plurality of style options displayed in the human-computer interaction interface by the user, and determining style requirement information of the text to be generated according to the selection operation; and generating the text generation request according to the input data and the style requirement information; or, Receiving input data including subject information of a text to be generated, which is input by a user through a text input box in a human-computer interaction interface, and receiving custom style requirement information, which is input by a user through a style information input control in the human-computer interaction interface; generating the text generation request according to the input data and the custom style requirement information; or, Receive input data containing subject information of the text to be generated, which is input by the user through a text input box in a human-computer interaction interface, and receive a style text sample, which is input by the user through a style information input control in the human-computer interaction interface; and generate the text generation request according to the input data and the style text sample.

4. The method according to any one of claims 1 to 3, in, The method further comprises: receiving text material associated with the subject information input by the user; The step of using the user's input data to generate a text generation request includes: using the user's input data and the text material to generate a text generation request; The text is generated by the text generation model based on the text material with the subject information in the input data as the subject, and the text style satisfies the style indicated by the style requirement information.

5. The method according to any one of claims 1 to 3, in, The method further comprises: receiving writing requirement information input by the user; The step of using the user's input data to generate a text generation request includes: using the user's input data and the writing requirement information to generate a text generation request; The text is a text generated by the text generation model with the subject information in the input data as the subject, in accordance with the writing requirement information and the style requirement information.

6. A text generation method, include: Obtaining subject information of the text to be generated and style requirement information of the text to be generated from the text generation request sent by the user device, and generating prompt information; Inputting the prompt information into a text generation model, so as to generate a text with the subject information as the theme and a style satisfying the style indicated by the style requirement information through the text generation model; Wherein, the text generation model is obtained based on the training of a general generative basic model.

7. The method according to claim 6, in, The text generation request also carries text material associated with the subject information; The step of obtaining the subject information of the text to be generated and the style requirement information of the text to be generated from the text generation request sent by the user device and generating the prompt information comprises: obtaining the subject information, the style requirement information and the text material from the text generation request sent by the user device and generating the prompt information; The step of inputting the prompt information into a text generation model so as to generate, through the text generation model, a text with the subject information as the theme and a style satisfying the style indicated by the style requirement information, includes: inputting the prompt information into a text generation model so as to generate, through the text generation model, a text with the subject information as the theme, generated based on the text material and a style satisfying the style indicated by the style requirement information.

8. The method according to claim 6, in, The text generation request also carries writing requirement information; The step of obtaining subject information of the text to be generated and style requirement information of the text to be generated from the text generation request sent by the user device and generating prompt information includes: obtaining the subject information, the style requirement information and the writing requirement information from the text generation request sent by the user device and generating prompt information; The step of inputting the prompt information into a text generation model so as to generate, through the text generation model, a text with the subject information as the theme and a style satisfying the style indicated by the style requirement information, includes: inputting the prompt information into a text generation model so as to generate, through the text generation model, a text with the subject information as the theme and generated in accordance with the writing requirement information and the style requirement information.

9. The method according to claim 6, in, The style requirement information is a style text sample; The method of obtaining subject information of a text to be generated and style requirement information of a text to be generated from a text generation request sent by a user device and generating prompt information includes: performing text style analysis on the style text sample carried in the text generation request sent by the user device to obtain corresponding text style information; and generating prompt information based on the subject information and the text style information.

10. The method according to any one of claims 6 to 9, in, The step of inputting the prompt information into a text generation model to generate a text with the subject information as the theme and a style satisfying the style indicated by the style requirement information through the text generation model includes: Inputting the prompt information into a text generation model to generate text outline data matching the subject information through the text generation model; Generate new prompt information using the text outline data, the subject information and the style requirement information; The new prompt information is input into a text generation model, so that the text generation model generates a text with the subject information as the theme and a style satisfying the style indicated by the style requirement information according to the text outline data.

11. The method according to claim 10, in, The step of using the text outline data, the subject information and the style requirement information to generate new prompt information includes: receiving text outline data modified by a user; New prompt information is generated using the modified text outline data, the subject information and the style requirement information.

12. A text generation model training method, include: Acquire training samples for model training, the training samples comprising prompt information samples and corresponding reply data samples, the prompt information samples containing style requirement information of the text to be generated, and the text style of the reply data samples matches the style indicated by the style requirement information; Inputting the prompt information sample into a general generative basic model, so that the general generative basic model performs text generation based on the prompt information sample to generate a text generation data sample; At least according to the difference between the text style of the text generation data sample and the text style of the reply data sample, the general generative basic model is fine-tuned and trained to obtain a text generation model that can generate text of a corresponding style according to the style requirement information.

13. The method according to claim 12, in, The obtaining of training samples for model training includes: Acquire a training sample group from a training sample set for model training, each training sample group includes a plurality of training samples, the plurality of training samples include a plurality of prompt information samples and a plurality of reply data samples corresponding to the plurality of prompt information samples, and the plurality of prompt information samples in the same group have the same information except for the style requirement information; Taking the training sample group as a unit, a plurality of training samples in the same training sample group are sequentially obtained for training the general generative basic model.

14. The method according to claim 12 or 13, in, The fine-tuning training of the general generative basic model at least according to the difference between the text style of the text generation data sample and the text style of the reply data sample comprises: Performing text style analysis on the text generation data sample to obtain a corresponding text style; The general generative basic model is fine-tuned and trained according to the difference between the text style of the text generation data sample and the text style of the response data sample.

15. The method according to claim 12 or 13, in, If the prompt information sample includes a style text sample, then the step of inputting the prompt information sample into a general generative basic model includes: Performing text style analysis on the style text sample to obtain a text style corresponding to the style text sample; Using the obtained text style as style requirement information and the information in the prompt information sample except the style text sample to generate new prompt information; The new prompt information is input into the general generative base model.

16. The method according to claim 12 or 13, in, The method further comprises: According to the text style of the text generation data sample, updating the style requirement information in the prompt information sample; A new training sample is generated based on the prompt information sample after the style requirement information is updated and the text generation data sample.

17. An electronic device, include: A processor, a communication interface, a memory and a communication bus, wherein the processor, the communication interface and the memory communicate with each other via the communication bus; The memory is used to store computer programs; The processor is configured to execute the method according to any one of claims 1 to 16 by running the computer program stored in the memory.

18. A computer storage medium having a computer program stored thereon, wherein the computer program, when executed by a processor, implements the method according to any one of claims 1 to 16.

19. A computer program product, comprising a computer program, which implements the method according to any one of claims 1 to 16 when executed by a processor.

Citation Information

Cited By

  • Text generation method, text generation model training method, electronic device, storage medium, and program product

    WO2026016899A1