Content generation method and device based on large model, electronic equipment and storage medium
By identifying the user's content generation intention and searching the recall documents in the document library, the appropriate content generation strategy is determined, and the problem of intention identification and policy determination in the generation of large-scale content is solved, and the accuracy and quality of generated content is improved.
Patent Information
- Application Number
- CN202510121803.0
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-01-24
- Publication Date
- 2025-05-23
AI Technical Summary
When using large models for content generation in the prior art, it is difficult to effectively identify the user's content generation intentions and strategies, resulting in the generated content not meeting user needs, and knowledge injection may have negative impacts.
By obtaining user input information, intent identification is performed to determine the content generation intention. If a class intent is generated for the document, the recall document is retrieved in the document library, the content generation strategy is determined based on the recall document, and the content generation strategy is adopted to avoid the negative impact of knowledge injection.
Improve the accuracy and quality of content generation, ensure that the generated content meets user needs, and avoid instability and errors in generated content caused by knowledge injection.
Smart Images

Figure CN120030999A_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of computer technology, in particular to artificial intelligence fields such as deep learning and big models, and specifically to a content generation method, device, electronic device and storage medium based on big models. Background Art
[0002] A large model refers to a machine learning model with large-scale parameters and complex computing structures. It can process massive amounts of data and complete various complex tasks, such as natural language processing, computer vision, and speech recognition. Large models can be widely used in many fields, such as content creation and knowledge question answering. Summary of the invention
[0003] The present application provides a content generation method, device, electronic device and storage medium based on a large model. The specific scheme is as follows:
[0004] According to one aspect of the present application, a content generation method based on a large model is provided, comprising:
[0005] Obtaining first input information;
[0006] performing intent recognition on the first input information to determine a content generation intent corresponding to the first input information;
[0007] In response to the content generation intention being a document generation type intention, searching and recalling in a document library according to the first input information to obtain a first recalled document;
[0008] Determining, according to the first recalled document, a content generation strategy corresponding to the first input information;
[0009] The content generation strategy is adopted to obtain generated content corresponding to the first input information.
[0010] According to another aspect of the present application, a content generation device based on a large model is provided, comprising:
[0011] An acquisition module, used for acquiring first input information;
[0012] an intention recognition module, configured to perform intention recognition on the first input information to determine a content generation intention corresponding to the first input information;
[0013] A retrieval and recall module, configured to, in response to the content generation intention being a document generation type intention, perform retrieval and recall in a document library according to the first input information to obtain a first recalled document;
[0014] A first determination module, configured to determine a content generation strategy corresponding to the first input information according to the first recalled document;
[0015] The content generation module is used to adopt the content generation strategy to obtain the generated content corresponding to the first input information.
[0016] According to another aspect of the present application, there is provided an electronic device, including:
[0017] at least one processor; and
[0018] a memory communicatively connected to the at least one processor; wherein,
[0019] The memory stores instructions that can be executed by the at least one processor. The instructions are executed by the at least one processor so that the at least one processor can perform the method described in the above embodiment.
[0020] According to another aspect of the present application, a non-transitory computer-readable storage medium storing computer instructions is provided, wherein the computer instructions are used to enable the computer to execute the method according to the above embodiment.
[0021] According to another aspect of the present application, a computer program product is provided, including a computer program, wherein the computer program implements the steps of the method described in the above embodiment when executed by a processor.
[0022] It should be understood that the content described in this section is not intended to identify the key or important features of the embodiments of the present application, nor is it intended to limit the scope of the present application. Other features of the present application will become easily understood through the following description. BRIEF DESCRIPTION OF THE DRAWINGS
[0023] The accompanying drawings are used to better understand the present solution and do not constitute a limitation of the present application.
[0024] Figure 1 A schematic diagram of a flow chart of a method for generating content based on a large model provided in an embodiment of the present application;
[0025] Figure 2 A schematic diagram of a flow chart of a content generation method based on a large model provided in another embodiment of the present application;
[0026] Figure 3 A schematic diagram of a flow chart of a content generation method based on a large model provided in another embodiment of the present application;
[0027] Figure 4 A schematic diagram of a process of content generation based on a large model provided in an embodiment of the present application;
[0028] Figure 5 A schematic diagram of the structure of a content generation device based on a large model provided in an embodiment of the present application;
[0029] Figure 6 It is a block diagram of an electronic device used to implement the large model-based content generation method of an embodiment of the present application. DETAILED DESCRIPTION
[0030] The following is a description of exemplary embodiments of the present application in conjunction with the accompanying drawings, including various details of the embodiments of the present application to facilitate understanding, which should be considered as merely exemplary. Therefore, it should be recognized by those of ordinary skill in the art that various changes and modifications can be made to the embodiments described herein without departing from the scope and spirit of the present application. Similarly, for the sake of clarity and conciseness, the description of well-known functions and structures is omitted in the following description.
[0031] The following describes the large model-based content generation method, device, electronic device and storage medium of the embodiments of the present application with reference to the accompanying drawings.
[0032] Figure 1 A flowchart of a large model-based content generation method provided in one embodiment of the present application.
[0033] The content generation method based on a large model in the embodiment of the present application can be executed by the content generation device based on a large model in the embodiment of the present application, and the device can be configured in an electronic device.
[0034] Among them, the electronic device can be any device with computing capabilities, such as a personal computer, a mobile terminal, a server, etc. The mobile terminal can be, for example, a vehicle-mounted device, a mobile phone, a tablet computer, a personal digital assistant, a wearable device, and other hardware devices with various operating systems, touch screens and / or display screens.
[0035] like Figure 1 As shown, the content generation method based on the large model includes:
[0036] Step 101: Obtain first input information.
[0037] In this application, users can input content generation demand information in the AI (Artificial Intelligence) entry interface of the document resource collection platform, so that the document resource collection platform can send the content generation demand information to the server, and the server can obtain the input content generation demand information, which is also the first input information.
[0038] For example, the first input information is “Personal Work Summary of Student Sports and Arts Development Center”.
[0039] Step 102: perform intent recognition on the first input information to determine the content generation intent corresponding to the first input information.
[0040] As a possible implementation method, an intent recognition model may be used to perform intent recognition on the first input information to determine the content generation intent corresponding to the first input information, that is, to determine the user intent.
[0041] As another possible implementation manner, keyword extraction may be performed on the first input information to obtain keywords contained in the first input information, and the content generation intention may be determined according to the keywords.
[0042] For example, the first input information is "Personal work summary of the Student Sports and Arts Development Center", and it can be determined that the content generation intention is to generate a work summary at the Student Sports and Arts Development Center.
[0043] For another example, the first input information is "What are the main dangers that lithium-ion batteries used in electric vehicles may cause under extreme circumstances?" It can be determined that the content generation intention is to query the dangers that lithium-ion batteries used in electric vehicles may cause under extreme circumstances.
[0044] Step 103, in response to the content generation intention being a document generation type intention, a search is performed in the document library according to the first input information to obtain a first recalled document.
[0045] In the present application, the content generation intention can be classified to determine whether it is a document generation type intention. If the content generation intention is a document generation type intention, then based on the first input information, a search and recall can be performed in the document library to obtain the first recalled document.
[0046] For example, high-quality content resources on the document resource collection platform can be screened out, and vectorized representations of document titles can be generated through embedded model training to obtain document title vectors, which can then be used as indexes to build a recallable document library.
[0047] Exemplarily, the first input information can be input into the embedding model for vectorized representation to obtain the vector of the first input information, and based on the correlation between the vector of the first input information and the document title vector in the document library, the document title vector with a high correlation with the first input information is determined, and the documents corresponding to these document title vectors are used as the first recalled documents.
[0048] Step 104: Determine a content generation strategy corresponding to the first input information according to the first recalled document.
[0049] In order to avoid the possible negative effects of knowledge injection into the content generated by the large model, in the present application, it can be determined whether the first recalled document can be used for content generation based on the first recalled document. If so, the content generation strategy can be determined to generate content based on the first recalled document by injecting knowledge into the large model. If not, the content generation strategy can be determined to generate content directly using the large model.
[0050] Exemplarily, a judgment can be made based on whether the first recalled document is relevant to the first input information. If the first recalled document is not relevant to the first input information, it can be determined not to use the first recalled document for content generation. Otherwise, it is determined to use the first recalled document for content generation.
[0051] Step 105: adopt a content generation strategy to obtain generated content corresponding to the first input information.
[0052] In the present application, content generation may be performed according to the first input information based on a content generation strategy corresponding to the first input information to obtain generated content corresponding to the first input information.
[0053] If the content generation strategy is to generate content by injecting knowledge into the big model according to the first recalled document, the big model can be used to generate content according to the first recalled document and the first input information. If the content generation strategy is to directly generate content using the big model, the big model can be used to generate content according to the first input information.
[0054] It should be noted that the macro models adopted by the two content generation strategies may be the same or different, and there is no limitation on this.
[0055] The large model-based content generation method of the embodiment of the present application can be applied to the AI content generation scenario of the document resource collection platform, and the large model knowledge injection method can be used to optimize the content generation effect.
[0056] In the embodiment of the present application, the intent of content generation is determined by performing intent recognition on the first input information. If the content generation intent is a document generation intent, the first recalled document is retrieved and recalled according to the first input information, and the content generation strategy is determined according to the first recalled document, and then the content generation strategy is used to generate content. Therefore, when the content generation intent of the input information is a document generation intent, the content generation strategy is determined according to the recalled document, and then the content generation strategy is used to generate content, which can avoid the negative impact of knowledge injection on content generation and improve the accuracy of generated content.
[0057] Figure 2 A flowchart of a large model-based content generation method provided in another embodiment of the present application.
[0058] like Figure 2 As shown, the content generation method based on the large model includes:
[0059] Step 201: Obtain first input information.
[0060] Step 202: perform intent recognition on the first input information to determine the content generation intent corresponding to the first input information.
[0061] Step 203, in response to the content generation intention being a document generation class intention, a search is performed in the document library according to the first input information to obtain a first recalled document.
[0062] In the present application, steps 201 to 203 may be implemented in any of the embodiments of the present application, and therefore will not be described in detail herein.
[0063] Optionally, in the retrieval and recall stage, a multi-channel recall result fusion method may be adopted to obtain the first recalled document.
[0064] Exemplarily, according to the first input information, retrieval and recall can be performed in the document library and the external network library built based on the external document resources, and the documents retrieved from the two libraries are used as the first recalled documents. If the document is not found in the document library and the external network library, retrieval and recall can be performed in the supplementary search library to obtain the first recalled document.
[0065] The supplementary search library can be obtained by supplementing the content through large model production based on long-tail queries of users captured regularly. Long-tail queries can refer to those query requirements that are not common in searches or inquiries but still exist.
[0066] Exemplarily, a search may be performed in the document library based on the first input information. If the document is not found, a search may be performed in the external network library. If the document is not found in the external network library, a search may be performed in the supplementary search library to obtain the first recalled document.
[0067] Therefore, by adopting a multi-channel recall result fusion method to obtain the first recalled document, the document recall probability can be improved.
[0068] Step 204: Determine whether a knowledge injection condition is met based on the first recalled document.
[0069] Among them, the knowledge injection condition can be used to determine whether the recalled document is suitable for injection into the large model for content generation.
[0070] Since the documents retrieved based on the first input information may not be relevant to the first input information, for example, if the first input information is "write a travel experience about City A", the recalled documents describe the economic situation of City A, and the two are not related. Therefore, the knowledge injection condition can be used to determine whether the first recalled document can be injected into the large model for content generation.
[0071] Exemplarily, the knowledge injection conditions may include but are not limited to: the first recalled document is irrelevant to the first input information; the content of the first recalled document conflicts with the known knowledge of the large model; the content of the first recalled document conflicts with the requirements in the first input information.
[0072] As a possible implementation method, corresponding prompt information can be generated based on the first recall document and the first input information. The prompt information can be used to prompt the large model to determine whether the knowledge injection conditions are met. The prompt information is input into the fourth large model, and the fourth large model is used to determine whether any of the following situations is met: the first recall document is irrelevant to the first input information, the content of the first recall document conflicts with the known knowledge of the large model, the content of the first recall document conflicts with the requirements in the first input information, etc. If none of the above situations exists, it can be determined that the knowledge conditions are met. If any of the above situations exists, it can be determined that the knowledge injection conditions are not met.
[0073] Exemplarily, the number of model parameters of the fourth largest model may be smaller than the number of model parameters of the first largest model, or smaller than the number of model parameters of the second largest model.
[0074] Therefore, based on the first recalled document and the first input information, using a large model to determine whether the knowledge injection condition is met can improve the accuracy of the judgment.
[0075] As a possible implementation, a pre-trained classification model may be used to determine whether the knowledge injection condition is met based on the first recall document and the first input information. The classification model may be obtained by training an initial classification model based on a training sample including sample input information, sample recall documents, and a label indicating whether the knowledge injection condition is met.
[0076] Step 205 , in response to satisfying the knowledge injection condition, determining a content generation strategy as generating content using a first large model according to the first recalled document.
[0077] The first large model may be a general large model, or may be obtained by fine-tuning and training the general large model using retrieved documents, and there is no limitation on this.
[0078] Exemplarily, the first large model can be trained in the following manner: obtain sample data, where the sample data may include second input information, a second recalled document retrieved based on the second input information, sample content generated based on the second input information and the second recalled document, etc. The sample data can be input into the general large model to obtain the probability of the general large model output, and the general large model can be fine-tuned and trained based on the probability to increase the probability of the model output until the model training end conditions are met to obtain the first large model.
[0079] The probability output by the general large model may refer to the probability of the general large model outputting the sample content when the second input information and the second recalled document are input into the general large model.
[0080] The model training end condition may be that the probability of the model output is greater than a preset threshold, or that a preset number of training times is reached, etc., and there is no limitation on this.
[0081] Exemplarily, the first prompt information can be generated according to the second input information and the second recalled document, and the first prompt information can be input into the third largest model for content generation to obtain the initial content output by the third largest model, and the initial content can be used as sample content.
[0082] Optionally, based on the initial content, at least one optimization strategy for the initial content can be obtained using the third largest model, and based on the optimization strategy, the first prompt information can be updated to obtain second prompt information, the second prompt information can be input into the third largest model, the initial content can be optimized using the third largest model to obtain optimized content, and then the sample content can be determined based on the optimized content.
[0083] Exemplarily, the number of model parameters of the third largest model may be greater than the number of model parameters of the first largest model.
[0084] Exemplarily, the optimized content may be evaluated to obtain an evaluation score, and the optimized content with the highest evaluation score may be used as sample content.
[0085] For example, we ask the initial content output by the third model: "What additional answers can be given to the above output content?" Assume that the third model answers: 1. Richer content 2. Please quote specific clauses 3. Convert the first person to the third person. Then, we can output based on these three optimization strategies respectively, and finally select sample content based on the evaluation results of the output content corresponding to the three optimization strategies.
[0086] Therefore, by using the third largest model to determine the optimization strategy for the initial content, the prompt information used to generate the initial content is updated based on the optimization strategy, the prompt information is obtained using the update, the initial content is optimized, and sample content is selected from the optimized content, so that the quality of the sample content can be improved, and then the sample content is used for fine-tuning training, which can improve the quality of the generated content of the fine-tuned large model.
[0087] Since adding recalled documents in the prompt information during the inference phase often cannot change the original knowledge logic system of the large model, the output content is unstable. If the injected knowledge conflicts with the model's own knowledge, it will also cause output errors. Therefore, by using the retrieved documents to fine-tune the general large model and obtain the first large model, the generation of the first large model can be made more stable, professional, and accurate.
[0088] Step 206 , in response to the knowledge injection condition not being met, determining the content generation strategy to directly use the second largest model for content generation.
[0089] The second largest model may be a general large model, or may be obtained by fine-tuning the general large model using retrieved documents, and there is no limitation on this.
[0090] Exemplarily, the first large model and the second large model can both be general large models, or the first large model is obtained by fine-tuning the general large model using retrieved documents, and the second large model is the general large model, or the first large model and the second large model are obtained by fine-tuning the general large model using retrieved documents, etc.
[0091] For example, the second largest model is large model a, and the retrieved documents can be used to fine-tune large model a to obtain the first largest model.
[0092] It should be noted that the first large model and the second large model can be the same or different, and there is no limitation on this. For example, the first large model and the second large model can be the same general large model or different general large models.
[0093] Step 207: adopt a content generation strategy to obtain generated content corresponding to the first input information.
[0094] In the present application, step 207 can be implemented in any of the embodiments of the present application, so it will not be described in detail here.
[0095] In the embodiment of the present application, by determining whether the knowledge injection condition is met according to the first recall document, if it is met, the content generation strategy is determined to be to generate content using the first large model according to the first recall document, and if it is not met, the content generation strategy is determined to be to directly generate content using the second large model. Thus, when the knowledge injection condition is met, the content is generated using the first large model according to the first recall document, which can avoid the injection of inappropriate recall documents to affect content generation, thereby improving the accuracy of generated content.
[0096] Figure 3 A flowchart of a large model-based content generation method provided in another embodiment of the present application.
[0097] like Figure 3 As shown, the content generation method based on the large model includes:
[0098] Step 301: Obtain first input information.
[0099] Step 302: perform intent recognition on the first input information to determine the content generation intent corresponding to the first input information.
[0100] Step 303, in response to the content generation intention being a document generation class intention, a search is performed in the document library according to the first input information to obtain a first recalled document.
[0101] Step 304: Determine a content generation strategy corresponding to the first input information according to the first recalled document.
[0102] In the present application, steps 301 to 304 may be implemented in any of the embodiments of the present application, and therefore will not be described in detail herein.
[0103] Step 305 , in response to the content generation strategy of using the first large model to generate content according to the first recalled document, learning requirement information is obtained.
[0104] The learning requirement information may be used to prompt the first large model about what to learn from the first recalled document.
[0105] Exemplarily, the learning requirement information may include, but is not limited to, prompting the first large model to learn the language style, writing format, professional knowledge, etc. of the first recalled document.
[0106] It should be noted that the content that the first large model needs to learn from the first recalled document in the learning requirement information can be determined according to actual needs and is not limited to this.
[0107] Step 306: Generate third prompt information according to the first recall document, the first input information and the learning prompt information.
[0108] As a possible implementation method, the slots of the general content prompt template can be filled according to the first recalled document and the first input information to obtain initial prompt information, and the initial prompt information can be updated according to the learning prompt information to obtain third prompt information.
[0109] As another possible implementation, the slots of the optimized content generation template may be filled according to the first recall document, the first input information and the learning prompt information to generate the third prompt information. The optimized content generation template may be obtained by optimizing the learning content of the general content generation template.
[0110] Step 307: input the third prompt information into the first large model, and use the first large model to generate content to obtain generated content.
[0111] In the present application, the third prompt information can be input into the first large model, and the first large model generates content according to the third prompt information to obtain generated content. It can be understood that the generated content here includes generated documents.
[0112] Due to different business scenarios, the format requirements for documents may be different. For example, the formats of work summaries and papers are different. Therefore, the genre category of the generated content can be determined based on the content generation intention, and the generated content can be post-processed according to the document format requirements corresponding to the genre category to obtain content that meets the document format requirements. The content that meets the document format requirements is returned to the document resource collection platform to be displayed to the user.
[0113] For example, if the intention of content generation is to generate a work summary, then after obtaining the generated content output by the large model, the generated content can be post-processed according to the document format requirements of the work summary to obtain a work summary that meets the work summary format requirements.
[0114] Therefore, by post-processing the generated content according to its genre category to obtain content that meets the document format requirements corresponding to the genre category, the content returned to the user can be made more standardized, thereby meeting the document generation needs of different business scenarios.
[0115] Optionally, if the intent category is a non-document generation intent, the second largest model is directly used to generate content based on the first input information to obtain generated content.
[0116] For example, if the first input information is a knowledge question and answer, then the answer to the question can be directly generated using the second largest model based on the first input information.
[0117] Therefore, for input information with non-document generation intent, directly using the large model for processing can save time and improve processing efficiency.
[0118] In an embodiment of the present application, by acquiring learning requirement information, content generation is performed using the first large model based on the first recalled document, the first input information and the learning requirement information. Therefore, when the first large model generates content, the learning requirement information is used to prompt the first large model with the content to learn from the first recalled document, thereby improving the accuracy of the generated content and greatly enhancing the real effect brought about by knowledge injection.
[0119] In order to facilitate understanding of the content generation method based on the large model of the present application, Figure 4 To explain, Figure 4 A schematic diagram of a process of content generation based on a large model provided in an embodiment of the present application.
[0120] like Figure 4 As shown in the figure, the process of content generation based on the large model is as follows:
[0121] Step 401: Obtain user input information.
[0122] Step 402, input information identification.
[0123] In this embodiment, the user's input information can be divided into two types, document generation and non-document generation. Document generation refers to the user's explicit need to generate a document, which can be specifically classified into work summaries, academic papers, research reports, contract agreements, etc. according to different genres. Non-document generation can include simple knowledge questions, such as what day of the week it is today, and editing instructions, such as help me make this sentence red or bold.
[0124] Step 403, retrieve and recall.
[0125] Among them, retrieval recall can be divided into offline document index construction and online document recall. Offline document index construction can include: screening out high-quality content resources on the document resource collection platform, generating vectorized representations of document titles through embedded model training, and then using the vectors as indexes to build a recallable content library. Online document recall: The input information can be input into the embedded model to obtain a vectorized representation, and the ANN (Approximate Nearest Neighbor Search) method can be used to improve retrieval efficiency and recall relevant documents.
[0126] Step 404: determine the knowledge injection conditions.
[0127] Considering the following situations, the use of knowledge injection into the content generated by the large model may bring negative effects: first, the content of the recalled document is irrelevant to the user input; second, the content of the recalled document itself contains factual errors and conflicts with the known knowledge of the large model; third, the content of the recalled document is contrary to the clear requirements in the user input. When any of these three situations is met, step 406 can be executed, that is, content generation is performed directly through the large model. When none of the three situations exist, that is, the knowledge injection conditions are met, step 405 can be executed, that is, the recalled document is injected into the fine-tuned large model for content generation.
[0128] Therefore, the overall effect of knowledge injection into the large model can be improved by using knowledge injection condition judgment.
[0129] Step 405, the fine-tuned large model is generated with retrieval enhancement.
[0130] In this embodiment, the sample data produced by knowledge injection can be used to perform supervised fine-tuning on the general large model to obtain a fine-tuned large model. Detailed explanations can be found in the above embodiments, so they will not be repeated here.
[0131] Step 406: Generate a large model.
[0132] Step 407: output the generated content.
[0133] Figure 4 The content generation method based on the big model shown may include the steps of input information discrimination, retrieval recall, knowledge injection condition discrimination, knowledge injection big model generation and general big model generation. Among them, input information discrimination and knowledge injection condition discrimination mainly distinguish whether the user's intention is a document generation type and whether it is suitable for content injection. The two generation links included are the big model call for knowledge injection using the retrieved content and the direct big model call.
[0134] The solution of this application can be applied to the AI content generation scenario of the document resource collection platform, and the large model knowledge injection technology is used to optimize the content generation effect. On the one hand, by adding a judgment link to form a funnel, problem events in the business can be effectively solved. On the other hand, the use of large model supervision fine-tuning and prompt word optimization to introduce effective information makes the model generation more stable, professional and accurate. Not only does it provide a wider range of retrieval knowledge enhancement solutions in business, but it also realizes the portability of technology.
[0135] In order to implement the above embodiment, the embodiment of the present application also proposes a content generation device based on a large model. Figure 5 A schematic diagram of the structure of a large model-based content generation device provided in one embodiment of the present application.
[0136] like Figure 5As shown, the large model-based content generation device 500 includes:
[0137] An acquisition module 510 is used to acquire first input information;
[0138] An intention recognition module 520, configured to perform intention recognition on the first input information to determine a content generation intention corresponding to the first input information;
[0139] A retrieval and recall module 530 is used for performing retrieval and recall in a document library according to the first input information in response to the content generation intention being a document generation type intention, so as to obtain a first recalled document;
[0140] A first determination module 540, configured to determine a content generation strategy corresponding to the first input information according to the first recalled document;
[0141] The content generation module 550 is configured to adopt the content generation strategy to obtain generated content corresponding to the first input information.
[0142] Optionally, the first determining module 540 is configured to:
[0143] Determining whether a knowledge injection condition is met according to the first recalled document;
[0144] In response to satisfying the knowledge injection condition, determining the content generation strategy to generate content using a first large model according to the first recalled document;
[0145] In response to the knowledge injection condition not being met, determining the content generation strategy to directly use the second largest model for content generation.
[0146] Optionally, the first large model is trained by the following steps:
[0147] Acquire sample data; wherein the sample data includes second input information, a second recalled document retrieved based on the second input information, and sample content generated based on the second input information and the second recalled document;
[0148] Fine-tune the general large model according to the sample data to obtain the first large model.
[0149] Optionally, the sample content is obtained in the following manner:
[0150] generating first prompt information according to the second input information and the second recall document;
[0151] Inputting the first prompt information into a third model, and using the third model to generate content to obtain initial content;
[0152] According to the initial content, using the third model, obtaining at least one optimization strategy for the initial content;
[0153] According to the optimization strategy, the first prompt information is updated to obtain second prompt information;
[0154] Inputting the second prompt information into the third large model, optimizing the initial content using the first large model to obtain optimized content;
[0155] The sample content is determined according to the optimized content.
[0156] Optionally, the first determining module 540 is configured to:
[0157] According to the first recall document and the first input information, using the fourth large model, determine whether any of the following situations exists: the first recall document is irrelevant to the first input information; the content of the first recall document conflicts with the known knowledge of the large model; the content of the first recall document conflicts with the requirements in the first input information;
[0158] In response to the absence of any of the following situations, determining that the knowledge injection condition is met;
[0159] In response to the existence of any of the following situations, it is determined that the knowledge injection condition is not met.
[0160] Optionally, the content generation strategy is to generate content using a first large model according to the first recalled document, and the content generation module 550 is used to:
[0161] Acquire learning requirement information; wherein the learning requirement information is used to prompt the first large model to learn content from the first recalled document;
[0162] generating third prompt information according to the first recall document, the first input information and the learning prompt information;
[0163] The third prompt information is input into the first large model, and the first large model is used to generate content to obtain the generated content.
[0164] Optionally, the device may further include:
[0165] A second determination module, configured to determine the genre category of the generated content according to the content generation intention;
[0166] A post-processing module is used to post-process the generated content according to the document format requirements corresponding to the genre category to obtain content that meets the document format requirements.
[0167] Optionally, the content generation module 550 is further configured to:
[0168] In response to the intent category being a non-document generation intent, the second largest model is directly used to generate content based on the first input information to obtain the generated content.
[0169] It should be noted that the explanation of the aforementioned embodiment of the content generation method based on a large model is also applicable to the content generation device based on a large model of this embodiment, so it will not be repeated here.
[0170] In the embodiment of the present application, the intent of content generation is determined by performing intent recognition on the first input information. If the content generation intent is a document generation intent, the first recalled document is retrieved and recalled according to the first input information, and the content generation strategy is determined according to the first recalled document, and then the content generation strategy is used to generate content. Therefore, when the content generation intent of the input information is a document generation intent, the content generation strategy is determined according to the recalled document, and then the content generation strategy is used to generate content, which can avoid the negative impact of knowledge injection on content generation and improve the accuracy of generated content.
[0171] According to an embodiment of the present application, the present application also provides an electronic device, a readable storage medium and a computer program product.
[0172] Figure 6 A schematic block diagram of an example electronic device 600 that can be used to implement an embodiment of the present application is shown. The electronic device is intended to represent various forms of digital computers, such as laptop computers, desktop computers, workbenches, personal digital assistants, servers, blade servers, mainframe computers, and other suitable computers. The electronic device can also represent various forms of mobile devices, such as personal digital processing, cellular phones, smart phones, wearable devices, and other similar computing devices. The components shown herein, their connections and relationships, and their functions are merely examples and are not intended to limit the implementation of the present application described and / or required herein.
[0173] like Figure 6As shown, the device 600 includes a computing unit 601, which can perform various appropriate actions and processes according to a computer program stored in a ROM (Read-Only Memory) 602 or a computer program loaded from a storage unit 608 to a RAM (Random Access Memory) 603. In the RAM 603, various programs and data required for the operation of the device 600 can also be stored. The computing unit 601, the ROM 602, and the RAM 603 are connected to each other via a bus 604. An I / O (Input / Output) interface 605 is also connected to the bus 604.
[0174] A number of components in the device 600 are connected to the I / O interface 605, including: an input unit 606, such as a keyboard, a mouse, etc.; an output unit 607, such as various types of displays, speakers, etc.; a storage unit 608, such as a disk, an optical disk, etc.; and a communication unit 609, such as a network card, a modem, a wireless communication transceiver, etc. The communication unit 609 allows the device 600 to exchange information / data with other devices through a computer network such as the Internet and / or various telecommunication networks.
[0175] The computing unit 601 may be a variety of general and / or special processing components with processing and computing capabilities. Some examples of the computing unit 601 include, but are not limited to, a CPU (Central Processing Unit), a GPU (Graphic Processing Units), various dedicated AI (Artificial Intelligence) computing chips, various computing units running machine learning model algorithms, a DSP (Digital Signal Processor), and any appropriate processor, controller, microcontroller, etc. The computing unit 601 performs the various methods and processes described above, such as a content generation method based on a large model. For example, in some embodiments, the content generation method based on a large model may be implemented as a computer software program, which is tangibly contained in a machine-readable medium, such as a storage unit 608. In some embodiments, part or all of the computer program may be loaded and / or installed on the device 600 via the ROM 602 and / or the communication unit 609. When the computer program is loaded into the RAM 603 and executed by the computing unit 601, one or more steps of the content generation method based on the large model described above may be performed. Alternatively, in other embodiments, the computing unit 601 may be configured to execute the large model-based content generation method in any other appropriate manner (for example, by means of firmware).
[0176] Various embodiments of the systems and techniques described above herein may be implemented in digital electronic circuit systems, integrated circuit systems, FPGAs (Field Programmable Gate Arrays), ASICs (Application-Specific Integrated Circuits), ASSPs (Application Specific Standard Products), SOCs (System On Chips), CPLDs (Complex Programmable Logic Devices), computer hardware, firmware, software, and / or combinations thereof. These various embodiments may include: being implemented in one or more computer programs that may be executed and / or interpreted on a programmable system including at least one programmable processor that may be a dedicated or general-purpose programmable processor that may receive data and instructions from a storage system, at least one input device, and at least one output device, and transmit data and instructions to the storage system, the at least one input device, and the at least one output device.
[0177] The program code for implementing the method of the present application can be written in any combination of one or more programming languages. These program codes can be provided to a processor or controller of a general-purpose computer, a special-purpose computer, or other programmable data processing device, so that the program code, when executed by the processor or controller, implements the functions / operations specified in the flow chart and / or block diagram. The program code can be executed entirely on the machine, partially on the machine, partially on the machine and partially on a remote machine as a stand-alone software package, or entirely on a remote machine or server.
[0178] In the context of the present application, a machine-readable medium may be a tangible medium that may contain or store a program for use by or in conjunction with an instruction execution system, device, or equipment. A machine-readable medium may be a machine-readable signal medium or a machine-readable storage medium. A machine-readable medium may include, but is not limited to, an electronic, magnetic, optical, electromagnetic, infrared, or semiconductor system, device, or device, or any suitable combination of the foregoing. More specific examples of machine-readable storage media may include electrical connections based on one or more lines, portable computer disks, hard disks, RAM, ROM, EPROM (Electrically Programmable Read-Only-Memory) or flash memory, optical fiber, CD-ROM (Compact Disc Read-Only Memory), optical storage devices, magnetic storage devices, or any suitable combination of the foregoing.
[0179] To provide interaction with a user, the systems and techniques described herein can be implemented on a computer having: a display device (e.g., a CRT (Cathode-Ray Tube) or LCD (Liquid Crystal Display) monitor) for displaying information to the user; and a keyboard and pointing device (e.g., a mouse or trackball) through which the user can provide input to the computer. Other types of devices can also be used to provide interaction with the user; for example, the feedback provided to the user can be any form of sensory feedback (e.g., visual feedback, auditory feedback, or tactile feedback); and input from the user can be received in any form (including acoustic input, voice input, or tactile input).
[0180] The systems and techniques described herein may be implemented in a computing system that includes backend components (e.g., as a data server), or a computing system that includes middleware components (e.g., an application server), or a computing system that includes frontend components (e.g., a user computer with a graphical user interface or a web browser through which a user can interact with implementations of the systems and techniques described herein), or a computing system that includes any combination of such backend components, middleware components, or frontend components. The components of the system may be interconnected by any form or medium of digital data communication (e.g., a communication network). Examples of communication networks include: LAN (Local Area Network), WAN (Wide Area Network), the Internet, and blockchain networks.
[0181] A computer system may include a client and a server. The client and the server are generally remote from each other and usually interact through a communication network. The relationship between the client and the server is generated by computer programs running on the corresponding computers and having a client-server relationship with each other. The server may be a cloud server, also known as a cloud computing server or a cloud host, which is a host product in the cloud computing service system to solve the defects of difficult management and weak business scalability in traditional physical hosts and VPS services (Virtual Private Server). The server may also be a server of a distributed system, or a server combined with a blockchain.
[0182] According to an embodiment of the present application, the present application also provides a computer program product, which, when an instruction processor in the computer program product executes, executes the large model-based content generation method proposed in the above embodiment of the present application.
[0183] It should be understood that the various forms of processes shown above can be used to reorder, add or delete steps. For example, the steps recorded in this application can be executed in parallel, sequentially or in different orders, as long as the expected results of the technical solution disclosed in this application can be achieved, and this document is not limited here.
[0184] The above specific implementations do not constitute a limitation on the protection scope of this application. It should be understood by those skilled in the art that various modifications, combinations, sub-combinations and substitutions can be made according to design requirements and other factors. Any modifications, equivalent substitutions and improvements made within the spirit and principles of this application should be included in the protection scope of this application.
Claims
1. A content generation method based on a large model, comprising: Obtaining first input information; performing intent recognition on the first input information to determine a content generation intent corresponding to the first input information; In response to the content generation intention being a document generation type intention, searching and recalling in a document library according to the first input information to obtain a first recalled document; Determining, according to the first recalled document, a content generation strategy corresponding to the first input information; The content generation strategy is adopted to obtain generated content corresponding to the first input information.
2. The method of claim 1, wherein: The step of determining, according to the recalled document, a content generation strategy corresponding to the first input information includes: Determining whether a knowledge injection condition is met according to the first recalled document; In response to satisfying the knowledge injection condition, determining the content generation strategy to generate content using a first large model according to the first recalled document; In response to the knowledge injection condition not being met, determining the content generation strategy to directly use the second largest model for content generation.
3. The method of claim 2, wherein: The first model is trained by the following steps: Acquire sample data; wherein the sample data includes second input information, a second recalled document retrieved based on the second input information, and sample content generated based on the second input information and the second recalled document; Fine-tune the general large model according to the sample data to obtain the first large model.
4. The method of claim 3, wherein: The sample content is obtained in the following ways: generating first prompt information according to the second input information and the second recall document; Inputting the first prompt information into a third model, and using the third model to generate content to obtain initial content; According to the initial content, using the third model, obtaining at least one optimization strategy for the initial content; According to the optimization strategy, the first prompt information is updated to obtain second prompt information; Inputting the second prompt information into the third large model, optimizing the initial content using the first large model to obtain optimized content; The sample content is determined according to the optimized content.
5. The method of claim 2, wherein: The determining, according to the first recalled document, whether a knowledge injection condition is met includes: According to the first recall document and the first input information, using the fourth large model, determine whether any of the following situations exists: the first recall document is irrelevant to the first input information; the content of the first recall document conflicts with the known knowledge of the large model; the content of the first recall document conflicts with the requirements in the first input information; In response to the absence of any of the following situations, determining that the knowledge injection condition is met; In response to the existence of any of the following situations, it is determined that the knowledge injection condition is not met.
6. The method of claim 1, wherein: The content generation strategy is to generate content using a first large model according to the first recalled document. The use of the content generation strategy to obtain generated content corresponding to the first input information includes: Acquire learning requirement information; wherein the learning requirement information is used to prompt the first large model to learn content from the first recalled document; generating third prompt information according to the first recall document, the first input information and the learning prompt information; The third prompt information is input into the first large model, and the first large model is used to generate content to obtain the generated content.
7. The method of claim 6, further comprising: Determining the genre category of the generated content according to the content generation intention; The generated content is post-processed according to the document format requirement corresponding to the genre category to obtain content that meets the document format requirement.
8. The method according to any one of claims 1 to 7, further comprising: In response to the intent category being a non-document generation intent, the second largest model is directly used to generate content based on the first input information to obtain the generated content.
9. A content generation device based on a large model, comprising: An acquisition module, used for acquiring first input information; an intention recognition module, configured to perform intention recognition on the first input information to determine a content generation intention corresponding to the first input information; A retrieval and recall module, configured to, in response to the content generation intention being a document generation type intention, perform retrieval and recall in a document library according to the first input information to obtain a first recalled document; A first determination module, configured to determine a content generation strategy corresponding to the first input information according to the first recalled document; The content generation module is used to adopt the content generation strategy to obtain the generated content corresponding to the first input information.
10. The device of claim 9, wherein: The first determining module is used to: Determining whether a knowledge injection condition is met according to the first recalled document; In response to satisfying the knowledge injection condition, determining the content generation strategy to generate content using a first large model according to the first recalled document; In response to the knowledge injection condition not being met, determining the content generation strategy to directly use the second largest model for content generation.
11. The device of claim 10, wherein: The first model is trained by the following steps: Acquire sample data; wherein the sample data includes second input information, a second recalled document retrieved based on the second input information, and sample content generated based on the second input information and the second recalled document; Fine-tune the general large model according to the sample data to obtain the first large model.
12. The device of claim 11, wherein: The sample content is obtained in the following ways: generating first prompt information according to the second input information and the second recall document; Inputting the first prompt information into a third model, and using the third model to generate content to obtain initial content; According to the initial content, using the third model, obtaining at least one optimization strategy for the initial content; According to the optimization strategy, the first prompt information is updated to obtain second prompt information; Inputting the second prompt information into the third large model, optimizing the initial content using the first large model to obtain optimized content; The sample content is determined according to the optimized content.
13. The device of claim 10, wherein: The first determining module is used to: According to the first recall document and the first input information, using the fourth large model, determine whether any of the following situations exists: the first recall document is irrelevant to the first input information; the content of the first recall document conflicts with the known knowledge of the large model; the content of the first recall document conflicts with the requirements in the first input information; In response to the absence of any of the following situations, determining that the knowledge injection condition is met; In response to the existence of any of the following situations, it is determined that the knowledge injection condition is not met.
14. The device of claim 9, wherein: The content generation strategy is to generate content using the first large model according to the first recalled document, and the content generation module is used to: Acquire learning requirement information; wherein the learning requirement information is used to prompt the first large model to learn content from the first recalled document; generating third prompt information according to the first recall document, the first input information and the learning prompt information; The third prompt information is input into the first large model, and the first large model is used to generate content to obtain the generated content.
15. The apparatus of claim 14, further comprising: A second determination module, configured to determine the genre category of the generated content according to the content generation intention; A post-processing module is used to post-process the generated content according to the document format requirements corresponding to the genre category to obtain content that meets the document format requirements.
16. The device according to any one of claims 9 to 15, wherein: The content generation module is further used for: In response to the intent category being a non-document generation intent, the second largest model is directly used to generate content based on the first input information to obtain the generated content.
17. An electronic device comprising: at least one processor; as well as a memory communicatively connected to the at least one processor; wherein, The memory stores instructions that can be executed by the at least one processor, and the instructions are executed by the at least one processor to enable the at least one processor to perform the method according to any one of claims 1 to 8.
18. A non-transitory computer-readable storage medium storing computer instructions, wherein: The computer instructions are used to cause the computer to execute the method according to any one of claims 1-8.
19. A computer program product, comprising a computer program, which, when executed by a processor, implements the steps of the method according to any one of claims 1 to 8.