Information query expansion method, electronic equipment, storage medium and program product

Through the large language model to understand and expand user queries from multiple perspectives, combined with semantic consistency detection and expanded prompt words, it solves the shortcomings of pseudo-related feedback and generated feedback in information retrieval, and improves the accuracy and credibility of query results.

CN118535681APending Publication Date: 2024-08-23CHINA UNITED NETWORK COMM GRP CO LTD +2

Patent Information

Application Number
CN202410735456.6
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-06-07
Publication Date
2024-08-23

AI Technical Summary

Technical Problem

In existing information retrieval methods, pseudo-relevant feedback is prone to retrieval failure. Generating relevant feedback makes it difficult for users to obtain accurate responses due to the redundancy and useless noise of large language models.

Method used

Use large language models to understand and expand user queries from multiple perspectives, perform semantic consistency detection on the expanded results, extract useful information, and use pre-stored expanded prompt words and semantic similarity calculations to improve the accuracy of query results.

Benefits of technology

It improves the accuracy of semantic understanding during user information retrieval, alleviates hallucination problems and redundancy in results generated by large language models, and ensures the credibility and accuracy of query results.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN118535681A
    Figure CN118535681A
Patent Text Reader

Abstract

The embodiment of the invention provides an information query expansion method, electronic equipment, a storage medium and a program product. The method comprises the steps that a query question input by a user is obtained, a target query question is obtained according to the query question and a pre-stored extension prompt word, the extension prompt word comprises a task role and a task description for answering the query question, and the target query question is input into a large language model, obtaining a plurality of pieces of document information for replying the query problem output by the large language model; target document information is obtained according to the single sentence average semantic similarity between the single sentences in each piece of document information and the single sentences in other document information, the target document information comprises target single sentences, and the single sentence average semantic similarity between the target single sentences and the single sentences in other document information is higher than a preset threshold value; and integrating the multiple pieces of target document information to obtain a query result corresponding to the query problem. According to the method, the accuracy of semantic understanding during user information retrieval is improved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the field of information retrieval technology, and in particular to an information query expansion method, electronic equipment, storage medium and program product. Background Art

[0002] The Information Retrieval (IR) system is the main way for users to query and obtain information. It is a method and means of finding information. It is not only used for information query in daily life, but is also widely used in scenarios such as dialogue robots, question-answering systems, and image search systems.

[0003] Currently, query expansion methods in information retrieval are divided into two categories: pseudo relevance feedback (PRF) and generative relevance feedback (GRF). Pseudo relevance feedback is to use the most relevant document set retrieved from the original query as "pseudo relevance", and use the content of these retrieved documents to extract and condense new query words. Although the pseudo relevance feedback method is simple and easy to implement, due to its weak semantic understanding ability, when the query is short or unclear, it often fails to analyze the query intent due to difficulty. Generative relevance feedback is based on the powerful understanding and generation capabilities of the large language model. The query is directly input into the large language model to generate relevant information, and the generated results are used for query expansion. Although the method of generating relevant feedback has excellent results and the large language model is easier to understand the query intent, there is redundancy in the information generated by the large language model. Directly using the generated results for downstream retrieval will introduce useless noise.

[0004] Based on the above situation, when performing information retrieval, it is easy for users to be unable to obtain accurate responses to their query questions. Summary of the invention

[0005] The embodiments of the present application provide an information query expansion method, an electronic device, a storage medium, and a program product, which use a large language model to understand and expand the information queried by the user from multiple angles, detect and control the expansion results, extract useful information, and improve the accuracy of the response when the user retrieves information.

[0006] In a first aspect, an embodiment of the present application provides an information query expansion method, comprising: obtaining a query question input by a user, obtaining a target query question according to the query question and a pre-stored expansion prompt word, wherein the expansion prompt word includes a task role and a task description for answering the query question, and the task description is used to indicate the task requirements of the query; the target query question includes the query question and the expansion prompt word;

[0007] Input the target query question into the large language model, and obtain multiple document information output by the large language model that answers the query question; wherein each of the document information is an independent result of answering the query question;

[0008] According to the average semantic similarity between a single sentence in each document information and a single sentence in other document information, the target document information includes a target single sentence, and the average semantic similarity between the target single sentence and the single sentence in other document information is higher than a preset threshold;

[0009] The multiple target document information is integrated and processed to obtain a query result corresponding to the query question.

[0010] In a possible implementation manner, acquiring target document information according to the average semantic similarity between a single sentence in each document information and a single sentence in other document information includes:

[0011] For each piece of document information, split the document information into a number of single sentences according to a preset symbol set;

[0012] According to the arrangement order of the single sentences in the document information, the semantic similarities between the single sentence in the current document information and the single sentences in other document information are calculated in sequence to obtain several similarity scores of the current single sentence;

[0013] Calculate the average semantic similarity of the current sentence based on several similarity scores of the current sentence;

[0014] For the average semantic similarity of each sentence in each document information, the sentences whose average semantic similarity is lower than a preset similarity are deleted to obtain the target document information.

[0015] In a possible implementation, the integrating the plurality of target document information to obtain a query result corresponding to the query question includes:

[0016] According to the arrangement order of the target single sentences in the target document information, a plurality of the target document information are integrated and processed to obtain a query result corresponding to the query question.

[0017] In a possible implementation, before obtaining the query question input by the user, the method includes:

[0018] Acquire an extended prompt word set by natural language, and store the extended prompt word, wherein a blank query field is reserved in the extended prompt word, and an identifier is set at the beginning and end of the blank query field;

[0019] The step of obtaining a target query question according to the query question and the pre-stored extended prompt words includes:

[0020] The query question is added to the blank query field of the extended prompt word to obtain the target query question.

[0021] In a possible implementation manner, before inputting the target query question into the large language model, the method further includes:

[0022] Obtaining a preset grammar rule corresponding to the language of the query question, and cleaning invalid characters in the query question according to the preset grammar rule to obtain a cleaned query question;

[0023] Acquire a preset dictionary library corresponding to the language of the query question, and perform spelling correction on the cleaned query question according to the dictionary library to obtain a corrected query question;

[0024] The step of filling the query question into the blank query field of the extended prompt word to obtain the target query question includes:

[0025] The corrected query question is added to the blank query field of the extended prompt word to obtain the target query question.

[0026] In a possible implementation manner, the acquiring the extended prompt word set by natural language and storing the extended prompt word includes:

[0027] Acquire an extended prompt word set by natural language, perform semantic understanding on the extended prompt word, and obtain a domain of the extended prompt word;

[0028] The domain and the extended prompt word are stored in association with each other to obtain associated storage content;

[0029] Before obtaining the target query question according to the query question and the pre-stored extended prompt words, the method further includes:

[0030] According to the field of the query question and the associated storage content, an extended prompt word matching the field is acquired.

[0031] In a possible implementation, the task description includes the task type, output format, and the amount of output document information.

[0032] In a second aspect, an embodiment of the present application provides an information query expansion device, including: a query expansion module, used to obtain a query question input by a user, and obtain a target query question according to the query question and a pre-stored expansion prompt word, wherein the expansion prompt word includes a task role and a task description for answering the query question, and the task description is used to indicate the task requirements of the query; the target query question includes the query question and the expansion prompt word;

[0033] A large language model is used to perform query processing on the target query question and output a plurality of document information that answers the query question; wherein each of the document information is an independent result of answering the query question;

[0034] A consistency detection model, used for obtaining target document information according to the average semantic similarity between a single sentence in each document information and a single sentence in other document information, wherein the target document information includes a target single sentence, and the average semantic similarity between the target single sentence and the single sentence in other document information is higher than a preset threshold;

[0035] The reconstruction model is used to integrate the multiple target document information to obtain the query result corresponding to the query question.

[0036] In a third aspect, an embodiment of the present application provides an information query expansion device, including: a memory, a processor;

[0037] The memory stores computer-executable instructions;

[0038] The processor executes the computer-executable instructions stored in the memory, so that the processor executes the above first aspect and / or various possible implementations of the first aspect.

[0039] In a fourth aspect, an embodiment of the present application provides a computer-readable storage medium, in which computer-executable instructions are stored. When the computer-executable instructions are executed by a processor, they are used to implement the first aspect above and / or various possible implementations of the first aspect.

[0040] In a fifth aspect, an embodiment of the present application provides a computer program product, including a computer program, which, when executed by a processor, implements the above first aspect and / or various possible implementation methods of the first aspect.

[0041] The information query expansion method, electronic device, storage medium and program product provided in the embodiments of the present application obtain a target query question by combining the query question with pre-stored expansion prompt words, and then expand the target query question through a large language model to obtain multiple document information, and obtain query results corresponding to the query question by screening and integrating the multiple document information, thereby improving the accuracy of semantic understanding when users expand information queries. BRIEF DESCRIPTION OF THE DRAWINGS

[0042] The accompanying drawings, which are incorporated in and constitute a part of this specification, illustrate embodiments consistent with the present application and, together with the description, serve to explain the principles of the present application.

[0043] Figure 1 A flowchart of an information query expansion method provided in one embodiment of the present application;

[0044] Figure 2 A flowchart of an information query expansion method provided in one embodiment of the present application;

[0045] Figure 3 A flowchart of an information query expansion method provided in one embodiment of the present application;

[0046] Figure 4 A schematic diagram of the structure of the information query extension provided in one embodiment of the present application;

[0047] Figure 5 A schematic diagram of the structure of an information query expansion device provided in one embodiment of the present application.

[0048] The above drawings have shown clear embodiments of the present application, which will be described in more detail later. These drawings and text descriptions are not intended to limit the scope of the present application in any way, but to illustrate the concept of the present application to those skilled in the art by referring to specific embodiments. DETAILED DESCRIPTION

[0049] Exemplary embodiments will be described in detail herein, examples of which are shown in the accompanying drawings. When the following description refers to the drawings, the same numbers in different drawings represent the same or similar elements unless otherwise indicated. The implementations described in the following exemplary embodiments do not represent all implementations consistent with the present application. Instead, they are merely examples of devices and methods consistent with some aspects of the present application as detailed in the appended claims.

[0050] In the prior art, pseudo-relevant feedback and generating positive-relevant feedback are two common query expansion methods when performing information retrieval. However, among these two retrieval expansion methods, pseudo-relevant feedback is prone to retrieval failure. The method of generating relevant feedback is easier to understand the query intent through a large language model, but due to the black-box nature of the large language model, it is easy to lead to a lack of controllability of the generated results, and there is an illusion that the generated results deviate from reality. In addition, there is redundancy in the information generated by the large language model, and directly using the generated results for downstream retrieval will introduce useless noise.

[0051] In order to solve the above problems, the present application provides an information query expansion method, which uses a large language model to understand and expand the information queried by the user from multiple angles, and detects and controls the expansion results to extract useful information, alleviate the hallucination problem of the large language model, and improve the accuracy of semantic understanding during user information retrieval.

[0052] The technical solution of the present application and how the technical solution of the present application solves the above-mentioned technical problems are described in detail below with specific embodiments. The following specific embodiments can be combined with each other, and the same or similar concepts or processes may not be repeated in some embodiments. The embodiments of the present application will be described below in conjunction with the accompanying drawings.

[0053] Figure 1 This is a flow chart of an information query expansion method provided by an embodiment of the present application. The execution subject of this embodiment may be a server that provides information retrieval for users, a processor or a processing unit in the server, such as Figure 1 As shown, the method includes:

[0054] S101. Obtain a query question input by a user, and obtain a target query question according to the query question and pre-stored extended prompt words. The extended prompt words include a task role and a task description for answering the query question. The task description is used to indicate the task requirements of the query. The target query question includes the query question and the extended prompt words.

[0055] Among them, the extended prompt words are pre-set, and the extended prompt words are used to guide and control the content generated by the large language model. The task role and task description are set in the extended prompt words. The extended prompt words can make the large language model understand the query problem more accurately, and the extended prompt words can limit the format of the generated document information, thereby prompting the large language model to generate more accurate responses to user queries.

[0056] Task roles can be set according to specific scenario requirements. When the query question belongs to a specific field, the task role can be set as a professional scholar in the corresponding field. For example, if the query question is in the financial field, the task role can be set as a researcher in the financial field. When the query question does not belong to a specific field, the task role can also be set as a more general scholar, such as a researcher in the question-and-answer field.

[0057] The task description explains the task requirements of the query, that is, indicates the task type, output format and the amount of output document information when querying the query problem.

[0058] S102: Input the target query question into the large language model, and obtain multiple document information that answers the query question output by the large language model; wherein each document information is an independent result of answering the query question.

[0059] Document information is the answer result generated by the large language model based on the query question. When the target query question is input into the large language model, since the extended prompt words in the target query question set the task description, the large language model can generate multiple document information for the same query question, and each document information is an independent result of answering the query question, so that the query expansion of the query question can be achieved.

[0060] S103, acquiring target document information according to the average semantic similarity between a single sentence in each document information and a single sentence in other document information. The target document information includes a target single sentence, and the average semantic similarity between the target single sentence and the single sentence in other document information is higher than a preset threshold.

[0061] The semantic similarity of a sentence refers to the proportion of similar semantics between the text of the current sentence and the comparison sentence, and is an indicator to measure the degree of semantic similarity between two sentences. By calculating the similarity between the current sentence and the comparison sentence, we can measure whether the information between the two sentences supports each other, whether the logic is smooth, and whether there is any inconsistency in semantics.

[0062] The document information includes several single sentences. When calculating the semantic similarity between the current single sentence and the single sentences in other document information, the current single sentence will obtain several semantic similarity scores.

[0063] The average semantic similarity of a single sentence refers to calculating the average of several semantic similarity scores of the same sentence according to the number of scores, and using the average semantic similarity of a single sentence to judge the semantic relevance between the current sentence and other document information.

[0064] Filter out the sentences whose average semantic similarity is lower than the preset threshold, so that the target sentences included in the filtered target document information have a higher semantic similarity than the preset threshold, which means that the target sentences in the target document information have a high semantic correlation with the target sentences in other target documents, and the multiple target document information support each other, are logically coherent, and have consistent semantics.

[0065] By calculating the average semantic similarity of a single sentence, semantic consistency detection between document information is achieved, making the target document information more credible relative to the query question input by the user.

[0066] S104: Integrate and process multiple target document information to obtain query results corresponding to the query question.

[0067] When integrating multiple target document information, the multiple target document information can be simply concatenated as the query result; or the multiple target document information after simple concatenation can be integrated again through the sequence-to-sequence T5 model to output the final query result.

[0068] In this embodiment, a large language model is used to answer the query question input by the user, and the task role and task description when answering the query question are indicated through extended prompt words, so that the large language model outputs multiple document information that meets the task description, and the multiple document information output by the large language model is subjected to semantic consistency detection, and the single sentences in the document information whose average semantic similarity is lower than a preset threshold are filtered and integrated to obtain the query result corresponding to the query question.

[0069] Through the large language model, the information of the user's query is understood and expanded from multiple angles, and the semantic consistency of multiple document information is checked to extract useful information and improve the accuracy of the response when the user retrieves information.

[0070] Figure 2 A flowchart of an information query expansion method provided in an embodiment of the present application is shown in FIG. Figure 2 As shown, based on the above embodiment, this embodiment describes in detail the process of obtaining target document information according to the average semantic similarity between a single sentence in each document information and a single sentence in other document information. The method includes:

[0071] S201. For each piece of document information, split the document information into several single sentences according to a preset symbol set.

[0072] The preset symbol set can be set and selected according to the language system. For example, the symbols that can be used to split a single sentence include a period, a question mark, an exclamation mark, an ellipsis, etc. When setting the symbol set, the rules of the input method can be comprehensively considered, such as full-width, half-width, etc.

[0073] When a preset symbol appears between sentences in the document information, the preset symbol is used as a basis for segmenting the single sentences in the document information, and the document information content before the preset symbol can be regarded as a single sentence, and each single sentence only includes one preset symbol.

[0074] S202 . Calculate the semantic similarity between a sentence in the current document information and a sentence in other document information in sequence according to the arrangement order of the sentences in the document information, and obtain a plurality of similarity scores for the current sentence.

[0075] The individual sentences in the document information are arranged in the order in which the large language model generates the response. For example, if the large language model generates 2 document information, where:

[0076] Document information A includes three sentences, namely a1, b1, and c1, and the order of the three sentences is a1 b1c1;

[0077] The document information B includes two sentences, which are a2 and b2 respectively, and the order of the two sentences is a2 b2.

[0078] When calculating the semantic degree of 3 single sentences in document information A and 2 single sentences in document information B, if the current document information A needs to perform semantic consistency detection, the order of semantic similarity calculation is a1&a2, a1&b2, b1&a2, b1&b2, c1& a2, c1& b2.

[0079] The semantic similarity of the sentences is calculated in sequence according to the arrangement order of the sentences in the document information, thereby improving the overall calculation efficiency of all the sentences in multiple document information and reducing the phenomenon of repeated calculation or omission of semantic similarity between two sentences.

[0080] S203: Calculate the average semantic similarity of the current sentence according to the similarity scores of the current sentence.

[0081] By sequentially calculating the semantic similarity between a sentence in the current document and sentences in other document information, we can obtain several similarity scores between the current sentence and other sentences. These similarity scores represent the logical connection and consistency between the sentence and the corresponding sentences in other documents. The average semantic similarity of a sentence is calculated by averaging several similarity scores of the sentence. The average semantic similarity of a sentence can be used to comprehensively judge the consistency between the sentence and sentences in other documents.

[0082] Referring to the above example document information A and document information B, taking the semantic similarity calculation of single sentence a1 in document information A as an example, the semantic similarity of single sentence a1 is calculated with a2 and b2 in document B respectively and two similarity scores are obtained. The two similarity scores are x and y respectively, then the average single sentence semantic similarity of single sentence a1 should be (x+y) / 2. Similarly, the average single sentence semantic similarity of single sentence b1, single sentence c1, single sentence a2, and single sentence b2 can be calculated respectively.

[0083] S204 , for each sentence in each document information, delete the sentence whose average semantic similarity is lower than a preset similarity to obtain the target document information.

[0084] Sentences whose average semantic similarity is lower than the preset similarity are filtered out, and target sentences whose semantic similarity is higher than the preset threshold are retained. This ensures that there is a high degree of consistency between sentences in multiple target document information and sentences in other documents. This can alleviate the hallucination problem when a large language model generates responses and improve the accuracy of semantic understanding when responding to user queries.

[0085] Referring to the above example, if the average semantic similarities of single sentences a1, b1, c1, a2, and b2 are 0.953, 0.687, 0.451, 0.716, and 0.934 respectively, and the preset similarity is 0.5, then single sentence c1 needs to be deleted, and the target document information after filtering should be:

[0086] The target document information A' includes two single sentences, namely a1 and b1;

[0087] The target document information B' includes two single sentences, which are a2 and b2 respectively.

[0088] In this embodiment, the average semantic similarity of each sentence is calculated to determine the consistency of the sentence with other sentences in other documents, and sentences with average semantic similarity lower than a preset similarity are deleted to obtain filtered target document information. By filtering the sentences in the document information, useful information is extracted when the large language model generates a reply, which is convenient for improving the accuracy of the reply when the user retrieves information.

[0089] Figure 3 A flowchart of an information query expansion method provided in an embodiment of the present application is shown in FIG. Figure 3 As shown, this embodiment is based on the above embodiment, and the method includes:

[0090] S301: Obtain a query question input by a user.

[0091] Exemplarily, the query problem input by the user is ": : Will the goldfish painting grow up?". The following steps are processed based on this example.

[0092] S302. Obtain the preset grammar rules corresponding to the language of the query problem. According to the preset grammar rules, clean the invalid characters in the query problem to obtain the cleaned query problem.

[0093] Grammar rules refer to the structure and practical norms of a language, that is, the construction rules of words, phrases, and sentences in the language, including the rules of sentence structure, parts of speech, tenses, voices, punctuation marks, etc. There are differences in grammar rules for different languages. For example, "." indicates the end of a declarative sentence, and when ".." appears at the end of a declarative sentence, one of the "." is an invalid character; or when there are extra characters in the middle of semantically coherent words, the extra characters should be cleaned.

[0094] By cleaning the invalid characters, the non-standard, invalid, or special characters that are meaningless for analyzing the query problem in the original query problem are removed, improving the quality and readability of the query problem, and facilitating the improvement of the accuracy when processing the query problem subsequently.

[0095] Exemplarily, a regular expression detection tool can be used to clean the invalid characters. For the query problem input by the user in the above step example, the cleaned query problem is "Will the goldfish painting grow up?".

[0096] S303. Obtain the preset dictionary library corresponding to the language of the query problem. According to the dictionary library, correct the spelling mistakes in the cleaned query problem to obtain the corrected query problem.

[0097] The dictionary library contains a large amount of information related to vocabulary memory, such as parts of speech, word meanings, synonyms, antonyms, word frequencies, etc.

[0098] Based on the dictionary library, correct the spelling mistakes in the query problem, and correct the grammar and syntactic errors in the query problem, thereby improving the semantic accuracy and text confidence of the query problem. For example, the "ping" in "Pingguo is red" should obviously be modified to "ping".

[0099] Exemplarily, the query problem after correcting the spelling mistakes in the cleaned query problem in the above step is "Will the goldfish grow up?".

[0100] S304. According to the field of the query problem and the pre-stored associated storage content, obtain the extended hint words that match the field.

[0101] Among them, the pre-stored associated storage content includes the corresponding relationship between the field and the extended hint words, and this corresponding relationship can be established in advance. Exemplarily, the specific methods for establishing the associated storage content include:

[0102] An extended prompt word is set by natural language and stored, wherein a blank query field is reserved in the extended prompt word, and an identifier is set at the beginning and end of the blank query field. The extended prompt word is obtained, and semantic understanding of the extended prompt word is performed to obtain a field of the extended prompt word. The field is associated with the extended prompt word and stored to obtain associated storage content.

[0103] Since the extended prompt word includes the task role, the field corresponding to the task role can be obtained by semantically understanding the extended prompt word. For example, if the task role in the extended prompt word is a researcher in the financial field, the field is the financial field. By associating and storing the content, it is easy to quickly find the corresponding matching extended prompt word by field.

[0104] For example, the expanded prompt words obtained based on the domain of the above query question are "You are a researcher in the field of question answering. Please make sure your answers are fair and positive. If you don't know the answer, please do not share false information. Below are instructions describing the task. Write a five-paragraph response that completes the request. ### Instructions: \n\n{blank query field}\n\n ### Document: \n\n"""".

[0105] The characters in “### instruction:\n\n{blank query field}\n\n ### document:\n\n”””” are identifiers at the beginning and end of the blank query field. The identifiers are used to enable the large language model to more accurately understand the task description of the query and accurately obtain the query question.

[0106] S305: Fill the corrected query question into the blank query field of the extended prompt word to obtain the target query question.

[0107] For example, the target query question is "You are a researcher in the field of question answering. Please make sure your answers are fair and positive. If you don't know the answer, please do not share false information. Below are instructions describing the task. Write a five-paragraph response that completes the request. ### Instructions: \n\n{Do goldfish grow up?}\n\n ### Document: \n\n"""".

[0108] S306: Input the target query question into the large language model, and obtain document information of multiple responses to the query question output by the large language model.

[0109] For example, the large language model outputs 5 document information that answer the query question. The 5 document information are [p1, p2, p3, p4, p5].

[0110] The text example of document information p1 is:

[0111] “Goldfish do grow! If cared for properly, they can live for several years, and their size will depend on factors such as diet, tank conditions, and breed. On average, a healthy goldfish can reach a length of approximately 5-6 inches (13-15 cm) within its first year of life. However, some large breeds, such as the common goldfish, can grow to as much as 10-12 inches (25-30 cm) over time. Proper care includes regular water changes, adequate filtration, and providing enough room to grow. It is important to note that rapid growth can lead to poor health, so it is best to monitor the size of your fish and adjust living conditions accordingly.”

[0112] S307 . For each piece of document information, split the document information into several single sentences according to a preset symbol set.

[0113] For example, the five document information are split separately. For example, taking the above document information P1 as an example, based on the exclamation mark and the period as the splitting basis, p1 can be split into six single sentences.

[0114] S308 . Calculate the semantic similarities between the sentence in the current document information and the sentences in other document information in order according to the arrangement order of the sentences in the document information, and obtain several similarity scores for the current sentence.

[0115] For example, when calculating the semantic similarity between a single sentence in the current document information and a single sentence in other document information, a consistency detection model may be used to calculate the semantic similarity.

[0116] S309: Calculate the sentence average semantic similarity of the current sentence according to the similarity scores of the current sentence.

[0117] For example, based on several similarity scores of each sentence, the average semantic similarity of the six sentences in p1 is calculated as follows:

[0118] 【0.99802477, 0.41190239, 0.89291378, 0.83873219, 0.29643006,0.72508559】.

[0119] S310: For each sentence in each document information, delete the sentences whose average semantic similarity is lower than a preset similarity to obtain target document information. The target document information includes the target sentence.

[0120] For example, if the preset similarity is 0.5, the second and fifth sentences are deleted, and the target document information p1' has 4 target single sentences remaining. p1' is:

[0121] “Goldfish do grow! On average, a healthy goldfish can reach a length of about 5-6 inches (13-15 cm) within its first year of life. However, some large breeds, such as the common goldfish, can grow to 10-12 inches (25-30 cm) over time. It is important to note that rapid growth can lead to poor health, so it is best to monitor the size of your fish and adjust living conditions accordingly.”

[0122] Similarly, through steps S307 - S310 , p2 ′, p3 ′, p4 ′, and p5 ′ can be obtained.

[0123] S311. Integrate multiple target document information according to the arrangement order of target sentences in the target document information to obtain query results corresponding to the query question.

[0124] According to step S311, if the five target document information are directly concatenated, the query result is p1'+p2'+p3'+p4'+p5'.

[0125] If the concatenated 5 target document information is input into the sequence-to-sequence model again, the final query result is the output result of the sequence-to-sequence model.

[0126] By cleaning invalid characters and correcting typos in the query questions, and matching extended prompt words with the fields corresponding to the query questions, the large language model can generate multiple document information that answer the query questions, filter single sentences in the document information, extract useful information, and then integrate multiple document information to generate query results.

[0127] The query questions are preprocessed to improve the semantic accuracy and text confidence of the query questions, and the extended prompt words of the response are matched by the domain of the query questions so that the subsequent large language model can be more accurate in the semantics of the document information when giving answers.

[0128] Figure 4 This is a schematic diagram of the structure of an information query expansion device provided in an embodiment of the present application. Figure 4 As shown, the information query extension 40 provided in this embodiment includes:

[0129] The query expansion module 401 is used to obtain a query question input by a user, and obtain a target query question according to the query question and pre-stored extended prompt words, wherein the extended prompt words include a task role and a task description for answering the query question, and the task description is used to indicate the task requirements of the query; the target query question includes the query question and the extended prompt words;

[0130] The large language model 402 is used to perform query processing on the target query question and output a plurality of document information that answer the query question; wherein each document information is an independent result that answers the query question;

[0131] The consistency detection model 403 is used to obtain target document information according to the average semantic similarity between a single sentence in each document information and a single sentence in other document information, wherein the target document information includes a target single sentence, and the average semantic similarity between the target single sentence and the single sentence in other document information is higher than a preset threshold;

[0132] The reconstruction model 404 is used to integrate the information of multiple target documents to obtain the query results corresponding to the query question.

[0133] The information query expansion device provided in this embodiment can execute the method provided in the above method embodiment. Its implementation principle and technical effect are similar, and this embodiment will not be described in detail here.

[0134] Figure 5 This is a schematic diagram of the structure of an information query expansion device provided in an embodiment of the present application. Figure 5 As shown, the electronic device 50 provided in this embodiment includes: at least one processor 501 and a memory 502. Optionally, the device 50 also includes a communication component 503. The processor 501, the memory 502 and the communication component 503 are connected via a bus 504.

[0135] In a specific implementation process, at least one processor 501 executes the computer-executable instructions stored in the memory 502, so that at least one processor 501 executes the above method.

[0136] The specific implementation process of the processor 501 can be found in the above method embodiment, and its implementation principle and technical effect are similar, so this embodiment will not be repeated here.

[0137] In the above embodiments, it should be understood that the processor can be a central processing unit (CPU), or other general-purpose processors, digital signal processors (DSP), application-specific integrated circuits (ASIC), etc. A general-purpose processor can be a microprocessor or any conventional processor. The steps of the method disclosed in the invention can be directly implemented as a hardware processor, or can be implemented by a combination of hardware and software modules in the processor.

[0138] The memory may include a high-speed memory (Random Access Memory, RAM), and may also include a non-volatile memory (NVM), such as at least one disk storage.

[0139] The bus can be an Industry Standard Architecture (ISA) bus, a Peripheral Component Interconnect (PCI) bus, or an Extended Industry Standard Architecture (EISA) bus, etc. The bus can be divided into an address bus, a data bus, a control bus, etc. For ease of representation, the bus in the drawings of this application is not limited to only one bus or one type of bus.

[0140] The present application also provides a computer program product, including a computer program, which implements the above method when executed by a processor.

[0141] The present application also provides a computer-readable storage medium, in which computer-executable instructions are stored. When a processor executes the computer-executable instructions, the above method is implemented.

[0142] The above-mentioned readable storage medium can be implemented by any type of volatile or non-volatile storage device or a combination thereof, such as static random access memory (SRAM), electrically erasable programmable read-only memory (EEPROM), erasable programmable read-only memory (EPROM), programmable read-only memory (PROM), read-only memory (ROM), magnetic memory, flash memory, magnetic disk or optical disk. The readable storage medium can be any available medium that can be accessed by a general or special-purpose computer.

[0143] An exemplary readable storage medium is coupled to a processor so that the processor can read information from the readable storage medium and write information to the readable storage medium. Of course, the readable storage medium can also be a component of the processor. The processor and the readable storage medium can be located in an application specific integrated circuit (Application Specific Integrated Circuits, referred to as: ASIC). Of course, the processor and the readable storage medium can also exist in the device as discrete components.

[0144] The division of units is only a logical function division, and there may be other divisions in actual implementation, such as multiple units or components can be combined or integrated into another system, or some features can be ignored or not executed. Another point is that the mutual coupling or direct coupling or communication connection shown or discussed can be an indirect coupling or communication connection through some interface, device or unit, which can be electrical, mechanical or other forms.

[0145] The units described as separate components may or may not be physically separated, and the components shown as units may or may not be physical units, that is, they may be located in one place or distributed on multiple network units. Some or all of the units may be selected according to actual needs to achieve the purpose of the solution of this embodiment.

[0146] In addition, each functional unit in each embodiment of the present invention may be integrated into one processing unit, or each unit may exist physically separately, or two or more units may be integrated into one unit.

[0147] If the function is implemented in the form of a software functional unit and sold or used as an independent product, it can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of the present invention, or the part that contributes to the prior art, or the part of the technical solution, can be embodied in the form of a software product. The computer software product is stored in a storage medium, including several instructions for a computer device (which can be a personal computer, server, or network device, etc.) to perform all or part of the steps of the methods of each embodiment of the present invention. The aforementioned storage medium includes: U disk, mobile hard disk, read-only memory (ROM, Read-Only Memory), random access memory (RAM, Random Access Memory), disk or optical disk, etc. Various media that can store program codes.

[0148] Those skilled in the art can understand that all or part of the steps of implementing the above-mentioned method embodiments can be completed by hardware related to program instructions. The aforementioned program can be stored in a computer-readable storage medium. When the program is executed, the steps of the above-mentioned method embodiments are executed; and the aforementioned storage medium includes: ROM, RAM, disk or optical disk and other media that can store program codes.

[0149] Finally, it should be noted that those skilled in the art will readily conceive of other embodiments of the present invention after considering the specification and practicing the invention disclosed herein. The present invention is intended to cover any variations, uses or adaptations of the present invention, which follow the general principles of the present invention and include common knowledge or customary technical means in the art not disclosed by the present invention, are not limited to the precise structure described above and shown in the drawings, and may be modified and changed in various ways without departing from the scope thereof. The scope of the present invention is limited only by the appended claims.

Claims

1. An information query expansion method, characterized in that: include: Acquire a query question input by a user, and obtain a target query question according to the query question and pre-stored extended prompt words, wherein the extended prompt words include a task role and a task description for answering the query question, and the task description is used to indicate the task requirements of the query; the target query question includes the query question and the extended prompt words; Input the target query question into the large language model, and obtain multiple document information output by the large language model that answers the query question; wherein each of the document information is an independent result of answering the query question; According to the average semantic similarity between a single sentence in each document information and a single sentence in other document information, the target document information includes a target single sentence, and the average semantic similarity between the target single sentence and the single sentence in other document information is higher than a preset threshold; The multiple target document information is integrated and processed to obtain a query result corresponding to the query question.

2. The method according to claim 1, characterized in that The step of obtaining target document information according to the average semantic similarity between a single sentence in each document information and a single sentence in other document information includes: For each piece of document information, split the document information into a number of single sentences according to a preset symbol set; According to the arrangement order of the single sentences in the document information, the semantic similarities between the single sentence in the current document information and the single sentences in other document information are calculated in sequence to obtain several similarity scores of the current single sentence; Calculate the average semantic similarity of the current sentence based on several similarity scores of the current sentence; For the average semantic similarity of each sentence in each document information, the sentences whose average semantic similarity is lower than a preset similarity are deleted to obtain the target document information.

3. The method according to claim 2, characterized in that The integrating and processing the plurality of target document information to obtain a query result corresponding to the query question includes: According to the arrangement order of the target single sentences in the target document information, a plurality of the target document information are integrated and processed to obtain a query result corresponding to the query question.

4. The method according to claim 1, characterized in that: Before obtaining the query question input by the user, the method includes: Acquire an extended prompt word set by natural language, and store the extended prompt word, wherein a blank query field is reserved in the extended prompt word, and an identifier is set at the beginning and end of the blank query field; The step of obtaining a target query question according to the query question and the pre-stored extended prompt words includes: The query question is added to the blank query field of the extended prompt word to obtain the target query question.

5. The method according to claim 4, characterized in that Before inputting the target query question into the large language model, the method further includes: Obtaining a preset grammar rule corresponding to the language of the query question, and cleaning invalid characters in the query question according to the preset grammar rule to obtain a cleaned query question; Acquire a preset dictionary library corresponding to the language of the query question, and perform spelling correction on the cleaned query question according to the dictionary library to obtain a corrected query question; The step of filling the query question into the blank query field of the extended prompt word to obtain the target query question includes: The corrected query question is added to the blank query field of the extended prompt word to obtain the target query question.

6. The method according to claim 4, characterized in that The step of acquiring the extended prompt word set by natural language and storing the extended prompt word includes: Acquire an extended prompt word set by natural language, perform semantic understanding on the extended prompt word, and obtain a domain of the extended prompt word; The domain and the extended prompt word are stored in association with each other to obtain associated storage content; Before obtaining the target query question according to the query question and the pre-stored extended prompt words, the method further includes: According to the field of the query question and the associated storage content, an extended prompt word matching the field is acquired.

7. The method according to any one of claims 1 to 6, characterized in that: The task description includes the task type, output format and the amount of output document information.

8. An information query expansion device, characterized in that: include: A query expansion module is used to obtain a query question input by a user, and obtain a target query question according to the query question and pre-stored extended prompt words, wherein the extended prompt words include a task role and a task description for answering the query question, and the task description is used to indicate the task requirements of the query; the target query question includes the query question and the extended prompt words; A large language model is used to perform query processing on the target query question and output a plurality of document information that answers the query question; wherein each of the document information is an independent result of answering the query question; A consistency detection model, used for obtaining target document information according to the average semantic similarity between a single sentence in each document information and a single sentence in other document information, wherein the target document information includes a target single sentence, and the average semantic similarity between the target single sentence and the single sentence in other document information is higher than a preset threshold; The reconstruction model is used to integrate the multiple target document information to obtain the query result corresponding to the query question.

9. An information query expansion device, characterized in that: include: Memory, processor; The memory stores computer-executable instructions; The processor executes the computer-executable instructions stored in the memory, so that the processor performs the method according to any one of claims 1 to 7.

10. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores computer-executable instructions, which are used to implement the method according to any one of claims 1 to 7 when executed by a processor.

11. A computer program product, characterized in that The invention comprises a computer program, which implements the method according to any one of claims 1 to 7 when being executed by a processor.

Citation Information

Patent Citations

  • Automatic answer summarizing method and system for question answering system

    CN105740310A

  • Method and apparatus for determining answer to question, device, and computer readable medium

    CN108846063A

  • System and method for generating answers based on clustering and sentence similarity

    CN111448561A

  • Text processing method and training method and device of text processing model

    CN116542258A

  • Dialogue model interaction method and device based on multiple tenants and storage medium

    CN116881429A

Cited By

  • Network operation and maintenance analysis method and device and storage medium

    CN118916618A

  • Information query method and device, terminal equipment and storage medium

    CN119357216A

  • Question query processing method and electronic equipment

    CN120256587A

  • Problem query processing method and electronic equipment

    CN120256587B

  • Instruction following data screening method and device for big language model illusion phenomenon

    CN120256623A