Article generation method and apparatus, and electronic device and storage medium

By generating text in rounds and combining generated content, the problem of low accuracy in large models when generating articles is solved, achieving higher accuracy in article generation and content consistency.

WO2025130403A1PCT designated stage expired Publication Date: 2025-06-26SHENZHEN INTELLIFUSION TECHNOLOGIES CO LTD
View PDF 5 Cites 0 Cited by

Patent Information

Application Number
PCT/CN2024/130217
Authority / Receiving Office
WO · WO
Patent Type
Applications
Current Assignee / Owner
Priority Date
2023-12-21
Filing Date
2024-11-06
Publication Date
2025-06-26

AI Technical Summary

Technical Problem

When generating articles, existing large models find it difficult to generate articles in the specified format and content, resulting in the generated articles being inconsistent with expectations and low accuracy.

Method used

Text generation is performed by rounds, inputting the output of the previous round for each round, and combining the text content generated by different rounds in the order of rounds to generate the target text content.

Benefits of technology

Improve the accuracy of article generation and ensure that the generated text content meets preset format and content requirements.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN2024130217_26062025_PF_FP_ABST
    Figure CN2024130217_26062025_PF_FP_ABST
Patent Text Reader

Abstract

Provided in the embodiments of the present invention is an article generation method. The method comprises: acquiring text information to be generated for the current round; on the basis of text content and a text structure, determining first prompt text for the current round; inputting the first prompt text for the current round into a preset large text generation model for text generation processing, so as to obtain text generation content for the current round; and after all rounds of text generation processing are completed, obtaining target text content. Prompt text for the current round is determined by means of text information to be generated for the current round, the prompt text is input into a preset large text generation model for text generation processing, text content is sequentially generated according to rounds, and the text content generated in different rounds is sequentially combined in order of rounds, so as to obtain target text content. Text is generated according to rounds, and an input for each round may comprise an output for the previous round, thereby ensuring the accuracy of target text content.
Need to check novelty before this filing date? Find Prior Art

Description

Article generation method, device, electronic device and storage medium

[0001] This application claims priority to the Chinese patent application filed with the China Patent Office on December 21, 2023, with application number 202311779463.8 and invention name “Article Generation Method, Device, Electronic Device and Storage Medium”, the entire contents of which are incorporated by reference into this application. Technical Field

[0002] The present invention relates to the field of text processing technology, and in particular to an article generation method, device, electronic device and storage medium. Background Art

[0003] Large models are currently experiencing explosive growth. They can understand text and perform reasoning in areas such as text generation, demonstrating excellent general generation capabilities. Large models can be instructed to generate different types of articles using specific commands. However, large models struggle to generate articles in a specified format and with given content. The resulting articles often do not meet expectations and exhibit low accuracy. Therefore, developing a method for generating articles that guarantees high accuracy has become a pressing challenge.

[0004] Summary of the Invention

[0005] An embodiment of the present invention provides an article generation method designed to address the problem of existing article generation methods where the actual generated articles do not meet expectations and have low accuracy. The method determines prompt text for the current round based on the to-be-generated text information of the current round. This prompt text is then input into a preset large text generation model for text generation processing. The text content is generated sequentially in rounds, and the text content generated in different rounds is combined sequentially in the order of the rounds to obtain the target text content. Because text generation is performed in rounds, and the input of each round can include the output of the previous round, the accuracy of the target text content can be guaranteed.

[0006] In a first aspect, an embodiment of the present invention provides a method for generating an article, the method comprising the following steps:

[0007] Obtaining text information to be generated for the current round, wherein the text information to be generated includes the text content and the text structure of the current round;

[0008] Determining a first prompt text for the current round based on the text content and text structure;

[0009] Inputting the first prompt text of the current round into a preset text generation model for text generation processing to obtain text generation content of the current round, wherein the text generation content of the current round corresponds to the text structure of the current round;

[0010] After completing all rounds of text generation processing, the target text content is obtained.

[0011] Optionally, the current round includes a first round and a non-first round, and obtaining the text information to be generated in the current round, wherein the text information to be generated includes the text content and the text structure of the current round, includes:

[0012] When the current round is the first round, the text content of the current round includes text input content input by the user;

[0013] When the current round is not the first round, the text content of the current round includes the text input content input by the user and the text generated content of the previous rounds.

[0014] Optionally, before obtaining the text information to be generated, the method further includes:

[0015] Obtaining a preset macro model and sample data, wherein the sample data includes different types of text content, and the different types of text content include text content corresponding to different text structures;

[0016] Performing data preprocessing based on the sample data to obtain a training data set;

[0017] The preset large model is trained for text generation based on the training data set to obtain the preset large model for text generation.

[0018] Optionally, performing data preprocessing based on the sample data to obtain a training data set includes:

[0019] Standardizing the text content to obtain text content with a unified text structure;

[0020] Determining different types of generation tasks based on the text content of the unified text structure;

[0021] The training dataset is determined based on the different types of generation tasks.

[0022] Optionally, the different types of text content include expanded text content, generated text content, and error-corrected text content, and determining different types of generation tasks based on the text content with the unified text structure includes:

[0023] Determining an article generation task based on the generated text content of the unified text structure;

[0024] Determining an expansion task based on the expanded text content of the unified text structure;

[0025] Determining an error correction task based on the error correction text content of the unified text structure;

[0026] Based on the article generation task, the expansion task and the error correction task, the different types of generation tasks are determined.

[0027] Optionally, determining the training data set based on the different types of generation tasks includes:

[0028] constructing different types of second prompt texts based on the different types of generation tasks;

[0029] The training data set is constructed based on the different types of second prompt texts, where the second prompt texts include prompt texts and label texts corresponding to the prompt texts.

[0030] Optionally, performing text generation training on the preset large model based on the training data set to obtain the preset text generation large model includes:

[0031] Inputting the prompt text into the preset large model for text generation processing to obtain a text generation result;

[0032] Calculate the loss value between the label text and the text generation result through a preset loss function;

[0033] Taking minimizing the loss value as the optimization goal, the parameters of the preset large model are adjusted, and the parameter adjustment process is iterated until the loss value converges to the minimum. The training is stopped to obtain the preset text generation large model.

[0034] In a second aspect, an embodiment of the present invention further provides an article generation device, the article generation device comprising:

[0035] A first acquisition module is used to acquire text information to be generated in the current round, wherein the text information to be generated includes the text content and the text structure of the current round;

[0036] A first determining module, configured to determine a first prompt text for a current round based on the text content and text structure;

[0037] A first generation module is configured to input the first prompt text of the current round into a preset text generation model for text generation processing to obtain text generation content of the current round, wherein the text generation content of the current round corresponds to the text structure of the current round;

[0038] The second generation module is used to obtain the target text content after completing all rounds of text generation processing.

[0039] In a third aspect, an embodiment of the present invention provides an electronic device comprising: a memory, a processor, and a computer program stored on the memory and executable on the processor, wherein the processor implements the steps of the article generation method provided in an embodiment of the present invention when executing the computer program.

[0040] In a fourth aspect, an embodiment of the present invention provides a computer-readable storage medium having a computer program stored thereon, and when the computer program is executed by a processor, the steps in the article generation method provided in the embodiment of the invention are implemented.

[0041] In an embodiment of the present invention, the text information to be generated in the current round is obtained, and the text information to be generated includes the text content of the current round and the text structure of the current round; based on the text content and text structure, the first prompt text of the current round is determined; the first prompt text of the current round is input into a preset text generation model for text generation processing to obtain the text generation content of the current round, and the text generation content of the current round corresponds to the text structure of the current round; after completing the text generation processing of all rounds, the target text content is obtained. Based on the text information to be generated in the current round, the prompt text of the current round is determined, and the prompt text is input into the preset text generation model for text generation processing. The text content is generated sequentially according to the rounds, and the text content generated in different rounds is sequentially combined according to the order of the rounds to obtain the target text content. Since text generation is performed in rounds, and the input of each round can include the output of the previous round, the accuracy of the target text content can be guaranteed. BRIEF DESCRIPTION OF THE DRAWINGS

[0042] In order to more clearly illustrate the embodiments of the present invention or the technical solutions in the prior art, the following briefly introduces the drawings required for use in the embodiments or the description of the prior art. Obviously, the drawings described below are only some embodiments of the present invention. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying any creative work.

[0043] FIG1 is a flow chart of an article generation method provided by an embodiment of the present invention;

[0044] FIG2 is a flow chart of an article-assisted writing method provided by an embodiment of the present invention;

[0045] FIG3 is a flow chart of a model training method provided by an embodiment of the present invention;

[0046] FIG4 is a schematic structural diagram of an article generating device provided in an embodiment of the present invention;

[0047] FIG5 is a schematic structural diagram of an electronic device provided by an embodiment of the present invention. DETAILED DESCRIPTION

[0048] The following will clearly and completely describe the technical solutions in the embodiments of the present invention in conjunction with the accompanying drawings. Obviously, the described embodiments are only part of the embodiments of the present invention, not all of the embodiments. All other embodiments obtained by ordinary technicians in this field based on the embodiments of the present invention without making any creative efforts shall fall within the scope of protection of the present invention.

[0049] As shown in FIG1 , FIG1 is a flowchart of an article generation method provided by an embodiment of the present invention, including:

[0050] 101. Obtain the text information to be generated in the current round.

[0051] In an embodiment of the present invention, the above-mentioned text information to be generated includes the text content of the current round and the text structure of the current round. The above-mentioned text structure can be understood as the organization and layout of the article, that is, what parts the article is composed of and the relationship between these parts. The above-mentioned text content refers to the specific text content in the article, and may include the opinions, facts, data, examples, etc. expressed by the author of the article (that is, it may be a preset text generation model). For example, the above-mentioned text structure may include structures such as title, keywords, abstract, outline, and full text. The above-mentioned text content may be the specific text content of the title, the specific text content of the keywords, the specific text content of the abstract, the specific text content of the outline, and the specific text content of the full text.

[0052] For example, if the text information to be generated is "Title: Large Model Implementation Training.\nKeywords:", the text structure is "Title" and "Keywords", and the text content corresponding to the "Title" is "Large Model Implementation Training". If the text information to be generated is "Title: Large Model Implementation Training.\nKeywords: Large Model; Training; Assistant.\nSummary:", the text structure is "Title", "Keywords", and "Summary", and the text content is "Large Model Implementation Training" corresponding to the "Title" and "Large Model; Training; Assistant" corresponding to the "Keywords". It can be seen that each text structure corresponds to a text content, and each text information to be generated includes at least one text structure corresponding to text content and one text structure without text content.

[0053] It should be noted that the article generation method provided in the embodiments of the present invention performs text generation processing sequentially in rounds, with each round only generating the text content required for a text structure. For example, if the text structure of the current round is title, keywords, and abstract, and the text content of the current round is the specific text content of the title and the specific text content of the keywords, then the current round needs to generate the specific text content of the abstract based on the specific text content of the title and the specific text content of the keywords.

[0054] If the text structure of the current round is title, keywords, abstract and outline, and the text content of the current round is the specific text content of the title, the specific text content of the keywords, and the specific text content of the abstract, then the current round needs to generate the specific text content of the outline based on the specific text content of the title, the specific text content of the keywords, and the specific text content of the abstract.

[0055] 102. Determine the first prompt text of the current round based on the text content and text structure.

[0056] In an embodiment of the present invention, different text structures correspond to different prompt instruction texts, and the prompt instruction texts can be used to prompt the text generation model to complete corresponding tasks according to corresponding instructions.

[0057] For example, if the text structure of the current round is title, keywords and abstract, and the text content of the current round is the specific text content of the title and the specific text content of the keywords, then the corresponding prompt instruction text can be set as "Please expand into an abstract based on the title and keywords."

[0058] If the text structure of the current round is title, keywords, abstract and outline, and the text content of the current round is the specific text content of the title, the specific text content of the keywords and the specific text content of the abstract, then the corresponding prompt instruction text can be set as "Please expand into an outline based on the title, keywords and abstract."

[0059] After the corresponding prompt instruction text is constructed according to the text structure and text content, the first prompt text can be constructed according to the prompt instruction text, text structure and text content.

[0060] For example, if the text structure of the current round consists of title, keywords, and summary, and the text content is "Large Model Implementation Training" for the title and "Large Model; Training; Assistant" for the keywords, and the prompt text is "Please expand it into a summary based on the title and keywords," then the first prompt text may be {"Instruction": "Please expand it into a summary based on the title and keywords.", "Input": "Title: Large Model Implementation Training.\nKeywords: Large Model; Training; Assistant."}.

[0061] If the current round's text structure consists of title, keywords, abstract, and outline, and the above text content is "Large Model Implementation Training" for the title, "Large Model; Training; Assistant" for the keywords, and "Large Model Implementation Training refers to specialized training for the deployment and implementation of large predictive models (typically those with high model complexity and a large number of parameters) for the abstract, then the above first prompt text can be {"Instructions": "Please expand the outline based on the title, keywords, and abstract.", "Input": "Title: Large Model Implementation Training.\nKeywords: Large Model; Training; Assistant.\nAbstract: Large Model Implementation Training refers to specialized training for the deployment and implementation of large predictive models (typically those with high model complexity and a large number of parameters). The purpose of this training is to help enterprises and institutions effectively use large models for data analysis and prediction, thereby optimizing and improving their businesses."}.

[0062] 103. Input the first prompt text of the current round into a preset text generation model for text generation processing to obtain the text generation content of the current round.

[0063] In an embodiment of the present invention, the text generation content of the current round corresponds to the text structure of the current round, and the current round includes at least one text structure corresponding to text content and one text structure that does not correspond to text content. The above-mentioned preset text generation large model can be understood as a large-scale deep learning model for text tasks, which usually has a large number of parameters and computational complexity, and can be used to process text data and perform text generation processing. The above-mentioned preset text generation large model can be obtained after training any large model that can complete text processing tasks in a vertical field (i.e., text generation capability). The above-mentioned large model that can complete text processing tasks can be the ChatGPT large model, the Wenxin Yiyan large model, the Skylark large model, the Baichuan large model, and the like.

[0064] After the first prompt text of the current round is input into the preset text generation model, the text generation model will perform corresponding text generation processing based on the text structure and text content and follow the prompt of the prompt instruction text to obtain the text generation content of the current round.

[0065] 104. After completing all rounds of text generation processing, the target text content is obtained.

[0066] In the embodiment of the present invention, the first prompt texts of different rounds are different, and the prompt instruction texts corresponding to the first prompt texts of different rounds are also different.

[0067] It should be noted that, in general, the structure of a complete article can include a title, keywords, abstract, outline, and full text. Different rounds can correspond to the above article structure, that is, the first round can generate the specific text content of the keywords based on the specific text content of the title; the second round can generate the specific text content of the abstract based on the specific text content of the title and the specific text content of the keywords; the third round can generate the specific text content of the outline based on the specific text content of the title, the specific text content of the keywords, and the specific text content of the abstract; and the fourth round can generate the specific text content of the full text based on the specific text content of the title, the specific text content of the keywords, the specific text content of the abstract, and the specific text content of the outline.

[0068] As can be seen, with the exception of the first round, the input for each round includes the specific text content of the first round input and the specific text content of the previous round output. After all rounds of text processing are completed, the specific text content of the final round input and output is combined according to the text structure of the specific text content to obtain the target text content.

[0069] In an embodiment of the present invention, the text information to be generated in the current round is obtained, and the text information to be generated includes the text content of the current round and the text structure of the current round; based on the text content and text structure, the first prompt text of the current round is determined; the first prompt text of the current round is input into the preset text generation model for text generation processing to obtain the text generation content of the current round, and the text generation content of the current round corresponds to the text structure of the current round; after completing the text generation processing of all rounds, the target text content is obtained. Based on the text information to be generated in the current round, the prompt text of the current round is determined, and the prompt text is input into the preset text generation model for text generation processing. The text content is generated in sequence according to the rounds, and the text contents generated in different rounds are combined in sequence according to the order of the rounds to obtain the target text content. Since text generation is performed in rounds, and the input of each round can include the output of the previous round, the accuracy of the target text content can be guaranteed.

[0070] It is understandable that in the specific implementation of this application, related data such as text information to be generated is involved. When the embodiments in this application are applied to specific products or technologies, user permission or consent is required, and the collection, use and processing of relevant data and the use of large models need to comply with relevant laws, regulations and standards of relevant countries and regions.

[0071] It should be noted that the article generation method provided in the embodiment of the present invention can be applied to computers, servers and other devices that can generate articles.

[0072] Optionally, in the step of obtaining the text information to be generated for the current round when the current round includes the first round and the non-first round, and the text information to be generated includes the text content of the current round and the text structure of the current round, when the current round is the first round, the text content of the current round includes the text input content entered by the user; when the current round is not the first round, the text content of the current round includes the text input content entered by the user and the text generation content of the historical rounds.

[0073] In an embodiment of the present invention, the text input content entered by the user may serve as the basis for text generation processing. The preset text generation model performs text generation processing sequentially in rounds based on the text input content to obtain target text content. The text generation content of the aforementioned historical rounds may be described based on the aforementioned rounds. If the current round is the second round, the text content obtained in the first round is the text generation content of the historical rounds. If the current round is the third round, the text content obtained in the first round and the text content obtained in the second round are the text generation content of the historical rounds.

[0074] Specifically, the above rounds can be explained by a flowchart of an article assisted writing as shown in Figure 2. In Figure 2, the first round is that the input text structure is the title and keywords, and the input text content is the specific text content of the title and the specific text content of the keywords, that is, the above text input content is the specific text content of the title and the specific text content of the keywords. Specifically, it can be understood that the user inputs the above text structure title and the specific text content corresponding to the title, the text structure "keywords" and the specific text content corresponding to the "keywords" into the big model (that is, the above preset text generation big model), performs text generation processing, and obtains the text structure "abstract" required for the article and the specific text content corresponding to the "abstract".

[0075] The second round involves inputting the aforementioned text structure "Title" and the specific text content corresponding to "Title," the text structure "Keywords" and the specific text content corresponding to "Keywords," and the text structure "Abstract" and the specific text content corresponding to "Abstract" generated in the first round into the macro model (i.e., the aforementioned preset text generation macro model) for text generation processing. This results in the required text structure "Outline" and the specific text content corresponding to "Outline." It can be seen that in the second round, the text structure "Abstract" and the specific text content corresponding to "Abstract" are the text generated content from the previous round.

[0076] The third round is to input the above-mentioned text structure "title" and the specific text content corresponding to the "title", the text structure "keywords" and the specific text content corresponding to the "keywords", the text structure "abstract" generated in the first round and the specific text content corresponding to the "abstract", and the text structure "outline" generated in the second round and the specific text content corresponding to the "outline" into the big model (that is, the above-mentioned preset text generation big model), perform text generation processing, and obtain the text structure "full text" required for the article and the specific text content corresponding to the "full text". It can be seen that in the third round, the text structure "abstract" and the specific text content corresponding to the "abstract", the text structure "outline" and the specific text content corresponding to the "outline" are the text generation content of the historical rounds.

[0077] The fourth round is to select text fragments from the specific text content corresponding to the "full text" generated in the third round, and then expand, rewrite, polish and correct them.

[0078] It should be noted that if the final "full text" is generated step by step based on the title alone, it may deviate from the expected output. Therefore, it is possible to generate the specific text content corresponding to the final "full text" step by step based on the title and keywords. This allows the output article to conform to the given title and keywords while also generating the full text according to the outline format, ultimately resulting in an article that meets the specified content, format, and is highly readable.

[0079] Optionally, before the step of obtaining the text information to be generated, a preset large model and sample data can also be obtained; data preprocessing is performed based on the sample data to obtain a training data set; and text generation training is performed on the preset large model based on the training data set to obtain a preset text generation large model.

[0080] In an embodiment of the present invention, the above-mentioned preset big model can be the above-mentioned big model that can complete the text processing task, that is, the above-mentioned ChatGPT big model, Wenxin Yiyan big model, Yunque big model, Baichuan big model, etc.

[0081] The above sample data includes different types of text content, and the different types of text content include text content corresponding to different text structures. The above different types of text content may include articles with abstracts, keywords, and outlines. Generally speaking, articles such as journals and papers are composed of titles, abstracts, keywords, and main text. That is, it includes the text structure "title" and the specific text content corresponding to the "title", the text structure "abstract" and the specific text content corresponding to the "abstract", the text structure "keywords" and the specific text content corresponding to the "keywords", and the text structure "main text" and the specific text content corresponding to the "main text".

[0082] The above-mentioned different types of text content may also include articles without abstracts, keywords, or outlines. For example, articles such as speeches and press releases lack abstracts, keywords, or outlines. In other words, they only include the text structure "title" and the specific text content corresponding to the "title," and the text structure "body" and the specific text content corresponding to the "body."

[0083] The above-mentioned different types of text content may also include text content that needs to be expanded, rewritten, and polished. The above-mentioned text content that needs to be expanded, rewritten, and polished may be texts with relatively brief content, such as news reports, announcements, statements, etc. These texts may only provide a brief overview of events or information and need to be further supplemented with details, background, and reasons to give readers a more comprehensive understanding of the situation. Alternatively, they may be contracts, legal documents, technical documents, etc. The language of these texts is often more professional and concise, and they need to be appropriately expanded and polished to make them more understandable and easy to understand. Alternatively, they may be advertising copy, brochures, product descriptions, etc. These texts need to highlight their key points or emphasize specific information to attract readers' attention and convey specific information.

[0084] The above-mentioned different types of text content may also include text content that requires text error correction, for example, text content with spelling errors, grammatical errors, or semantic errors.

[0085] The above different types of text content can be obtained from open source data obtained from the Internet or can be generated manually or by the above preset large model. The above preprocessing can include standardization, which can be used to unify text content with different text structures into text content with the same text structure.

[0086] After obtaining the above-mentioned different types of text content, the above-mentioned different types of text content can be standardized to obtain text content with a unified text structure. The above-mentioned training data set is constructed based on the text content with the unified text structure, and the above-mentioned preset large model is trained on text generation based on the above-mentioned training data set to obtain the above-mentioned preset text generation large model.

[0087] Optionally, in the step of performing data preprocessing based on sample data to obtain a training data set, the text content can also be standardized to obtain text content with a unified text structure; based on the text content with a unified text structure, different types of generation tasks are determined; based on different types of generation tasks, a training data set is determined.

[0088] In an embodiment of the present invention, the above-mentioned standardization process can be to standardize the text structure. Generally, the standardized text structure should be "title", "keywords", "abstract", "outline" and "full text". If the above-mentioned text content is an article including a title, abstract, keywords, outline and full text, it already has the above-mentioned standardized text structure, "title", "keywords", "abstract", "outline" and "full text", and no standardization process is required. If the above-mentioned text content does not include the text structure "outline" and the specific content corresponding to the "outline", it can be combined into an outline by extracting the title in the full text. If the above-mentioned text content is an article that only includes a title and a full text, the above-mentioned preset large model can be used to generate an abstract and keywords, and the article can be summarized to obtain an outline, which can be modified manually.

[0089] After obtaining the text content of the unified text structure, different types of generation tasks can be determined based on the text content of the unified text structure. The different types of generation tasks can include generation tasks, error correction tasks, and expansion tasks. Different types of second prompt texts are constructed based on the different types of generation tasks, and the training dataset is constructed based on the different types of second prompt texts.

[0090] Optionally, in the step of determining different types of generation tasks based on the text content of a unified text structure, it is also possible to determine the article generation task based on the generated text content of the unified text structure; determine the expansion task based on the expanded text content of the unified text structure; determine the error correction task based on the error correction text content of the unified text structure; and determine different types of generation tasks based on the article generation task, the expansion task, and the error correction task.

[0091] In an embodiment of the present invention, the different types of text content include expanded text content, generated text content, and error correction text content. The expanded text content may be the text content that needs to be expanded, rewritten, or polished, and the error correction text content may be the text content that needs to be corrected. The generated text content may be the content that needs to be generated.

[0092] When the above text content is expanded text content, it means that expansion processing, rewriting processing or polishing processing is required, and the corresponding task is the expansion task. When the text content is error correction text content, it means that error correction processing is required, and the corresponding task is error correction text. When the text content is generated text content, it means that article generation is required, and the corresponding task is the article generation task. It can be understood that the above task is a task of processing text. It can be understood that the above expansion task can include expansion processing, rewriting processing and polishing processing.

[0093] Optionally, in the step of determining the training data set based on different types of generation tasks, different types of second prompt texts may be constructed based on different types of generation tasks; and the training data set may be constructed based on different types of second prompt texts.

[0094] In an embodiment of the present invention, the second prompt text includes a prompt text and a label text corresponding to the prompt text. The prompt text may include a prompt instruction text, a text structure, and text content. Specifically, different types of prompt instruction texts may be constructed based on different types of generation tasks and text structures, and different types of second prompt texts may be constructed based on the text structure, text content, and prompt instruction text corresponding to different types of generation tasks. The different types of second prompt texts are categorized and added to a preset empty set to obtain the training data set.

[0095] For example, if the generation task is an article generation task, and the article generation task specifically requires the model to generate a summary based on the title and keywords, then the prompt instruction text is, "Instruction": "Please expand the title and keywords into a summary," the specific text content corresponding to the "Title" is "Large Model Implementation Training," and the specific text content corresponding to the "Keywords" is "Large Model; Training; Assistant," then the second prompt text may be {"Instruction": "Please expand the title and keywords into a summary.", "Input": "Title: Large Model Implementation Training.\nKeywords: Large Model; Training; Assistant.", "Output": "Large Model Implementation Training refers to specialized training for the deployment and implementation of large predictive models (typically those with high model complexity and a large number of parameters). The purpose of this training is to help enterprises and institutions effectively use large models for data analysis and prediction, thereby achieving business optimization and improvement."}. The content corresponding to the "output" is the label text corresponding to the prompt text, the content corresponding to the "input" is the text content and structure, and the content corresponding to the "instruction" is the prompt instruction text. It should be noted that the above-mentioned "output" can be the output obtained manually based on the above-mentioned "input" according to the "instructions", or it can be understood as the expected output result, which is used for loss calculation when training the above-mentioned preset large model.

[0096] If the above-mentioned generated task is an expansion task, the above-mentioned instruction text can be "You are an expansion assistant. Expansion is to enrich the content by adding detailed information, giving examples, providing more details, etc. without changing the meaning of the original text. The purpose of expansion is to enrich the article, make it more in-depth and broad, so as to better convey information or opinions. Please expand the following text and only output the expanded text. Please make sure not to mention any content that may violate human values, such as violence, invasion of privacy, or pornography." The text content corresponding to the above-mentioned expansion task is "Always put people first and serve the people", then the above-mentioned second prompt text can be {"Instruction": "You are an expansion assistant. Expansion is not By altering the original text's meaning, enrich the content by adding details, giving examples, and providing more nuance. The purpose of expansion is to enrich the article, giving it greater depth and breadth to better convey the message or point of view. Please expand the following text and output only the expanded text. Please ensure that any content that may violate human values, such as violence, discrimination, invasion of privacy, politics, or pornography, is not mentioned. \nText: {}\nExpanded result: ","Input": "Always put people first and serve the people.","Output": "Always uphold a people-oriented spirit, diligently consider strategies, and diligently implement actions that benefit the people. Major decisions are based on the people, and work measures are based on the people."}

[0097] More specifically, if the generated task is an expansion task, and the text corresponding to the prompt text is "A company has released a new product.", then the label text can be "A company has released a new product with multiple innovative features designed to meet market demand." If the generated task is a polishing task, and the text corresponding to the prompt text is "Party A is required to pay Party B 100,000 yuan.", then the label text can be "Party A is required to pay Party B 100,000 yuan, which will be paid within 10 working days after the contract is signed." If the generated task is a rewriting task, and the text corresponding to the prompt text is "Our product is the best," then the label text can be "Our product is one of the best on the market. It has multiple advantages and features that can meet your needs."

[0098] Optionally, in the step of performing text generation training on a preset large model based on a training data set to obtain a preset text generation large model, the prompt text can also be input into the preset large model for text generation processing to obtain a text generation result; the loss value between the label text and the text generation result is calculated through a preset loss function; with minimizing the loss value as the optimization goal, the parameters of the preset large model are adjusted, and the parameter adjustment process is iterated until the loss value converges to the minimum, and the training is stopped to obtain the preset text generation large model.

[0099] In an embodiment of the present invention, the above-mentioned text generation result is the output obtained by performing text generation processing on the above-mentioned preset large model when the training is not completed (i.e., the above-mentioned text generation result). The above-mentioned preset loss function can be a cross-entropy function. The above-mentioned cross-entropy function is used to process binary classification problems or multi-classification problems. When processing binary classification problems, the above-mentioned cross-entropy function can be described by the following binary classification cross-entropy formula:

[0100] Among them, the above loss is expressed as the loss value, the above y is the true label of each character in the above label text, and the value is 0 or 1. It represents the probability that each character in the text generation result output by the above preset large model is a positive example, that is, the probability of y=1. When y=1, When y=0,

[0101] When dealing with multi-classification problems, the above cross entropy function can be described by the following multi-classification cross entropy formula:

[0102] Where p(x) is the overall true distribution of the label text, and q(x) is the overall distribution probability of the generated text. It is understood that the binary cross entropy formula can be used to calculate the loss between each character in the label text and each character in the generated text, while the multi-class cross entropy formula is used to calculate the overall distribution probability loss between the label text and the generated text.

[0103] Specifically, the training process of the above-mentioned preset text generation large model can be illustrated by a flowchart of model training as shown in Figure 3. As shown in Figure 3, data from different data sources such as data source 1, data source 2, data source n-1 and data source n are collected and preprocessed to obtain text content with a unified text structure. A part of the text content with a unified text structure is randomly extracted to construct a training set, and the remaining part is constructed as a test set. The preset large model is trained according to the above-mentioned training set to obtain a trained large model. The trained large model is deployed and the trained large model is evaluated and tested through the test set. When the evaluation test passes, the above-mentioned preset text generation large model can be obtained. If the evaluation test does not pass, the training can continue through the above-mentioned test set until the evaluation test of the above-mentioned trained large model passes, and the above-mentioned preset text generation large model is obtained.

[0104] More specifically, the deployment of the above model can be carried out in the form of text-generate-inference (TGI). The above TGI is a framework specifically for deploying large models, which can facilitate people to deploy models, and ultimately returns an API (i.e., interface). The above test set is used to test the above trained large model through the above API, and the text generation results output by the above trained model are compared with the label text in the above test set. The accuracy rate of the above text generation results that meets the above label text is calculated. Until the above accuracy rate reaches the preset accuracy requirement, the above preset text generation large model is obtained.

[0105] As shown in FIG4 , an embodiment of the present invention further provides an article generating device, including:

[0106] A first acquisition module 401 is configured to acquire text information to be generated in the current round, wherein the text information to be generated includes the text content and the text structure of the current round;

[0107] A first determining module 402 is configured to determine a first prompt text for the current round based on the text content and text structure;

[0108] A first generation module 403 is configured to input the first prompt text of the current round into a preset text generation model for text generation processing to obtain text generation content of the current round, wherein the text generation content of the current round corresponds to the text structure of the current round;

[0109] The second generation module 404 is used to obtain the target text content after completing all rounds of text generation processing.

[0110] Optionally, the first acquisition module 401 includes:

[0111] A first round submodule, configured to, when the current round is the first round, include the text content of the current round including the text input content input by the user;

[0112] The non-first round submodule is used to, when the current round is not the first round, the text content of the current round includes the text input content input by the user and the text generated content of the historical rounds.

[0113] Optionally, the article generating device further includes:

[0114] A second acquisition module is used to acquire a preset large model and sample data, wherein the sample data includes different types of text content, and the different types of text content include text content corresponding to different text structures;

[0115] A preprocessing module, configured to perform data preprocessing based on the sample data to obtain a training data set;

[0116] A training module is generated, which is used to perform text generation training on the preset large model based on the training data set to obtain the preset text generation large model.

[0117] Optionally, the preprocessing module includes:

[0118] A standardization submodule, configured to standardize the text content to obtain text content with a unified text structure;

[0119] A first determination submodule is configured to determine different types of generation tasks based on the text content of the unified text structure;

[0120] The second determining submodule is configured to determine the training data set based on the different types of generation tasks.

[0121] Optionally, the first determining submodule includes:

[0122] A first determining unit, configured to determine an article generation task based on the generated text content of the unified text structure;

[0123] A second determining unit is configured to determine an expansion task based on the expanded text content of the unified text structure;

[0124] A third determining unit is configured to determine an error correction task based on the error correction text content of the unified text structure;

[0125] A fourth determining unit is configured to determine the different types of generation tasks based on the article generation task, the expansion task, and the error correction task.

[0126] Optionally, the second determining submodule includes:

[0127] A construction unit, configured to construct different types of second prompt texts based on the different types of generation tasks;

[0128] The construction unit is configured to construct the training data set based on the different types of second prompt texts, where the second prompt texts include prompt texts and label texts corresponding to the prompt texts.

[0129] Optionally, generating a training module includes:

[0130] A generation submodule is used to input the prompt text into the preset large model to perform text generation processing and obtain a text generation result;

[0131] A calculation submodule, configured to calculate a loss value between the label text and the text generation result using a preset loss function;

[0132] The training submodule is used to adjust the parameters of the preset large model with minimizing the loss value as the optimization goal, iterate the parameter adjustment process until the loss value converges to the minimum, stop training, and obtain the preset text generation large model.

[0133] As shown in FIG5 , an embodiment of the present invention further provides an electronic device, characterized in that it includes a processor, and the processor can execute any one of the above-mentioned article generation methods.

[0134] Specifically, the invention includes a processor 501, a memory 502, and a computer program for executing the article generation method stored in the memory 502 and capable of running on the processor 501, wherein:

[0135] The processor 501 runs the computer program of the article generation method stored in the memory 502 and performs the following steps:

[0136] Obtaining text information to be generated for the current round, wherein the text information to be generated includes the text content and the text structure of the current round;

[0137] Determining a first prompt text for the current round based on the text content and text structure;

[0138] Inputting the first prompt text of the current round into a preset text generation model for text generation processing to obtain text generation content of the current round, wherein the text generation content of the current round corresponds to the text structure of the current round;

[0139] After completing all rounds of text generation processing, the target text content is obtained.

[0140] Optionally, the current round executed by the processor 501 includes a first round and a non-first round, and the obtaining of text information to be generated in the current round, wherein the text information to be generated includes text content and a text structure of the current round, includes:

[0141] When the current round is the first round, the text content of the current round includes text input content input by the user;

[0142] When the current round is not the first round, the text content of the current round includes the text input content input by the user and the text generated content of the previous rounds.

[0143] Optionally, before obtaining the text information to be generated, the method executed by the processor 501 further includes:

[0144] Obtaining a preset macro model and sample data, wherein the sample data includes different types of text content, and the different types of text content include text content corresponding to different text structures;

[0145] Performing data preprocessing based on the sample data to obtain a training data set;

[0146] The preset large model is trained for text generation based on the training data set to obtain the preset large model for text generation.

[0147] Optionally, the processor 501 performs data preprocessing based on the sample data to obtain a training data set, including:

[0148] Standardizing the text content to obtain text content with a unified text structure;

[0149] Determining different types of generation tasks based on the text content of the unified text structure;

[0150] The training dataset is determined based on the different types of generation tasks.

[0151] Optionally, the different types of text content executed by the processor 501 include expanded text content, generated text content, and error-corrected text content, and determining different types of generation tasks based on the text content with the unified text structure includes:

[0152] Determining an article generation task based on the generated text content of the unified text structure;

[0153] Determining an expansion task based on the expanded text content of the unified text structure;

[0154] Determining an error correction task based on the error correction text content of the unified text structure;

[0155] Based on the article generation task, the expansion task and the error correction task, the different types of generation tasks are determined.

[0156] Optionally, the determining of the training data set based on the different types of generation tasks performed by the processor 501 includes:

[0157] constructing different types of second prompt texts based on the different types of generation tasks;

[0158] The training data set is constructed based on the different types of second prompt texts, where the second prompt texts include prompt texts and label texts corresponding to the prompt texts.

[0159] Optionally, the processor 501 performs text generation training on the preset large model based on the training data set to obtain the preset text generation large model, including:

[0160] Inputting the prompt text into the preset large model for text generation processing to obtain a text generation result;

[0161] Calculate the loss value between the label text and the text generation result through a preset loss function;

[0162] Taking minimizing the loss value as the optimization goal, the parameters of the preset large model are adjusted, and the parameter adjustment process is iterated until the loss value converges to the minimum. The training is stopped to obtain the preset text generation large model.

[0163] An embodiment of the present invention also provides a computer-readable storage medium, on which a computer program is stored. When the computer program is executed by a processor, the computer program implements the various processes of the article generation method or the application-side article generation method provided in the embodiment of the present invention, and can achieve the same technical effect. To avoid repetition, it will not be repeated here.

[0164] Those skilled in the art will appreciate that all or part of the processes in the above-described method embodiments can be implemented by instructing related hardware using a computer program. The computer program can be stored in a computer-readable storage medium, and when executed, the program can include the processes in the above-described method embodiments. The computer-readable storage medium can be a magnetic disk, an optical disk, a read-only memory (ROM), or a random access memory (RAM).

[0165] The above disclosure is merely a preferred embodiment of the present invention and certainly cannot be used to limit the scope of the present invention. Therefore, equivalent changes made according to the claims of the present invention are still within the scope of the present invention.

Claims

1. A method for generating an article, characterized in that: The method comprises the following steps: Acquire the text information to be generated in the current round, wherein the text information to be generated includes the text content and the text structure of the current round; Determine the first prompt text of the current round based on the text content and text structure; Inputting the first prompt text of the current round into a preset text generation model for text generation processing to obtain text generation content of the current round, wherein the text generation content of the current round corresponds to the text structure of the current round; After completing all rounds of text generation processing, the target text content is obtained.

2. The article generation method according to claim 1, characterized in that: The current round includes the first round and the non-first round, and the obtaining of the text information to be generated in the current round, wherein the text information to be generated includes the text content of the current round and the text structure of the current round, includes: When the current round is the first round, the text content of the current round includes text input content input by the user; When the current round is not the first round, the text content of the current round includes the text input content input by the user and the text generated content of the historical rounds.

3. The article generation method according to claim 1, characterized in that: Before obtaining the text information to be generated, the method further includes: Obtaining a preset macro model and sample data, wherein the sample data includes different types of text content, wherein the different types of text content include text content corresponding to different text structures; Performing data preprocessing based on the sample data to obtain a training data set; The preset large model is trained for text generation based on the training data set to obtain the preset large model for text generation.

4. The article generation method according to claim 3, characterized in that: The data preprocessing is performed based on the sample data to obtain a training data set, including: Standardizing the text content to obtain text content with a unified text structure; Determining different types of generation tasks based on the text content of the unified text structure; The training data set is determined based on the different types of generation tasks.

5. The article generation method according to claim 4, characterized in that: The different types of text content include expanded text content, generated text content, and error correction text content. The different types of generation tasks are determined based on the text content with the unified text structure, including: Determining an article generation task based on the generated text content of the unified text structure; Determining an expansion task based on the expanded text content of the unified text structure; Determining the error correction task based on the error correction text content with a unified text structure; Based on the article generation task, the expansion task and the error correction task, the different types of generation tasks are determined.

6. The article generation method according to claim 4, characterized in that: The determining the training data set based on the different types of generation tasks includes: Based on the different types of generation tasks, construct different types of second prompt texts; The training data set is constructed based on the different types of second prompt texts, where the second prompt texts include prompt texts and label texts corresponding to the prompt texts.

7. The article generation method according to claim 6, characterized in that: The step of performing text generation training on the preset large model based on the training data set to obtain the preset text generation large model includes: Inputting the prompt text into the preset large model for text generation processing to obtain a text generation result; Calculate the loss value between the label text and the text generation result through a preset loss function; Taking minimizing the loss value as the optimization goal, the parameters of the preset large model are adjusted, and the parameter adjustment process is iterated until the loss value converges to the minimum, and the training is stopped to obtain the preset text generation large model.

8. An article generating device, characterized in that: The article generating device comprises: A first acquisition module is used to acquire text information to be generated in the current round, wherein the text information to be generated includes text content and text structure of the current round; A first determination module, used to determine the first prompt text of the current round based on the text content and text structure; A first generation module is used to input the first prompt text of the current round into the preset text generation model for text generation processing to obtain the text generation content of the current round, wherein the text generation content of the current round corresponds to the text structure of the current round; The second generation module is used to obtain the target text after completing all rounds of text generation processing. content.

9. An electronic device, characterized in that: include: A memory, a processor, and a computer program stored in the memory and executable on the processor, wherein when the processor executes the computer program, the steps in the article generation method according to any one of claims 1 to 7 are implemented.

10. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores a computer program, and when the computer program is executed by a processor, the steps in the article generation method according to any one of claims 1 to 7 are implemented.

Citation Information

Patent Citations

  • Text generation method and device

    CN114997164A

  • Article generation method and device, electronic equipment and storage medium

    CN116468009A

  • Long text generation method and device based on large language model, equipment and storage medium

    CN116796728A

  • Article generation method and device, electronic equipment and storage medium

    CN116933751A

  • Automatic identifying system and method

    US20220147717A1