Answer text generation method and device, equipment, storage medium, program product and government affair question and answer system
By using a large language model to process user interaction-related problem texts in an intelligent question-answer system, and combining basic text library search technology, the problem that intelligent question-answer technology cannot accurately understand the meaning of user statements is solved, improving the accuracy and comprehensiveness of the answers.
Patent Information
- Application Number
- CN202411931491.1
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-12-25
- Publication Date
- 2025-04-08
AI Technical Summary
The intelligent question-and-answer technology has the situation of "answering questions" and cannot accurately understand the meaning of the user's sentence, resulting in a decrease in the accuracy of the answer.
By entering the user's interactive related question text into the large language model, the reference answer text is generated, and based on whether the reference answer text has a search identifier, it searches in the basic text library to obtain the intermediate answer text, and finally uses the large language model to process the intermediate answer text and question text to generate the target answer text.
It improves the accuracy and comprehensiveness of the answers, reduces the impact of basic text library retrieval on answer quality, and enhances the understanding and generation ability of the intelligent question and answer system.
Smart Images

Figure CN119782518A_ABST
Abstract
Description
Technical Field
[0001] The present disclosure relates to the fields of artificial intelligence technology and Internet technology, and more specifically, to an answer text generation method, device, equipment, storage medium, program product and government affairs question and answer system. Background Art
[0002] With the rapid development of artificial intelligence technology and Internet technology, users can obtain search knowledge through intelligent question and answer anytime and anywhere. The technology of intelligent question and answer brings convenience to users' daily life.
[0003] In the process of realizing the concept of the present disclosure, the inventors found that there are at least the following problems in the related technology: the intelligent question-answering technology has the problem of "answering irrelevant questions" and cannot accurately understand the meaning of the user's sentence, so that the accuracy of the answer is reduced. Summary of the invention
[0004] In view of this, the present disclosure provides an answer text generation method, device, equipment, storage medium, program product and government affairs question and answer system.
[0005] One aspect of the present disclosure provides a method for generating an answer text, comprising: in response to a user's interactive operation, inputting a question text related to the interactive operation into a large language model to obtain a reference answer text; in response to the reference answer text having a retrieval identifier, searching a basic text library based on the question text to obtain an intermediate answer text, wherein the retrieval identifier represents that the basic text library has an answer text related to the question text; and using the large language model to process the intermediate answer text and the question text to obtain a target answer text.
[0006] According to an embodiment of the present disclosure, in response to a reference answer text having a retrieval identifier, a search is performed in a basic text library based on a question text to obtain an intermediate answer text, including: in response to the reference answer text having a retrieval identifier, a target basic text sub-library is determined from a plurality of candidate basic text sub-libraries of the basic text library based on attribute information of the user; a text vector of the question text is respectively matched with a text vector of at least one basic text in the target basic text sub-library for similarity to obtain a target basic text that matches the question text; and an intermediate answer text is determined based on the target basic text.
[0007] According to an embodiment of the present disclosure, the attribute information of the user includes at least one of the following: an operation preference attribute and a geographical attribute.
[0008] According to an embodiment of the present disclosure, the basic text is determined based on the following operations: using a large language model to perform text structure analysis on basic files released in a historical period to obtain a structured first basic text, the first basic text representing the activity implementation rules in the basic files; and\or using a large language model to perform question and answer information detection on historical interactive texts to obtain a second basic text in the historical interactive text that represents an explanation of the activity implementation rules, wherein the basic text includes the first basic text and the second basic text.
[0009] According to an embodiment of the present disclosure, a large language model is obtained by fine-tuning an initial large language model using sample question text and sample answer text, and a first sample answer text in the sample answer text is determined based on the following operations: sampling a sample file to obtain a sample question text and a sample reference answer text; performing similarity matching on a text vector of the sample question text with a text vector of at least one basic text in a basic text library to obtain a sample basic text that matches the sample question text; in response to a semantic correlation between the sample reference answer text and the sample basic text satisfying a preset threshold, generating a first sample answer text with a retrieval identifier based on the sample basic text.
[0010] According to an embodiment of the present disclosure, the sample answer text also includes a second sample answer text, and the second sample answer text is determined based on the following operation: in response to the semantic correlation between the sample reference answer text and the sample base text not satisfying a preset threshold, a second sample answer text without a retrieval identifier is generated based on the sample reference answer text.
[0011] According to an embodiment of the present disclosure, the above method also includes: in response to the reference answer text not having a retrieval identifier, determining the reference answer text as the target answer text.
[0012] Another aspect of the present disclosure provides an answer text generation device, including: an input module, which is used to input question text related to the interactive operation into a large language model in response to a user's interactive operation to obtain a reference answer text; a retrieval module, which is used to search in a basic text library based on the question text in response to the reference answer text having a retrieval identifier to obtain an intermediate answer text, wherein the retrieval identifier represents that the basic text library has an answer text related to the question text; and a processing module, which uses the large language model to process the intermediate answer text and the question text to obtain a target answer text.
[0013] Aspects of the present disclosure provide a government affairs question-answering system, including:
[0014] An acquisition module is used to acquire input information; an execution module is used to determine a target task based on the input information received by the acquisition module, determine a large language model and a basic text library based on the target task, and execute the above method by calling the large language model and the basic text library to obtain output information; an output module is used to output the output information obtained by the execution module.
[0015] Another aspect of the present disclosure provides an electronic device, comprising:
[0016] one or more processors;
[0017] a memory for storing one or more programs,
[0018] When the one or more programs are executed by the one or more processors, the one or more processors implement the method as described above.
[0019] Another aspect of the present disclosure provides a computer-readable storage medium storing computer-executable instructions, which are used to implement the above method when executed.
[0020] Another aspect of the present disclosure provides a computer program product, which includes computer executable instructions, and when the instructions are executed, are used to implement the method as described above.
[0021] According to an embodiment of the present disclosure, in response to the user's interactive operation, the question text related to the interactive operation is input into the large language model to obtain a reference answer text. In response to the reference answer text having a retrieval identifier, and the retrieval identifier represents that the basic text library has an answer text related to the question text, the large language model can determine whether it is necessary to call the knowledge in the basic text library according to the retrieval identifier to enhance the accuracy of the answer. Based on the question text, a search is performed in the basic document library to obtain an intermediate answer text with a targeted reply. In order to reduce the impact of the intermediate answer text retrieved by the basic text library on the quality of the answer, the large language model is used to process the intermediate answer text and the question text, so that a more comprehensive and accurate target answer text can be obtained, thereby improving the accuracy of the answer. BRIEF DESCRIPTION OF THE DRAWINGS
[0022] The above and other objects, features and advantages of the present disclosure will become more apparent through the following description of the embodiments of the present disclosure with reference to the accompanying drawings, in which:
[0023] Figure 1 An exemplary system architecture to which the answer text generation method according to an embodiment of the present disclosure can be applied is schematically shown;
[0024] Figure 2 A flowchart of a method for generating an answer text according to an embodiment of the present disclosure is schematically shown;
[0025] Figure 3 A schematic diagram of constructing a vector database according to an embodiment of the present disclosure is schematically shown;
[0026] Figure 4 A schematic diagram schematically shows a method of using a large language model to perform text structure analysis on basic documents released in a historical period to obtain a structured first basic text according to an embodiment of the present disclosure;
[0027] Figure 5 A schematic diagram schematically shows the generation of a sample answer text according to an embodiment of the present disclosure;
[0028] Figure 6 A flowchart of a method for generating an answer text according to another embodiment of the present disclosure is schematically shown;
[0029] Figure 7 A block diagram of an answer text generating device according to an embodiment of the present disclosure is schematically shown;
[0030] Figure 8 A schematic diagram of a structure of a government affairs question-and-answer system according to an embodiment of the present disclosure is shown; and
[0031] Fig. 9 A block diagram of an electronic device suitable for implementing the answer text generation method according to an embodiment of the present disclosure is schematically shown. DETAILED DESCRIPTION
[0032] Hereinafter, embodiments of the present disclosure will be described with reference to the accompanying drawings. However, it should be understood that these descriptions are exemplary only and are not intended to limit the scope of the present disclosure. In the following detailed description, for ease of explanation, many specific details are set forth to provide a comprehensive understanding of the embodiments of the present disclosure. However, it is apparent that one or more embodiments may also be implemented without these specific details. In addition, in the following description, descriptions of known structures and technologies are omitted to avoid unnecessary confusion of the concepts of the present disclosure.
[0033] The terms used herein are only for describing specific embodiments and are not intended to limit the present disclosure. The terms "comprise", "include", etc. used herein indicate the existence of the features, steps, operations and / or components, but do not exclude the existence or addition of one or more other features, steps, operations or components.
[0034] All terms (including technical and scientific terms) used herein have the meanings commonly understood by those skilled in the art unless otherwise defined. It should be noted that the terms used herein should be interpreted as having a meaning consistent with the context of this specification and should not be interpreted in an idealized or overly rigid manner.
[0035] When using expressions such as "at least one of A, B, and C, etc.", they should generally be interpreted according to the meaning of the expression commonly understood by those skilled in the art (for example, "a system having at least one of A, B, and C" should include but is not limited to a system having A alone, B alone, C alone, A and B, A and C, B and C, and / or A, B, C, etc.).
[0036] In the embodiments of the present disclosure, the collection, updating, analysis, processing, use, transmission, provision, disclosure, storage, etc. of the data involved (for example, including but not limited to user personal information) are in compliance with the provisions of relevant laws and regulations, are used for legitimate purposes, and do not violate public order and good morals. In particular, necessary measures are taken for user personal information to prevent illegal access to user personal information data and maintain the security of user personal information and network security.
[0037] In the embodiments of the present disclosure, the user's authorization or consent is obtained before obtaining or collecting the user's personal information.
[0038] Intelligent question-answering technology has the problem of "answering irrelevant questions" and cannot accurately understand the meaning of user statements, which reduces the accuracy of the answers.
[0039] An embodiment of the present disclosure provides an answer text generation method, comprising: in response to a user's interactive operation, inputting a question text related to the interactive operation into a large language model to obtain a reference answer text; in response to the reference answer text having a retrieval identifier, searching in a basic text library based on the question text to obtain an intermediate answer text, wherein the retrieval identifier represents that the basic text library has an answer text related to the question text; and using the large language model to process the intermediate answer text and the question text to obtain a target answer text.
[0040] Figure 1 An exemplary system architecture to which the answer text generation method according to an embodiment of the present disclosure can be applied is schematically shown.
[0041] It should be noted that Figure 1 What is shown is merely an example of a system architecture to which the embodiments of the present disclosure can be applied, in order to help those skilled in the art understand the technical content of the present disclosure, but it does not mean that the embodiments of the present disclosure cannot be used in other devices, systems, environments or scenarios.
[0042] like Figure 1As shown, the system architecture 100 according to this embodiment may include a first terminal device 101, a second terminal device 102, a third terminal device 103, a network 104, and a server 105. The network 104 is used to provide a medium for a communication link between the first terminal device 101, the second terminal device 102, the third terminal device 103, and the server 105. The network 104 may include various connection types, such as wired and / or wireless communication links, etc.
[0043] The user may use the first terminal device 101, the second terminal device 102, and the third terminal device 103 to interact with the server 105 through the network 104 to receive or send messages, etc. Various communication client applications may be installed on the first terminal device 101, the second terminal device 102, and the third terminal device 103, such as shopping applications, web browser applications, search applications, instant messaging tools, email clients, and / or social platform software, etc. (only for example).
[0044] The first terminal device 101, the second terminal device 102, and the third terminal device 103 may be various electronic devices having display screens and supporting web browsing, including but not limited to smart phones, tablet computers, laptop computers, desktop computers, and the like.
[0045] The server 105 may be a server that provides various services, such as a background management server (only as an example) that provides support for websites browsed by users using the first terminal device 101, the second terminal device 102, and the third terminal device 103. The background management server may analyze and process the received data such as user requests, and feed back the processing results (such as web pages, information, or data obtained or generated according to user requests) to the terminal device.
[0046] It should be noted that the answer text generation method provided in the embodiment of the present disclosure can generally be executed by the server 105. Accordingly, the answer text generation system provided in the embodiment of the present disclosure can generally be set in the server 105. The answer text generation method provided in the embodiment of the present disclosure can also be executed by a server or server cluster that is different from the server 105 and can communicate with the first terminal device 101, the second terminal device 102, the third terminal device 103 and / or the server 105. Correspondingly, the answer text generation system provided in the embodiment of the present disclosure can also be set in a server or server cluster that is different from the server 105 and can communicate with the first terminal device 101, the second terminal device 102, the third terminal device 103 and / or the server 105. Alternatively, the answer text generation method provided in the embodiment of the present disclosure can also be executed by the first terminal device 101, the second terminal device 102 or the third terminal device 103, or can also be executed by other terminal devices different from the first terminal device 101, the second terminal device 102 or the third terminal device 103. Accordingly, the answer text generation system provided by the embodiment of the present disclosure may also be arranged in the first terminal device 101, the second terminal device 102 or the third terminal device 103, or in other terminal devices different from the first terminal device 101, the second terminal device 102 or the third terminal device 103.
[0047] For example, the reference answer text may be originally stored in any one of the first terminal device 101, the second terminal device 102 or the third terminal device 103 (for example, the first terminal device 101, but not limited thereto), or stored in an external storage device and may be imported into the first terminal device 101. Then, the first terminal device 101 may locally execute the answer text generation method provided in the embodiment of the present disclosure, or send the reference answer text to other terminal devices, servers, or server clusters, and the other terminal devices, servers, or server clusters that receive the reference answer text may execute the answer text generation method provided in the embodiment of the present disclosure.
[0048] It should be understood that Figure 1 The number of terminal devices, networks and servers in the embodiment is only for illustration. Any number of terminal devices, networks and servers may be provided according to implementation requirements.
[0049] Figure 2 The flowchart of the answer text generation method according to the embodiment of the present disclosure is schematically shown.
[0050] like Figure 2 As shown, the method includes operations S210 to S230.
[0051] In operation S210, in response to the user's interactive operation, a question text related to the interactive operation is input into a large language model to obtain a reference answer text.
[0052] According to the embodiments of the present disclosure, the interactive operation may be voice, text or image input, button operation, etc. For example, the interactive operation may be voice input, and the input voice is parsed into question text. The interactive operation may also be text input, and the input text is semantically analyzed to obtain the question text. The interactive operation may also be image input, and the input image is subjected to text recognition, and then the recognized text is semantically analyzed to obtain the question text. The interactive operation may also be a button operation, and each button may represent question text related to different fields, regions, etc.
[0053] According to an embodiment of the present disclosure, the large language model can be a deep learning model with natural language processing capabilities, capable of learning rich knowledge and content of text. The large language model is usually first trained using a large amount of sample text, and then the trained large language model is applied.
[0054] For example, since the conventional large language model does not have the function of verifying the reliability of information retrieved from the knowledge base, the answer text initially obtained by the large language model lacks accuracy and reliability. Therefore, the large language model of the present disclosure is trained using a large language sample text with a retrieval identifier. The retrieval identifier of the large language sample text can be determined based on the semantic relevance between the large language sample text and the text in the basic text library. The large language sample text can be a text converted from speech, a text recognized by an image, a communication text on a social media platform, an economic transaction text, a legal text, etc.
[0055] In operation S220, in response to the reference answer text having a search identifier, a search is performed in the basic text library based on the question text to obtain an intermediate answer text, wherein the search identifier indicates that the basic text library has an answer text related to the question text.
[0056] According to the embodiments of the present disclosure, the basic text library can be a knowledge base that needs to be further searched for question texts. At the same time, the basic text library can be texts in professional fields, texts divided by regions, etc. Professional fields can be fields such as economy, politics, law, and the Internet. The basic text library can also be a regional text library in a professional field. Professional fields can be major categories or minor categories. For example, the major category can be artificial intelligence, and the minor category can be artificial intelligence in the field of logistics. For example, the major category can be political knowledge, and the minor category can be modern political knowledge.
[0057] According to an embodiment of the present disclosure, the basic text library may include a pair of texts of a question and an answer, and the question text may be matched with the question text in the basic text library to determine the intermediate question text. The intermediate answer text is determined based on the intermediate question text.
[0058] According to an embodiment of the present disclosure, the search identifier may be set according to actual conditions.
[0059] For example, the search tag can be [Search], which clearly and concisely concludes that the answer to the reference answer text is not targeted, and it is necessary to retrieve information in the basic text library to improve the accuracy of the answer.
[0060] For example, the search identifier can be an abbreviation of the field, so as to clearly and concisely conclude that the answer in the reference answer text does not have the characteristics of the field, and it is necessary to use the information in the basic text library belonging to the field to improve the accuracy of the answer.
[0061] For example, first sample the answer of the text to obtain the answer text to be determined. Calculate the correlation between the answer text to be determined and the answer text to obtain the correlation value. The answer text can be the answer text in the historical government affairs question and answer. Mark the answer text to be determined with a correlation value greater than 0.95 to obtain the answer text in the basic text library.
[0062] The correlation calculation may be a cosine similarity, Euclidean distance, Mahalanobis distance, edit distance, semantic similarity measurement, etc. For example, the sampled answer text and government question text may be vectorized to obtain an answer vector and a question vector, and then the correlation value between the reference answer vector and the question vector may be calculated using cosine similarity, etc. When the correlation value is greater than a correlation threshold, the answer text to be determined is marked to obtain the answer text in the basic text library.
[0063] According to an embodiment of the present disclosure, the intermediate answer text represents a semantic text that matches the question text.
[0064] In operation S230, the intermediate answer text and the question text are processed using the large language model to obtain a target answer text.
[0065] According to an embodiment of the present disclosure, the reliability of the target answer text can be improved by processing the question text raised by the user and the targeted intermediate answer text through a large language model.
[0066] For example, for question texts in the field of logistics, such as "how to keep express delivery fresh". The reference answer text can be "adopt fast transportation methods". The intermediate answer text can be "in order to keep type A express delivery fresh, most of them are directly airlifted from the starting point to the destination.". By using a large language model to process the intermediate answer text and question text, the target answer text can be obtained. The target answer text can be "express delivery can be kept fresh by air." The above is only exemplary. For question texts of regions, types, etc., target answer texts will also be generated according to the characteristics of different regions, types, etc. For example, in order to make the large language model process the intermediate answer text and question text more comprehensive and coherent, the intermediate answer text and the question text can be first integrated to obtain an integrated text. The integrated text can reflect the semantic relationship between the intermediate answer text and the question text, so that the target answer text output by the large language model is more accurate.
[0067] According to an embodiment of the present disclosure, the answer text generation method can be executed by a server or by an intelligent question-and-answer robot.
[0068] According to an embodiment of the present disclosure, in response to the user's interactive operation, the question text related to the interactive operation is input into the large language model to obtain a reference answer text. In response to the reference answer text having a retrieval identifier, and the retrieval identifier represents that the basic text library has an answer text related to the question text, the large language model can determine whether it is necessary to call the knowledge in the basic text library according to the retrieval identifier to enhance the accuracy of the answer. Based on the question text, a search is performed in the basic document library to obtain an intermediate answer text with a targeted reply. Since the intermediate answer text may have problems such as missing information or repeated content, in order to reduce the impact of the intermediate answer text retrieved by the basic text library on the answer quality, the large language model is used to process the intermediate answer text and the question text, so that a more comprehensive and accurate target answer text can be obtained, thereby improving the accuracy of the answer.
[0069] According to an embodiment of the present disclosure, in response to a reference answer text having a retrieval identifier, a search is performed in a basic text library based on a question text to obtain an intermediate answer text, including: in response to the reference answer text having a retrieval identifier, a target basic text sub-library is determined from a plurality of candidate basic text sub-libraries of the basic text library based on attribute information of the user; a text vector of the question text is respectively matched with a text vector of at least one basic text in the target basic text sub-library for similarity to obtain a target basic text that matches the question text; and an intermediate answer text is determined based on the target basic text.
[0070] According to an embodiment of the present disclosure, the attribute information of the user may be a unique code of the user device, a unique identifier of the user, a frequency of domain interaction operations of the user, and the like.
[0071] According to an embodiment of the present disclosure, a candidate basic text corresponding to the attribute information of a user is determined from a basic text library through a retrieval model.
[0072] For example, the retrieval model can be a RAG model (Retrieval-Augmented Generation Model) that has both information retrieval and text generation functions. The RAG model is used to improve the performance of large language models in tasks such as answering questions and generating text. The RAG model retrieves documents or information fragments related to the question text from the basic text library, and then uses the documents or information fragments related to the question text as context information to assist in generating more accurate intermediate answer texts. By utilizing a large amount of unstructured data, the accuracy and reliability of the retrieval model can be improved. At the same time, the basic text library can come from multiple channels, and the RAG model can also avoid the bias of the model to a certain extent and improve the diversity of generated content. By combining retrieval and generation, the RAG model can better understand and process user requests and provide richer and more accurate information.
[0073] According to the embodiment of the present disclosure, the basic texts in the target basic text sub-library and the question texts have the same characteristic contents of professional fields, regions, categories, etc. For example, if the question text has professional field characteristics and regional characteristics, then the basic texts also have the same field characteristics and regional characteristics.
[0074] According to an embodiment of the present disclosure, a text vector of the question text is matched with a text vector of at least one basic text in a target basic text sub-library in terms of similarity.
[0075] For example, the similarity calculation may be cosine similarity, Euclidean distance, Mahalanobis distance, edit distance, semantic similarity measurement, etc. The base text having the greatest similarity to the question text is determined as the target base text.
[0076] For example, the target basic text is determined as the intermediate answer text. The target basic text can also be feature extracted according to the question text to obtain text keywords. The intermediate answer text is generated using the text keywords.
[0077] Typically, the RAG model and the large language model are often viewed as two independent systems, lacking optimization of the overall link. The RAG model focuses on assisting the generation process by retrieving relevant information, while the large language model relies on its large parameters and complex structure to directly generate text. This separation may lead to insufficient optimization of the overall link, affecting the performance of the question-answering system.
[0078] The large language model lacks accuracy evaluation of the information retrieved by the RAG model when summarizing and generating answers. The large language model relies on the information retrieved by the RAG model when generating answers. If the information retrieved by the RAG model is inaccurate, the answers generated by the large language model may also be affected. Large language models usually do not have a mechanism to verify the accuracy of external information and may unconditionally accept the information provided by the RAG model and incorporate it into the generated answer text.
[0079] The RAG model relies on semantic search to retrieve information, but semantic search does not always fully understand the nuances and complexities of the question text. This may lead to a mismatch between the retrieval results and the actual needs. Each step from text segmentation to answer generation may lead to information loss. At the same time, since multiple retrieved contexts may contain similar information, content duplication may occur.
[0080] According to an embodiment of the present disclosure, in response to a user's interactive operation, the question text related to the interactive operation is input into the large language model to obtain a reference answer text. In the case where the reference answer text has a retrieval identifier, the RAG model is used to search the basic text library based on the question text to obtain an intermediate answer text, which not only makes up for the accuracy assessment of the reference answer text by the large language model, but also retrieves a targeted intermediate answer text. The large language model is then used to process the intermediate answer text and the question text, which can comprehensively reduce the impact of information loss and content duplication of the intermediate answer text during the semantic retrieval process of the RAG model, which is conducive to improving the quality of answers to intelligent questions and answers.
[0081] According to an embodiment of the present disclosure, the basic text in the basic text library is vectorized to establish a vector database corresponding to the basic text library. The target basic text matching the question text can be quickly retrieved from the vector database through the retrieval model.
[0082] Figure 3 A schematic diagram of constructing a vector database according to an embodiment of the present disclosure is schematically shown.
[0083] like Figure 3 As shown, the basic text 310 is segmented to obtain a plurality of segmented texts 320. The plurality of segmented texts 320 are vectorized to obtain text vectors 330. The text vectors 330 are used to build a vector database 340.
[0084] For example, each basic text 310 in the basic text library is segmented by recursive segmentation to obtain a segmented text 320 of about 500 characters, and there is an overlap of about 50 characters between adjacent text blocks in the segmented text 320. Then, each text block is input into the embedding model to generate a text vector 330, and the text vector 330 and the metadata of the original segment corresponding to the text vector 330 (such as the text position, etc.) are inserted into the appropriate position of the vector database, thereby completing the construction of the vector database 340.
[0085] Recursive chunking meets the following conditions: The base text is split into multiple smaller chunks according to the maximum length limit. Each chunk tries to maintain the integrity of meaning, for example, it can be split into sentences or paragraphs. For each chunk, if its length still exceeds the maximum input length of the model, the chunking method can be recursively applied until all chunks are less than or equal to the maximum length limit.
[0086] According to an embodiment of the present disclosure, the basic text library can be dynamically updated. When a new text is retrieved, it can be first identified whether there is a basic text that needs to be replaced, the basic text that needs to be replaced is deleted from the basic text library and vector database 340, and the new text is added to the basic text library and vector database 340.
[0087] According to an embodiment of the present disclosure, the attribute information of the user includes at least one of the following: an operation preference attribute and a geographical attribute.
[0088] According to an embodiment of the present disclosure, the operation preference attribute may be determined by the operation frequency, keyword frequency, etc. of questions related to fields, regions, etc. In the case where the reference answer text has a search identifier, a candidate basic text corresponding to the user's operation preference attribute is determined from the basic text library, so that the basic text that is biased towards the operation preference attribute can be preliminarily determined.
[0089] According to an embodiment of the present disclosure, the geographical attribute may be a geographical location region. Given that the question text has a regional characteristic, when the reference answer text has a search identifier, the geographical location region where the user is located is determined. A candidate basic text corresponding to the user's geographical attribute is determined from the basic text library.
[0090] For example, if the question text is in a language related to government affairs, and the reference answer text obtained through the large language model has a search identifier, then the basic text library has an answer text related to the question text. Then, according to the user's operation preference attribute and / or geographical attribute, the intermediate answer text that can be related to the question text raised by the user is obtained from the basic text library. In this way, the large language model is used to process the question text and the intermediate answer text to obtain a more accurate target answer text.
[0091] According to an embodiment of the present disclosure, the basic text is determined based on the following operations: using a large language model to perform text structure analysis on basic files released in a historical period to obtain a structured first basic text, the first basic text representing the activity implementation rules in the basic files; and\or using a large language model to perform question and answer information detection on historical interactive texts to obtain a second basic text in the historical interactive text that represents an explanation of the activity implementation rules, wherein the basic text includes the first basic text and the second basic text.
[0092] According to the embodiments of the present disclosure, the activity implementation rules may be government rules such as economic activities, cultural activities, and legal proceedings. Due to different geographical attributes, the content of the basic documents is also different. Moreover, the text words in the basic documents released in the historical period have the characteristics of rigor, standardization, and authority. Therefore, the text words of the first basic text have the same writing characteristics.
[0093] According to the embodiments of the present disclosure, since the answer texts in the historical interactive texts are mostly semantically parsed through basic files released in the historical period, the second basic text also has the characteristics of rigorous, standardized, and authoritative text words.
[0094] According to the embodiment of the present disclosure, in response to the user's interactive operation, the question text related to the interactive operation is input into the large language model to obtain a reference answer text; in response to the reference answer text having a search identifier, a search is performed in at least one basic text in the basic text library based on the question text, so that the intermediate answer text obtained also has the characteristics of more rigorous, standardized, and authoritative text words. The intermediate answer text and the question text are processed using the large language model to obtain the target answer text for the activity implementation rules, and the text words of the target answer text have the characteristics of rigorous, standardized, and authoritative, which is more suitable for public and formal intelligent question and answer scenarios.
[0095] For example, the intelligent question-answering scenario can be a regional cultural activity, and the basic text library can be a regional cultural knowledge library. The question text is input into the large language model to obtain a reference answer text. In response to the reference answer text having a retrieval identifier, and the retrieval identifier represents that the basic text library has an answer text related to the question text, a search is performed in the regional cultural knowledge library based on the question text to obtain an intermediate answer text with regional cultural response content. The large language model is then used to process the intermediate answer text and the question text to obtain a comprehensive and accurate target answer text, thereby improving the accuracy of the answer.
[0096] Figure 4 The schematic diagram schematically shows a schematic diagram of using a large language model to perform text structure analysis on basic documents released in a historical period to obtain a structured first basic text according to an embodiment of the present disclosure.
[0097] like Figure 4 As shown, the basic file may include text structure information, such as title, author, release time, text, etc. The first basic text is obtained by performing text structure analysis on the basic files released in the historical period.
[0098] The basic files may be files of different original data formats. For example, different data processing tools are used to process files of different types of original data formats.
[0099] For example, if the historical interactive text contains high-frequency questions and answers, each question-answer pair can be used as an output. For the basic documents released in the historical period, the large language model can be used to extract questions and form question-answer pairs as output. All document outputs are formed through data enhancement to build a basic text library. Data enhancement can raise questions and answers for each document, and generate multiple new questions using different expressions for the original questions, and combine each new question with the original answer to build. In this way, a basic text library and a vector database can be constructed to implement data processing and enhancement methods for different formats.
[0100] For question texts with unique regional characteristics, there are large differences in basic documents with different geographical attributes. In order to build a candidate basic text sub-library with basic texts from different regions, and dynamically determine the target basic text according to the user's geographical attributes during the retrieval process, the differences in basic documents from different regions can be effectively distinguished.
[0101] According to an embodiment of the present disclosure, a large language model is obtained by fine-tuning an initial large language model using sample question text and sample answer text, and a first sample answer text in the sample answer text is determined based on the following operations: sampling a sample file to obtain a sample question text and a sample reference answer text; performing similarity matching on a text vector of the sample question text and a text vector of at least one basic text in a basic text library to obtain a sample basic text that matches the sample question text; in response to a semantic correlation between the sample reference answer text and the sample basic text satisfying a preset threshold, generating a first sample answer text with a retrieval identifier based on the sample basic text.
[0102] According to the embodiments of the present disclosure, the initial large language model is fine-tuned to set a retrieval mark. While retaining the powerful language understanding and generation capabilities of the initial large language model, it can be determined based on the retrieval mark whether the reference answer text needs to call the basic text library to increase the accuracy of the answer to the question text. At the same time, the target basic text sub-library in a specific scenario is determined from the basic text library based on the user's attribute information, and the intermediate answer text with strong relevance to the question text is retrieved from the target basic text sub-library. Since the intermediate answer text may have problems such as information loss and content duplication, the reference answer text and the highly relevant intermediate answer text are input into the large language model to obtain the target answer text, which can not only more accurately meet the needs of specific scenarios, but also improve the accuracy of the answer.
[0103] According to an embodiment of the present disclosure, the sample file may be a relevant file such as historical activity implementation rules, so that the text wording of the answer of the large language model has the characteristics of rigor, standardization, and authority, and is more suitable for public and formal intelligent question-and-answer scenarios.
[0104] According to an embodiment of the present disclosure, the basic text in the basic text library is stored in the format of question-answer pairs. Therefore, the sample question text is matched with at least one basic text in the basic text library to determine the sample basic text corresponding to the sample question text. The sample basic answer text can be extracted from the sample basic text, and the semantic relevance between the sample reference answer text and the sample basic answer text can be calculated. In response to the semantic relevance between the sample reference answer text and the sample basic answer text meeting a preset threshold, a first sample answer text with a retrieval identifier is generated based on the sample basic answer text.
[0105] For example, the relevance judgment model is used to judge the semantic relevance between the sample reference answer text and the sample basic answer text.
[0106] For example, the sample basic answer text is marked to obtain a first sample answer text with a search identifier.
[0107] According to an embodiment of the present disclosure, the sample answer text also includes a second sample answer text, and the second sample answer text is determined based on the following operation: in response to the semantic correlation between the sample reference answer text and the sample base text not satisfying a preset threshold, a second sample answer text without a retrieval identifier is generated based on the sample reference answer text.
[0108] Figure 5 The diagram schematically shows the generation of sample answer text according to an embodiment of the present disclosure.
[0109] like Figure 5As shown, the sample file 510 is sampled to obtain a sample question text 520 and a sample reference answer text 530. The text vector of the sample question text 520 is matched with the text vector of at least one basic text in the basic text library 540 for similarity, to obtain a sample basic text 550 that matches the sample question text. In response to the semantic relevance 560 between the sample reference answer text 530 and the sample basic text 550 meeting a preset threshold, a first sample answer text 570 with a retrieval identifier is generated based on the sample basic text 550. In response to the semantic relevance 560 between the sample reference answer text 530 and the sample basic text 550 not meeting the preset threshold, a second sample answer text 580 without a retrieval identifier is generated based on the sample reference answer text 530.
[0110] For example, the preset threshold may be 0.95. If the preset threshold is met, it may be greater than 0.95, and the question text has a strong correlation with the sample basic text 550. If the preset threshold is not met, it may be less than 0.95, and the question text has a strong correlation with the sample basic text 550.
[0111] The initial large language model is fine-tuned using sample question text and sample answer text. The model can be fine-tuned using a preset fine-tuning scheme. The preset fine-tuning scheme significantly reduces the memory requirements during the fine-tuning process through quantization, thereby improving the efficiency and feasibility of fine-tuning. Combining the two methods of quantization and low-rank adaptation, it is possible to fine-tune models with up to 65B parameters with limited computing resources, such as a single 48GB GPU (Graphic Processing Unit), while maintaining performance comparable to 16-bit full-parameter fine-tuning. When resources are sufficient, the fine-tuning scheme can use other fine-tuning schemes to further improve the accuracy of the model.
[0112] The update process of the large language model adopts the method of regular full update. Considering that it is almost impossible to delete some knowledge from the weight of the large language model. Taking weekly and monthly updates as an example, the basic files published in that month are used as input, sample question texts and sample answer texts are resampled, the basic file library is rebuilt, and then the large language model is retrained using the above answer text generation method to achieve dynamic answer text generation.
[0113] According to an embodiment of the present disclosure, the above method also includes: in response to the reference answer text not having a retrieval identifier, determining the reference answer text as the target answer text.
[0114] According to an embodiment of the present disclosure, if the reference answer text does not have a retrieval identifier representing that the basic text library does not have an answer text related to the question text, the reference answer text is determined as the target answer text.
[0115] Figure 6 The flowchart of the answer text generation method according to another embodiment of the present disclosure is schematically shown.
[0116] like Figure 6 As shown, the method includes operations S610 to S670.
[0117] In operation S610, in response to an interactive operation of a user, a question text related to the interactive operation is input into a large language model to obtain a reference answer text.
[0118] In operation S620, determine whether the reference answer text has a search identifier. If so, execute operation S630; if not, execute operation S640.
[0119] In operation S630, a target basic text sub-base is determined from a plurality of candidate basic text sub-bases of the basic text base based on the attribute information of the user.
[0120] In operation S640, the text vector of the question text is matched with the text vector of at least one basic text in the target basic text sub-library for similarity, so as to obtain a target basic text matching the question text.
[0121] In operation S650, an intermediate answer text is determined according to the target base text.
[0122] In operation S660, the intermediate answer text and the question text are processed using the large language model to obtain a target answer text.
[0123] In operation S670, the reference answer text is determined as the target answer text.
[0124] Figure 7 The block diagram of the answer text generating device according to the embodiment of the present disclosure is schematically shown.
[0125] like Figure 7 As shown, the answer text generating device 700 includes an input module 710 , a retrieval module 720 and a processing module 730 .
[0126] The input module 710 is used to respond to the user's interactive operation and input the question text related to the interactive operation into the large language model to obtain the reference answer text. In one embodiment, the input module 710 can be used to perform the operation S210 described above, which will not be repeated here.
[0127] The retrieval module 720 is used to retrieve the basic text library based on the question text in response to the reference answer text having a retrieval identifier to obtain an intermediate answer text, wherein the retrieval identifier represents that the reference basic text library has an answer text related to the question text. In one embodiment, the retrieval module 720 can be used to perform the operation S220 described above, which will not be repeated here.
[0128] The processing module 730 is used to process the intermediate answer text and the question text using the large language model to obtain the target answer text. In one embodiment, the processing module 730 can be used to perform the operation S230 described above, which will not be repeated here.
[0129] According to an embodiment of the present disclosure, the retrieval module 720 includes a first determination submodule, a matching submodule, and a second determination submodule. The first determination submodule is used to determine a target basic text sub-library from multiple candidate basic text sub-libraries of the basic text library based on the user's attribute information in response to the reference answer text having a retrieval identifier. The matching submodule is used to perform similarity matching on the text vector of the question text with the text vector of at least one basic text in the target basic text sub-library, respectively, to obtain a target basic text that matches the question text. The second determination submodule is used to determine the intermediate answer text based on the target basic text.
[0130] According to an embodiment of the present disclosure, the attribute information of the user includes at least one of the following: an operation preference attribute and a geographical attribute.
[0131] According to an embodiment of the present disclosure, the basic text is determined based on the following operations: using a large language model to perform text structure analysis on basic files released in a historical period to obtain a structured first basic text, the first basic text representing the activity implementation rules in the basic files; and\or using a large language model to perform question and answer information detection on historical interactive texts to obtain a second basic text in the historical interactive text that represents an explanation of the activity implementation rules, wherein the basic text includes the first basic text and the second basic text.
[0132] According to an embodiment of the present disclosure, a large language model is obtained by fine-tuning an initial large language model using sample question text and sample answer text, and a first sample answer text in the sample answer text is determined based on the following operations: sampling a sample file to obtain a sample question text and a sample reference answer text; performing similarity matching on a text vector of the sample question text with a text vector of at least one basic text in a basic text library to obtain a sample basic text that matches the sample question text; in response to a semantic correlation between the sample reference answer text and the sample basic text satisfying a preset threshold, generating a first sample answer text with a retrieval identifier based on the sample basic text.
[0133] According to an embodiment of the present disclosure, the sample answer text also includes a second sample answer text, and the second sample answer text is determined based on the following operation: in response to the semantic correlation between the sample reference answer text and the sample base text not satisfying a preset threshold, a second sample answer text without a retrieval identifier is generated based on the sample reference answer text.
[0134] According to an embodiment of the present disclosure, the above-mentioned device further comprises a determination module. The determination module is used to determine the reference answer text as the target answer text in response to the reference answer text not having a search identifier.
[0135] According to the embodiments of the present invention, any one or more of the modules, submodules, units, and subunits, or at least part of the functions of any one of them can be implemented in one module. According to the embodiments of the present invention, any one or more of the modules, submodules, units, and subunits can be split into multiple modules for implementation. According to the embodiments of the present invention, any one or more of the modules, submodules, units, and subunits can be at least partially implemented as hardware circuits, such as field programmable gate arrays (FPGAs), programmable logic arrays (PLAs), systems on chips, systems on substrates, systems on packages, application specific integrated circuits (ASICs), or can be implemented by hardware or firmware in any other reasonable way of integrating or packaging circuits, or can be implemented in any one of the three implementation methods of software, hardware, and firmware, or in any appropriate combination of any of them. Alternatively, according to the embodiments of the present invention, one or more of the modules, submodules, units, and subunits can be at least partially implemented as computer program modules, and when the computer program modules are run, the corresponding functions can be performed.
[0136] For example, any multiple of the input module 710, the retrieval module 720, and the processing module 730 can be combined in one module / unit / sub-unit for implementation, or any one of the modules / units / sub-units can be split into multiple modules / units / sub-units. Alternatively, at least part of the functions of one or more of these modules / units / sub-units can be combined with at least part of the functions of other modules / units / sub-units and implemented in one module / unit / sub-unit. According to an embodiment of the present disclosure, at least one of the input module 710, the retrieval module 720, and the processing module 730 can be at least partially implemented as a hardware circuit, such as a field programmable gate array (FPGA), a programmable logic array (PLA), a system on a chip, a system on a substrate, a system on a package, an application specific integrated circuit (ASIC), or can be implemented by hardware or firmware such as any other reasonable way of integrating or packaging the circuit, or implemented in any one of the three implementation methods of software, hardware, and firmware, or in any appropriate combination of any of them. Alternatively, at least one of the input module 710 , the retrieval module 720 , and the processing module 730 may be at least partially implemented as a computer program module, and when the computer program module is executed, the corresponding function may be performed.
[0137] It should be noted that the answer text generating device part in the embodiment of the present disclosure corresponds to the answer text generating method part in the embodiment of the present disclosure. The description of the answer text generating device part specifically refers to the answer text generating method part, which will not be repeated here.
[0138] Figure 8 The structural block diagram of the government affairs question and answer system according to the embodiment of the present disclosure is schematically shown.
[0139] In the embodiments of the present disclosure, Figure 8 As shown, the government question and answer system 800 may include an acquisition module 810 , an execution module 820 and an output module 830 .
[0140] The acquisition module 810 is used to acquire input information.
[0141] The execution module 820 is used to determine the target task based on the input information received by the acquisition module, determine the large language model and the basic text library based on the target task, and execute the answer text generation method by calling the large language model and the basic text library to obtain output information.
[0142] The output module 830 is used to output the output information obtained by the execution module.
[0143] According to the embodiment of the present disclosure, the acquisition module 810 is responsible for receiving or sensing information such as queries, requests, instructions, signals or data from the outside world (such as users or external environment), and converting them into a format that can be understood and processed by the government question and answer system 800. The acquisition module 810 is the primary link for the government question and answer system 800 to interact with the outside world. It enables the government question and answer system 800 to efficiently and accurately obtain the necessary "sensory" information from the outside world and respond to this information.
[0144] In an example, the acquisition module 810 may acquire the question text related to the interactive operation described above.
[0145] In the example, the execution module 820 is the core support for the ability of the government affairs question and answer system 800 to handle complex tasks. The execution module 820 can execute the government affairs answer text generation method described above.
[0146] In the example, the performance of the execution module 820 may be closely related to the large language model on which the government affairs question-answering system 800 is based. In order to give full play to the capabilities of the large language model, the internal structure of the execution module 820 may be designed to be highly configurable and extensible so as to cope with various types of tasks and requirements in real scenarios.
[0147] In the example, after the government affairs question-answering system 800 obtains the question text related to the interactive operation, the execution module 820 can input the question text related to the interactive operation into the large language model to obtain the reference answer text. In response to the reference answer text having a retrieval identifier, the execution module 820 can search in the basic text library based on the question text to obtain the intermediate answer text. The execution module 820 can use the large language model to process the intermediate answer text and the question text to obtain the target answer text, and pass the target answer text to the output module 830.
[0148] It is understandable that although the large language model has excellent language understanding and generation capabilities, it is just like a human being and can only solve very limited tasks without any tools. When the government Q&A system 800 is endowed with the ability to call tools, it can perform tasks such as using a calculator to perform mathematical operations, using Python to perform data analysis, and using a search engine to perform weather forecasts.
[0149] In an example, the output module 830 may output the target answer text described above.
[0150] The government affairs question and answer system 800 according to the embodiment of the present disclosure can simply and effectively improve the level of intelligence, and enhance flexibility and versatility.
[0151] Fig. 9 A block diagram of an electronic device suitable for implementing the answer text generation method according to an embodiment of the present disclosure is schematically shown.
[0152] Fig. 9 The electronic device shown is only an example and should not bring any limitation to the functions and scope of use of the embodiments of the present disclosure.
[0153] like Fig. 9 As shown, the electronic device 900 according to an embodiment of the present disclosure includes a processor 901, which can perform various appropriate actions and processes according to a program stored in a read-only memory (ROM) 902 or a program loaded from a storage part 908 into a random access memory (RAM) 903. The processor 901 may include, for example, a general-purpose microprocessor (e.g., a CPU), an instruction set processor and / or a related chipset and / or a dedicated microprocessor (e.g., an application-specific integrated circuit (ASIC)), etc. The processor 901 may also include an onboard memory for caching purposes. The processor 901 may include a single processing unit or multiple processing units for performing different actions of the method flow according to an embodiment of the present disclosure.
[0154] In RAM 903, various programs and data required for the operation of electronic device 900 are stored. Processor 901, ROM 902 and RAM 903 are connected to each other via bus 904. Processor 901 performs various operations of the method flow according to the embodiment of the present disclosure by executing the program in ROM 902 and / or RAM 903. It should be noted that the program can also be stored in one or more memories other than ROM 902 and RAM 903. Processor 901 can also perform various operations of the method flow according to the embodiment of the present disclosure by executing the program stored in the one or more memories.
[0155] According to an embodiment of the present disclosure, the electronic device 900 may further include an input / output (I / O) interface 905, which is also connected to the bus 904. The electronic device 900 may further include one or more of the following components connected to the input / output (I / O) interface 905: an input portion 906 including a keyboard, a mouse, etc.; an output portion 907 including a cathode ray tube (CRT), a liquid crystal display (LCD), etc., and a speaker, etc.; a storage portion 908 including a hard disk, etc.; and a communication portion 909 including a network interface card such as a LAN card, a modem, etc. The communication portion 909 performs communication processing via a network such as the Internet. A drive 910 is also connected to the input / output (I / O) interface 905 as needed. A removable medium 911, such as a magnetic disk, an optical disk, a magneto-optical disk, a semiconductor memory, etc., is installed on the drive 910 as needed, so that a computer program read therefrom is installed into the storage portion 908 as needed.
[0156] According to an embodiment of the present disclosure, the method flow according to an embodiment of the present disclosure can be implemented as a computer software program. For example, an embodiment of the present disclosure includes a computer program product, which includes a computer program carried on a computer-readable storage medium, and the computer program contains a program code for executing the method shown in the flowchart. In such an embodiment, the computer program can be downloaded and installed from the network through the communication part 909, and / or installed from the removable medium 911. When the computer program is executed by the processor 901, the above-mentioned functions defined in the system of the embodiment of the present disclosure are executed. According to an embodiment of the present disclosure, the system, equipment, device, module, unit, etc. described above can be implemented by a computer program module.
[0157] The present disclosure also provides a computer-readable storage medium, which may be included in the device / apparatus / system described in the above embodiments; or may exist independently without being assembled into the device / apparatus / system. The above computer-readable storage medium carries one or more programs, and when the above one or more programs are executed, the method according to the embodiment of the present disclosure is implemented.
[0158] According to an embodiment of the present disclosure, the computer-readable storage medium may be a non-volatile computer-readable storage medium. For example, it may include, but is not limited to: a portable computer disk, a hard disk, a random access memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), a portable compact disk read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination thereof. In the present disclosure, a computer-readable storage medium may be any tangible medium containing or storing a program that may be used by or in combination with an instruction execution system, apparatus, or device.
[0159] For example, according to an embodiment of the present disclosure, the computer-readable storage medium may include the ROM 902 and / or the RAM 903 described above and / or one or more memories other than the ROM 902 and the RAM 903 .
[0160] An embodiment of the present disclosure also includes a computer program product, which includes a computer program, which contains program code for executing the method provided by the embodiment of the present disclosure. When the computer program product runs on an electronic device, the program code is used to enable the electronic device to implement the answer text generation method provided by the embodiment of the present disclosure.
[0161] When the computer program is executed by the processor 901, the above functions defined in the system / device of the embodiment of the present disclosure are executed. According to the embodiment of the present disclosure, the system, device, module, unit, etc. described above can be implemented by a computer program module.
[0162] In one embodiment, the computer program may be based on a tangible storage medium such as an optical storage device, a magnetic storage device, etc. In another embodiment, the computer program may also be transmitted and distributed in the form of a signal on a network medium, and downloaded and installed through the communication part 909, and / or installed from a removable medium 911. The program code contained in the computer program may be transmitted using any appropriate network medium, including but not limited to: wireless, wired, etc., or any suitable combination of the above.
[0163] According to an embodiment of the present disclosure, the program code for executing the computer program provided by the embodiment of the present disclosure can be written in any combination of one or more programming languages. Specifically, these computing programs can be implemented using high-level process and / or object-oriented programming languages, and / or assembly / machine languages. Programming languages include, but are not limited to, Java, C++, python, "C" language or similar programming languages. The program code can be executed entirely on the user computing device, partially on the user device, partially on the remote computing device, or entirely on the remote computing device or server. In the case of a remote computing device, the remote computing device can be connected to the user computing device through any type of network, including a local area network (LAN) or a wide area network (WAN), or can be connected to an external computing device (for example, using an Internet service provider to connect through the Internet).
[0164] The flowcharts and block diagrams in the accompanying drawings illustrate the possible implementation architecture, functions and operations of the systems, methods and computer program products according to various embodiments of the present disclosure. In this regard, each box in the flowchart or block diagram may represent a module, a program segment, or a part of a code, and the above-mentioned module, program segment, or a part of the code contains one or more executable instructions for implementing the specified logical function. It should also be noted that in some alternative implementations, the functions marked in the box may also occur in an order different from that marked in the accompanying drawings. For example, two boxes represented in succession can actually be executed substantially in parallel, and they can sometimes be executed in the opposite order, depending on the functions involved. It should also be noted that each box in the block diagram or flowchart, and the combination of boxes in the block diagram or flowchart, can be implemented with a dedicated hardware-based system that performs a specified function or operation, or can be implemented with a combination of dedicated hardware and computer instructions. It can be understood by those skilled in the art that the features recorded in the various embodiments of the present disclosure can be combined and / or combined in a variety of ways, even if such a combination or combination is not explicitly recorded in the present disclosure. In particular, without departing from the spirit and teaching of the present disclosure, the features described in the various embodiments of the present disclosure may be combined and / or combined in a variety of ways. All of these combinations and / or combinations fall within the scope of the present disclosure.
[0165] The embodiments of the present disclosure are described above. However, these embodiments are only for illustrative purposes and are not intended to limit the scope of the present disclosure. Although the embodiments are described above, this does not mean that the measures in the various embodiments cannot be used in combination to advantage. Without departing from the scope of the present disclosure, those skilled in the art may make a variety of substitutions and modifications, which should all fall within the scope of the present disclosure.
Claims
1. A method for generating an answer text, comprising: In response to the user's interactive operation, inputting the question text related to the interactive operation into the large language model to obtain a reference answer text; In response to the reference answer text having a search identifier, searching in a basic text library based on the question text to obtain an intermediate answer text, wherein the search identifier indicates that the basic text library has an answer text related to the question text; The intermediate answer text and the question text are processed using the large language model to obtain a target answer text.
2. The method according to claim 1, wherein: In response to the reference answer text having a search identifier, searching in a basic text library based on the question text to obtain an intermediate answer text includes: In response to the reference answer text having a search identifier, determining a target basic text sub-base from a plurality of candidate basic text sub-bases of the basic text base based on the attribute information of the user; Performing similarity matching on the text vector of the question text and the text vector of at least one basic text in the target basic text sub-library to obtain a target basic text that matches the question text; The intermediate answer text is determined based on the target basic text.
3. The method according to claim 2, wherein: The attribute information of the user includes at least one of the following: an operation preference attribute and a geographic attribute.
4. The method according to claim 2, wherein: The base text is determined based on the following operations: Using the large language model to perform text structure analysis on basic documents released in a historical period to obtain a structured first basic text, wherein the first basic text represents an activity implementation rule in the basic document; and\or The large language model is used to detect question and answer information on the historical interaction text to obtain a second basic text in the historical interaction text that represents an explanation of the activity implementation rules, wherein the basic text includes the first basic text and the second basic text.
5. The method according to claim 1, wherein: The large language model is obtained by fine-tuning an initial large language model using sample question texts and sample answer texts, wherein the first sample answer text in the sample answer texts is determined based on the following operations: Sampling the sample document to obtain the sample question text and the sample reference answer text; Performing similarity matching on the text vector of the sample question text and the text vector of at least one of the basic texts in the basic text library, respectively, to obtain a sample basic text that matches the sample question text; In response to the semantic relevance between the sample reference answer text and the sample basic text satisfying a preset threshold, a first sample answer text having the retrieval identifier is generated according to the sample basic text.
6. The method according to claim 5, wherein: The sample answer text also includes a second sample answer text, and the second sample answer text is determined based on the following operations: In response to the semantic relevance between the sample reference answer text and the sample basic text not satisfying the preset threshold, a second sample answer text without the retrieval identifier is generated based on the sample reference answer text.
7. The method according to claim 1, wherein: The method further comprises: In response to the reference answer text not having the search identifier, the reference answer text is determined as the target answer text.
8. An answer text generating device, comprising: An input module, used for inputting question text related to the interactive operation into the large language model in response to the user's interactive operation, to obtain a reference answer text; A retrieval module, configured to, in response to the reference answer text having a retrieval identifier, search a basic text library based on the question text to obtain an intermediate answer text, wherein the retrieval identifier indicates that the basic text library has an answer text semantically related to the question text; A processing module is used to use the large language model to process the intermediate answer text and the question text to obtain a target answer text.
9. A government affairs question-answering system, comprising: An acquisition module is used to obtain input information; an execution module, configured to determine a target task based on the input information received by the acquisition module, determine a large language model and a basic text library based on the target task, and execute the method according to any one of claims 1 to 7 by calling the large language model and the basic text library to obtain output information; An output module is used to output the output information obtained by the execution module.
10. An electronic device, comprising: one or more processors; a memory for storing one or more programs, When the one or more programs are executed by the one or more processors, the one or more processors implement the method according to any one of claims 1 to 7.
11. A computer-readable storage medium having executable instructions stored thereon, which, when executed by a processor, enables the processor to implement the method according to any one of claims 1 to 7.
12. A computer program product, comprising a computer program, which, when executed by a processor, implements the method according to any one of claims 1 to 7.
Citation Information
Cited By
Government affair question answering system based on deep government affair thinking
CN120763283A
Clinical intelligent question answering system based on artificial intelligence
CN121092678A