A method, device and question-answering method for generating model input information

By extracting key information and association relationships in government data, combining hierarchical retrieval and semantic vector recall, generating model input information and inputting large language models, the problems of intelligent question-and-answer technology in government affairs field in data processing and knowledge base construction are solved, and the accuracy, efficiency and completeness of question-and-answer are improved.

CN119739833APending Publication Date: 2025-04-01ZHONGKE DINGFU BEIJING TECH DEV
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202411811068.8
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-12-10
Publication Date
2025-04-01

AI Technical Summary

Technical Problem

When the existing intelligent question-and-answer technology is applied in the government affairs field, it requires a lot of human resources to process data and build a knowledge base, and it is difficult to effectively deal with the particularity of government affairs data, resulting in insufficient accuracy, efficiency and completeness of question-and-answer.

Method used

By extracting key information and association relationships from the target data, combining hierarchical retrieval and semantic vector recall, the model input information is generated, and a large language model is input to complete the answers to the user's questions.

Benefits of technology

It improves the accuracy, efficiency and completeness of Q&A in government affairs Q&A applications, reduces the costs of manual intervention and data processing, and can better cope with the particularity of government affairs data.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119739833A_ABST
    Figure CN119739833A_ABST
Patent Text Reader

Abstract

The embodiment of the present application provides a model input information generation method, device and question-answering method, which determines the first target data in the target data according to the key information; determines the second target data based on the semantic vector comparison between the target data and the question data; determines the target associated data of the first and second target data according to the association relationship; calculates the target similarity according to the text similarity and semantic vector similarity of the first and second target data, the target associated data and the question data; selects the m third target data with the highest scores, and inputs the third target data and the question data into the large model. It can recall the content associated with the relevant content of the user's question, avoid the problem of incompleteness and incompleteness of the recalled knowledge fragments, combine the key information and semantic vectors, and cover a more comprehensive range. After multiple similarity calculations, the part of the data with the highest score is obtained, and then it is input into the large model, which can effectively improve the accuracy and efficiency.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the field of intelligent question answering, and in particular to a method and device for generating model input information, and a question answering method. Background Art

[0002] With the continuous advancement of artificial intelligence technology and the increasing maturity of technologies such as speech recognition and natural language processing, some repetitive and frequent manual work content is gradually being replaced by artificial intelligence. Among them, intelligent question-answering technology is a typical application example.

[0003] As an advanced form of information retrieval system, intelligent question-answering technology can answer questions raised by users in accurate and concise natural language, providing an effective means for integrating a large amount of knowledge. It mainly consists of three parts: question understanding, knowledge retrieval, and answer generation. At present, the common intelligent question-answering implementation solutions on the market can be roughly divided into two types. The first is to use traditional natural language processing (NLP) technology to perform fine processing and corresponding model training on data in specific business scenarios, and to build a question-answer database by processing, refining and extracting data, so as to realize related conversation functions such as FAQ and multi-round question-answering. The second solution is to use a large language model (LLM) to provide question-answering interaction capabilities with users, build a retrieval system by slicing and vectorizing data, and access the business data of related business scenarios as industry knowledge to provide knowledge corresponding to user questions.

[0004] However, when the existing intelligent question-answering technology is applied to the government affairs field, since the information and knowledge in the government affairs field are more prone to change and modification, such as changes in policy orientation, etc., it is necessary to process the government affairs-related information into government affairs knowledge and build a corresponding knowledge base through NLP technology, which not only consumes a lot of human resources, but also requires frequent manual intervention in subsequent maintenance. In addition, some data in the government affairs field, such as government documents and policy documents, have file formats that are different from regular texts. Therefore, LLM technology based on simple data slicing is difficult to effectively deal with the particularity of these government affairs data. Summary of the invention

[0005] The embodiments of the present application provide a method and device for generating model input information, which determines content information related to user question data through multiple means, and then inputs the information into a large language model to complete the answer to the user's question, thereby improving the accuracy, efficiency and completeness of question answering in government question and answering applications, and solving the problems existing in the application of NLP technology and LLM technology in the field of government question and answering.

[0006] In a first aspect, an embodiment of the present application provides a method for generating model input information, comprising:

[0007] Extracting at least one key information from the target data, wherein the target data is data having relevant information in the government affairs field, and the key information includes keywords and summary information of the target data;

[0008] Determine at least one first target data in the target data according to the key information, each of the first target data corresponds to at least one of the key information;

[0009] Determine at least one second target data based on the comparison result of the semantic vectors corresponding to the target data and the question data, wherein the second target data and the first target data are data in the target data, wherein the question data is a question related to the government affairs field raised by the user;

[0010] If at least one association relationship is extracted from the target data, target association data of the first target data and the second target data are determined according to the extracted association relationship, the target association data being data that has an association relationship with the first target data and the second target data, and the association relationship being data association information in the target data;

[0011] Calculate target similarities of the first target data, the second target data, the target-associated data and the question data respectively according to text similarities and semantic vector similarities of the first target data, the second target data, the target-associated data and the question data;

[0012] The third target data corresponding to the m target similarities with the highest scores are selected, and model input information for input into the large language model is generated based on the third target data and the question data, wherein the third target data is data among the first target data, the second target data and the target associated data.

[0013] In a feasible implementation, the target similarities of the first target data, the second target data, the target associated data and the question data are calculated respectively according to the text similarities and semantic vector similarities of the first target data, the second target data, the target associated data and the question data, including:

[0014] Constructing a set according to the first target data, the second target data and the target-related data, the set including all the first target data, the second target data, the target-related data and the text similarity and semantic vector similarity of the first target data, the second target data, the target-related data and the question data;

[0015] Performing normalization processing according to the text similarity between the first target data, the second target data, the target-related data and the question data in the set and the highest value and the lowest value of the text similarity and the semantic vector similarity in the set to obtain a normalized text similarity value;

[0016] The target similarity is calculated according to the normalized value of the text similarity and the semantic vector similarity.

[0017] In a feasible implementation, the formula for performing the normalization process is:

[0018]

[0019] Among them, S i is the normalized value of text similarity, S i0 is the similarity of any text in the set, S max is the highest value of text similarity and semantic vector similarity in the set, S min is the lowest value of text similarity and semantic vector similarity in the set.

[0020] In a feasible implementation, the formula for calculating the target similarity is:

[0021] F=(1+αS i )V

[0022] Among them, F is the target similarity, α is a hyperparameter with a value of [0, 1], and S i is the normalized value of text similarity, and V is the semantic vector similarity.

[0023] In a feasible implementation manner, before extracting at least one key information from the target data, the method further includes:

[0024] Preprocessing the target data includes: cleaning and deduplicating the target data; performing structural analysis on the cleaned and deduplicated data to obtain at least one hierarchical data, wherein the hierarchical data is data of any structural hierarchical level in the cleaned and deduplicated data;

[0025] Store the preprocessed data in the database.

[0026] In a feasible implementation, key information extraction and correlation relationship extraction are performed on the target data, including:

[0027] Extracting keywords and summary information from the hierarchical data except the hierarchical data corresponding to the lowest level in the hierarchical data;

[0028] Extract data association information of all hierarchical data.

[0029] In a feasible implementation, determining at least one first target data according to the extracted key information includes:

[0030] According to the hierarchical levels of the hierarchical data, at least one first target data is determined in sequence from a high level to a low level.

[0031] In a feasible implementation, the determining at least one second target data based on the comparison result of the semantic vectors corresponding to the target data and the question data includes:

[0032] Converting the hierarchical data into semantic text vectors;

[0033] Convert the question data into a question semantic text vector;

[0034] Comparing the semantic text vector with the question semantic text vector;

[0035] The hierarchical data corresponding to the k semantic text vectors with the highest vector comparison similarity are determined as the second target data, where k≥1.

[0036] In a second aspect, an embodiment of the present application provides a model input information generating device, comprising:

[0037] A data extraction module, used to extract at least one key information from the target data, wherein the target data is data having relevant information in the government affairs field, and the key information includes keywords and summary information of the target data;

[0038] A first recall module, configured to determine at least one first target data in the target data according to the key information extracted by the data extraction module, each of the first target data corresponding to at least one of the key information;

[0039] A second recall module is used to determine at least one second target data based on a comparison result of the semantic vectors corresponding to the target data and the question data, wherein the second target data and the first target data are data in the target data, wherein the question data is a question related to the government affairs field raised by the user;

[0040] a third recall module, configured to determine, when the data extraction module extracts at least one association relationship from the target data, target association data of the first target data and the second target data according to the association relationship extracted by the data extraction module, wherein the target association data is data that has an association relationship with the first target data and the second target data, and the association relationship is data association information in the target data;

[0041] a calculation module, configured to calculate target similarities of the first target data, the second target data, the target-related data and the question data, respectively, according to text similarities and semantic vector similarities of the first target data, the second target data, the target-related data and the question data;

[0042] An input module is used to select third target data corresponding to the m target similarities with the highest scores, and generate model input information for inputting a large language model based on the third target data and the question data, wherein the target data is data among the first target data, the second target data and the target-associated data.

[0043] In a third aspect, an embodiment of the present application provides a question-answering method, including:

[0044] Receiving user's question data, and using the above-mentioned model input information generation method or device according to the question data to obtain model input information for inputting into the large language model;

[0045] The model input information is input into the large language model through a prompt instruction, and the large language model is used to output reply data corresponding to the question data according to the model input information.

[0046] The embodiments of the present application provide a method, device and question-answering method for generating model input information. By extracting the correlation relationship of the target data, it is possible to recall the content related to the relevant content of the question data in the subsequent recall, thereby avoiding the problem of incomplete and incomplete recalled knowledge fragments. By combining key information recall and semantic vector recall, the coverage is more comprehensive, and the part of data with the highest score is obtained after calculating multiple similarities, and then it is input into the large language model together with the question data, which can effectively improve the accuracy and efficiency of the large language model output reply data. BRIEF DESCRIPTION OF THE DRAWINGS

[0047] Figure 1 It is a flowchart of a method for generating model input information provided by an embodiment of the present application;

[0048] Figure 2 It is a schematic diagram of a processing flow of a method for generating model input information provided in an embodiment of the present application;

[0049] Figure 3 It is a question-answering flow diagram of a method for generating model input information provided by an embodiment of the present application;

[0050] Figure 4 It is a structural diagram of a model input information generating device provided in an embodiment of the present application;

[0051] Figure 5It is another structural schematic diagram of a model input information generating device provided in one embodiment of the present application;

[0052] Figure 6 is a structural diagram of a second computing module provided in an embodiment of the present application;

[0053] Figure 7 is a structural schematic diagram of a preprocessing module provided in an embodiment of the present application;

[0054] Figure 8 It is a structural diagram of the second recall module provided in one embodiment of the present application. DETAILED DESCRIPTION

[0055] In order to enable those skilled in the art to better understand the technical solutions in the present application, the technical solutions in the embodiments of the present application will be clearly and completely described below in conjunction with the drawings in the embodiments of the present application. Obviously, the described embodiments are only part of the embodiments of the present application, not all of the embodiments. Based on the embodiments in the present application, all other embodiments obtained by ordinary technicians in the field without creative work should fall within the scope of protection of the present application.

[0056] The common intelligent question-answering solutions currently available on the market can be roughly divided into two types. The first is to use natural language processing (NLP) technology to perform fine processing on data from specific business scenarios and corresponding model training, thereby realizing related conversational functions such as FAQ (frequently-asked questions, FAQ), multi-round question-answering, etc.; the second solution is to use a large language model (LLM) to provide the ability to interact with users in question-answering, and access the business data of related business scenarios as industry knowledge to provide knowledge corresponding to user questions.

[0057] The details of these two solutions are as follows:

[0058] NLP technology generally starts with preprocessing the relevant knowledge data required for question and answer, including data cleaning, deduplication, data enhancement and other related preprocessing work. Then, knowledge engineering work is carried out according to the needs of the business scenario, and the preprocessed data is further refined to extract the relevant knowledge in the data. For example, for a news report describing a car accident, relevant information such as the characters, event types, time and location of the event in the news is extracted. Specific knowledge engineering work needs to be designed according to the needs of the business scenario, and there may be differences in different scenarios. Finally, based on the knowledge processed in the previous step, the corresponding question and answer data is constructed and an intent recognition model is trained using the question and answer data. The model is used to determine the specific question category to which the user's question belongs when providing question and answer services in the future, and finally obtain the corresponding question answer from the database based on the category; how to build the specific intent recognition model needs to be formulated according to the needs. The advantages of NLP technology are high accuracy in answering questions, high operating efficiency and easy to meet hardware requirements. Its disadvantage is that it is extremely dependent on data. In the absence of real question-and-answer data, the use of artificially constructed data is likely to lead to a decrease in accuracy. Knowledge engineering is complex, has high requirements for professional knowledge and algorithms, and requires a lot of manpower. Not only does it require a lot of human resources and corresponding business knowledge as support in the process of extracting knowledge from the data, but also manual review is required after the extraction is completed using the corresponding algorithm to ensure that the extracted knowledge is accurate. And because of the need for refined extraction of knowledge, it is almost impossible to reuse the results of trained models in different scenarios.

[0059] LLM technology first slices the business data, that is, divides a document into several short text segments with a length of no more than 300 words, and uses a text vectorization model to convert the text into vectors, and then stores the text segments and their vectors in the database; then builds a knowledge retrieval system to retrieve text segments related to the question based on the user's input question. Usually, this step uses text vector retrieval or text vector plus text content retrieval to retrieve and recall relevant content; finally, the retrieved related information and user questions are input into LLM, and the user questions are answered based on the capabilities of LLM itself.

[0060] The advantages of LLM technology are that it can process data more conveniently, has a wide range of applicable scenarios, has a high accuracy in answering questions, and can support a wide range of questions and answers. Its disadvantages are that it consumes a lot of resources, has a slow response speed, and is extremely dependent on the accuracy of knowledge retrieval. When the user's question cannot retrieve valid data or the retrieval effect is poor, it will directly affect the final answer effect, and may lead to incomplete answers, wrong answers, etc.

[0061] In the field of government affairs, due to the particularity of government affairs information, processing government affairs-related information into government affairs domain knowledge and building a corresponding knowledge base through NLP technology not only requires a lot of human resources, but also requires frequent manual intervention in subsequent maintenance. This is because some information and knowledge in the field of government affairs are prone to changes and modifications, such as changes in policy orientation, etc. When encountering such a situation, manual maintenance and update of the knowledge base is required.

[0062] The other solution, intelligent question-answering in the government affairs field based on LLM technology, can effectively save the process of building a knowledge base, but it cannot cope with the data characteristics of government affairs data well based on simple data slicing. The reason is that some data in the government affairs field, such as government documents and policy documents, have file formats different from regular texts, and conventional slicing methods may cause information damage; and some policy documents and government documents have strong correlations, that is, one file has an association with another file, so it is necessary to obtain some relevant information from the associated files.

[0063] In response to the above problems, the embodiments of the present application provide a model input information generation method, device and question-answering method, which determine content information related to user question data through a variety of recall methods and generate model input information, and then input the large language model to complete the answer to the user's question, thereby improving the accuracy, efficiency and completeness of question-answering in government question-answering applications.

[0064] Figure 1 It is a flowchart of a method for generating model input information provided in an embodiment of the present application. Figure 2 It is a schematic diagram of the processing flow of the model input information generating method provided in one embodiment of the present application. Figure 3 Schematic diagram of the question-answering process of the method for generating model input information provided by an embodiment of the present application. Figure 1-3 As shown, the embodiment of the present application provides a method for generating model input information, including:

[0065] S100, extracting at least one key information and an association relationship from target data.

[0066] Among them, the key information is the keywords and / or sentences in the target data, such as chapter names and brief description information, and the association relationship is the association or citation relationship between a file in the target data and other files, such as reference documents in a paper.

[0067] When extracting the association relationship, the associated files before and after the trigger word can be extracted from the current file through the pre-set trigger word, and stored in the database in the form of a four-tuple of "current file-trigger word-relation type-associated file". In some examples, the trigger word can be identified by Name Entity Recognition (NER), the associated file can be extracted by relation extraction, and then the associated file can be compared with the name of the standard file in the database by regular matching, and the names of the standard files with low matching and multiple matching results can be filtered out, and the names of the standard files with high matching can be retained, which are the names of the associated files. For example, the current file contains the content "according to the "X City Water Supply Regulations", NER recognizes the trigger word "according to", extracts "X City Water Supply Regulations" through relation extraction, and compares it with the name of the standard file in the corresponding database through regular matching. If the matching degree is higher than the preset matching degree threshold and there is only one matching result, the name of the corresponding standard file is recorded in the four-tuple and stored, so that the corresponding content can be extracted in the file corresponding to the name later.

[0068] It should be noted that the association relationship may not necessarily be extracted from the target data, which may be manifested in that the result of association relationship extraction is empty, that is, no quadruple corresponding to the association relationship is stored in the database after extraction.

[0069] Before extracting at least one key information and association relationship from the target data, the target data generally needs to be preprocessed, including the following steps:

[0070] Remove duplicate data, abnormal symbols, html tags and other non-text-related content from the target data to ensure the overall neatness and effectiveness of the processed text data. The target data refers to data with relevant information in the government affairs field (hereinafter referred to as government affairs data), such as policy documents, notices, news, etc.

[0071] By analyzing the structural characteristics of different types of government data, corresponding structured parsing schemes are formulated, that is, different types of government data correspond to different structured parsing schemes. In this way, in actual application, the appropriate structured parsing scheme can be selected according to the file type of the processed text data to complete the structured parsing of this type of file. This step can restore the hierarchical relationship that originally existed in the data, such as multi-level labels. The question and answer data source in the government field is usually government documents, which often have a specific file format. According to this specific format, the hierarchical structure of chapters, sections, etc. in the file can be parsed separately to facilitate subsequent data retrieval.

[0072] According to the structured parsing scheme, the target data is structured parsed to obtain text fragment data at different levels and converted into corresponding semantic vectors. If the target data is small, structured parsing can be omitted and the target data can be directly converted into corresponding semantic vectors.

[0073] The text segment data and corresponding semantic vectors at each level are stored in the corresponding database.

[0074] After the preprocessing is completed, the text fragment data of each different level (excluding the lowest level) obtained after structured parsing is used as the main body to extract its key information, such as keywords and summary information. Each level of data corresponds to a key information. In some examples, the text structure after structured parsing contains three layers of chapters, sections, and articles. In this step, the corresponding extraction work is performed on the contents of the two levels of chapters and sections. The text content that needs to be extracted at the "section" level is the content of all "articles" under the section (when extracting the key information of the second-to-last level, the key information of all the lowest-level data contained therein is extracted, so there is no need to extract the lowest-level data separately), and the extraction of the "chapter" is completed in the same way. The main purpose of this step is to facilitate the implementation of subsequent hierarchical recall.

[0075] The text fragment data of all levels after structured analysis is used as the main content, and the information of the remaining text fragment data that may be mentioned in each text fragment data, that is, the association relationship between the text fragment data in the text, is extracted and saved.

[0076] S200: Determine at least one first target data in the target data according to the key information.

[0077] After the user asks a question, the text fragment data of all levels after structured analysis is taken as the main body. According to the keywords and summary information corresponding to the text fragment data of each level, in the order of hierarchy, the text similarity is used to determine whether there is text fragment data in the text fragment data of each level that matches the answer corresponding to the user's question, that is, the first target data.

[0078] In some examples, the text structure after structured analysis includes a three-layer structure of chapters, sections, and articles. First, based on the keywords and summary information of the chapter-level text fragment data, it is determined whether the first target data exists. Then, based on the keywords and summary information of the section-level text fragment data, it is determined whether the first target data exists. If so, the corresponding text fragment data is recalled, that is, at least one first target data is determined.

[0079] Compared with searching for text fragments related to the user's question data in the entire text, this step performs content recall in a multi-level, step-by-step and detailed manner, with a higher accuracy rate and higher operating efficiency than conventional recall methods.

[0080] S300, based on the comparison result of the semantic vectors corresponding to the target data and the question data, determine at least one second target data, the second target data and the first target data are data in the target data, wherein the question data is a question related to the government affairs field raised by the user.

[0081] The question data is converted into a vector, and then the semantic vector of the question data is compared with the semantic vectors of all text fragment data in the database, and the semantic vectors of the k text fragment data with the highest vector comparison similarity are selected, k ≥ 1, and the text fragment data corresponding to the k vectors are recalled. Specifically, the vector comparison similarity can be obtained by calculating the cosine similarity between the semantic vector of the question data and the semantic vector of the text fragment data.

[0082] S400, judging whether the text segments recalled in the aforementioned steps S200 and S300 have an associated relationship based on the extraction result in the aforementioned step S100.

[0083] It is determined in the database whether there is a quadruple corresponding to the association relationship. If so, there is an association relationship; if not, there is no association relationship.

[0084] If there is an association relationship, execute steps S410 to S413; if not, execute steps S420 to S422.

[0085] Steps S410 to S413 are described below:

[0086] S410, determining target associated data of the first target data and the second target data according to the extracted associated relationship;

[0087] According to the association relationship in the form of four-tuple stored in the database, the text segment data having an association relationship with the first target data and the second target data, ie, the target association data, is determined from among all the text segment data.

[0088] S411, respectively calculating the text similarity (similarity of the text itself) and semantic vector similarity (similarity of the meaning expressed by the text) of the first target data, the second target data, the target-related data and the question data;

[0089] It is easy to understand that, since the text similarity has been calculated when determining the first target data, it is only necessary to calculate the semantic vector similarity between the first target data and the question data; the same applies to the second target data.

[0090] In some examples, the BM25 algorithm may be used to calculate text similarity, and the semantic vector similarity may use the cosine similarity method in step S300. It should be noted that other algorithms may also be used, and the embodiments of the present application do not limit the specific algorithm.

[0091] S412, calculating target similarities of the first target data, the second target data, the target-related data, and the question data respectively according to the text similarity and the semantic vector similarity;

[0092] S413, selecting the third target data corresponding to the m target similarities with the highest scores, that is, the text fragment data corresponding to the m target similarities with the highest scores, and generating model input information for input into the large language model based on the third target data and the question data, wherein the third target data is data among the first target data, the second target data and the target associated data.

[0093] After determining that there is an association relationship, the content associated with the text fragments recalled by hierarchical retrieval and the text fragments recalled by semantic vectors is used as candidate text, and the three recall results (including text fragments recalled by hierarchical retrieval, text fragments recalled by semantic vectors and candidate texts) are ranked and scored to select the most effective reference text as the input of the large language model.

[0094] The steps to calculate target similarity include:

[0095] Constructing a set according to the first target data, the second target data and the target-related data, the set including all the first target data, the second target data, the target-related data and the text similarity and semantic vector similarity of the first target data, the second target data, the target-related data and the question data;

[0096] Perform normalization processing according to the text similarity between the first target data, the second target data, the target-related data and the question data in the set and the highest value and the lowest value among all text similarities and semantic vector similarities in the set to obtain a normalized value of text similarity;

[0097] The formula for normalization is:

[0098]

[0099] Among them, S i is the normalized value of text similarity, S i0 is the similarity of any text in the set, S max is the highest value of text similarity and semantic vector similarity in the set, S minis the lowest value of text similarity and semantic vector similarity in the set.

[0100] The target similarity is calculated based on the normalized text similarity value and the semantic vector similarity.

[0101] The formula for calculating target similarity is:

[0102] F=(1+αS i )V

[0103] Among them, F is the target similarity, and α is a hyperparameter with a value of [0, 1], which is used to control the normalized value S of the text similarity. i The importance of V is the semantic vector similarity.

[0104] Steps S420 to S422 are described below:

[0105] S420, respectively calculating text similarity and semantic vector similarity between the first target data, the second target data and the question data;

[0106] S421, calculating target similarities of the first target data, the second target data and question data respectively according to the text similarity and the semantic vector similarity;

[0107] S422, selecting third target data corresponding to the m target similarities with the highest scores, and generating model input information for input into a large language model based on the third target data and the question data.

[0108] In step S422, the third target data is data in the first target data and the second target data.

[0109] The calculation method in steps S420 to S422 is the same as the calculation method in steps S410 to S413 and will not be described in detail herein.

[0110] In some examples, model input information is input into the large model through a prompt instruction and then a corresponding response is obtained.

[0111] The present application provides a method for generating model input information, which has relatively simple data processing and does not require complex data knowledge engineering. It can more comprehensively extract content related to user questions through a combination of hierarchical retrieval recall, semantic vector recall and association recall. It covers a comprehensive range of questions and answers and can solve the problem of incomplete and incomplete knowledge fragments in the reply content, effectively improving the accuracy of questions and answers, the completeness and efficiency of replies.

[0112] Figure 4 Schematic diagram of the structure of a model input information generating device provided by an embodiment of the present application. Figure 4As shown, another embodiment of the present application further provides a model input information generating device, comprising:

[0113] A data extraction module, used to extract at least one key information from the target data, wherein the target data is data having relevant information in the government affairs field, and the key information includes keywords and summary information of the target data;

[0114] A first recall module, configured to determine at least one first target data in the target data according to the key information extracted by the data extraction module, each of the first target data corresponding to at least one of the key information;

[0115] A second recall module is used to determine at least one second target data based on a comparison result of the semantic vectors corresponding to the target data and the question data, wherein the second target data and the first target data are data in the target data, wherein the question data is a question related to the government affairs field raised by the user;

[0116] a third recall module, configured to determine, when the data extraction module extracts at least one association relationship from the target data, target association data of the first target data and the second target data according to the association relationship extracted by the data extraction module, wherein the target association data is data that has an association relationship with the first target data and the second target data, and the association relationship is data association information in the target data;

[0117] a calculation module, configured to calculate target similarities of the first target data, the second target data, the target-related data and the question data, respectively, according to text similarities and semantic vector similarities of the first target data, the second target data, the target-related data and the question data;

[0118] An input module is used to select third target data corresponding to the m target similarities with the highest scores, and generate model input information for inputting a large language model based on the third target data and the question data, wherein the third target data is data among the first target data, the second target data and the target-associated data.

[0119] The calculation module includes:

[0120] A first calculation module, used to calculate the text similarity and semantic vector similarity of the first target data, the second target data, the target-related data and the question data respectively;

[0121] The second calculation module is used to calculate the target similarities of the first target data, the second target data, the target-related data and the question data respectively according to the text similarity and the semantic vector similarity.

[0122] Figure 6 is a schematic diagram of the structure of the second computing module provided in an embodiment of the present application, referring to Figure 6 As shown, the second computing module includes:

[0123] A set construction module, used to construct a set according to the first target data, the second target data and the target-related data, wherein the set includes all the first target data, the second target data, the target-related data and the text similarity and semantic vector similarity between the first target data, the second target data, the target-related data and the question data;

[0124] A normalization module, configured to perform normalization processing according to the text similarity between the first target data, the second target data, the target-related data and the question data in the set and the highest and lowest values ​​of the text similarity and the semantic vector similarity in the set, so as to obtain a normalized value of the text similarity;

[0125] The target similarity calculation module is used to calculate the target similarity according to the text similarity normalization value and the semantic vector similarity.

[0126] The normalization module performs normalization processing using the following formula:

[0127]

[0128] In formula (1), S i is the normalized value of text similarity, S i0 is the similarity of any text in the set, S max is the highest value of text similarity and semantic vector similarity in the set, S min is the lowest value of text similarity and semantic vector similarity in the set.

[0129] The target similarity calculation module calculates the target similarity by the following formula:

[0130] F=(1+αS i )V(2)

[0131] In formula (2), F is the target similarity, α is a hyperparameter with a value of [0, 1], and V is the semantic vector similarity.

[0132] Figure 5 is another structural diagram of a device for generating model input information provided by an embodiment of the present application. Figure 5 As shown, another embodiment of the present application further provides a model input information generating device, which, based on the above embodiment, further includes:

[0133] The preprocessing module is used to preprocess the target data; and store the preprocessed data into a database.

[0134] Figure 7 is a schematic diagram of the structure of a preprocessing module provided in an embodiment of the present application, referring to Figure 7 As shown, the preprocessing module includes:

[0135] A cleaning and deduplication module, used for cleaning and deduplication of the target data;

[0136] The structured parsing module is used to perform structured parsing on the cleaned and deduplicated data to obtain at least one hierarchical data, where the hierarchical data is data of any structural level in the cleaned and deduplicated data.

[0137] The data extraction module is connected to the database / knowledge base in communication, and when extracting key information and association relationships from target data, includes:

[0138] Extracting keywords and summary information from the hierarchical data except the hierarchical data corresponding to the lowest level in the hierarchical data;

[0139] Extract data association information of all hierarchical data.

[0140] In some examples, the data association information is stored in a database / knowledge base.

[0141] When the first recall module determines the first target data in the target data according to the key information extracted by the data extraction module, at least one first target data is determined in sequence from a high level to a low level according to the level of the hierarchical data.

[0142] Figure 8 is a schematic diagram of the structure of the second recall module provided in an embodiment of the present application, referring to Figure 8 As shown, the second recall module includes:

[0143] A vector conversion module, used to convert the hierarchical data into a semantic text vector; and convert the question data into a question semantic text vector;

[0144] A comparison module is used to compare the semantic text vector with the question semantic text vector; and to determine the hierarchical data corresponding to the k semantic text vectors with the highest vector comparison similarity as the second target data, where k≥1.

[0145] The present application also provides a question-answering method, including:

[0146] Receiving user's question data, and using the above-mentioned model input information generation method or device according to the question data to obtain model input information for inputting into the large language model;

[0147] The model input information is input into the large language model through a prompt instruction, and the large language model is used to output reply data corresponding to the question data according to the model input information.

[0148] It is easy to understand that those skilled in the art can combine, split, reorganize, etc. the embodiments of the present application to obtain other embodiments based on the several embodiments provided in the present application, and these embodiments do not exceed the protection scope of the present application.

[0149] The above specific implementation methods further explain in detail the purpose, technical solutions and beneficial effects of the embodiments of the present application. It should be understood that the above are only specific implementation methods of the embodiments of the present application and are not used to limit the protection scope of the embodiments of the present application. Any modifications, equivalent substitutions, improvements, etc. made on the basis of the technical solutions of the embodiments of the present application should be included in the protection scope of the embodiments of the present application.

Claims

1. A method for generating model input information, characterized in that: include: Extracting at least one key information from the target data, wherein the target data is data having relevant information in the government affairs field, and the key information includes keywords and summary information of the target data; Determine at least one first target data in the target data according to the key information, each of the first target data corresponds to at least one of the key information; Determine at least one second target data based on the comparison result of the semantic vectors corresponding to the target data and the question data, wherein the second target data and the first target data are data in the target data, wherein the question data is a question related to the government affairs field raised by the user; If at least one association relationship is extracted from the target data, target association data of the first target data and the second target data are determined according to the extracted association relationship, the target association data being data that has an association relationship with the first target data and the second target data, and the association relationship being data association information in the target data; Calculate target similarities of the first target data, the second target data, the target-associated data and the question data respectively according to text similarities and semantic vector similarities of the first target data, the second target data, the target-associated data and the question data; The third target data corresponding to the m target similarities with the highest scores are selected, and model input information for input into the large language model is generated based on the third target data and the question data, wherein the third target data is data among the first target data, the second target data and the target associated data.

2. The method according to claim 1, characterized in that The step of calculating target similarities between the first target data, the second target data, the target associated data and the question data respectively based on text similarities and semantic vector similarities between the first target data, the second target data, the target associated data and the question data comprises: Constructing a set according to the first target data, the second target data and the target-related data, the set including all the first target data, the second target data, the target-related data and the text similarity and semantic vector similarity of the first target data, the second target data, the target-related data and the question data; Performing normalization processing according to the text similarity between the first target data, the second target data, the target-related data and the question data in the set and the highest value and the lowest value of the text similarity and the semantic vector similarity in the set to obtain a normalized text similarity value; The target similarity is calculated according to the normalized value of the text similarity and the semantic vector similarity.

3. The method according to claim 2, characterized in that The formula for normalization is: Among them, S i is the normalized value of text similarity, S i0 is the similarity of any text in the set, S max is the highest value of text similarity and semantic vector similarity in the set, S min is the lowest value of text similarity and semantic vector similarity in the set.

4. The method according to claim 2, characterized in that: The formula for calculating the target similarity is: F=(1+αS i )V Among them, F is the target similarity, α is a hyperparameter with a value of [0, 1], and S i is the normalized value of text similarity, and V is the semantic vector similarity.

5. The method according to any one of claims 1 to 4, characterized in that: Before extracting at least one key information from the target data, the method further includes: Preprocessing the target data includes: cleaning and deduplicating the target data; performing structural analysis on the cleaned and deduplicated data to obtain at least one hierarchical data, wherein the hierarchical data is data of any structural hierarchical level in the cleaned and deduplicated data; Store the preprocessed data in the database.

6. The method according to claim 5, characterized in that Extract key information and association relationships from target data, including: Extracting keywords and summary information from the hierarchical data except the hierarchical data corresponding to the lowest level in the hierarchical data; Extract data association information of all hierarchical data.

7. The method according to claim 5, characterized in that Determining at least one first target data according to the extracted key information includes: According to the hierarchical levels of the hierarchical data, at least one first target data is determined in sequence from a high level to a low level.

8. The method according to claim 5, characterized in that The determining at least one second target data based on the comparison result of the semantic vectors corresponding to the target data and the question data comprises: Converting the hierarchical data into semantic text vectors; Convert the question data into a question semantic text vector; Comparing the semantic text vector with the question semantic text vector; The hierarchical data corresponding to the k semantic text vectors with the highest vector comparison similarity are determined as the second target data, where k≥1.

9. A model input information generating device, characterized in that: include: A data extraction module, used to extract at least one key information from the target data, wherein the target data is data having relevant information in the government affairs field, and the key information includes keywords and summary information of the target data; A first recall module, configured to determine at least one first target data in the target data according to the key information extracted by the data extraction module, each of the first target data corresponding to at least one of the key information; A second recall module is used to determine at least one second target data based on a comparison result of the semantic vectors corresponding to the target data and the question data, wherein the second target data and the first target data are data in the target data, wherein the question data is a question related to the government affairs field raised by the user; a third recall module, configured to determine, when the data extraction module extracts at least one association relationship from the target data, target association data of the first target data and the second target data according to the association relationship extracted by the data extraction module, wherein the target association data is data that has an association relationship with the first target data and the second target data, and the association relationship is data association information in the target data; a calculation module, configured to calculate target similarities of the first target data, the second target data, the target-related data and the question data, respectively, according to text similarities and semantic vector similarities of the first target data, the second target data, the target-related data and the question data; An input module is used to select third target data corresponding to the m target similarities with the highest scores, and generate model input information for inputting a large language model based on the third target data and the question data, wherein the target data is data among the first target data, the second target data and the target-associated data.

10. A question-answering method, characterized in that: include: Receiving user's question data, and obtaining model input information for inputting into a large language model using the method according to any one of claims 1 to 8 or the device according to claim 9 according to the question data; The model input information is input into the large language model through a prompt instruction, and the large language model is used to output reply data corresponding to the question data according to the model input information.