Text generation method, text generation model training method, electronic device, storage medium, and program product
By fine-tuning the large language model using training samples, a text generation model capable of generating text that meets word count requirements is generated. This solves the problem that LLM cannot meet users' word count needs and achieves accuracy and personalization in text generation.
Patent Information
- Application Number
- PCT/CN2025/106629
- Authority / Receiving Office
- WO · WO
- Patent Type
- Applications
- Current Assignee / Owner
- Priority Date
- 2024-07-17
- Filing Date
- 2025-07-02
- Publication Date
- 2026-01-22
AI Technical Summary
Existing Large Language Models (LLMs) cannot accurately meet users' personalized needs for word count when generating text, and cannot generate text with an appropriate word count.
By acquiring training samples, including prompt information samples and corresponding response data samples, which contain word count requirements, and fine-tuning the training using a general generative base model, a text generation model capable of generating text according to the word count requirements is generated.
It enables the accurate generation of text that meets the predetermined word count requirement based on user needs, satisfying users' personalized needs for text generation.
Smart Images

Figure CN2025106629_22012026_PF_FP_ABST
Abstract
Description
Text generation and its model training methods, electronic devices, storage media and program products
[0001] This disclosure claims priority to Chinese Patent Application No. 202410963778.6, filed with the China Patent Office on July 17, 2024, entitled “Text Generation and Model Training Method Thereof, Electronic Device, Storage Medium and Program Product”, the entire contents of which are incorporated herein by reference. Technical Field
[0002] This disclosure relates 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 Technology
[0003] Currently, machine learning models, such as LLM (Large Language Model), are playing an increasingly important role in people's work and life.
[0004] LLM (Learning Model) is a model trained on massive amounts of text data that can not only generate natural language text but also deeply understand its meaning, handling various natural language tasks such as text summarization, question answering, and translation. While LLM possesses strong processing capabilities, its general-purpose nature means it may not always meet users' personalized needs. For example, in some scenarios, users have word count requirements for the text generated by LLM—neither too many nor too few words. Current LLM models, and similar models, cannot meet this requirement.
[0005] Therefore, how to accurately generate text that meets the word count requirement is a technical problem that needs to be solved. Summary of the Invention
[0006] In view of the above, embodiments of this disclosure 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 problems.
[0007] According to a first aspect of the present disclosure, a text generation method is provided, comprising: generating a text generation request using user input data and sending it to a server, wherein the text generation request carries topic information of the text to be generated and word count 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 text generated by the text generation model with the topic information in the input data as the topic and the word count meeting the word count requirement information, and the text generation model is obtained by training based on a general generative basic model.
[0008] According to a second aspect of the present disclosure, a text generation method is provided, comprising: obtaining topic information of the text to be generated and word count 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 to generate text with the topic information as the topic and the word count meeting the word count requirement information indicated by the word count requirement information; wherein the text generation model is obtained based on a general generative basic model.
[0009] According to a third aspect of the present disclosure, a method for training a one-line text generation model is provided, comprising: acquiring training samples for model training, the training samples including prompt information samples and corresponding response data samples, the prompt information samples containing word count requirement information for the text to be generated, and the word count of the response data samples matching the word count requirement information; inputting the prompt information samples into a general generative base model, so that the general generative base model generates text based on the prompt information samples to obtain text generation data samples; and fine-tuning the general generative base model at least based on the difference between the word count of the text generation data samples and the word count of the response data samples to obtain a text generation model capable of generating text with the corresponding word count according to the word count requirement information.
[0010] According to a fourth aspect of the present disclosure, an electronic device is provided, 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; and the processor is used to execute any of the methods described in the first, second, and third aspects above by running the computer program stored in the memory.
[0011] According to a fifth aspect of the present disclosure, a computer storage medium is provided having a computer program stored thereon, which, when executed by a processor, implements the methods described in any one of the first, second, and third aspects.
[0012] According to a sixth aspect of the present disclosure, a computer program product is provided, including a computer program that, when executed by a processor, implements the methods described in any one of the first, second, and third aspects.
[0013] According to the text generation scheme provided in this disclosure, since a text generation request can be generated based on user input data and sent to the server, the text generation request carries the topic information of the text to be generated and the word count requirement information of the text to be generated. Then, the text generated by the text generation model obtained by the server based on the general generative basic model in response to the text generation request is received. The text is generated by the text generation model with the topic information in the input data as the topic and the word count meets the word count requirement information. Therefore, this scheme can use the text generation model to generate text that meets the predetermined word count requirement more accurately, thereby better meeting the user's needs for text generation. Attached Figure Description
[0014] To more clearly illustrate the technical solutions in the embodiments of this disclosure or the prior art, the drawings used in the description of the embodiments or the prior art will be briefly introduced below. Obviously, the drawings described below are only some embodiments recorded in the embodiments of this disclosure. For those skilled in the art, other drawings can be obtained based on these drawings.
[0015] Figure 1 is a schematic diagram of an exemplary system to which the embodiments of the present disclosure are applicable.
[0016] Figure 2 is a flowchart of a text generation model training method according to an embodiment of the present disclosure.
[0017] Figure 3 is an optional flowchart of the method of obtaining training samples in step S202 of this embodiment of the present disclosure.
[0018] Figure 4 is an optional flowchart of step S204 in an embodiment of this disclosure.
[0019] Figure 5 is a flowchart of the steps of a text generation method according to an embodiment of this disclosure.
[0020] Figure 6A is a schematic diagram of a human-computer interaction interface on the user equipment side of the embodiment shown in Figure 5.
[0021] Figure 6B is a schematic diagram of another human-computer interaction interface on the user device side in the embodiment shown in Figure 5.
[0022] Figure 6C is a schematic diagram of another human-computer interaction interface on the user equipment side in the embodiment shown in Figure 5.
[0023] Figure 7 is a flowchart of another text generation method according to an embodiment of this disclosure.
[0024] Figure 8 is an optional flowchart of step S704 in the embodiment shown in Figure 7.
[0025] Figure 9 is a scenario example diagram according to an embodiment of the present disclosure.
[0026] Figure 10 is a schematic diagram of the structure of an electronic device according to an embodiment of the present disclosure. Detailed Implementation
[0027] To enable those skilled in the art to better understand the technical solutions in the embodiments of this disclosure, the technical solutions in the embodiments of this disclosure will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of this disclosure, and not all embodiments. Based on the embodiments of this disclosure, all other embodiments obtained by those skilled in the art should fall within the protection scope of this disclosure.
[0028] Figure 1 illustrates an exemplary system to which embodiments of the present disclosure are applicable. As shown in Figure 1, the system 100 may include a cloud server 102, a communication network 104, and / or one or more user devices 106, with multiple user devices being an example in Figure 1.
[0029] The cloud server 102 can 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 server clusters, etc. In some embodiments, the cloud server 102 can perform any suitable function. For example, in some embodiments, the cloud server 102 can implement a text generation model training method to obtain a trained text generation model. As an optional example, in some embodiments, the cloud server 102 can first obtain training samples for model training, including prompt information samples and corresponding response data samples. The prompt information samples contain word count requirements for the text to be generated, and the word count of the response data samples matches the word count requirements indicated by the word count requirements. Then, the prompt information samples are input into a general generative base model so that the general generative base model generates text based on the prompt information samples to obtain text generation data samples. Afterward, the general generative base model is fine-tuned and trained at least according to the difference between the word count of the text generation data samples and the word count of the response data samples to obtain a text generation model capable of generating text with the corresponding word count requirements. In some embodiments, after training the text generation model, the cloud server 102 can implement a text generation method to generate text that meets the requirements. As an optional example, in some embodiments, the cloud server 102 can first generate a prompt message based on at least the topic information and word count requirement information of the text to be generated carried in the text generation request sent by the user device 106; then, the prompt message is input into the text generation model to generate text with the topic information as its subject and the word count meeting the word count requirement information, wherein the text generation model is obtained based on a general generative base model. Optionally, after generating the text, the cloud server 102 can return the generated text to the user device 106.
[0030] 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 equipment 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 server 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 equipment 106 and the cloud server 102, such as a network link, a dial-up link, a wireless link, a hardwired link, any other suitable communication link, or any suitable combination of such links.
[0031] User device 106 may include any one or more user devices suitable for presenting text, interacting with users, etc. When user device 106 performs the scheme of the embodiments of this disclosure, user device 106 may implement a text generation method to generate text that meets the requirements. As an optional example, in some embodiments, user device 106 may first generate a text generation request based on user input data and send it to a server such as cloud server 102. The text generation request carries the topic information of the text to be generated and the word count requirement information of the text to be generated. It then receives text generated by the text generation model of the server such as cloud server 102 in response to the text generation request. The text is generated by the text generation model with the topic information in the input data as the topic and the word count meets the word count requirement information. The text generation model is obtained based on a general generative basic model. In some embodiments, user device 106 may include any suitable type of device. For example, in some embodiments, user device 106 may include a mobile device, tablet computer, laptop computer, desktop computer, and / or any other suitable type of user device. Optionally, a pre-defined client program (such as a browser) may be installed on the user device 106, which can receive user input data through its human-computer interaction interface, so as to generate a text generation request based on the user input data and send it to the server, such as the cloud server 102, through the client program.
[0032] Based on the above system, this disclosure provides a text generation scheme and a text generation model training scheme, which are described below through several embodiments.
[0033] To facilitate the explanation of the embodiments of this disclosure, the training method of the text generation model will be described first. Figure 2 is a flowchart of the steps of a text generation model training method according to an embodiment of this disclosure. Referring to Figure 2, the text generation model training method includes steps S202, S204, S206, and S208, specifically:
[0034] S202: Obtain training samples for model training.
[0035] The training samples include prompt information samples and corresponding response data samples. The prompt information samples contain word count requirements for the text to be generated, and the word count of the response data samples matches the word count requirements indicated by the word count requirements.
[0036] Training samples can come from a training sample set. A training sample includes a pair of prompt information samples and response data samples.
[0037] In this embodiment of the disclosure, during model training, the prompt information samples in the training samples are also called prompt samples. These prompt samples enable the model to be trained to generate text indicating the number of words required by the word count information contained in the prompt information samples. The prompt information samples may include historical prompt information or prompt information samples generated in a certain manner.
[0038] Optionally, the word count requirement in the prompt sample can be presented in any style; it can specify a range of words or a specific number of words. For example, as an easy-to-understand example, the word count requirement could include "Generate text in the range of 900 to 1000 words," "Generate text of approximately 1000 words," or "Generate text of 1000 words." For example, "Approximately 1000 words" could be 1000 ± a words, where 'a' can be selected as needed, for example, a = 50.
[0039] In this embodiment of the disclosure, during model training, the response data samples in the training samples can be used as supervision conditions for supervised training to calculate the loss with the text generation data samples predicted by the model, and then the model is trained based on the calculation results, including but not limited to adjusting model parameters. The number of characters in the response data samples matches the number of characters indicated by the character count requirement information in the prompt information samples. For example, if the character count requirement information of the above prompt information samples is "generate text in the range of 900 to 1000 characters", then the corresponding response data sample can have a character count of 900 to 1000 characters; if the character count requirement information of the above prompt information samples is "generate text of approximately 1000 characters", then the corresponding response data sample can have a character count of 950 to 1050 characters (only as an example); if the character count requirement information of the above prompt information samples is "generate text of 1000 characters", then the corresponding response data sample can have a character count of 1000 characters. The text generation model to be trained generates text based on the prompt information samples in the training samples. Then, according to a preset loss function, it calculates the loss value, i.e., the difference between the number of words in the generated text (i.e., the text generation data sample) and the number of words in the response data sample, and adjusts the model parameters based on this loss value. This process is executed iteratively until the training termination condition is met, such as reaching a preset number of training iterations or the loss value reaching a preset threshold. The loss function used in this embodiment can be set by those skilled in the art according to actual needs, including but not limited to the cross-entropy loss function, and this embodiment does not limit the specific implementation of the loss function.
[0040] In some alternative embodiments, a general generative base model can be used as a foundation to obtain the desired text generation model through fine-tuning training. In some implementations, the general generative base model can be a Large Language Model (LLM). The LLM itself possesses powerful text understanding and generation capabilities, and after appropriate training, it can effectively meet text generation requirements. In this embodiment of the disclosure, the general generative base model is trained using input training samples, and after training, a text generation model capable of generating text that meets the word count requirements is obtained.
[0041] Optionally, referring to the flowchart shown in FIG3, the method of obtaining training samples in step S202 may include steps S2021 and S2022, specifically:
[0042] S2021: Obtain training sample groups from the training sample set used for model training. Each training sample group includes multiple training samples, which include multiple prompt information samples and multiple response data samples corresponding to the multiple prompt information samples. Among the multiple prompt information samples in the same group, all information is the same except for the word count requirement.
[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 message sample and a corresponding response data sample. In this training sample group, the multiple prompt message samples are identical except for the word count requirement. For example, this other information could include the topic information or content requirement information of the text to be generated.
[0044] Optionally, multiple training sample groups can be obtained from the training sample set. For example, taking two training sample groups, A1 and A2, the word count requirements for each training sample in training sample group A1 (e.g., n training samples) are X1, ..., Xn, and the topic information can all be B1. Similarly, the word count requirements for each training sample in training sample group A2 (e.g., m training samples) are Y1, ..., Ym, and the topic information can all be B2. In a specific example, suppose a training sample group contains three training samples with the same topic information but different word count requirements. For example, training sample 01 is "Please help me write a paper on computer principles, approximately 2000 words"; training sample 02 is "Please help me write a paper on computer principles, approximately 5000 words"; and "Please help me write a paper on computer principles, approximately 7000 words". It is evident that in this group of training samples, the word count requirements differ, but other information remains the same.
[0045] S2022: Take multiple training samples from the same training sample group as a unit, and use them to train the general generative base model.
[0046] The obtained training sample set can be used for subsequent model training. An exemplary method can be found in the relevant description in step S204 below, which will not be repeated here.
[0047] It should be understood that, based on the optional implementation of steps S2021 to S2022 above, in this disclosure, multiple training samples in the same training sample group can be obtained sequentially, which facilitates subsequent model training. Among the multiple prompt information samples in the same training sample group, all information is the same except for the word count requirement. Therefore, in the subsequent model training process, multiple training samples in the same training sample group can be used sequentially to train the general generative basic model with different word count requirements by controlling variables. This makes the model more sensitive to word count information, so that when using the trained text generation model to generate text, it can more accurately generate text that meets the predetermined word count requirement, thereby meeting the user's needs for text generation.
[0048] S204: Input the prompt information sample into the general generative base model so that the general generative base model can generate text based on the prompt information sample and obtain text generation data sample.
[0049] Optionally, after obtaining a training sample for model training, the prompt information sample in the training sample can be input into the general generative base model so that the general generative base model can generate text based on the prompt information sample and obtain text generation data sample.
[0050] Alternatively, multiple training samples can be sequentially obtained from the same training sample group, and for each training sample, the prompt information sample in the training sample is input into the general generative base model, so that the general generative base model can generate text based on the prompt information sample in the training sample to obtain the corresponding text generation data sample.
[0051] For example, taking the training sample groups A1 and A2 mentioned above as examples, for training sample group A1, multiple training samples in training sample group A1 can be obtained sequentially, and multiple prompt sample information of word count requirement information X1, ..., Xn and the corresponding response data samples C1, ..., Cn can be used to train the general generative basic model. Then, for training sample group A2, multiple training samples in training sample group A2 can be obtained sequentially, and multiple prompt sample information of word count requirement information Y1, ..., Ym and the corresponding response data samples D1, ..., Dm can be used to train the general generative basic model.
[0052] For example, taking the training sample groups A1 and A2 above as examples, for training sample group A1, prompt sample information containing word count requirement information X1, ..., Xn can be obtained sequentially, and then input into the general generative base model. The general generative base model generates text generation data samples P1, ..., Pn based on the prompt sample information containing word count requirement information X1, ..., Xn. For training sample group A2, prompt sample information containing word count requirement information Y1, ..., Yn can be obtained sequentially, and then input into the general generative base model. The general generative base model generates text generation data samples Q1, ..., Qm based on the prompt sample information containing word count requirement information Y1, ..., Ym.
[0053] In some optional embodiments, referring to the flowchart shown in FIG4, the above step S204 may include the following steps S2041 to S2042, specifically:
[0054] S2041: Input the prompt information sample into the general generative base model, and extract the word count requirement information and semantic information of the prompt information sample through the general generative base model.
[0055] General generative foundation models, such as LLM, possess strong text understanding capabilities and can extract semantic information from text. For example, taking the prompt sample containing the word count requirement information X1 as an example, this prompt sample information can be input into a general generative foundation model (such as LLM). The general generative foundation model analyzes the prompt sample information to obtain the corresponding word count requirement information X1 and the semantic information of the prompt sample. Other prompt sample information can be processed similarly.
[0056] For example, taking the input data as "Please help me write a paper on computer principles, approximately 7000 words," the generated prompt message will also include the above information. For the general generative basic model, upon receiving this prompt message, it extracts the word count requirement information "approximately 7000 words" and the semantic information of "Please help me write a paper on computer principles," such as "generate a computer principles paper." Subsequent processing will then be based on these two pieces of information.
[0057] S2042: Based on semantic information, text is generated according to the number of words indicated by the word count requirement information through a general generative basic model to obtain text generation data samples.
[0058] Taking the aforementioned prompt information sample containing the word count requirement information X1 as an example, during model training, the text generation capability of the general generative base model is used to generate text according to the required word count information X1 based on the semantic information of the prompt information sample, obtaining text generation data sample P1. Other prompt information samples are processed similarly, yielding text generation data samples P2, ..., Pn, and text generation data samples Q1, ..., Qm as needed.
[0059] Based on this, through the optional implementation of steps S2041 to S2042 above, text generation can be effectively achieved by using a generative language model based on prompt information samples to obtain text generation data samples. This facilitates subsequent model training processes and yields a text generation model capable of generating text with the corresponding number of characters according to the character count requirement. This allows the text generation model to be used to generate text that meets the predetermined character count requirement more accurately, thus better satisfying the user's needs for text generation.
[0060] S206: Fine-tune the general generative basic model based on the difference between the number of characters in the generated text data sample and the number of characters in the response data sample to obtain a text generation model that can generate text with the corresponding number of characters according to the character count requirement.
[0061] After the general generative base model generates text generation data samples, word count processing can be performed on them, including but not limited to obtaining the word count of the text generation data samples by writing and running programs, or by calling API interfaces for word count. Then, based on the word count of the generated text data samples and the word count of the response data samples, a loss value (i.e., the difference between the word count of the generated text data samples and the word count of the response data samples) is calculated using a preset loss function such as the cross-entropy loss function. The general generative base model is then fine-tuned and trained based on this loss value.
[0062] Based on the difference in the number of characters between the generated text data sample and the response data sample, the general generative basic model is fine-tuned to adjust the model parameters. After the training ends, a text generation model that can generate text with the required number of characters is obtained.
[0063] Optionally, the training termination condition can be set as needed. For example, the training termination condition can be that the training is considered complete when a predetermined number of training iterations have been reached, thus ending the model training process. Alternatively, the training termination condition can also be that the training termination condition is reached when the loss value calculated by a preset loss function falls within a preset loss value range, thus ending the model training process.
[0064] Based on this, in an optional implementation of steps S202 to S206 in this embodiment, training samples for model training are obtained. These training samples include prompt information samples and corresponding response data samples. The prompt information samples contain word count requirements for the text to be generated, and the word count of the response data samples matches the word count requirements indicated by the word count requirements. The prompt information samples are then input into a general generative basic model so that the general generative basic model generates text based on the prompt information samples, thereby obtaining text generation data samples. The general generative basic model is then fine-tuned based at least on the difference between the word count of the text generation data samples and the word count of the response data samples. This results in a text generation model that can generate text with the corresponding word count requirements according to the word count requirements. Using this text generation model, text that meets the predetermined word count requirements can be generated more accurately, thereby better meeting the user's needs for text generation.
[0065] In some optional embodiments, the fine-tuning training in step S206 above may include: fine-tuning the general generative base model based on the differences between the content of the text-generated data sample and the content of the response data sample, and the differences between the number of words in the text-generated data sample and the number of words in the response data sample.
[0066] Optionally, the difference between the content of the generated text data sample and the content of the response data sample can be the difference in semantic information between the content of the generated text data sample and the content of the response data sample.
[0067] For example, during model training, the fine-tuning training process of the aforementioned text data sample P1 and response data sample C1 can be used as an example for understanding. The general generative basic model can be fine-tuned based on the differences between the content of the text generation data sample P1 and the content of the response data sample C1, as well as the differences between the number of words in the text generation data sample P1 and the number of words in the response data sample C1. Referring to the fine-tuning training process of P1 and C1, the model can be trained multiple times using text generation data samples and response data samples generated from other training samples to obtain a text generation model that can generate text with the corresponding number of words according to the word count requirement information, and the text can meet the predetermined content requirements.
[0068] It should be understood that, through the above optional implementation methods, the general generative basic model is fine-tuned and trained based on the differences between the content of the text generation data sample and the content of the response data sample, as well as the differences between the number of words in the text generation data sample and the number of words in the response data sample. After training, a text generation model is obtained. Using this text generation model, text that meets the predetermined word count requirement and the predetermined content requirement can be accurately generated, thereby better meeting the user's needs for text generation.
[0069] In some optional embodiments, the text generation model training method of this disclosure further includes: updating the word count requirement information in the prompt information sample according to the word count of the text generation data sample; and generating new training samples based on the prompt information sample and the text generation data sample after the word count requirement information has been updated.
[0070] Optionally, the updated prompt information sample can be designated as the new prompt information sample, and the generated text data sample can be designated as the new response data sample. These new prompt information samples and new response data samples can then be used as new training samples for model training. This effectively expands the training samples, utilizes the model's generated data, and ensures that the generated training samples have relatively accurate word count requirements, significantly reducing the cost of obtaining training samples.
[0071] Based on this, this disclosure updates the word count requirement information in the prompt information sample according to the word count of the text generation data sample, and generates new training samples based on the updated prompt information sample and the text generation data sample. On the one hand, this enriches the training samples and improves the model training effect; on the other hand, the new training samples can be used to achieve adversarial training of the general generative basic model. During the training process, it is beneficial to gradually improve the accuracy of the general generative basic model in generating text that meets the preset word count requirement. Thus, the text generation model obtained after training can more accurately generate text that meets the predetermined word count requirement and the predetermined content requirement during the inference stage, thereby better meeting the user's needs for text generation.
[0072] It is understood that the foregoing description of the text generation model training method is merely an illustrative example of this disclosure and is not intended to limit this disclosure in any way.
[0073] The text generation method of this embodiment will now be described. Referring to the flowchart shown in FIG5, this embodiment describes the text generation method from the perspective of a user device. The text generation method of this embodiment includes the following steps S502 and S504, specifically:
[0074] S502: Using the user's input data, generate a text generation request and send it to the server. The text generation request carries the topic information of the text to be generated and the word count requirement of the text to be generated.
[0075] The text generation method of this disclosure can be used in user equipment 106. The input data may include user requirements regarding the subject matter and word count of the text to be generated. After receiving the user's input data, user equipment 106 can analyze the input data and generate a corresponding text generation request based on the input data. This text generation request carries the subject matter and word count requirements of the text to be generated. After receiving the text generation request, it can send the request to a server (which may be a cloud server 102), and the server will respond to the request and generate the text.
[0076] Users can input the above-mentioned input data in any way. Optionally, a predetermined client program can be installed on the user device 106. The client program can be configured with a human-computer interaction interface for inputting data. Users can input the above-mentioned input data in the human-computer interaction interface using methods including but not limited to typing, voice input, copy and paste input, and dragging and dropping materials.
[0077] Optionally, the topic information of the text to be generated can indicate the topic 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.
[0078] In some optional embodiments, the implementation of generating a text request based on user input data in step S502 may include: receiving input data from the user through a text input box in the human-computer interaction interface, which contains the topic information and word count requirement information of the text to be generated, and generating a text generation request based on the input data.
[0079] For example, referring to the example human-computer interaction interface in FIG6A, the human-computer interaction interface can be the human-computer interaction interface of the client program on the user device 106, including a text input box. The user can input the input data containing the topic information and word count requirement information of the text to be generated into the text input box by typing, voice input, copy and paste input, etc. After the input is completed, the user device 106 can obtain the input data and generate the corresponding text generation request based on the input data.
[0080] For example, in a simplified example, if a user wants to generate 10,000 words of text on the topic of "the application of artificial intelligence in new media creation," they can enter something like, "Please generate an article on the topic of 'the application of artificial intelligence in new media creation,' requiring 10,000 words," in the text input box of Figure 6A. When the user clicks the "Generate Article Directly" button on the interface, the article (10,000 words) will be generated directly based on the input data, according to the 10,000-word requirement. If the user clicks the "Generate Reference Outline" button, a text outline will be generated first, and after user confirmation, the 10,000-word text will be generated based on that outline. This example is not intended to limit the scope of this disclosure.
[0081] Based on this, the above optional method allows users to conveniently input data containing the topic information and word count requirement of the text to be generated through the text input box. This enables the text generation request generated based on the input data to effectively carry the topic information and word count requirement of the text to be generated, so as to facilitate the subsequent generation of text that meets the predetermined word count requirement, thereby better meeting the user's needs for text generation.
[0082] In some alternative embodiments, the implementation of generating a text request using user input data in step S502 may include: receiving input data from the user through a text input box in the human-computer interaction interface, which contains the topic information of the text to be generated; receiving the user's selection operation on multiple word count options displayed in the human-computer interaction interface; determining the word count requirement information of the text to be generated based on the selection operation; and generating a text generation request using the input data and the word count requirement information.
[0083] For example, referring to the example human-computer interaction interface in Figure 6B, this human-computer interaction interface can be the human-computer interaction interface of a client program on user device 106, including a text input box and multiple character count options. The user can input data containing the topic information of the text to be generated into the text input box through typing, voice input, copy and paste input, etc., and then select the required number of characters from the multiple character count options. User device 106 can determine the character count requirement information of the text to be generated based on the user's selected character count option. Then, user device 106 can generate a text generation request based on the input data and the character count requirement information.
[0084] Optionally, the multiple word count options may include fixed word count options (such as "500 words", "1000 words", etc. shown in Figure 6B), word count range options (such as "more than 2500 words" option shown in Figure 6B), or word count input options (such as "input word count" option shown in Figure 6B). The word count input options allow users to freely output the word count based on the selection operation, so as to further meet the user's text generation needs.
[0085] For example, in a simple example, if a user wants to generate 1000 words of text with the main content "Application of Artificial Intelligence in New Media Creation", they can enter something like "Application of Artificial Intelligence in New Media Creation" in the text input box for the topic information in Figure 6B, and then select the "1000 words" word count option in Figure 6B to complete the input of the data and word count requirement. Of course, this example is not intended to limit the scope of this disclosure in any way.
[0086] Based on this, the above optional method allows users to conveniently input data containing the topic information of the text to be generated through the text input box, and also allows users to conveniently input the word count requirement information through the word count option. This enables the text generation request generated based on the input data and word count requirement information to effectively carry the topic information and word count requirement information of the text to be generated, so as to facilitate the subsequent generation of text that meets the predetermined word count requirement, thereby better meeting the user's needs for text generation.
[0087] S504: Receive the text generated by the text generation model of the server in response to the text generation request. The text is generated by the text generation model with the topic information in the input data as the topic and the number of words generated meets the word count requirement indicated by the word count information.
[0088] As mentioned earlier, this text generation model is obtained by fine-tuning and training based on a general generative base model.
[0089] In this embodiment of the disclosure, after receiving a text generation request sent by a user device, the server (including but not limited to the cloud server shown in Figure 1) can respond to the text generation request by generating corresponding text through a text generation model. When generating text, the text generation model uses the topic information carried in the text generation request as the topic to generate the text content, and generates text that meets the word count requirement information based on the word count requirement information carried in the text generation request. This accurately generates text that meets the user's predetermined word count and topic requirements, thus better satisfying the user's text generation needs.
[0090] Optionally, the server can generate a prompt message based at least on the topic information and word count requirement of the text to be generated carried in the text generation request sent by the user device; then, the prompt message is input into the text generation model to generate text with the topic information as the subject and the word count meeting the word count requirement. Afterward, the server can send the generated text to the user device.
[0091] Based on this, the text generation method in steps S502 to S504 above can generate a text generation request based on the user's input data and send it to the server. The text generation request carries the topic information of the text to be generated and the word count requirement information of the text to be generated. Then, the text generation model on the server responds to the text generation request and generates the text. The text is generated by the text generation model with the topic information in the input data as the topic and the word count meets the word count requirement information. Therefore, this solution can use the text generation model to generate text that meets the predetermined word count requirement more accurately, thereby better meeting the user's needs for text generation.
[0092] Optionally, the text generation method in this embodiment further includes receiving text material associated with the topic information input by the user. Optionally, the text material can be of any type, including but not limited to Word, PDF, TXT, PPT, Excel, etc., and can also be an image containing text. The text material records text content related to the topic 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 means of, for example, directly concatenating it with the input data, and carrying it through prompts. However, this is not limited to this; other methods that can be passed to the text generation model are also applicable.
[0093] In some alternative embodiments, the implementation of generating a text request based on user input data in step S502 may include: generating a text generation request based on user input data and text materials. Based on this, the text generated by the server may be text generated using a text generation model with the topic information in the input data as the theme, based on the text materials, and with a word count meeting the word count requirement indicated by the word count requirement information.
[0094] Optionally, referring to the example human-computer interaction interface in FIG6C, the human-computer interaction interface may be 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 and dropping, or by clicking and selecting the text materials). The user 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.
[0095] Optionally, the server can generate a prompt message based at least on the topic information, word count requirement information, and text material carried in the text generation request sent by the user device. This prompt message is then input into the text generation model to generate text that is based on the topic information, uses the text material, and meets the word count requirement. The server can then send the generated text to the user device.
[0096] For example, an example application scenario for generating text from text materials could be that a user wants the generated text to contain the main internal parts, semantic information, or key information of an article. In this case, they can find some example articles as reference text materials associated with the topic information and input them to generate a text generation request. The text generation model then generates the text based on the topic information, text materials, and word count requirements. It should be understood that this example application scenario is not intended to limit the embodiments of this disclosure.
[0097] It should be understood that, through the text material associated with the topic information input by the user in this disclosure, the text generation model can use the topic information in the input data as the topic and refer to the content of the text material to generate text with a word count that meets the word count requirement information. This makes the generated text not only meet the predetermined word count requirement, but also more closely correspond to the text material in terms of content, thereby better meeting the user's needs for text generation.
[0098] Optionally, the text generation method in this embodiment further includes receiving writing requirement information input by a user. Optionally, the writing requirement information may indicate the writing requirements for the text to be generated, intended to indicate a series of regulations, guidelines, or expected standards that the text to be generated must follow. It may include writing requirements other than word count requirements and can be used as limiting conditions for generating the text. For example, it may require the generated text to be logically clear, have a certain timeliness, and have necessary data and factual evidence to support its core viewpoints, etc. As shown in Figure 6C, the user can input writing requirements through the writing requirement input box in the human-computer interaction interface of the client program on the user device 106.
[0099] In some alternative embodiments, the implementation of generating a text request based on user input data in step S502 may include: generating a text generation request based on user input data and writing requirement information. Based on this, the text generated by the server may be generated by a text generation model using the topic information in the input data as the topic, and according to the writing requirement information and word count requirement information.
[0100] Optionally, users can input writing requirements through text input boxes on the human-computer interaction interface. For example, referring to the human-computer interaction interface of Figure 6C, both input data and writing requirements can be entered into the text input boxes to generate a text generation request based on the user's input data and writing requirements.
[0101] Optionally, the server can generate a prompt message based at least on the topic information, word count requirement information, and writing requirement information carried in the text generation request sent by the user device. This prompt message is then input into the text generation model to generate text with the topic information as the subject and according to the writing and word count requirements. The server can then send the generated text to the user device.
[0102] For example, an example application scenario for generating text based on writing requirements could be that a user desires text with requirements beyond word count, such as "no names of people allowed" or "at least three famous quotes required." In such cases, these requirements can be input as writing requirements to generate a text generation request. The text generation model then generates the text based on the topic information, writing requirements, and word count requirements. It should be understood that this example application scenario is not intended to limit the scope of this disclosure.
[0103] It should be understood that by having the user input writing requirements information, the text generation model can use the topic information in the input data as the topic and refer to the writing requirements information to generate text with the word count required by the word count requirement information. This allows the generated text to not only meet the predetermined word count requirement, but also to better match the other writing requirements indicated by the writing requirements information in terms of content, thereby better meeting the user's needs for text generation.
[0104] It is understood that the foregoing description of the text generation method in the first aspect is merely an illustrative example of this disclosure and is not intended to limit this disclosure in any way.
[0105] Referring to the flowchart shown in Figure 7, this disclosure provides another text generation method. This method, from the perspective of a server-side application such as a cloud server, focuses on the inference application of the generated text generation model. The text generation method includes the following steps S702 and S704, specifically:
[0106] S702: Obtain the subject information and word count requirement information of the text to be generated from the text generation request sent by the user equipment, and generate a prompt message.
[0107] Regarding the text generation request, please refer to the description of the relevant parts in the above embodiments, which will not be repeated here.
[0108] In step S702 of this embodiment, after the user equipment sends the text generation request to the server, the server can generate prompt information based on the topic information of the text to be generated and the word count requirement information of the text to be generated carried in the text generation request. The prompt information can be understood by the text generation model for text generation.
[0109] S704: Input the prompt information into the text generation model to generate text with the topic information as the topic and the word count meeting the word count requirement indicated by the text generation model.
[0110] The text generation model is based on a general generative base model, which can effectively generate text. It should be understood that the text generation model can be trained on the general generative base model in any way. For example, it can be trained using the methods described in the foregoing text generation model training method embodiments. For details, please refer to the foregoing embodiments; further elaboration is not provided here.
[0111] Based on this, the text generation method in the above steps S702 to S704 of this embodiment can generate prompt information based on at least the topic information and word count requirement information of the text to be generated carried in the text generation request sent by the user equipment. Then, the prompt information is input into the text generation model so that the text generation model can generate text with the topic information as the topic and the word count meeting the word count requirement information. Thus, the text with the predetermined word count and topic requirements required by the user can be accurately generated, which better meets the user's needs for text generation.
[0112] Optionally, if the text generation request also carries text material associated with the topic information, then in some optional embodiments, step S702 may include: generating prompt information based at least on the topic information, word count requirement information, and text material carried in the text generation request sent by the user device; step S704 may include: inputting the prompt information into the text generation model to generate text with the topic information as the topic, based on the text material, and with a word count meeting the word count requirement information. The specific implementation can be referred to the relevant descriptions in the foregoing text generation method embodiments, and will not be repeated here.
[0113] It should be understood that in this embodiment of the disclosure, the text generation model is input based on the topic information, word count requirement information, and text material generation prompt information carried in the text generation request sent by the user device. This enables the text generation model to generate text with the topic information as the topic and the content of the text material as a reference, so that the generated text not only meets the predetermined word count requirement, but also corresponds more closely to the text material in terms of content, thereby better meeting the user's needs for text generation.
[0114] Optionally, if the text generation request also carries writing requirement information, then in some optional embodiments, step S702 may include: generating prompt information based at least on the topic information, word count requirement information, and writing requirement information carried in the text generation request sent by the user device; step S704 may include: inputting the prompt information into the text generation model to generate text with the topic information as the theme and according to the writing requirement information and word count requirement information. The specific implementation can be referred to the relevant descriptions in the foregoing text generation method embodiments, and will not be repeated here.
[0115] It should be understood that in this embodiment of the disclosure, prompt information is generated based on the topic information, word count requirement information, and writing requirement information carried in the text generation request sent by the user device, and then input into the text generation model. This enables the text generation model to use the topic information in the input data as the topic and refer to the writing requirement information to generate text with a word count that meets the word count requirement information. This results in the generated text not only meeting the predetermined word count requirement but also better conforming to other writing requirements indicated by the writing requirement information in terms of content, thereby better meeting the user's needs for text generation.
[0116] In some optional embodiments, referring to the flowchart shown in FIG8, any implementation of step S704 above may include the following steps S7041, S7042 and S7043, specifically:
[0117] S7041: Input the prompt information into the text generation model to generate text outline data that matches the topic information.
[0118] Optionally, the text outline data can briefly describe the various parts of the text to be generated. Because the text generation model has powerful text generation capabilities, it can randomly generate text outline data in various styles. Therefore, it allows for the selection of appropriate text outline data as needed to generate new prompts, thereby achieving text generation.
[0119] For ease of understanding, in some examples, the text outline data generated by the text generation model based on the prompt information and matching the topic information can be:
[0120] “
[0121] I. History of Computer Development
[0122] 1.1XXXXX
[0123] 1.2XXXXXXX
[0124] ......
[0125] II. Components of a Computer
[0126] 2.1XXXXX
[0127] 2.2XXXXXXX
[0128] ......
[0129] "
[0130] As can be seen from the example above, this text outline data is similar to a table of contents, which can briefly describe the contents of each part of the text to be generated. This text outline data facilitates subsequent text generation.
[0131] S7042: Generate new prompts based on text outline data, topic information, and word count requirements.
[0132] After obtaining the text outline data, new prompts can be generated based on the text outline data, topic information, and word count requirements. These new prompts can then be input into the text generation model for text generation.
[0133] In some optional embodiments, step S7042 may include: receiving text outline data modified by the user; and generating new prompt information based on the modified text outline data, topic information, and word count requirement information.
[0134] It should be understood that in the above embodiments, users are allowed to modify the text outline data generated in step S7041, and generate new prompt information based on the modified text outline data, topic information and word count requirement information, so that the generated text that meets the predetermined word count requirement can better meet the user's needs for using the generated text.
[0135] Optionally, after generating the text outline data in step S7041, the server (cloud server 102) can 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 device 106 can modify the text outline data as needed. After modification, the user device 106 sends the modified text outline data to the server. The server receives the modified text outline data and can then generate new prompt information based on the modified text outline data, topic information, and word count requirement information for subsequent text generation.
[0136] Of course, in other optional embodiments, if the user is satisfied with the text outline data generated in step S7041, the text outline data does not need to be modified. The server can directly generate new prompt information based on the text outline data, topic information and word count requirement information generated in step S7041 for subsequent text generation.
[0137] S7043: Input the new prompt information into the text generation model so that the text generation model can generate text with the topic information as the theme and the word count meeting the word count requirement as indicated by the text outline data.
[0138] Based on this, the optional implementation of steps S7041 to S7043 in this disclosure allows for the input of prompt information into a text generation model to generate text outline data that matches the topic information. Then, based on the text outline data, topic information, and word count requirement information, new prompt information is generated and input into the text generation model. This conveniently and effectively generates text with the topic information as its theme and the word count meeting the word count requirement, according to the text outline data. This effectively ensures the correspondence between the content and topic of the generated text that meets the predetermined word count requirement, better meeting the user's needs for the generated text.
[0139] Figure 9 is a schematic diagram illustrating a scenario example of the text generation scheme according to an embodiment of this disclosure. The text generation scheme in this embodiment will be understood in conjunction with Figure 9. It should be noted that the scenario example shown in Figure 9 is only for facilitating understanding of the embodiments of this disclosure and is not intended to limit the scope of this disclosure in any way.
[0140] As shown in Figure 9, suppose a user inputs "Please help me write a paper on computer principles, approximately 7000 words" (i.e., input data) through the user device's human-computer interaction interface. The user device generates a corresponding text generation request based on this input data and sends it to the cloud server. Upon receiving the text generation request, the cloud server parses the input data and generates a corresponding prompt message, which includes the information "Please help me write a paper on computer principles, approximately 7000 words." This prompt message is then input into the cloud server's text generation model; in this example, it is shown as a finely tuned and trained LLM. Upon receiving the prompt message, the LLM generates a paper on computer principles according to the word count requirement of "approximately 7000 words" and outputs approximately 7000 words of text.
[0141] Then, the cloud server can send the text of about 7,000 characters to the user's device for display on the user's device.
[0142] As can be seen, the text generation model in this example can effectively generate text according to the user's required word count. It should be noted that the various embodiments of this disclosure use several thousand words as examples, but those skilled in the art should understand that in practical applications, LLM can generate long texts of tens of thousands, hundreds of thousands, or even millions of words. The embodiments of this disclosure do not limit the specific word count of the generated text; all are applicable to the solutions of the embodiments of this disclosure and are within the scope of protection claimed by this disclosure.
[0143] This disclosure also provides an electronic device, including: 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 of the methods described in the foregoing plurality of method embodiments by running the computer program stored in the memory.
[0144] Figure 10 shows a structural block diagram of an optional electronic device according to an embodiment of this disclosure. This disclosure does not limit the specific implementation of the electronic device 1000. As an example, referring to Figure 10, the electronic device 1000 provided in this disclosure includes: a processor 1002, a communications interface 1004, a memory 1006, and a communication bus 1008. Wherein:
[0145] The processor 1002, communication interface 1004, and memory 1006 communicate with each other via communication bus 1008.
[0146] Communication interface 1004 is used to communicate with other electronic devices or servers.
[0147] The processor 1002 is used to execute the computer program 1010, specifically the relevant steps in any of the aforementioned method embodiments.
[0148] Specifically, computer program 1010 may include program code that includes computer operation instructions.
[0149] The processor 1002 may be a CPU, a GPU (Graphics Processing Unit), an Application Specific Integrated Circuit (ASIC), or one or more integrated circuits configured to implement embodiments of the present disclosure. The one or more processors included in the smart device may be processors of the same type, such as one or more CPUs; or they may be processors of different types, such as one or more CPUs and one or more ASICs.
[0150] Memory 1006 is used to store computer program 1010. Memory 1006 may include high-speed RAM memory, and may also include non-volatile memory, such as at least one disk storage device.
[0151] Specifically, computer program 1010 can be used to cause processor 1002 to execute the method of any of the foregoing multiple method embodiments.
[0152] The specific implementation of each step in computer program 1010 can be found in the corresponding descriptions of the steps and units in any of the foregoing method embodiments, and will not be repeated here. Those skilled in the art will clearly understand that, for the sake of convenience and brevity, the specific working processes of the devices and modules described above can be referred to the corresponding process descriptions in the foregoing method embodiments, and will not be repeated here.
[0153] Furthermore, this disclosure also provides a computer storage medium storing a computer program thereon, which, when executed by a processor, implements the methods of any of the foregoing method embodiments. The computer storage medium includes, but is not limited to, compact disc read-only memory (CD-ROM), random access memory (RAM), floppy disk, hard disk, or magneto-optical disk.
[0154] This disclosure also provides a computer program product, including a computer program that, when executed by a processor, implements the method as described in any of the above-described method embodiments.
[0155] Furthermore, 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 for training the model, data used for analysis, stored data, displayed data, etc.) involved in the embodiments of this disclosure are all information and data authorized by the user or fully authorized by all parties. Moreover, the collection, use and processing of related data must comply with the relevant laws, regulations and standards of the relevant countries and regions, and corresponding operation entry points are provided for users to choose to authorize or refuse.
[0156] It should be noted that, depending on the implementation needs, the various components / steps described in the embodiments of this disclosure can be broken down into more components / steps, or two or more components / steps or parts of the operation of components / steps can be combined into new components / steps to achieve the purpose of the embodiments of this disclosure.
[0157] The methods described above according to embodiments of this disclosure can be implemented in hardware, firmware, or 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 as computer code originally stored on a remote recording medium or a non-transitory machine-readable medium and subsequently stored on a local recording medium, downloaded over a network. Thus, the methods described herein can be stored 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 is understood that the computer, processor, microprocessor controller, or programmable hardware includes storage components (e.g., Random Access Memory (RAM), Read-Only Memory (ROM), Flash Memory, etc.) capable of storing or receiving software or computer code, which, when accessed and executed by the computer, processor, or hardware, implements the methods described herein. Furthermore, when a general-purpose computer accesses code used to implement the methods shown herein, the execution of the code transforms the general-purpose computer into a dedicated computer for performing the methods shown herein.
[0158] Those skilled in the art will recognize that the units and method steps of the various examples 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 implemented in hardware or software depends on the specific application and design constraints of the technical solution. Those skilled in the art can use different methods to implement the described functions for specific applications, but such implementations should not be considered beyond the scope of the embodiments disclosed herein.
[0159] The term "comprising" and its variations as used herein are open-ended, meaning "including but not limited to". The term "based on" means "at least partially based on". The term "one embodiment" means "at least one embodiment"; the term "another embodiment" means "at least one additional 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 this disclosure are only used to distinguish different devices, modules, or units, and are not used to limit the order of functions performed by these devices, modules, or units or their interdependencies. It should be noted that the modifications of "a" and "a plurality" mentioned in the embodiments of this disclosure are illustrative and not restrictive, and those skilled in the art should understand that unless otherwise expressly indicated in the context, they should be understood as "one or more".
[0160] The above embodiments are only used to illustrate the embodiments of this disclosure, and are not intended to limit the embodiments of this disclosure. Those skilled in the art can make various changes and modifications without departing from the spirit and scope of the embodiments of this disclosure. Therefore, all equivalent technical solutions also fall within the scope of the embodiments of this disclosure, and the patent protection scope of the embodiments of this disclosure should be defined by the claims.
Claims
1. A text generation method, comprising: generating a text generation request using input data of a user and sending to a server, the text generation request carrying theme information of a text to be generated and word number requirement information of the text to be generated; receiving a text generated by a 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 theme information in the input data as a theme and a word number satisfying the word number requirement information indicated by the word number requirement information, the text generation model being obtained based on a general generative base model.
2. The method of claim 1, wherein, The generating a text generation request using input data of a user comprises: receiving input data of a user input through a text input box in a human-computer interaction interface, the input data containing theme information of a text to be generated and word number requirement information, and generating the text generation request using the input data; or, receiving input data of a user input through a text input box in a human-computer interaction interface, the input data containing theme information of a text to be generated, and receiving a selection operation of a user on a plurality of word number options displayed in the human-computer interaction interface, and determining word number requirement information of the text to be generated according to the selection operation; generating the text generation request using the input data and the word number requirement information.
3. The method of claim 1 or 2, wherein, the method further comprises receiving text material input by the user and associated with the theme information; the generating a text generation request using input data of a user comprises: generating a text generation request using input data of a user and the text material; the text is a text generated by the text generation model with the theme information in the input data as a theme and based on the text material, and the word number satisfying the word number requirement information indicated by the word number requirement information.
4. The method of any one of claims 1-3, wherein, the method further comprises receiving writing requirement information input by the user; the generating a text generation request using input data of a user comprises: generating a text generation request using input data of a user and the writing requirement information; the text is a text generated by the text generation model with the theme information in the input data as a theme and according to the writing requirement information and the word number requirement information.
5. A text generation method, comprising: obtaining theme information of a text to be generated and word number requirement information of the text to be generated from a text generation request sent from a user device, and generating prompt information; inputting the prompt information into a text generation model to generate a text with the theme information as a theme and a word number satisfying the word number requirement information indicated by the word number requirement information by the text generation model; wherein the text generation model is obtained based on a general generative base model.
6. The method of claim 5, wherein, The text generation request also carries text material associated with the theme information; The subject information of the text to be generated and the word number requirement information of the text to be generated are obtained from the text generation request sent by the user equipment, and prompt information is generated, including: obtaining the subject information, the word number requirement information and the text material from the text generation request sent by the user equipment, and generating prompt information; The prompt information is input into the text generation model to generate a text with the subject information as the subject and the word number satisfying the word number indicated by the word number requirement information through the text generation model, including: inputting the prompt information into the text generation model to generate a text with the subject information as the subject, based on the text material, and the word number satisfying the word number indicated by the word number requirement information through the text generation model.
7. The method of claim 5 or 6, wherein, The text generation request also carries writing requirement information; The subject information of the text to be generated and the word number requirement information of the text to be generated are obtained from the text generation request sent by the user equipment, and prompt information is generated, including: obtaining the subject information, the word number requirement information and the writing requirement information from the text generation request sent by the user equipment, and generating prompt information; The prompt information is input into the text generation model to generate a text with the subject information as the subject and the word number satisfying the word number indicated by the word number requirement information through the text generation model, including: inputting the prompt information into the text generation model to generate a text with the subject information as the subject, according to the writing requirement information and the word number requirement information through the text generation model.
8. The method according to any one of claims 5-7, wherein, The prompt information is input into the text generation model to generate a text with the subject information as the subject and the word number satisfying the word number indicated by the word number requirement information through the text generation model, including: The prompt information is input into the text generation model to generate a text outline data matched with the subject information through the text generation model; According to the text outline data, the subject information and the word number requirement information, new prompt information is generated; The new prompt information is input into the text generation model to generate a text with the subject information as the subject and the word number satisfying the word number indicated by the word number requirement information according to the text outline data through the text generation model.
9. The method of claim 8, wherein, The new prompt information is generated according to the text outline data, the subject information and the word number requirement information, including: Receiving the text outline data modified by the user; According to the modified text outline data, the subject information and the word number requirement information, new prompt information is generated.
10. A text generation model training method, comprising: Obtaining a training sample for model training, the training sample comprising prompt information samples and corresponding reply data samples, the prompt information samples containing word number requirement information of the text to be generated, and the word number of the reply data samples matching the word number indicated by the word number requirement information; input the prompt information sample into the general generative base model, so that the general generative base model generates text based on the prompt information sample, and obtain text generation data samples; perform fine-tuning training on the general generative base model according to at least a difference between a number of words of the text generation data sample and a number of words of the reply data sample, and obtain a text generation model capable of generating text with a corresponding number of words according to the number of words requirement information.
11. The method of claim 10, wherein, The method further includes: obtaining a training sample group from a training sample set used for model training, each training sample group including a plurality of training samples, the plurality of training samples including 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 being identical in information except for the number of words requirement information; obtaining the plurality of training samples in the same training sample group in sequence as a unit for training the general generative base model.
12. The method of claim 10 or 11, wherein, The method further includes: performing fine-tuning training on the general generative base model according to a difference between a number of words of the text generation data sample and a number of words of the reply data sample.
13. The method according to any one of claims 10-12, wherein, The method further includes: updating the number of words requirement information in the prompt information sample according to the number of words of the text generation data sample; generating new training samples based on the prompt information sample after the number of words requirement information is updated and the text generation data sample.
14. The method according to any one of claims 10-13, wherein, The method further includes: inputting the prompt information sample into the general generative base model, extracting the number of words requirement information in the prompt information sample and semantic information of the prompt information sample through the general generative base model; generating text based on the semantic information through the general generative base model according to the number of words indicated by the number of words requirement information, and obtaining text generation data samples.
15. An electronic device comprising: a processor, a communication interface, a memory, and a communication bus, wherein the processor, the communication interface, and the memory complete communication with each other through the communication bus; the memory is configured to store a computer program; the processor is configured to execute the method in any one of claims 1-14 by running the computer program stored on the memory.
16. A computer storage medium having a computer program stored thereon, the computer program being executed by a processor to implement the method in any one of claims 1-14.
17. A computer program product comprising a computer program, the computer program being executed by a processor to implement the method in any one of claims 1-14.
Citation Information
Patent Citations
Model training method and device, generative writing method and device and electronic equipment
CN117291244A
Text instruction data generation method and device, electronic equipment and storage medium
CN117332860A
Article generation method and apparatus based on large language model, and electronic device
CN117709295A
Text generation method, text model training method, electronic equipment, storage medium and program product
CN119090001A
Method of generating text, method of training model, electronic device, and medium
US20230084438A1