Text generation method, device, electronic device and storage medium

By splitting the query request into sub-requests and sharing the search module and prompt word generation module, the problem of low iteration update efficiency in different scenarios is solved, and efficient update and accurate generation of the text generation device are realized.

CN119719356BActive Publication Date: 2025-07-04UC MOBILE CHINA CO LTD
View PDF 3 Cites 0 Cited by

Patent Information

Application Number
CN202510229660.5
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2025-02-28
Publication Date
2025-07-04
Estimated Expiration
2045-02-28

AI Technical Summary

Technical Problem

In the prior art, retrieval enhancement generation (RAG) is less efficient when iteratively updated in different application scenarios, and each scenario needs to be updated separately, resulting in inefficient efficiency.

Method used

Split the user query request into multiple subquery requests, and retrieve reference information from the knowledge base. After generating the prompt word, enter the text generation model. The split and search module can be used in multiple scenarios. The prompt word and text generation module are dedicated to specific scenarios to achieve shared updates.

Benefits of technology

It improves the iterative update efficiency of the text generation device, reduces the need for repeated updates in different scenarios, and improves the update efficiency and the accuracy of text generation.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119719356B_ABST
    Figure CN119719356B_ABST
Patent Text Reader

Abstract

Embodiments of the present disclosure provide a text generation method, apparatus, electronic device, and storage medium. The text generation apparatus includes: a splitting module configured to split a first query request from a user device into a plurality of sub-query requests; a retrieval module configured to retrieve reference information corresponding to the first query request and the sub-query requests from a knowledge base; a prompt word generation module configured to generate a first prompt word based on the reference information; a text generation module configured to input the first prompt word into a text generation model and generate text corresponding to the first query request through the text generation model; the prompt word generation module and the text generation module are dedicated to the text generation scenario corresponding to the first query request, and the splitting module and the retrieval module are used for multiple text generation scenarios. This solution can improve the efficiency of iterative update of the text generation apparatus.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] Embodiments of the present disclosure relate to the field of computer technology, and in particular, to a text generation method, apparatus, electronic device, and storage medium. Background Art

[0002] Currently, machine learning models such as large language models (LLMs) play an increasingly important role in people's work and life. Retrieval-Augmented Generation (RAG) is an artificial intelligence technology that combines information retrieval technology and language generation models. RAG can retrieve relevant information from an external knowledge base and use the retrieved relevant information as a prompt to input into the LLM to enhance the model's ability to handle instruction-intensive tasks such as question answering, text summarization, content generation, etc. RAG includes multiple processes such as Chain of Thought (COT), material recall, material ranking, and model generation.

[0003] Currently, RAG is deployed separately in different application scenarios. For example, RAG is deployed separately in question answering scenarios, text summarization scenarios, and content generation scenarios.

[0004] However, during the use of RAG, continuous iterative updates are required. When RAG is deployed separately for different application scenarios, when iteratively updating RAG, it is necessary to separately perform iterative updates on the RAG deployed in each application scenario, resulting in a low efficiency of RAG iterative updates. Summary of the Invention

[0005] In view of this, embodiments of the present disclosure provide a text generation method, apparatus, electronic device, and storage medium to at least partially solve the above problems.

[0006] According to a first aspect of the embodiments of the present disclosure, there is provided a text generation apparatus, including: a splitting module, configured to split a first query request from a user device into multiple sub-query requests, where the intent complexity of the first query request is greater than a complexity threshold; a retrieval module, configured to retrieve at least one reference information corresponding to the first query request from a knowledge base, and retrieve at least one reference information corresponding to the sub-query request from the knowledge base; a prompt word generation module, configured to generate a first prompt word according to at least part of the reference information; a text generation module, configured to input the first prompt word into a text generation model, and generate text corresponding to the first query request through the text generation model; wherein, the prompt word generation module and the text generation module are dedicated to the text generation scenario corresponding to the first query request, and the splitting module and the retrieval module are used for multiple text generation scenarios.

[0007] According to a second aspect of the embodiments of the present disclosure, a text generation method is provided, including: generating a first query request using first input data of a user, where the intent complexity of the first query request is greater than a complexity threshold; sending the first query request to a server; receiving text generated by the server in response to the first query request, where the server includes a splitting module, a retrieval module, a prompt word generation module, and a text generation module; the splitting module is configured to split the first query request into multiple sub-query requests; the retrieval module is configured to retrieve at least one reference information corresponding to the first query request from a knowledge base, and retrieve at least one reference information corresponding to the sub-query requests from the knowledge base; the prompt word generation module is configured to generate a first prompt word according to at least part of the reference information; the text generation module is configured to input the first prompt word into a text generation model, and generate text corresponding to the first query request through the text generation model; the prompt word generation module and the text generation module are dedicated to the text generation scenario corresponding to the first query request, and the splitting module and the retrieval module are used for multiple text generation scenarios.

[0008] According to a third aspect of the embodiments of the present disclosure, a text generation method is provided, including: through a splitting module, splitting a first query request from a user device into multiple sub-query requests, where the intent complexity of the first query request is greater than a complexity threshold; through a retrieval module, retrieving at least one reference information corresponding to the first query request from a knowledge base, and retrieving at least one reference information corresponding to the sub-query requests from the knowledge base; through a prompt word generation module, generating a first prompt word according to at least part of the reference information; through a text generation module, inputting the first prompt word into a text generation model, and generating text corresponding to the first query request through the text generation model; where the prompt word generation module and the text generation module are dedicated to the text generation scenario corresponding to the first query request, and the splitting module and the retrieval module are used for multiple text generation scenarios.

[0009] According to a fourth aspect of the embodiments of the present disclosure, an electronic device is provided, including: a processor, a memory, a communication interface, and a communication bus, and the processor, the memory, and the communication interface complete communication with each other through the communication bus; the memory is used to store at least one executable instruction, and the executable instruction causes the processor to perform the operations corresponding to the method described in the second aspect or the third aspect above.

[0010] According to a fifth aspect of the embodiments of the present disclosure, a computer storage medium is provided, on which a computer program is stored, and when the program is executed by a processor, the method described in the second aspect or the third aspect above is implemented.

[0011] According to a sixth aspect of the embodiments of the present disclosure, there is provided a computer program product including computer instructions that direct a computing device to execute the method described in the second aspect or the third aspect above.

[0012] According to the text generation solution provided by the embodiments of the present disclosure, after the splitting module splits the first query request into multiple sub-query requests, the retrieval module can respectively retrieve the reference information corresponding to the first query request and the sub-query requests from the knowledge base, and the prompt word generation module can generate a first prompt word based on at least part of the reference information. After the text generation module inputs the first prompt word into the text generation model, it can generate the text corresponding to the first query request through the text generation model. Since the prompt word generation module and the text generation module are dedicated to the text generation scenario corresponding to the first query request, while the splitting module and the retrieval module can be used in multiple text generation scenarios, when iteratively updating the text generation device, the splitting module and the retrieval module shared by multiple text generation scenarios can be iteratively updated once, without iteratively updating the splitting module and the retrieval module for the text generation devices in different text generation scenarios respectively, thereby improving the efficiency of iteratively updating the text generation device. BRIEF DESCRIPTION OF THE DRAWINGS

[0013] To more clearly illustrate the technical solutions in the embodiments of the present disclosure or the prior art, the following will briefly introduce the drawings required for use in the description of the embodiments or the prior art. Obviously, the drawings in the following description are only some embodiments recorded in the embodiments of the present disclosure, and those of ordinary skill in the art can also obtain other drawings based on these drawings.

[0014] Figure 1 It is a schematic diagram of an exemplary system applied in an embodiment of the present disclosure;

[0015] Figure 2 It is a schematic diagram of a text generation device in an embodiment of the present disclosure;

[0016] Figure 3 It is a schematic diagram of multiple text generation devices in an embodiment of the present disclosure;

[0017] Figure 4 It is a schematic diagram of a text generation device in another embodiment of the present disclosure;

[0018] Figure 5 It is a schematic diagram of multiple text generation devices in another embodiment of the present disclosure;

[0019] Figure 6 It is a schematic diagram of a text generation device in yet another embodiment of the present disclosure;

[0020] Figure 7Schematic diagram of a text generation device according to another embodiment of the present disclosure;

[0021] Figure 8 Schematic diagram of multiple text generation devices according to another embodiment of the present disclosure;

[0022] Figure 9 Schematic diagram of a text generation device including a second screening module according to an embodiment of the present disclosure;

[0023] Figure 10 Schematic diagram of a text generation device including a routing module according to an embodiment of the present disclosure;

[0024] Figure 11 Flowchart of a text generation method according to an embodiment of the present disclosure;

[0025] Figure 12 Flowchart of a text generation method according to another embodiment of the present disclosure;

[0026] Figure 13 Schematic diagram of an electronic device according to an embodiment of the present disclosure. Detailed implementation manners

[0027] The following describes the present disclosure based on embodiments, but the present disclosure is not limited to these embodiments. In the following detailed description of the present disclosure, some specific details are described in detail. Those skilled in the art can fully understand the present disclosure without the description of these details. In order to avoid obscuring the essence of the present disclosure, well-known methods, processes, and procedures are not described in detail. Additionally, the drawings are not necessarily drawn to scale.

[0028] Exemplary System

[0029] Figure 1 An exemplary system applicable to the embodiment solution of the present disclosure is shown. As Figure 1 shown, the system may include a cloud server 102, a communication network 104, and at least one user device 106, Figure 1 exemplified as multiple user devices 106 herein.

[0030] The cloud server 102 can be any suitable device for storing information, data, programs, and / or any other appropriate type of content, including but not limited to distributed storage system devices, server clusters, computing cloud server clusters, etc. In some embodiments, the cloud server 102 can perform any suitable function. For example, in some embodiments, the cloud server 102 can be used for text generation. As an alternative example, the cloud server 102 can receive a query request sent by the user device 106 and determine whether the query request is a complex intent. When the query request is a complex intent, the cloud server 102 can split the query request into multiple sub-query requests, retrieve the reference information corresponding to the query request and the sub-query requests from an external knowledge base, generate a prompt word based on the retrieved reference information, input the prompt word into a text generation model, generate text corresponding to the query request through the text generation model, and then return the generated text to the user device 106. In different text generation scenarios, the functional modules for implementing query request splitting and for implementing retrieving reference information are common, so the RAG deployed in different application scenarios can share the functional modules for implementing query request splitting and the functional modules for implementing retrieving reference information.

[0031] The communication network 104 can be any suitable combination of one or more wired and / or wireless networks. For example, the communication network 104 can include any one or more of the following: the Internet, an intranet, a Wide Area Network (WAN), a Local Area Network (LAN), a wireless network, a Digital Subscriber Line (DSL) network, a Frame Relay network, an Asynchronous Transfer Mode (ATM) network, a Virtual Private Network (VPN), and / or any other suitable communication network. The user device 106 can be connected to the communication network 104 through one or more first communication links 112, and the communication network 104 can be linked to the cloud server 102 via one or more second communication links 114. The first communication link 112 and the second communication link 114 can be any communication link suitable for transmitting data between the cloud server 102 and the user device 106, such as a network link, a dial-up link, a wireless link, a hardwired link, any other suitable communication link, or any suitable combination of such links.

[0032] The user device 106 may include any one or more user devices suitable for text presentation and interaction. When the solution of the embodiments of the present disclosure is implemented by the user device 106, the user device 106 may send a query request to the cloud server 102 to generate text that meets the requirements through the cloud server 102. As an alternative example, the user device 106 may generate a query request based on the input data of the user, and send the generated query request to the cloud server 102, so that the cloud server 102 generates text corresponding to the query request according to the description in the above embodiments, and returns the generated text to the user device 106. Furthermore, after receiving the text returned by the cloud server 102, the user device 106 may display the received text.

[0033] The user device 106 may include any suitable type of device. For example, the user device 106 may include a mobile device, a tablet computer, a laptop computer, a desktop computer, or any other suitable type of user device. As an alternative example, a predetermined client program (such as a browser, etc.) may be installed on the user device 106. The client program may receive the input data of the user through the human-computer interaction interface, generate a query request according to the input data, and then send the query request to the cloud server 102.

[0034] The embodiments of the present disclosure mainly focus on the process of generating text by the cloud server 102 and the user device 106, and the text generation process will be described in detail later.

[0035] Text Generation Device

[0036] Based on the above system, the embodiments of the present disclosure provide a text generation device, which may be deployed on the server side, such as deployed on the above cloud server 102. The following describes this text generation device in detail through multiple embodiments.

[0037] Figure 2 is a schematic block diagram of a text generation device according to an embodiment of the present disclosure. As Figure 2 shown, the text generation device 200 includes a splitting module 201, a retrieval module 203, a prompt word generation module 204, and a text generation module 205.

[0038] The splitting module 201 may split a first query request from the user device into multiple sub-query requests, where the intention complexity of the first query request is greater than the complexity threshold. The user may input the purpose or information to be obtained on the user device 106 according to the requirements. Then, the user device 106 generates a first query request according to the input data of the user. The first query request may be any suitable request, such as a question in a question-and-answer scenario, an input text to be extracted for summary in a text summary scenario, a topic description in a content generation scenario, etc.

[0039] The intention of a query request refers to the purpose that the user wants to achieve or the type of information to be obtained through this query request. The intention types include information query (the user wants to obtain specific information about a certain topic or question), navigation (the user wants to find a specific website or web page), transactional operation (the user wants to complete a certain transaction, such as purchasing goods, booking services, etc.), answer query (the user wants to get an answer to a specific question, such as "What's the weather like tomorrow"), entertainment (the user wants to listen to music, watch videos or play games, etc.), social interaction (the user wants to communicate with others or view updates on social networks), local search (the user wants to find nearby services or merchants, such as "Where is the nearest convenience store"), etc.

[0040] The intention complexity of a query request can indicate the complexity of the requirements expressed by the user when making the query. Based on a complexity threshold, query requests can be divided into simple-intention query requests and complex-intention query requests. Simple-intention query requests are short queries, such as "weather", "news", etc. Complex-intention query requests are long and structurally complex queries that can contain multiple clauses and conditions, such as "Looking for a travel destination suitable for a two-day solo trip with a budget within 2000".

[0041] For ease of description, in the embodiments of the present disclosure, complex-intention query requests are defined as first query requests, and simple-intention query requests are defined as second query requests. In an example, after the cloud server 102 receives a query request sent by the user device 106, the upstream model can determine the intention complexity of the query request. If the intention complexity of the query request is greater than the complexity threshold, the query request is determined as a first query request; if the intention complexity of the query request is less than or equal to the complexity threshold, the query request is determined as a second query request. After the upstream model determines that a certain query request is a first query request or a second query request, the upstream model can send a corresponding upstream signal for this query request. The text generation device 200 can determine whether this query request is a first query request or a second query request according to the upstream signal. It should be noted that the upstream model can determine the intention complexity of the query request in any suitable way, such as according to the length of the query request, the number of clauses included, the number of conditions included, etc. The embodiments of the present disclosure do not limit the way for the upstream model to determine the intention complexity.

[0042] When the splitting module 201 splits the first query request into multiple sub-query requests, it can split the multiple clauses and / or conditions included in the first query request into multiple sub-query requests. For example, if the first query request is "Find tourist destinations suitable for a two-day trip for one person with a budget within 2000", the splitting module 201 can split the first query request into two sub-query requests: "The budget is within 2000" and "Find tourist destinations suitable for a two-day trip for one person". It should be noted that the splitting module 201 can split the first query request into multiple sub-query requests in any suitable way, and the specific way for the splitting module 201 to split the first query request into multiple sub-query requests is not limited in the embodiments of the present disclosure.

[0043] After the splitting module 201 splits the first query request into multiple sub-query requests, the retrieval module 203 can retrieve one or more reference information corresponding to the first query request from the knowledge base, and retrieve one or more reference information corresponding to the sub-query requests from the knowledge base. The retrieval module 203 can obtain recall parameters based on the first query request and the sub-query requests, and then retrieve matching indexes from the knowledge base according to the recall parameters, and then use the retrieved indexes as reference information. The reference information can be in any suitable format. For example, the reference information can be text, image, video, voice, etc. It should be noted that unless otherwise stated, the knowledge base in the embodiments of the present disclosure refers to a shared knowledge base, that is, the knowledge base in the embodiments of the present disclosure is a knowledge base shared by RAG in different application scenarios.

[0044] In one example, the text generation device 200 can include a parameter generation module. The parameter generation module can generate recall parameters corresponding to the first query request and can generate recall parameters corresponding to the sub-query requests. The retrieval module 203 can retrieve the reference information corresponding to the first query request from the knowledge base according to the recall parameters corresponding to the first query request. The retrieval module 203 can retrieve the reference information corresponding to the sub-query requests from the knowledge base according to the recall parameters corresponding to the sub-query requests. Different text generation scenarios are equipped with independent parameter generation modules.

[0045] After the retrieval module 203 retrieves multiple reference information, the prompt word generation module 204 can generate the first prompt word (Prompt) according to at least part of the reference information, and the first prompt word can be one or more. The prompt word generation module 204 can generate the first prompt word based on the reference information in any suitable way, and the embodiments of the present disclosure do not limit this.

[0046] After the prompt word generation module 204 generates the first prompt word, the text generation module 205 can input the first prompt word into the text generation model, so that the text generation model generates the text corresponding to the first query request based on the first prompt word. The text generation model can be an LLM.

[0047] In different text generation scenarios, the rules or models for generating prompts are different, and the text generation models called to generate text are different. Therefore, different text generation scenarios are equipped with their own prompt generation modules 204 and text generation modules 205, that is, the prompt generation module 204 and the text generation module 205 are dedicated to the text generation scenario corresponding to the first query request. In different text generation scenarios, the rules or models for query request splitting and relevant information retrieval are the same. Therefore, different text generation scenarios can share the splitting module 201 and the retrieval module 203.

[0048] Figure 3 The figure shows a schematic diagram of multiple text generation devices according to another embodiment of the present disclosure. As Figure 3 shown, text generation scenarios 1 to N each have their own prompt generation module 204 and text generation module 205, and text generation scenarios 1 to N share the splitting module 201 and the retrieval module 203.

[0049] It should be noted that the text generation device 200 in the embodiments of the present disclosure can at least partially implement the RAG function and iteratively update the functional modules included in RAG, that is, iteratively update at least some of the modules included in the text generation device 200.

[0050] In the embodiments of the present disclosure, after the splitting module 201 splits the first query request into multiple sub-query requests, the retrieval module 203 can respectively retrieve the reference information corresponding to the first query request and the sub-query requests from the knowledge base. The prompt generation module 204 can generate a first prompt according to at least some of the reference information. After the text generation module 205 inputs the first prompt into the text generation model, it can generate the text corresponding to the first query request through the text generation model. Since the prompt generation module 204 and the text generation module 205 are dedicated to the text generation scenario corresponding to the first query request, while the splitting module 201 and the retrieval module 203 can be used in multiple text generation scenarios, when iteratively updating the text generation device 200, the splitting module 201 and the retrieval module 203 shared by multiple text generation scenarios can be iteratively updated once, without iteratively updating the splitting module 201 and the retrieval module 203 respectively for the text generation device 200 in different text generation scenarios, thereby improving the efficiency of iteratively updating the text generation device 200.

[0051] In a possible implementation, as Figure 4Schematic diagram of the text generation device shown. The text generation device 200 includes a first screening module 206. The first screening module 206 can screen the first target reference information from the reference information corresponding to the first query request and the sub-query requests according to the relevance to the first query request. Then, the prompt word generation module 204 can generate the first prompt word according to the first target reference information.

[0052] After the retrieval module 203 retrieves the reference information of the first query request and the sub-query requests, the first screening module 206 can sort the multiple reference information retrieved by the retrieval module 203 in descending order of relevance to the first query request, and then determine the first at least one reference information as the first target reference information according to the sorting result, that is, the first target reference information can be one or more. The first screening module 206 can send the determined first target reference information to the prompt word generation module 204. Then, the prompt word generation module 204 generates the first prompt word based on the received first target reference information.

[0053] The first screening module 206 is used to screen the first target reference information with a higher relevance to the first query request from the reference information according to the relevance between the reference information and the first query request. Therefore, the same first screening module 206 can be applied to different text generation scenarios, that is, different text generation scenarios can share the first screening module 206. As Figure 5 Schematic diagram of multiple text generation devices shown. The text generation scenarios 1 to N respectively have their own prompt word generation modules 204 and text generation modules 205. The text generation scenarios 1 to N share the splitting module 201, the retrieval module 203, and the first screening module 206.

[0054] In the embodiments of the present disclosure, after the retrieval module 203 retrieves multiple reference information, the first screening module 206 screens out the first target reference information with a higher relevance to the first query request from these multiple reference information. After the prompt word generation module 204 generates the first prompt word according to the first target reference information, the text generation module 205 inputs the first prompt word into the text generation model to obtain the text corresponding to the first query request. By screening the first target reference information through the first screening module 206, the number of reference information used to generate the first prompt word is reduced, avoiding excessive reference information from causing greater interference to the text generation model, thereby ensuring the correctness of the generated text. The first screening module 206 can be used in multiple text generation scenarios. When iteratively updating the text generation device 200, the first screening module 206 shared by multiple text generation scenarios can be iteratively updated once, without iteratively updating the first screening module 206 for the text generation device 200 in different text generation scenarios respectively, thereby improving the efficiency of iteratively updating the text generation device 200.

[0055] In a possible implementation, as Figure 6 shown in the schematic diagram of the text generation device, the first screening module 206 includes a first screening unit 2061, a second screening unit 2062, and a third screening unit 2063.

[0056] The first screening unit 2061 may screen out at least one first reference information from the reference information corresponding to the first query request in the order of decreasing relevance to the first query request. In one example, the first screening unit 2061 may sort the reference information corresponding to the first query request in the order of decreasing relevance to the first query request, and then determine the first at least one reference information as the first reference information according to the sorting result, that is, the first reference information may be one or more.

[0057] For each sub-query request, the second screening unit 2062 may screen out at least one second reference information from the reference information corresponding to the sub-query request in the order of decreasing relevance to the sub-query request. In one example, for each sub-query request, the second screening unit 2062 may sort the reference information corresponding to the sub-query request in the order of decreasing relevance to the sub-query request, and then determine the first at least one reference information as the second reference information according to the sorting result, that is, the second reference information may be one or more.

[0058] The third screening unit 2063 may screen out at least one first target reference information from the first reference information and the second reference information according to the relevance to the first query request. In one example, the third screening unit 2063 may perform a mixed sorting on the first reference information and the second reference information in the order of decreasing relevance to the first query request, and then determine the first at least one reference information and / or the second reference information with a higher ranking as the first target reference information according to the sorting result, that is, the first target reference information may be one or more.

[0059] In the embodiments of the present disclosure, the first screening unit 2061 screens out the first reference information with a higher relevance to the first query request from the reference information corresponding to the first query request, the second screening unit 2062 screens out the second reference information with a higher relevance to the first query request from the reference information corresponding to the sub-query request, and the third screening unit 2063 screens out the first target reference information with a higher relevance to the first query request from the first reference information and the second reference information, so that the source of the first target reference information is wide and the relevance to the first query request is high, ensuring the accuracy of the generated text.

[0060] In a possible implementation, as Figure 7Schematic diagram of the text generation device shown. The text generation device 200 includes an information supplement module 207 and a second screening module 208. The information supplement module 207 can query at least one supplementary reference information from the supplementary knowledge base corresponding to the text generation scenario of the first query request. The second screening module 208 can screen the second target reference information from the reference information corresponding to the query request and sub-query request, and supplementary information according to the relevance to the first query request. Then, the prompt word generation module 204 can generate the first prompt word based on the second target reference information.

[0061] The text generation scenario corresponding to the first query request has a corresponding supplementary knowledge base, which stores relevant information belonging to the text generation scenario corresponding to the first query request. The information in this supplementary knowledge base can be used as reference information when generating text in the corresponding text generation scenario. The supplementary knowledge base is a dedicated knowledge base for the corresponding text generation scenario. Different text generation scenarios correspond to different supplementary knowledge bases. For example, the question-and-answer scenario, text summary scenario, and content generation scenario respectively correspond to different supplementary knowledge bases.

[0062] After receiving the first query request, the information supplement module 207 can search for information in the corresponding supplementary knowledge base that matches the first query request as the supplementary reference information for the first query request. In one example, the information supplement module 207 can use one or more pieces of information with a relatively high matching degree in the supplementary knowledge base as the supplementary reference information for the first query request.

[0063] The retrieval module 203 can send the retrieved relevant information to the second screening module 208, and the information supplement module 207 can send the found supplementary reference information to the second screening module 208. The second screening module 208 can screen the second target reference information with a relatively high relevance to the first query request from the reference information and supplementary reference information according to the relevance of the reference information and supplementary reference information to the first query request, and then send the screened second target reference information to the prompt word generation module 204. Then, the prompt word generation module 204 generates the first prompt word based on the received second target reference information.

[0064] The second screening module 208 is used to screen out second target reference information with a relatively high relevance to the first query request from the reference information and the supplementary reference information according to the relevance between the reference information and the supplementary reference information and the first query request. Therefore, the same second screening module 208 can be applied to different text generation scenarios, that is, different text generation scenarios can share the second screening module 208. The information supplement module 207 is used to search for supplementary reference information matching the first query request from the supplementary knowledge base corresponding to the text generation scenario of the first query request. Different text generation scenarios correspond to different supplementary knowledge bases. Therefore, the information supplement module 207 needs to be designed separately for the corresponding text generation scenario, that is, the information supplement module 207 is dedicated to the text generation scenario corresponding to the first query request, and different text generation scenarios correspond to different information supplement modules 207.

[0065] As Figure 8 shown in the schematic diagrams of multiple text generation devices, text generation scenarios 1 to N each have their own prompt word generation module 204, text generation module 205, and information supplement module 207, and text generation scenarios 1 to N share the splitting module 201, retrieval module 203, and second screening module 208.

[0066] In the embodiments of the present disclosure, the information supplement module 207 can search for supplementary reference information matching the first query request from the supplementary knowledge base, and the second screening module 208 screens out second target reference information with a relatively high relevance to the first query request from the reference information and the supplementary reference information. After the prompt word generation module 204 generates a first prompt word according to the second target reference information, the text generation module 205 inputs the first prompt word into the text generation model to obtain the text corresponding to the first query request. By searching for supplementary reference information through the information supplement module 207, and the supplementary reference information comes from the dedicated knowledge base of the text generation scenario corresponding to the first query request, it can provide second target reference information with a relatively high relevance to the first query request, ensuring the correctness of the text generated by the text generation model. By screening the second target reference information through the second screening module 208, the number of reference information used to generate the first prompt word is reduced, avoiding excessive reference information from causing greater interference to the text generation model, thereby ensuring the correctness of the generated text. The second screening module 208 can be used in multiple text generation scenarios. When iteratively updating the text generation device 200, the second screening module 208 shared by multiple text generation scenarios can be iteratively updated once, without iteratively updating the second screening module 208 for the text generation device 200 in different text generation scenarios respectively, thereby improving the efficiency of iteratively updating the text generation device 200.

[0067] In a possible implementation manner, as Figure 9Schematic diagram of the text generation device shown. The second screening module 208 includes a fourth screening unit 2081, a fifth screening unit 2082, a sixth screening unit 2083, and a seventh screening unit 2084.

[0068] The fourth screening unit 2081 can screen out at least one third reference information from the reference information corresponding to the first query request in the order of decreasing relevance to the first query request. In one example, the fourth screening unit 2081 can sort the reference information corresponding to the first query request in the order of decreasing relevance to the first query request, and then, based on the sorting result, determine the first at least one reference information as the third reference information, that is, the third reference information can be one or more.

[0069] For each sub-query request, the fifth screening unit 2082 can screen out at least one fourth reference information from the reference information corresponding to the sub-query request in the order of decreasing relevance to the sub-query request. In one example, for each sub-query request, the fifth screening unit 2082 can sort the reference information corresponding to the sub-query request in the order of decreasing relevance to the sub-query request, and then, based on the sorting result, determine the first at least one reference information as the fourth reference information, that is, the fourth reference information can be one or more.

[0070] The sixth screening unit 2083 can screen out at least one fifth reference information from the supplementary reference information in the order of decreasing relevance to the first query request. In one example, the sixth screening unit 2083 can sort the supplementary reference information in the order of decreasing relevance to the first query request, and then, based on the sorting result, determine the first at least one supplementary reference information as the fifth reference information, that is, the fifth reference information can be one or more.

[0071] The seventh screening unit 2084 can screen out at least one second target reference information from the third reference information, the fourth reference information, and the fifth reference information according to the relevance to the first query request. In one example, the seventh screening unit 2084 can perform a mixed sorting on the third reference information, the fourth reference information, and the fifth reference information in the order of decreasing relevance to the first query request, and then, based on the sorting result, determine the first at least one third reference information and / or fourth reference information and / or fifth reference information as the second target reference information, that is, the second target reference information can be one or more.

[0072] In an embodiment of the present disclosure, the fourth screening unit 2081 screens out third reference information with a relatively high relevance to the first query request from the reference information corresponding to the first query request. The fifth screening unit 2082 screens out fourth reference information with a relatively high relevance to the first query request from the reference information corresponding to the sub-query request. The sixth screening unit 2083 screens out fifth reference information with a relatively high relevance to the first query request from the supplementary reference information. The seventh screening unit 2084 screens out second target reference information with a relatively high relevance to the first query request from the third reference information, the fourth reference information, and the fifth reference information, so that the source of the second target reference information is wide and the relevance to the first query request is relatively high, ensuring the accuracy of the generated text.

[0073] In a possible implementation manner, as Figure 2 - 9 shown, the prompt generation module 204 can generate a second prompt according to the second query request from the user device 106. The intention complexity of the second query request is less than or equal to the complexity threshold, that is, the second query request is a simple intention query request, and the second query request and the first query request correspond to the same text generation scenario. The second prompt can be one or more, and the prompt generation module 204 can generate the second prompt in any suitable manner, which is not limited in the embodiments of the present disclosure.

[0074] The prompt generation module 204 can send the generated second prompt to the text generation module 205. Further, the text generation module 205 can input the second prompt into the text generation model to generate text corresponding to the second query request through the text generation model.

[0075] It should be noted that since the first query request and the second query request are query requests corresponding to the same text generation scenario, the text corresponding to the first query request and the text corresponding to the second query request can be generated by the same text generation model, that is, the text generation module 205 inputs the first prompt and the second prompt into the same text generation model.

[0076] In an embodiment of the present disclosure, for the second query request with a simple intention, there is no need to split the second query request and recall the reference information. The prompt generation module 204 directly generates the second prompt according to the second query request, and the text generation module 205 inputs the second prompt into the text generation model to generate text corresponding to the second query request through the text generation model, improving the speed of generating the text corresponding to the second query request, that is, improving the response speed of the simple intention query request.

[0077] In a possible implementation manner, as Figure 10Schematic diagram of the text generation device shown. The text generation device 200 includes a routing module 209. After receiving a query request from the user device 106, the routing module 209 can determine whether the intent complexity of the query request is greater than a complexity threshold. If the intent complexity of the query request is greater than the complexity threshold, it determines that the query request is a first query request, and then sends the query request to the splitting module 201 for processing. If the intent complexity of the query request is less than or equal to the complexity threshold, it determines that the query request is a second query request, and then sends the query request to the prompt word generation module 204 for processing.

[0078] In one example, after receiving a query request, the routing module 209 can determine whether the complexity of the query request is greater than the complexity threshold based on the upstream signal carried by the query request. The upstream signal can be generated by the upstream model of the text generation device 200 and sent to the routing module 209 together with the query request.

[0079] In the embodiments of the present disclosure, after the routing module 209 receives a query request, it sends the query request with an intent complexity greater than the complexity threshold to the splitting module 201, so that the query request is processed as a first query request, and sends the query request with an intent complexity less than or equal to the intent complexity to the prompt word generation module 204, so that the query request is processed as a second query request. Thus, the accuracy of the generated text can be improved for complex intent query requests, and the efficiency of generating text can be improved for simple intent requests.

[0080] It should be noted that in the above embodiments, when data is transmitted between modules in the text generation device 200, the module sending the data can perform formatting (format) processing on the data to be sent, so that the data can be completely received by the module receiving the data. The module receiving the data can parse (parser) the data after receiving the data to obtain data that can be recognized and processed.

[0081] Text Generation Method Applied to User Equipment

[0082] Based on the above system, the embodiments of the present disclosure provide a text generation method, which can be executed by the above user device 106. The following describes the text generation method in detail through multiple embodiments.

[0083] Figure 11 It is a flowchart of the text generation method according to an embodiment of the present disclosure. The text generation method is executed by a user device, as Figure 11 shown. The text generation method includes the following steps:

[0084] Step 1101: Generate a first query request using the user's first input data, where the intent complexity of the first query request is greater than the complexity threshold.

[0085] Step 1102: Send the first query request to the server.

[0086] In one example, the first query request can be sent to the cloud server 102 in the above system embodiment, and the text generation device 200 in the foregoing embodiment is deployed on the cloud server 102.

[0087] Step 1103: Receive the text generated by the server in response to the first query request.

[0088] The server includes a splitting module, a retrieval module, a prompt word generation module, and a text generation module; the splitting module is used to split the first query request into multiple sub-query requests; the retrieval module is used to retrieve at least one reference information corresponding to the first query request from the knowledge base, and retrieve at least one reference information corresponding to the sub-query request from the knowledge base; the prompt word generation module is used to generate a first prompt word according to at least part of the reference information; the text generation module is used to input the first prompt word into the text generation model and generate the text corresponding to the first query request through the text generation model; the prompt word generation module and the text generation module are dedicated to the text generation scenario corresponding to the first query request, and the splitting module and the retrieval module are used for multiple text generation scenarios.

[0089] In the embodiments of the present disclosure, after generating a first query request using the user's first input data, the first query request is sent to the server, so that the server generates the corresponding text based on the first query request, and then receives the text generated by the server in response to the first query request. Since the prompt word generation module and the text generation module are dedicated to the text generation scenario corresponding to the first query request, and the splitting module and the retrieval module can be used for multiple text generation scenarios, when iteratively updating the text generation device, the splitting module and the retrieval module shared by multiple text generation scenarios can be iteratively updated at one time, without iteratively updating the splitting module and the retrieval module for the text generation devices in different text generation scenarios respectively, thereby improving the efficiency of iteratively updating the text generation device.

[0090] In a possible implementation manner, a second query request can be generated using the user's second input data, the intent complexity of the second query request is less than or equal to the complexity threshold, and the first query request and the second query request correspond to the same text generation scenario. After sending the second query request to the server, receive the text of the server in response to the second query request. The text corresponding to the second query request is generated by the text generation module after inputting the second prompt word into the text generation model, and the second prompt word is generated by the prompt word generation module according to the second query request.

[0091] In the embodiments of the present disclosure, for a second query request with a simple intent, there is no need to split the second query request and recall reference information. The prompt word generation module directly generates a second prompt word according to the second query request, and the text generation module inputs the second prompt word into the text generation model, and generates text corresponding to the second query request through the text generation model, which improves the speed of generating text corresponding to the second query request, that is, improves the response speed of the simple intent query request.

[0092] It should be noted that the text generation method in the embodiments of the present disclosure and the foregoing text generation device embodiments are based on the same inventive concept. The specific process of the text generation method can refer to the description in the foregoing text generation device embodiments and has the same beneficial effects as the foregoing text generation device embodiments, and will not be elaborated here.

[0093] Text Generation Method Applied to Server

[0094] Based on the above system, the embodiments of the present disclosure provide a text generation method, and this text generation method can be executed by the above cloud server 102. The following will detail this text generation method through multiple embodiments.

[0095] Figure 12 is a flowchart of the text generation method according to an embodiment of the present disclosure. This text generation method is executed by the server, as Figure 12 shown, this text generation method includes the following steps:

[0096] Step 1201: Through the splitting module, split the first query request from the user device into multiple sub-query requests, and the intent complexity of the first query request is greater than the complexity threshold;

[0097] Step 1202: Through the retrieval module, retrieve at least one reference information corresponding to the first query request from the knowledge base, and retrieve at least one reference information corresponding to the sub-query request from the knowledge base;

[0098] Step 1203: Through the prompt word generation module, generate a first prompt word according to at least part of the reference information;

[0099] Step 1204: Through the text generation module, input the first prompt word into the text generation model, and generate text corresponding to the first query request through the text generation model.

[0100] Among them, the prompt word generation module and the text generation module are dedicated to the text generation scenario corresponding to the first query request, and the splitting module and the retrieval module are used for multiple text generation scenarios.

[0101] In an embodiment of the present disclosure, after splitting a first query request into multiple sub-query requests through a splitting module, retrieving reference information corresponding to the first query request and the sub-query requests from a knowledge base through a retrieval module, generating a first prompt word according to at least part of the reference information through a prompt-word generation module, inputting the first prompt word into a text generation model through a text generation module, and generating text corresponding to the first query request through the text generation model. Since the prompt-word generation module and the text generation module are dedicated to the text generation scenario corresponding to the first query request, while the splitting module and the retrieval module can be used in multiple text generation scenarios, when iteratively updating the text generation device, the splitting module and the retrieval module shared by multiple text generation scenarios can be iteratively updated once, without iteratively updating the splitting module and the retrieval module for the text generation devices in different text generation scenarios respectively, thereby improving the efficiency of iteratively updating the text generation device.

[0102] In a possible implementation manner, after receiving a second query request from a user device, a second prompt word can be generated based on the second query request through a prompt-word generation module, the intention complexity of the second query request is less than or equal to a complexity threshold, the second query request and the first query request correspond to the same text generation scenario, and then the second prompt word is input into the text generation model through the text generation module, and text corresponding to the second query request is generated through the text generation model.

[0103] In an embodiment of the present disclosure, for a second query request with a simple intention, there is no need to split the second query request and recall reference information. The prompt-word generation module directly generates a second prompt word according to the second query request, and the text generation module inputs the second prompt word into the text generation model, and text corresponding to the second query request is generated through the text generation model, improving the speed of generating the text corresponding to the second query request, that is, improving the response speed of the query request with a simple intention.

[0104] It should be noted that the text generation method in the embodiment of the present disclosure and the foregoing text generation device embodiment are based on the same inventive concept. The specific process of the text generation method can refer to the description in the foregoing text generation device embodiment and has the same beneficial effects as the foregoing text generation device embodiment, and will not be elaborated herein.

[0105] Electronic Device

[0106] Figure 13 is a schematic block diagram of an electronic device provided by an embodiment of the present disclosure. The specific implementation of the electronic device is not limited in the specific embodiments of the present disclosure. Such as Figure 13As shown in the figure, the electronic device may include: a processor 1302, a communications interface 1304, a memory 1306, and a communication bus 1308. Among them:

[0107] The processor 1302, the communications interface 1304, and the memory 1306 communicate with each other through the communication bus 1308.

[0108] The communications interface 1304 is used to communicate with other electronic devices or servers.

[0109] The processor 1302 is used to execute the program 1310, and specifically can execute the relevant steps in any of the foregoing text generation method embodiments.

[0110] Specifically, the program 1310 may include program code, and the program code includes computer operation instructions.

[0111] The processor 1302 may be a CPU, or a GPU (Graphic Processing Unit), or a specific integrated circuit ASIC (Application Specific Integrated Circuit), or one or more integrated circuits configured to implement the embodiments of the present disclosure. One or more processors included in the intelligent device may be of the same type of processor, such as one or more CPUs; or may be of different types of processors, such as one or more CPUs and one or more ASICs.

[0112] The memory 1306 is used to store the program 1310. The memory 1306 may include high-speed RAM memory, and may also include non-volatile memory, such as at least one disk memory.

[0113] The program 1310 is specifically used to cause the processor 1302 to execute the text generation method in any of the foregoing embodiments.

[0114] For the specific implementation of each step in the program 1310, reference may be made to the corresponding steps and descriptions in the corresponding units in any of the foregoing text generation method embodiments, which will not be elaborated here. Those skilled in the art can clearly understand that for the convenience and conciseness of description, the specific working processes of the above-described devices and modules can refer to the corresponding process descriptions in the foregoing method embodiments, which will not be elaborated here.

[0115] In the electronic device according to the embodiments of the present disclosure, after the splitting module splits the first query request into multiple sub-query requests, the retrieval module can retrieve the reference information corresponding to the first query request and the sub-query requests from the knowledge base respectively, and the prompt word generation module can generate a first prompt word according to at least part of the reference information. After the text generation module inputs the first prompt word into the text generation model, the text generation model can generate the text corresponding to the first query request. Since the prompt word generation module and the text generation module are dedicated to the text generation scenario corresponding to the first query request, while the splitting module and the retrieval module can be used in multiple text generation scenarios, when iteratively updating the text generation device, the splitting module and the retrieval module shared by multiple text generation scenarios can be iteratively updated once, without iteratively updating the splitting module and the retrieval module for the text generation devices in different text generation scenarios respectively, thereby improving the efficiency of iteratively updating the text generation device.

[0116] Computer Storage Medium

[0117] The present disclosure also provides a computer-readable storage medium storing instructions for causing a machine to execute the text generation method as described herein. Specifically, a system or device equipped with a storage medium can be provided, on which software program code for implementing the functions of any one of the above embodiments is stored, and the computer (or CPU or MPU) of the system or device is caused to read and execute the program code stored in the storage medium.

[0118] In this case, the program code read from the storage medium itself can implement the functions of any one of the above embodiments, so the program code and the storage medium storing the program code constitute a part of the present disclosure.

[0119] Examples of the storage medium for providing the program code include floppy disks, hard disks, magneto-optical disks, optical disks (such as CD-ROM, CD-R, CD-RW, DVD-ROM, DVD-RAM, DVD-RW, DVD+RW), magnetic tapes, non-volatile memory cards, and ROMs. Optionally, the program code can be downloaded from a server computer via a communication network.

[0120] Computer Program Product

[0121] The embodiments of the present disclosure also provide a computer program product, including computer instructions, where the computer instructions direct a computing device to perform any corresponding operation in the above-mentioned multiple method embodiments.

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

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

[0124] The methods according to the embodiments of the present disclosure described above can be implemented in hardware, firmware, or be implemented as software or computer code that can be stored in a recording medium (such as a CD ROM, RAM, floppy disk, hard disk, or magneto-optical disk), or be implemented as computer code originally stored in a remote recording medium or a non-transitory machine-readable medium and downloaded through a network and to be stored in a local recording medium, so that the methods described herein can be processed by such software stored on a recording medium using a general-purpose computer, a dedicated processor, or programmable or dedicated hardware (such as an ASIC or FPGA). It can be understood that a computer, a processor, a microprocessor controller, or programmable hardware includes a storage component (such as a RAM, a ROM, a flash memory, etc.) that can store or receive software or computer code. When the software or computer code is accessed and executed by the computer, the processor, or the hardware, the methods described herein are implemented. In addition, when a general-purpose computer accesses the code for implementing the methods shown herein, the execution of the code converts the general-purpose computer into a dedicated computer for executing the methods shown herein.

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

[0126] Those of ordinary skill in the art will appreciate that the units and method steps of the examples described in conjunction with the embodiments disclosed herein can be implemented in electronic hardware, or in a combination of computer software and electronic hardware. Whether these functions are executed in hardware or software depends on the specific application and design constraints of the technical solution. Skilled artisans may use different methods to implement the described functions for a particular application, but such implementation should not be considered to exceed the scope of the embodiments of the present disclosure.

[0127] The above embodiments are only used to illustrate the embodiments of the present disclosure, rather than to limit the embodiments of the present disclosure. Those of ordinary skill in the relevant technical field can also make various changes and modifications without departing from the spirit and scope of the embodiments of the present disclosure. Therefore, all equivalent technical solutions also belong to the scope of the embodiments of the present disclosure. The patent protection scope of the embodiments of the present disclosure shall be defined by the claims.

Claims

1. A text generation device, comprising: A splitting module, configured to split a first query request from a user device into multiple sub-query requests, where the intent complexity of the first query request is greater than a complexity threshold; A parameter generation module, configured to generate recall parameters corresponding to the first query request and recall parameters corresponding to the sub-query requests; A retrieval module, configured to retrieve at least one reference information corresponding to the first query request from a knowledge base according to the recall parameters corresponding to the first query request, and retrieve at least one reference information corresponding to the sub-query requests from the knowledge base according to the recall parameters corresponding to the sub-query requests; A prompt word generation module, configured to generate a first prompt word according to at least part of the reference information; A text generation module, configured to input the first prompt word into a text generation model, and generate text corresponding to the first query request through the text generation model; Wherein, different text generation scenarios are equipped with independent parameter generation modules, the prompt word generation module and the text generation module are dedicated to the text generation scenario corresponding to the first query request, and multiple text generation scenarios share one splitting module and one retrieval module; and when iteratively updating the text generation device, the splitting module shared by multiple text generation scenarios is updated once in an iteration.

2. The device according to claim 1, wherein the device further comprises: A first screening module; The first screening module is configured to screen first target reference information from the reference information corresponding to the first query request and the sub-query requests according to the relevance to the first query request; The prompt word generation module is configured to generate the first prompt word according to the first target reference information; Wherein, the first screening module is used for multiple text generation scenarios.

3. The device according to claim 2, wherein The first screening module includes: A first screening unit, configured to screen at least one first reference information from the reference information corresponding to the first query request in descending order of relevance to the first query request; A second screening unit, configured to screen at least one second reference information from the reference information corresponding to the sub-query request in descending order of relevance to the sub-query request; A third screening unit, configured to screen at least one of the first target reference information from the first reference information and the second reference information in descending order of relevance to the first query request.

4. The device according to claim 1, wherein the device further comprises: An information supplement module and a second screening module; The information supplement module is configured to find at least one supplementary reference information from a supplementary knowledge base of the text generation scenario corresponding to the first query request; The second screening module is configured to screen second target reference information from the reference information corresponding to the query request and the sub-query requests, and the supplementary reference information according to the relevance to the first query request; The prompt word generation module is configured to generate the first prompt word according to the second target reference information; Wherein, the information supplement module is dedicated to the text generation scenario corresponding to the first query request, and the second screening module is used for multiple text generation scenarios.

5. The apparatus according to claim 4, wherein The second screening module includes: A fourth screening unit, configured to screen out at least one third reference information from the reference information corresponding to the first query request in descending order of relevance to the first query request; A fifth screening unit, configured to screen out at least one fourth reference information from the reference information corresponding to the sub-query request in descending order of relevance to the sub-query request; A sixth screening unit, configured to screen out at least one fifth reference information from the at least one supplementary reference information in descending order of relevance to the first query request; A seventh screening unit, configured to screen out at least one of the second target reference information from the third reference information, the fourth reference information, and the fifth reference information in descending order of relevance to the first query request.

6. The apparatus according to any one of claims 1-5, wherein The prompt word generation module is configured to generate a second prompt word according to a second query request from the user device, the intention complexity of the second query request is less than or equal to the complexity threshold, and the second query request and the first query request correspond to the same text generation scenario; The text generation module is configured to input the second prompt word into the text generation model and generate text corresponding to the second query request through the text generation model.

7. The apparatus according to claim 6, wherein the apparatus further comprises: A routing module, configured to, after receiving a query request from the user device, if the intention complexity of the query request is greater than the complexity threshold, send the query request to the splitting module, and if the intention complexity of the query request is less than or equal to the complexity threshold, send the query request to the prompt word generation module.

8. A text generation method, comprising: Generating a first query request using the user's first input data, the intention complexity of the first query request being greater than a complexity threshold; Sending the first query request to a server; Receiving text generated by the server in response to the first query request, wherein the server deploys a text generation apparatus, and the text generation apparatus comprises a splitting module, a parameter generation module, a retrieval module, a prompt word generation module, and a text generation module; the splitting module is configured to split the first query request into a plurality of sub-query requests; the parameter generation module is configured to generate a recall parameter corresponding to the first query request and a recall parameter corresponding to the sub-query request, the retrieval module is configured to retrieve at least one reference information corresponding to the first query request from a knowledge base according to the recall parameter corresponding to the first query request, and retrieve at least one reference information corresponding to the sub-query request from the knowledge base according to the recall parameter corresponding to the sub-query request; the prompt word generation module is configured to generate a first prompt word according to at least part of the reference information; The text generation module is configured to input the first prompt into a text generation model, and generate text corresponding to the first query request through the text generation model; different text generation scenarios are equipped with independent parameter generation modules, and the prompt generation module and the text generation module are dedicated to the text generation scenario corresponding to the first query request. A plurality of text generation scenarios share one splitting module and one retrieval module; moreover, when iteratively updating the text generation device, the splitting module shared by the plurality of text generation scenarios is completed in one iteration update.

9. The method according to claim 8, wherein the method further comprises: generating a second query request using second input data of a user, wherein the intent complexity of the second query request is less than or equal to the complexity threshold, and the first query request and the second query request correspond to the same text generation scenario; sending the second query request to the server; receiving the text generated by the server in response to the second query request, wherein the text corresponding to the second query request is generated by the text generation module after inputting a second prompt into the text generation model, and the second prompt is generated by the prompt generation module according to the second query request.

10. A text generation method, comprising: splitting, by a splitting module, a first query request from a user device into a plurality of sub-query requests, wherein the intent complexity of the first query request is greater than a complexity threshold; generating, by a parameter generation module, a recall parameter corresponding to the first query request and a recall parameter corresponding to the sub-query requests; retrieving, by a retrieval module, at least one reference information corresponding to the first query request from a knowledge base according to the recall parameter corresponding to the first query request, and retrieving at least one reference information corresponding to the sub-query requests from the knowledge base according to the recall parameter corresponding to the sub-query requests; generating, by a prompt generation module, a first prompt according to at least part of the reference information; inputting, by a text generation module, the first prompt into a text generation model, and generating text corresponding to the first query request through the text generation model; wherein different text generation scenarios are equipped with independent parameter generation modules, and the prompt generation module and the text generation module are dedicated to the text generation scenario corresponding to the first query request. A plurality of text generation scenarios share one splitting module and one retrieval module; moreover, when iteratively updating a text generation device including the splitting module, the parameter generation module, the retrieval module, the prompt generation module, and the text generation module, the splitting module shared by the plurality of text generation scenarios is completed in one iteration update.

11. The method according to claim 10, wherein the method further comprises: Through the prompt word generation module, a second prompt word is generated according to a second query request from the user device, the intention complexity of the second query request is less than or equal to the complexity threshold, and the second query request and the first query request correspond to the same text generation scenario; Through the text generation module, the second prompt word is input into the text generation model, and text corresponding to the second query request is generated through the text generation model.

12. An electronic device, comprising: A processor, a memory, a communication interface, and a communication bus, and the processor, the memory, and the communication interface complete mutual communication through the communication bus; The memory is used to store at least one executable instruction, and the executable instruction causes the processor to perform operations corresponding to the method according to any one of claims 8-11.

13. A computer storage medium, on which a computer program is stored, and when the program is executed by a processor, it implements the method according to any one of claims 8-11.

14. A computer program product, including computer instructions, and the computer instructions instruct a computing device to execute the method according to any one of claims 8-11.

Citation Information

Patent Citations

  • Question answering method and device, electronic equipment and computer readable storage medium

    CN116244418A

  • Method, system and equipment for generating SQL (Structured Query Language) statement based on large model

    CN119127913A

  • Picture material batch generation method and device, equipment and medium

    CN119444897A