Real-time retrieval enhancement generation method and device based on industrial brain

By performing query reconstruction and text cleaning in the industrial brain, and combining large language models to generate similarity rankings of hypothetical documents, the problem of insufficient retrieval accuracy and real-time performance of existing retrieval systems in high-timeliness and high-complexity application scenarios is solved. More accurate and efficient information retrieval is achieved.

CN118520074BActive Publication Date: 2024-10-22ADVANCED INST OF INFORMATION TECH (AIIT) PEKING UNIV
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202410989506.3
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2024-07-23
Publication Date
2024-10-22
Estimated Expiration
2044-07-23

AI Technical Summary

Technical Problem

When the existing real-time retrieval system of the industrial brain handles high-timeliness, high-relevance and high-complexity application scenarios, there are problems with inaccurate retrieval results and excessive irrelevant content, resulting in insufficient retrieval accuracy and real-time performance.

Method used

By obtaining the original query information, perform query reconstruction and text cleaning, use TF-IDF and Jaccard similarity calculation to filter relevant documents, and combine the large language model to generate similarity rankings between hypothetical documents and candidate documents, and finally combine the retrieval results with the original query information Combine to generate the answer.

Benefits of technology

It significantly improves the performance and practicality of the retrieval system, improves the retrieval accuracy and the effectiveness of adapting to real-time changes in information flow, and ensures the accuracy and relevance of retrieval results.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN118520074B_ABST
    Figure CN118520074B_ABST
Patent Text Reader

Abstract

The embodiment of the present invention discloses a real-time retrieval enhancement generation method and device based on an industrial brain. The method includes: obtaining original query information; inputting the original query information into a search engine; performing text cleaning and sentence segmentation on the search results to obtain relevant documents; sorting the relevant documents, screening the documents related to the original query information, to obtain candidate documents; combining the original query information with the prompt word using a large language model to generate a hypothetical document, splicing the hypothetical document with the original query information, calculating the similarity with the candidate document and sorting it; combining the retrieval results with the original query information, and inputting them into the large language model to generate the corresponding answer. By implementing the method of the embodiment of the present invention, the deficiencies of the existing retrieval system in terms of real-time and accuracy can be effectively solved, the performance and practicality of the retrieval system can be improved, and the retrieval accuracy and effectiveness in adapting to real-time changes in information flow can be improved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to an information retrieval method, and more specifically to a real-time retrieval enhancement generation method and device based on an industrial brain. Background Art

[0002] As a cutting-edge integrated technology, the Industrial Brain aims to comprehensively perceive and analyze complex tasks such as industrial development trends, enterprise development trends, and the balance of supply and demand in the industrial chain. This highly integrated intelligent system needs to process massive and diverse data and extract valuable insights from it.

[0003] Among traditional methods, RAG (Retrieval-Augmented Generation) technology is widely used in such tasks. However, most current retrieval systems still rely on pre-built static corpora or use large language models to generate relevant content. This approach has two major flaws: first, the retrieved content lacks timeliness because the knowledge base of the corpus and the large language model is not updated in real time; second, the content generated by the large language model may contain "hallucination" information, affecting the accuracy of the output.

[0004] In view of this, real-time retrieval has become a key element in building reliable systems for tasks such as open-domain question answering and fact verification. However, existing real-time retrieval systems still face many challenges, especially when dealing with application scenarios such as industrial brains that require high timeliness, high relevance, and high complexity. Existing systems often retrieve a large amount of irrelevant content and have inaccurate problems when ranking the relevance of retrieval results.

[0005] Therefore, it is necessary to design a new method to effectively solve the shortcomings of the existing retrieval system in terms of real-time and accuracy, improve the performance and practicality of the retrieval system, and improve the retrieval accuracy and effectiveness in adapting to real-time changes in information flow. Summary of the invention

[0006] The purpose of the present invention is to overcome the defects of the prior art and provide a real-time retrieval enhancement generation method and device based on industrial brain.

[0007] To achieve the above purpose, the present invention adopts the following technical solution: a real-time retrieval enhancement generation method based on industrial brain, comprising:

[0008] Get original query information;

[0009] Reconstructing the query based on the original query information and inputting it into the search engine to obtain search results;

[0010] Performing text cleaning and sentence segmentation on the search results to obtain relevant documents;

[0011] Sorting the relevant documents and screening the documents related to the original query information to obtain candidate documents;

[0012] The original query information is combined with the prompt word using a large language model to generate a hypothetical document. After the hypothetical document is spliced ​​with the original query information, the similarity with the candidate documents is calculated and sorted to obtain the retrieval results.

[0013] Combining the search result with the original query information to obtain extended query information;

[0014] The expanded query information is input into a large language model to generate a corresponding answer.

[0015] A further technical solution is: the query reconstruction based on the original query information is input into the search engine to obtain search results, including:

[0016] Reconstructing the query based on the original query information in combination with the large language model to obtain a query reconstruction result;

[0017] Inputting the query reconstruction result into a search engine for searching to obtain search results;

[0018] The query reconstruction is performed according to the original query information in combination with the large language model to obtain a query reconstruction result, including:

[0019] Generate prompt words according to the original query information;

[0020] The query is reconstructed by using a large language model combined with the original query information, prompt words, and the search engine's search skills to obtain the query reconstruction result.

[0021] A further technical solution is: the search results are cleaned and divided into sentences to obtain relevant documents, including:

[0022] Using a regular expression, setting a masking word library, and using the masking word library to clean the search results to obtain a cleansing result;

[0023] Recognizing and classifying punctuation marks on the cleaning results;

[0024] The Chinese sentences in the cleaning result are segmented according to Chinese punctuation marks, and the English punctuation marks are processed by using an avoidance function, and then the English sentences in the cleaning result are segmented to obtain relevant documents.

[0025] A further technical solution is: the avoidance function is used to process English punctuation marks, and then the English sentences in the cleaning result are segmented, including:

[0026] Pre-use regular expressions to match periods in abbreviations, URLs, email addresses, and decimals, and replace them with special characters;

[0027] The English sentences in the cleaning result are segmented according to the special characters, and when the English sentences are segmented, the special characters are restored to corresponding English periods.

[0028] A further technical solution is: sorting the relevant documents and screening the documents related to the original query information to obtain candidate documents includes:

[0029] The relevant documents are sorted using TF-IDF, and documents related to the original query information are screened to obtain candidate documents.

[0030] A further technical solution is: the use of TF-IDF to sort the relevant documents and screen the documents related to the original query information to obtain candidate documents, including:

[0031] Sort the relevant documents using TF-IDF, and filter relevant documents below a set threshold to obtain a filtering result;

[0032] Using a context acquisition strategy based on a greedy algorithm, combining the filtering result and surrounding sentences corresponding to the filtering result to obtain text;

[0033] The Jaccard similarity is used to calculate the degree of repetition between paragraphs of the text, so as to remove the repeated contents in the text and obtain candidate documents.

[0034] A further technical solution is: the original query information is combined with the prompt word using a large language model to generate a hypothetical document, the hypothetical document is spliced ​​with the original query information, and the similarity with the candidate documents is calculated and sorted to obtain the retrieval results, including:

[0035] Generate a hypothetical document using a large language model based on the original query information combined with the prompt word;

[0036] splicing the hypothetical document with the original query information to form a splicing result;

[0037] Convert the candidate document and the concatenation result into embedding vectors respectively;

[0038] Calculating the similarity between the vector corresponding to the candidate document and the vector corresponding to the concatenation result;

[0039] Re-ranking is performed according to the similarity, and candidate documents meeting the requirements are screened according to the re-ranking result to obtain the retrieval result.

[0040] Its further technical solution is: the form of the prompt word includes at least one of generating an answer using the provided document information, generating an answer by combining context information and own knowledge, and providing an answer according to query requirements, wherein the query requirements include associating the query with a specific document.

[0041] The present invention also provides a real-time retrieval enhancement generation device based on the industrial brain, comprising:

[0042] An original query acquisition unit, used to acquire original query information;

[0043] A search unit, configured to reconstruct a query based on the original query information and then input the query into a search engine to obtain search results;

[0044] A cleaning and segmentation unit, used for performing text cleaning and sentence segmentation on the search results to obtain relevant documents;

[0045] A screening unit, used to sort the relevant documents and screen the documents related to the original query information to obtain candidate documents;

[0046] A retrieval unit is used to generate a hypothetical document by combining the original query information with the prompt word using a large language model, and then the hypothetical document is spliced ​​with the original query information, and the similarity with the candidate documents is calculated and sorted to obtain the retrieval result;

[0047] An expansion unit, used to combine the search result with the original query information to obtain expanded query information;

[0048] A generating unit is used to input the expanded query information into a large language model to generate a corresponding answer.

[0049] The present invention further provides a computer device, which includes a memory and a processor. The memory stores a computer program, and the processor implements the above method when executing the computer program.

[0050] Compared with the prior art, the present invention has the following beneficial effects: the present invention submits a request to a search engine through original query information to obtain relevant search results, then performs text processing and sorting on the search results to obtain candidate documents related to the original query, then uses a large language model to generate hypothetical documents, and calculates the similarity between these hypothetical documents and the candidate documents, thereby obtaining the final retrieval results. Finally, the retrieval results are combined with the original query information, and the large language model is used again to generate extended query information, and finally the corresponding answers are generated, effectively solving the deficiencies of the existing retrieval system in terms of real-time and accuracy, improving the performance and practicality of the retrieval system, and improving the retrieval accuracy and effectiveness in adapting to real-time changing information flows.

[0051] The present invention is further described below in conjunction with the accompanying drawings and specific embodiments. BRIEF DESCRIPTION OF THE DRAWINGS

[0052] In order to more clearly illustrate the technical solutions of the embodiments of the present invention, the accompanying drawings required for use in the description of the embodiments will be briefly introduced below. Obviously, the accompanying drawings described below are some embodiments of the present invention. For ordinary technicians in this field, other accompanying drawings can be obtained based on these accompanying drawings without paying any creative work.

[0053] Figure 1 A schematic diagram of an application scenario of the real-time retrieval enhancement generation method based on the industrial brain provided in an embodiment of the present invention;

[0054] Figure 2 A flowchart of a real-time retrieval enhancement generation method based on an industrial brain provided in an embodiment of the present invention;

[0055] Figure 3 A schematic block diagram of a real-time retrieval enhancement generation device based on an industrial brain provided by an embodiment of the present invention;

[0056] Figure 4 A schematic block diagram of a computer device provided in an embodiment of the present invention. DETAILED DESCRIPTION

[0057] The following will be combined with the drawings in the embodiments of the present invention to clearly and completely describe the technical solutions in the embodiments of the present invention. Obviously, the described embodiments are part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of the present invention.

[0058] It should be understood that when used in this specification and the appended claims, the terms "include" and "comprises" indicate the presence of described features, integers, steps, operations, elements and / or components, but do not exclude the presence or addition of one or more other features, integers, steps, operations, elements, components and / or combinations thereof.

[0059] It should also be understood that the terms used in this specification of the present invention are only for the purpose of describing specific embodiments and are not intended to limit the present invention. As used in the specification of the present invention and the appended claims, unless the context clearly indicates otherwise, the singular forms "a", "an" and "the" are intended to include plural forms.

[0060] It should be further understood that the term "and / or" used in the present description and the appended claims refers to and includes any and all possible combinations of one or more of the associated listed items.

[0061] See also Figure 1 and Figure 2 , Figure 1 Schematic diagram of the application scenario of the real-time retrieval enhancement generation method based on the industrial brain provided in an embodiment of the present invention. Figure 2 A schematic flow chart of a real-time retrieval enhancement generation method based on an industrial brain provided in an embodiment of the present invention. The real-time retrieval enhancement generation method based on the industrial brain is applied to a server, which interacts with a terminal for data. The server combines the instant retrieval enhancement generation technology of sparse and dense retrieval to dynamically expand the query and optimize the accuracy and real-time performance of the search results. The method of this embodiment first reconstructs the original query to interact with the search engine more effectively. Then, through preliminary text screening, useless or garbled text is removed, and the relevant documents are divided by sentences for further processing. TF-IDF is used to sort the preliminary screened related documents to obtain extended documents that are highly relevant to the original query. Then, the semantic similarity of the extended documents and the original query is calculated and sorted, and the Top-K most relevant texts are selected as part of the extended query. Finally, these extended texts are combined with the original query as input to a large language model to generate the final answer. The method of this embodiment can effectively overcome the limitations of existing methods in dealing with real-time performance and information retrieval accuracy. After a large number of experimental verifications, the effectiveness of RTRAG in improving retrieval accuracy and adapting to changes in real-time information flows has been demonstrated.

[0062] Figure 2 1 is a flow chart of a real-time search enhancement generation method based on an industrial brain provided by an embodiment of the present invention. Figure 2 As shown, the method includes the following steps S110 to S170.

[0063] S110: Obtain original query information.

[0064] In this embodiment, the original query information refers to the initial search request submitted by the user to the search engine or information retrieval system. This query is usually a text or keyword combination used by the user to describe his information needs in order to obtain relevant information or answers.

[0065] S120: Reconstruct the query according to the original query information and input it into a search engine to obtain search results.

[0066] In this embodiment, the search results refer to the results obtained by inputting the original query information into the search engine.

[0067] In one embodiment, the above-mentioned step S120 may include steps S121 - S122 .

[0068] S121 . Reconstruct the query according to the original query information in combination with the large language model to obtain a query reconstruction result.

[0069] In one embodiment, the above-mentioned step S121 may include steps S1211 - S1212 .

[0070] S1211: Generate prompt words according to the original query information.

[0071] In this embodiment, a prompt word is generated using a language model based on the original query information. The prompt word should reflect the information content that the queryer really wants to obtain, so as to facilitate a more accurate search.

[0072] S1212: Reconstruct the query using the large language model in combination with the original query information, prompt words, and search engine search skills to obtain a query reconstruction result.

[0073] In this embodiment, in the information retrieval process, directly relying on simple query words sometimes leads to insufficient relevance of search results. For example, when the search word is "the marketing situation of Company A in the past three years", the search engine may display a large amount of content related to Company A's cars, as well as some recruitment information and news reports containing Company A, which do not fully meet the needs of the inquirer. This situation is partly due to the limitations of search engines in ranking content based on keywords and popularity.

[0074] However, search engines usually provide a variety of advanced search techniques that can help users get more accurate results. Here are some practical search techniques:

[0075] Exact phrase search: Use double quotes " " to surround a phrase to search for results containing the exact phrase.

[0076] Exclude / Include specific words: Use the minus sign - to exclude specific words, and the plus sign + to do the opposite.

[0077] Keyword selection: Use or to connect multiple keywords to search for results containing any keyword.

[0078] Search a specific site: Use the site: operator to limit your search to a specific site.

[0079] Title search: Use the intitle: operator to search for article titles containing specific keywords.

[0080] Index analysis: Optimize search strategies by analyzing the search traffic and popularity of keywords.

[0081] File type specification: Use filetype: followed by a file extension to search for files of a specific type.

[0082] Link content search: Use the inurl: operator to search for web pages that contain specific keywords in the URL.

[0083] These techniques can help users more accurately locate and obtain the information they need, avoiding the problem of irrelevant results that may be brought about by simple keyword searches.

[0084] By setting a prompt and using a large language model to generate a new query based on the original query intent and a certain search technique, the relevance of search results can be significantly improved. For example, assuming the original query is "A company's marketing situation in the past three years", the language model may generate a new query similar to the following: ""A company paper packaging company" marketing situation in the past three years OR 2021 OR 2022 OR 2023 OR 2024 -Advertisement-Recruitment information site:dsd.com". This new query combines precise phrase search, keyword selection, specific website search and other techniques to help exclude irrelevant content and focus on searching for marketing information related to "A company". In this way, the search results required by users can be obtained more accurately, avoiding the problem of irrelevant results caused by simple keyword searches.

[0085] In this embodiment, the form of the above-mentioned prompt words includes at least one of generating answers using provided document information, generating answers combining context information and own knowledge, and providing answers according to query requirements, wherein the query requirements include associating the query with a specific document.

[0086] Among them, utilizing the provided document information means telling the large language model that its role is to use the provided document information to support answering queries. This requires the model to effectively utilize the given document content to ensure the accuracy and basis of the answer.

[0087] Combining contextual information with own knowledge means guiding the large language model to not only rely on document information when answering questions, but also combine contextual information and its own extensive knowledge to generate answers. This method can make the answers more comprehensive and in-depth.

[0088] Providing answers based on query requirements means associating queries with specific documents, requiring the large language model to answer around the specific requirements of the query, ensuring the relevance and completeness of the answer to the query. At the same time, the model is allowed to generate meaningful answers based on its own understanding and inference capabilities to meet user needs when encountering irrelevant or insufficient document information.

[0089] S122: Input the query reconstruction result into a search engine for searching to obtain search results.

[0090] In this embodiment, the query reconstruction result is input into a search engine for searching to obtain search results, so as to quickly locate relevant search results.

[0091] S130: Perform text cleaning and sentence segmentation on the search results to obtain relevant documents.

[0092] In this embodiment, the related documents refer to a set of documents generated in the final processing process that conform to specific formats and specifications.

[0093] In one embodiment, the above-mentioned step S130 may include steps S131 to S133.

[0094] S131. Using a regularized expression, setting a masked word library, and using the masked word library to clean the search results to obtain a cleaned result.

[0095] In this embodiment, the cleaning result refers to the clear and structured text content obtained after a series of text processing steps.

[0096] After the search results are obtained, in order to extract the text information therein, this embodiment uses concurrent requests to crawl the webpage, which significantly shortens the download time. However, the search results initially extracted usually contain a large amount of information irrelevant to the original query information, most of which are HTML tag elements. These irrelevant elements will not only reduce the retrieval efficiency, but also affect the accuracy of the information.

[0097] Although the sparse search link can reduce the interference of irrelevant information to a certain extent, it cannot completely eliminate these elements. If the filtering threshold is set too high, some content that is deeply semantically related to the query may be mistakenly deleted. For example, for the query "latest news of Company A", the announcement of the board of directors' appointment of the CEO and his personal resume may be considered not directly relevant, but in fact contain important relevant information. On the other hand, although dense retrieval can screen at the deep semantic level, it is extremely computationally expensive and time-consuming.

[0098] In order to solve these problems, the method of this embodiment proposes a more accurate and efficient method: using regularized expressions and setting a masked word library. This method effectively excludes common HTML tag elements and irrelevant words such as "Baidu.com" and "Baidu.com knows". After each search, the system will update the masked word library to adapt to the ever-changing websites and content. With the continuous enrichment of the masked word library, the irrelevant elements in the search results are significantly reduced, thereby greatly improving the accuracy of information and retrieval efficiency.

[0099] S132, identifying and classifying punctuation marks on the cleaning results;

[0100] S133, segmenting the Chinese sentences in the cleaning result according to Chinese punctuation marks, processing the English punctuation marks using an avoidance function, and then segmenting the English sentences in the cleaning result to obtain relevant documents.

[0101] In this embodiment, the avoidance function is used to process English punctuation marks, and then the English sentences in the cleaning result are segmented, including:

[0102] Pre-use regular expressions to match periods in abbreviations, URLs, email addresses, and decimals, and replace them with special characters;

[0103] The English sentences in the cleaning result are segmented according to the special characters, and when the English sentences are segmented, the special characters are restored to corresponding English periods.

[0104] In this embodiment, after data cleaning is completed, most of the search content will be related to the original query information. The next step is to segment the retrieved text into sentences, which can easily convert each sentence into an embedded vector representation. Specifically, the method of this embodiment performs a segmentation operation of Chinese sentences based on various punctuation marks (such as full stop, exclamation mark, question mark and other Chinese punctuation marks).

[0105] When processing English sentences, due to the possible presence of abbreviations (such as Mr., Dr., Nov.), URLs or e-mail addresses, and numbers (such as decimals 0.25, 33.66), directly dividing sentences based on periods may lead to incorrect division. In order to avoid this situation, the method of this embodiment introduces an avoidance function to handle these special cases to ensure correct sentence division. Specifically, a predefined regular expression is used to match the English periods in these special cases, and they are temporarily replaced with a special character. After completing the sentence division, these replacements are restored to their original form to avoid special cases being incorrectly divided into sentences.

[0106] The benefit of this method is that it ensures the accuracy and completeness of sentence segmentation. By correctly segmenting sentences, it can ensure that each sentence, as an independent semantic unit, can be more accurately converted into an embedded vector representation. This precise text processing method not only improves the effectiveness of subsequent semantic analysis and machine learning models, but also reduces the noise and errors introduced by incorrect sentence segmentation, thereby improving the performance and reliability of the overall system.

[0107] S140: Sort the relevant documents and filter the documents relevant to the original query information to obtain candidate documents.

[0108] Specifically, the relevant documents are sorted using TF-IDF, and documents related to the original query information are screened to obtain candidate documents.

[0109] In this embodiment, candidate documents refer to a set of documents that may be related to the original query and are first screened out according to certain criteria (such as TF-IDF, etc.) during the retrieval process. In this embodiment, the set of documents obtained by sorting and screening relevant documents using technologies such as TF-IDF is called candidate documents. These documents will be further evaluated for their relevance to the original query in subsequent steps, and ultimately decide whether to present them to the user as the final retrieval results.

[0110] In one embodiment, the above-mentioned step S140 may include steps S141 - S143 .

[0111] S141. Sort the relevant documents using TF-IDF, and filter relevant documents below a set threshold to obtain a filtering result.

[0112] In this embodiment, the filtering result refers to the documents remaining after filtering out the relevant documents whose values ​​are lower than a set threshold from the results obtained by sorting the relevant documents using TF-IDF.

[0113] TF-IDF (Term Frequency-Inverse Document Frequency) is used to measure the importance of a word to a document set or corpus.

[0114] All sentences in the relevant documents are ranked by calculating the TF-IDF score, as follows: ; ;

[0115] By multiplying TF and IDF, we can get the importance score of a term in a sentence: ;

[0116] All sentences are sorted according to the TF-IDF score, and the more keywords appear, the higher the ranking. In addition, a score threshold is set, and relevant documents below the threshold will be directly deleted during the sorting process. In this way, the text retrieval process is optimized to ensure that the most relevant sentences can be quickly screened out when processing a large amount of text, and further intensive retrieval and analysis can be carried out.

[0117] Keyword matching is used to screen the sentences with the most matching keywords in the original query and related documents. These sentences are selected as the central sentences of the expanded documents. In addition, the surrounding sentences of the central sentences need to be combined to remove duplicates to improve the accuracy of text analysis and understanding, and reduce the time consumption of subsequent text embedding representation conversion.

[0118] S142: Using a context acquisition strategy based on a greedy algorithm, combine the filtering result and surrounding sentences corresponding to the filtering result to obtain text.

[0119] In this embodiment, the filtering result is mainly the central sentence. In order to improve the accuracy of the subsequent semantic similarity calculation, the final text can be expanded based on the context acquisition strategy of the greedy algorithm. The central sentence is the main one, and the context acquisition strategy based on the greedy algorithm is adopted to determine the surrounding sentences of the central sentence, and further determine the text. Specifically, the text is reorganized into a short text segment consisting of the central sentence and its context, and the length does not exceed N characters. Specifically, based on the complete information of the relevant documents, the context information of the central sentence is gradually expanded through the greedy algorithm. First, the relevance of the central sentence and each sentence before and after it to the central sentence is determined, and the similarity between the sentences is quickly calculated using the simbert-base-chinese model. If the similarity is lower than the preset threshold, it is further determined whether the previous or next sentence is related, until a sentence with a similarity higher than the threshold is found to form a context paragraph. If the paragraph text length does not reach N at this time, the above process is repeated to continue to expand the context. When the addition operation causes the text length to exceed the threshold N, the backtracking operation will be triggered, the addition will be canceled and the result will be returned.

[0120] This strategy effectively controls the text length and enriches the context information, while ensuring the relevance between contexts and excluding contexts that are irrelevant to the central sentence but exist in related documents.

[0121] For example, the relevant documentation contains the following:

[0122] "Net profit exceeds 100 million! Company A extends the industrial chain to expand into new areas of paper products_development_annual report_income. The higher the medal level (), the better its overall performance on the platform. The total number of article readings View TA's article comments 2023-05-06 09:05 Published in: Province B. Annual financial report | Net profit exceeds 100 million! Company A extends the industrial chain to expand into new areas of paper products. Recently, A-share printing and packaging listed companies have all released annual reports. Judging from the annual reports of various companies published on a certain information disclosure website designated by a certain association and a certain information website, A-share printing and packaging listed companies have their own joys and sorrows in 2022. Company A's performance in 2022: In 2022, Company A achieved operating income of 2.058 billion yuan, a year-on-year increase of 23.66%; net profit attributable to shareholders of 105 million yuan, a year-on-year increase of 7.99%; non-net profit of 75.161 million yuan, a year-on-year increase of 22.64%."

[0123] In the above example, due to force majeure factors in the masking word library, all irrelevant content cannot be completely blocked, resulting in a small amount of irrelevant information still being mixed in the relevant documents. However, through the rapid similarity judgment process in the context acquisition process of this embodiment, that is, using the simbert-base-chinese model to quickly calculate the similarity between sentences, these obviously irrelevant contents can be effectively excluded.

[0124] S143: Using Jaccard similarity to calculate the degree of repetition between paragraphs of the text, so as to remove repeated content in the text and obtain candidate documents.

[0125] In this embodiment, during text processing, a large amount of repeated content in the context is often encountered, which may affect the accuracy and efficiency of subsequent analysis. For example, two paragraphs are as follows:

[0126] Paragraph 1: The compressive strength of a carton mainly comes from the material index and technical performance of the cardboard or base paper. The function of a packaging carton depends on the flute type, thickness, grade and performance of the corrugated cardboard. Therefore, in carton design, the gram weight, density, quality grade and combination ratio of the face paper, lining paper, core paper and sandwich paper must be considered. In addition, in addition to the gram weight of the paper, the density and quality grade of the paper are also very important.

[0127] Paragraph 2: The functionality of a packaging carton depends on the flute type, thickness, grade and performance of the corrugated board. Therefore, in carton design, the grammage, density, quality grade and combination ratio of the face paper, lining paper, core paper and sandwich paper need to be considered. We should not forget that in addition to the grammage of paper, the density and quality grade of paper are equally important. The way to improve the performance of corrugated board is not necessarily to increase the grammage of the base paper, because this will significantly increase the cost, which may not be the best choice from a cost-effective point of view.

[0128] In these two paragraphs, "In carton design, the weight, density, quality grade and combination ratio of the face paper, lining paper, core paper and sandwich paper should be considered" and "We should not forget that in addition to the weight of paper, the density and quality grade of paper are equally important" are repeated contents that are adjacent to each other. This repetition will affect the information density and accuracy of the text.

[0129] In order to solve this problem, the Jaccard similarity is introduced in this embodiment to evaluate the similarity between paragraphs. The Jaccard similarity calculation formula is as follows: ; When the similarity is greater than When the text is repeated, it is determined that there are two duplicate paragraphs, and the shorter one is deleted. This effectively reduces the duplicate content in the text and improves the efficiency and accuracy of text processing and analysis.

[0130] S150, combining the original query information with the prompt word using a large language model to generate a hypothetical document, concatenating the hypothetical document with the original query information, calculating the similarity with the candidate documents and ranking them to obtain a retrieval result.

[0131] In this embodiment, the search result refers to documents or information related to the user's query that are screened out from the relevant documents.

[0132] In one embodiment, the above-mentioned step S152 may include steps S151 to S155.

[0133] S151, generating a hypothetical document using a large language model according to the original query information combined with the prompt word;

[0134] S152, splicing the hypothetical document with the original query information to form a splicing result;

[0135] S153, converting the candidate document and the concatenation result into embedding vectors respectively;

[0136] S154: Calculate the similarity between the vector corresponding to the candidate document and the vector corresponding to the concatenation result.

[0137] In this embodiment, cosine similarity is used to calculate the similarity between the vector corresponding to the candidate document and the vector corresponding to the concatenation result.

[0138] S155 , re-ranking is performed according to the similarity, and candidate documents meeting the requirements are screened according to the re-ranking result to obtain a retrieval result.

[0139] In this embodiment, similarity is calculated based on the candidate documents and the original query information, mainly for semantic similarity calculation; this process determines which small text segments in the relevant documents can be effectively used to enhance the query content. This technology uses advanced embedded coding technology to convert queries and expanded documents into vector representations in high-dimensional space, which is usually completed by relying on pre-trained language models. These models can capture the semantic information of the text, making the text vectors with similar semantics in space closer.

[0140] However, it is often difficult to achieve the desired effect by relying solely on a short query to sort a large amount of retrieved content. This is because a short query can only provide limited contextual information and cannot fully and deeply reflect its true intention. In contrast, the retrieved content is usually lengthy and complex, containing rich information and background knowledge. When a short query is compared with these lengthy contents for similarity, it is difficult for the system to capture the deep connections and subtle differences between them, resulting in inaccurate sorting results.

[0141] Specifically, some content that is highly relevant to the user's query intent may be ignored due to superficial mismatches, while some content that is far from the user's query intent may be ranked at the top due to accidental similarity. For example, when the user query is "What are the raw materials for corrugated cardboard?", the calculated text similarity ranking may be as follows:

[0142] Types of corrugated boxes? What is corrugated cardboard? What are the raw materials of cardboard boxes? What materials are corrugated cardboard boxes made of? What materials are corrugated cardboard made of? Raw materials of cardboard boxes? Corrugated cardboard production process?

[0143] What are the ingredients of corrugated boxes? iAsk Knowledgeable People What are the raw materials of corrugated boxes? iAsk Knowledgeable People What are the components of corrugated boxes? iAsk Knowledgeable People How are corrugated boxes made? iAsk Knowledgeable People How to make and use heavy-duty corrugated boxes? What to do if the corrugated boxes are wet and soft? iAsk Knowledgeable People

[0144] From these examples, we can see that the top-ranked text may contain only questions without corresponding answers, because the similarity calculation is based on only one question.

[0145] In order to improve the accuracy of the ranking, the method of this embodiment proposes a re-ranking strategy: first, a large language model is combined with the original query information to generate a hypothetical document, which is related to the original query information, and then the document is spliced ​​with the original query information to increase semantic information. Then, the spliced ​​document is calculated for similarity with the search content, so as to obtain a more accurate ranking result.

[0146] However, when implementing this strategy, existing methods such as HyDE and query2doc have a significant problem: due to the knowledge update limitations of large language models, when faced with unfamiliar questions, the model may generate irrelevant responses. For example, "As an AI, I cannot provide real-time financial reports of a specific company. It is recommended to visit the official website or financial news website to obtain the latest information."

[0147] To this end, a prompt word is also combined to guide the large language model to generate high-quality answers or templates related to the original query information. That is, based on the original query information combined with the prompt word, a large language model is used to generate a hypothetical document; the hypothetical document is spliced ​​with the original query information to form a splicing result to increase semantic information; even if this method cannot generate a completely correct answer, it can generate content related to the original query, thereby improving the accuracy of screening out the true answer in the similarity calculation and sorting process.

[0148] In addition, the method of this embodiment uses cosine similarity as a method for measuring the similarity between two vectors. Cosine similarity not only takes into account the direction of the vector, but is also not affected by the length of the vector, which is particularly effective when processing text data because the length of the text may affect the result. Its calculation formula is: ; A and B refer to the vector corresponding to the candidate document and the vector corresponding to the original query information respectively; after calculating the similarity between the vector corresponding to the original query information and the vectors corresponding to all candidate documents, the top-K small texts that are most similar to the original query information are selected as the retrieval results. These texts are then concatenated with the original query as the input of the large language model, thereby generating a more comprehensive and accurate answer.

[0149] This technology brings multiple benefits. First, it allows queries to be dynamically expanded in real-time search engine results, making the query information acquisition more comprehensive and in-depth. Second, by using semantic similarity calculation, it can ensure that the selected extended text is semantically related to the original query, thereby improving the quality and accuracy of the generated answer. Finally, the method of this embodiment makes up for the shortcomings of large language models in real-time information acquisition, effectively responds to the challenges in the information retrieval process, and provides users with a more satisfactory query experience.

[0150] In summary, this technology not only enhances the effectiveness and practicality of queries, but also brings new solutions to the field of information retrieval and promotes the advancement and application of search technology.

[0151] In addition, for prompt words, using different prompt words to guide the large language model to generate answers is an effective method, which can help control the model output to make it more in line with user needs.

[0152] First, a simple prompt word is used, aiming to set the model as a "helpful assistant" and answer questions based on the given query. At the same time, this description can also be converted to Chinese to fit the large language model trained with the Chinese corpus. The Chinese and English prompt words are compared as follows:

[0153] Prompt1 = "you are a helpful assistant. Answer questions with the given document." + query;

[0154] Prompt 1 = "You are an all-knowing assistant. Able to answer questions based on the given document" + query;

[0155] This prompt explicitly tells the model its role and requires it to use the provided document information in its answer.

[0156] Secondly, slightly more detailed prompts are used to more precisely guide the model to understand the requirements and generate answers based on the context. The prompts are in the following form:

[0157] Prompt2 = "Context information is below. {most_similar_doc} Using both the context information and also using your own knowledge, answer the question: {query} If the context isn't helpful, you can also answer the question on your own."

[0158] Hint 2 = "The context information is as follows: {most relevant documents}. Use the context information and your own knowledge to answer the question: {query}. If the context information is not helpful, you can also answer the question yourself."

[0159] This prompt word not only guides the model to use contextual information, but also encourages the model to generate answers based on its own knowledge, thereby more comprehensively meeting the query requirements.

[0160] The third type of prompt word adopts the format of the reference, combining specific document information and query requirements, as shown below:

[0161] Prompt3 = "query:" + query + "Use the provided text documents (someof which might be irrelevant, and if none of these contexts are relevant to the query, answer in your own way.) and write high-quality answers tightly around the given query.\n" +

[0162] Document [1](Title: Asian Americans in science and technology) Prizein physics for discovery of the subatomic particle J / ψ. SubrahmanyanChandrasekhar shared...

[0163] Document [2](Title: List of Nobel laureates in Physics) The first Nobel Prize in Physics was awarded in 1901 to Wilhelm Conrad Röntgen, ofGermany, who received...

[0164] Document [3](Title: Scientist) and pursued through a unique method,was essentially in place. Ramón y Cajal won the Nobel Prize in 1906 for hisremarkable...

[0165] Hint word 3 = "Query:" +Query+ "Use the provided text documents (some of which may not be relevant to the query. If all documents are not relevant to the query, answer them on your own.) and write a high-quality answer closely surrounding the given query.\n" +

[0166] Document [1] (Title: Asian American Contributions to Science and Technology) won the Physics Prize for the discovery of the subatomic particle J / ψ. Subramanian Chandrasekhar shared...

[0167] Document [2] (Title: List of Nobel Prize winners in Physics) In 1901, the first Nobel Prize in Physics was awarded to Wilhelm Conrad Röntgen of Germany for...

[0168] Document [3] (Title: Scientist) and conducted research through a unique method, which was basically in place. Ramón y Cajal won the Nobel Prize in 1906 for his outstanding contributions…

[0169] This formatting of prompts directly associates the query with a specific document, requiring the model to provide high-quality answers around the query. It also allows the model to answer based on its own understanding when the document information is irrelevant or insufficient.

[0170] In summary, the form of prompt words includes at least one of generating answers using provided document information, generating answers combining context information and own knowledge, and providing answers according to query requirements, wherein the query requirements include associating the query with a specific document.

[0171] By comparing the form and function of these three prompts, we can help determine which prompt is more effective and can best guide the large language model to generate answers that meet user needs.

[0172] The method of this embodiment guides the large language model to generate pseudo answers, that is, hypothetical documents, which are highly relevant to the original query information by designing clever prompt words, and then splices the hypothetical documents with the original query information, and uses the spliced ​​results to calculate similarity with candidate documents, and then re-ranks them, thereby significantly improving the accuracy of the retrieval results.

[0173] S160: Combine the search result with the original query information to obtain extended query information.

[0174] In this embodiment, expanding the query information refers to combining the search result and the original query information into one input.

[0175] Combining search results can expand the original query from a static, limited information space to a dynamic, broad information resource. This can increase coverage and ensure that the expanded query information obtained is more comprehensive and accurate. By splicing relevant text paragraphs with the original query, the generated answer can be made more in-depth and detailed.

[0176] Retrieval results often contain diverse information related to the original query, such as synonyms, related topics, etc. By combining this information, the semantic intent of the query can be better captured, thereby improving the quality of answers and user satisfaction.

[0177] Combining real-time search results with the original query allows the expanded query information to reflect the latest information and changes in a timely manner. This dynamic update capability is particularly important for information queries that require continuous updates and feedback, such as news events, market trends, and other fields.

[0178] Combining the search results can provide users with richer and more personalized information responses. By ensuring that the generated expanded query information is more closely matched to the user's actual needs, the user's search experience and satisfaction can be significantly improved.

[0179] In short, combining the retrieval results with the original query information can not only improve the quality and comprehensiveness of the query results, but also enhance the real-time performance and user experience of the system, thus playing an important role in the application of information retrieval and question-answering systems.

[0180] S170: Input the expanded query information into a large language model to generate a corresponding answer.

[0181] Based on the user's original query and extended information, a complete query statement or question description is constructed. This can include keywords in the original query, key information in the extended information, and specific requirements or restrictions of the query. The constructed query is input into the selected large language model. The model searches and matches the preprocessed extended information set based on the query statement to find the most relevant information. Based on the matching results, the corresponding answer or suggestion is generated.

[0182] By extending the query information, the model can obtain more background and context information, so as to understand and answer the user's query more accurately. Extended information can provide more details and relevant knowledge, enrich the content and depth of the answer, and help users better understand and use the information. For complex or multifaceted queries, extended information can provide the necessary background and diverse perspectives, allowing the model to analyze and answer from multiple angles. Through more comprehensive and accurate answers, users' satisfaction and trust in the service or system are improved, and the user experience is enhanced.

[0183] In addition, the cosine similarity (CosSimEval) between the model-generated answers and the real answers, as well as Rouge-1, ROUGE-2, and Rouge-L are used as the main evaluation indicators, and the similarity is lower than the threshold The prediction is judged as wrong. The second evaluation index is as follows: for the most relevant top k texts retrieved from the extended document, the present invention adopts True Positives@k: the proportion of sentences related to the real situation in the top k contents. True Negative@k: the proportion of sentences irrelevant to the real situation in the bottom k contents. All indicators are as high as possible.

[0184] Implementation details: Filter the number of documents related to the original query information , retrieved from the similarity calculation The most relevant text is used as the extended query and concatenated with the original query. Evaluation index CosSimEval similarity is lower than the threshold It is judged as a prediction error.

[0185] Dataset: To verify the effectiveness of the model, this example conducts experiments on the 2wikimultihopQA dataset. The statistical results of the data are shown in Table 1.

[0186] Table 1. Dataset statistics

[0187]

[0188] Train-medium and train-hard are both training sets, but the difference is the difficulty of the questions. Dev and test represent the validation set and test set respectively.

[0189] Experimental results: Table 2 shows the impact of different prompts on the answers generated by the model. It can be found that the results generated by prompt3 are most similar to the real answers. Although simple prompts can also guide the model to generate useful answers, detailed and structured prompts can make the output of the model more in line with the standards. For example, it can avoid generating meaningless text and make the output language more professional. Therefore, the present invention recommends using detailed prompts in practical applications.

[0190] Table 2. The impact of different prompts on the answers generated by the model

[0191]

[0192] Table 3 shows the results of RTRAG on the 2wikimultihopQA validation set. It can be seen from the table that after adding the RTRAG component, the accuracy of the large language model's answers has been greatly improved. When the large language model is starling-lm-7b-alpha, after using RTRAG, ROUGE-1 improved by 17.30%, ROUGE-2 improved by 12.12%, and ROUGE-L improved by 11.05%. When the large language model is qwen1_5-14b-chat, the performance of using RTRAG improved by 24.68%, 20.63%, and 17.53%, respectively. The results show that when RTRAG is not used, the large language model can only answer questions based on its own knowledge, and the questions in 2wikimultihopQA are generally difficult, and it is difficult to answer them based on the knowledge of the large model itself. After using RTRAG to retrieve relevant knowledge from the entire network and input it into the large language model, the accuracy of the answer has been significantly improved.

[0193] Table 3. Results of RTRAG on the 2wikimultihopqa test set

[0194]

[0195] Table 4 shows the results of calculating similarity and ranking after using different text embedding models to convert small text segments in extended documents into embedding vectors, as well as the similarity results of the answers finally generated by the large language model. From the experimental results, it can be found that as the model dimension increases, the performance is improved. However, this is also accompanied by an increase in the time required to encode the extended document, which is a trade-off that must be considered while pursuing higher performance.

[0196] Table 4. Impact of different text embedding models on overall performance

[0197]

[0198] For example, there is the following original query information: "What are the recent advances in artificial intelligence technology?"

[0199] First, get the original query information: The original query information is "What are the recent advances in artificial intelligence technology?"

[0200] Enter into the search engine and get search results: Use the search engine to query the above questions and get a series of search results.

[0201] Text cleaning and sentence segmentation to obtain relevant documents: Perform text cleaning on the search results, remove noise information such as HTML tags and advertisements, and retain only the main text content. Divide the cleaned text into sentences and segment them according to Chinese and English punctuation marks to obtain a series of relevant documents.

[0202] Sparse retrieval and dense retrieval to obtain retrieval results: Use the TF-IDF algorithm to sort the relevant documents and find the documents most relevant to the original query information as candidate documents. Calculate the similarity between the candidate documents and the original query information, and further sort and filter them to obtain the final retrieval results.

[0203] Generate extended query information based on the original query information: Generate prompt words based on the original query information, such as "artificial intelligence technology", "technological progress", etc. Input these prompt words into a large language model (such as GPT-4) to generate further query reconstruction results.

[0204] Input the expanded query information into the large language model to generate answers: Input the generated expanded query information into the large language model, and the model generates the corresponding answers based on the input information and previous search results. The answer can be a piece of text, a set of links, or other information forms to answer the original query.

[0205] In summary, in response to the challenges of the prior art, this embodiment proposes a technical solution for multi-step content screening for real-time retrieval enhancement generation and pseudo-answer generation and document re-ranking based on a large language model. This technical solution first uses a search engine to retrieve relevant content in real time, improves retrieval accuracy through query reconstruction and masked word library construction, and then performs fine data cleaning and sentence division to obtain a relatively pure document set. Next, a preliminary screening is performed at the keyword level through sparse retrieval based on TF-IDF scores, and a context acquisition strategy based on a greedy algorithm and Jaccard deduplication technology are used to optimize extended documents. The large language model is then used to generate pseudo-answers related to the query, and the screening results are deeply optimized from a semantic level through intensive retrieval combined with the original query. Finally, the system intelligently selects the most relevant paragraphs as the core content of the extended query, and guides the large language model to generate the final answer through carefully designed prompt words. This method significantly improves the information processing capability and decision support efficiency of the industrial brain.

[0206] After a large number of experimental verifications, this technology effectively solves the shortcomings of existing retrieval systems in terms of real-time and accuracy, and significantly improves the performance and practicality of the retrieval system in the industrial brain. It is worth noting that although the experiments and examples of this embodiment are mainly based on the paper packaging industry, this method has wide applicability and scalability. As a typical manufacturing branch, the paper packaging industry has a complex supply chain structure and changing market demand, which provides an ideal verification platform for this technology. Through successful applications in this specific field, there is reason to believe that this method can be effectively extended to other industries and provide strong technical support for various industrial brain systems. The above-mentioned real-time retrieval enhancement generation method based on the industrial brain submits a request to the search engine through the original query information to obtain relevant search results, and then performs text processing and sorting on the search results to obtain candidate documents related to the original query. Then, a large language model is used to generate hypothetical documents, and the similarity between these hypothetical documents and the candidate documents is calculated to obtain the final retrieval results. Finally, the retrieval results are combined with the original query information, and the large language model is used again to generate extended query information, and finally the corresponding answers are generated, which effectively solves the shortcomings of the existing retrieval system in terms of real-time and accuracy, improves the performance and practicality of the retrieval system, and improves the retrieval accuracy and effectiveness in adapting to real-time changing information flows.

[0207] Figure 3 is a schematic block diagram of a real-time search enhancement generation device 300 based on an industrial brain provided by an embodiment of the present invention. Figure 3As shown, corresponding to the above-mentioned real-time search enhancement generation method based on the industrial brain, the present invention also provides a real-time search enhancement generation device 300 based on the industrial brain. The real-time search enhancement generation device 300 based on the industrial brain includes a unit for executing the above-mentioned real-time search enhancement generation method based on the industrial brain, and the device can be configured in a server. Specifically, please refer to Figure 3 The real-time retrieval enhancement generation device 300 based on the industrial brain includes an original query acquisition unit 301, a search unit 302, a cleaning and division unit 303, a screening unit 304, a retrieval unit 305, an expansion unit 306 and a generation unit 307.

[0208] The original query acquisition unit 301 is used to acquire the original query information; the search unit 302 is used to reconstruct the query according to the original query information and input it into the search engine to obtain the search results; the cleaning and division unit 303 is used to perform text cleaning and sentence division on the search results to obtain relevant documents; the screening unit 304 is used to sort the relevant documents and screen the documents related to the original query information to obtain candidate documents; the retrieval unit 305 is used to generate a hypothetical document by using a large language model for the original query information in combination with the prompt words, and calculate the similarity with the candidate documents after splicing the hypothetical document with the original query information and sorting them to obtain the retrieval result; the expansion unit 306 is used to combine the retrieval result with the original query information to obtain the extended query information; the generation unit 307 is used to input the extended query information into the large language model to generate the corresponding answer.

[0209] In one embodiment, the search unit 302 includes:

[0210] The reconstruction subunit is used to perform query reconstruction based on the original query information in combination with the large language model to obtain a query reconstruction result; the search subunit is used to input the query reconstruction result into a search engine for searching to obtain a search result;

[0211] In one embodiment, the reconstruction subunit comprises:

[0212] The prompt word generation module is used to generate prompt words according to the original query information; the query module is used to use the large language model to combine the original query information, the prompt words and the search skills of the search engine to perform query reconstruction to obtain the query reconstruction result.

[0213] In one embodiment, the cleaning division unit 303 includes:

[0214] The cleaning subunit is used to use a regular expression to set a masking word library, and use the masking word library to clean the search results to obtain a cleaning result; the identification subunit is used to identify and classify punctuation marks in the cleaning results; the division subunit is used to segment the Chinese sentences in the cleaning results according to Chinese punctuation marks, and use an avoidance function to process English punctuation marks, and then segment the English sentences in the cleaning results to obtain relevant documents.

[0215] In one embodiment, the division subunit is also used to pre-match English periods in abbreviations, URLs, email addresses and decimals using regular expressions, and replace them with special characters; segment the English sentences in the cleaning results according to the special characters, and restore the special characters to corresponding English periods after the English sentences are segmented.

[0216] In one embodiment, the screening unit 304 is used to sort the relevant documents using TF-IDF and screen the documents related to the original query information to obtain candidate documents;

[0217] In one embodiment, the screening unit 304 includes:

[0218] The sorting and filtering subunit is used to sort the relevant documents using TF-IDF and filter the relevant documents below a set threshold to obtain a filtering result; the context acquisition subunit is used to use a context acquisition strategy based on a greedy algorithm to combine the filtering result and the surrounding sentences corresponding to the filtering result to obtain a text; the deduplication subunit is used to calculate the degree of repetition between paragraphs of the text using Jaccard similarity to remove repeated content in the text to obtain a candidate document.

[0219] In one embodiment, the retrieval unit 305 includes:

[0220] A document generation subunit is used to generate a hypothetical document using a large language model according to the original query information combined with a prompt word; a splicing subunit is used to splice the hypothetical document with the original query information to form a splicing result; a conversion subunit is used to convert the candidate document and the splicing result into an embedding vector respectively; a calculation subunit is used to calculate the similarity between the vector corresponding to the candidate document and the vector corresponding to the splicing result; a reordering subunit is used to reorder according to the similarity, and screen the candidate documents that meet the requirements according to the reordering results to obtain the retrieval results.

[0221] In one embodiment, the calculation subunit is used to calculate the similarity between the vector corresponding to the candidate document and the vector corresponding to the concatenation result by using cosine similarity.

[0222] It should be noted that technical personnel in the relevant field can clearly understand that the specific implementation process of the above-mentioned real-time retrieval enhancement generation device 300 based on the industrial brain and each unit can refer to the corresponding description in the aforementioned method embodiment, and for the convenience and conciseness of the description, it will not be repeated here.

[0223] The above-mentioned real-time search enhancement generation device 300 based on the industrial brain can be implemented in the form of a computer program. The computer program can be used in Figure 4 Runs on the computer device shown.

[0224] See also Figure 4 , Figure 4 5 is a schematic block diagram of a computer device provided in an embodiment of the present application. The computer device 500 may be a server, wherein the server may be an independent server or a server cluster composed of multiple servers.

[0225] See also Figure 4 The computer device 500 includes a processor 502 , a memory and a network interface 505 connected via a system bus 501 , wherein the memory may include a non-volatile storage medium 503 and an internal memory 504 .

[0226] The non-volatile storage medium 503 can store an operating system 5031 and a computer program 5032. The computer program 5032 includes program instructions, and when the program instructions are executed, the processor 502 can execute a real-time retrieval enhancement generation method based on an industrial brain.

[0227] The processor 502 is used to provide computing and control capabilities to support the operation of the entire computer device 500 .

[0228] The internal memory 504 provides an environment for the operation of the computer program 5032 in the non-volatile storage medium 503. When the computer program 5032 is executed by the processor 502, the processor 502 can execute a real-time retrieval enhancement generation method based on the industrial brain.

[0229] The network interface 505 is used to communicate with other devices over the network. Figure 4 The structure shown in the figure is merely a block diagram of a portion of the structure related to the solution of the present application, and does not constitute a limitation on the computer device 500 to which the solution of the present application is applied. The specific computer device 500 may include more or fewer components than those shown in the figure, or combine certain components, or have a different arrangement of components.

[0230] The processor 502 is used to run the computer program 5032 stored in the memory to implement the following steps:

[0231] The original query information is obtained; the query is reconstructed according to the original query information and then input into the search engine to obtain search results; the search results are cleaned and divided into sentences to obtain relevant documents; the relevant documents are sorted, and documents related to the original query information are screened to obtain candidate documents; the original query information is combined with prompt words to generate a hypothetical document using a large language model, and the hypothetical document is spliced ​​with the original query information, and the similarity with the candidate document is calculated and sorted to obtain a retrieval result; the retrieval result is combined with the original query information to obtain an extended query information; the extended query information is input into the large language model to generate a corresponding answer.

[0232] The form of the prompt word includes at least one of generating an answer using provided document information, generating an answer by combining context information with own knowledge, and providing an answer according to query requirements, wherein the query requirements include associating the query with a specific document.

[0233] In one embodiment, when the processor 502 implements the step of reconstructing the query according to the original query information and then inputting it into the search engine to obtain search results, the processor 502 specifically implements the following steps:

[0234] The query is reconstructed according to the original query information in combination with the large language model to obtain a query reconstruction result; the query reconstruction result is input into a search engine for searching to obtain a search result.

[0235] In one embodiment, when the processor 502 implements the step of performing query reconstruction according to the original query information combined with the large language model to obtain a query reconstruction result, the processor 502 specifically implements the following steps:

[0236] Generate prompt words according to the original query information; and use a large language model to combine the original query information, the prompt words and the search skills of the search engine to perform query reconstruction to obtain a query reconstruction result.

[0237] In one embodiment, when the processor 502 implements the step of performing text cleaning and sentence segmentation on the search results to obtain relevant documents, the processor 502 specifically implements the following steps:

[0238] A regular expression is used to set a masked word library, and the masked word library is used to clean the search results to obtain a cleaned result; punctuation marks are identified and classified for the cleaned result; Chinese sentences in the cleaned result are segmented according to Chinese punctuation marks, and English punctuation marks are processed using an avoidance function, and then the English sentences in the cleaned result are segmented to obtain relevant documents.

[0239] In one embodiment, when the processor 502 implements the step of using the avoidance function to process English punctuation marks and then segmenting the English sentences in the cleaning result, the processor 502 specifically implements the following steps:

[0240] Regular expressions are used in advance to match the English periods in abbreviations, URLs, email addresses and decimals, and replaced with special characters; English sentences in the cleaning result are segmented according to the special characters, and after the English sentences are segmented, the special characters are restored to the corresponding English periods.

[0241] In one embodiment, when the processor 502 implements the step of sorting the relevant documents and screening the documents related to the original query information to obtain candidate documents, the processor 502 specifically implements the following steps:

[0242] The relevant documents are sorted using TF-IDF, and documents related to the original query information are screened to obtain candidate documents.

[0243] In one embodiment, when the processor 502 implements the step of sorting the relevant documents using TF-IDF and screening the documents related to the original query information to obtain candidate documents, the processor 502 specifically implements the following steps:

[0244] The related documents are sorted using TF-IDF, and related documents below a set threshold are filtered to obtain filtering results; a context acquisition strategy based on a greedy algorithm is used to combine the filtering results and surrounding sentences corresponding to the filtering results to obtain text; the repetition degree between paragraphs of the text is calculated using Jaccard similarity to remove repeated content in the text to obtain candidate documents.

[0245] In one embodiment, when the processor 502 implements the step of combining the original query information with the prompt word with a large language model to generate a hypothetical document, concatenating the hypothetical document with the original query information, calculating the similarity with the candidate documents and sorting them to obtain the search result, the following steps are specifically implemented:

[0246] Generate a hypothetical document using a large language model based on the original query information combined with the prompt word; splice the hypothetical document with the original query information to form a splicing result; convert the candidate document and the splicing result into embedded vectors respectively; calculate the similarity between the vector corresponding to the candidate document and the vector corresponding to the splicing result; reorder according to the similarity, and filter the candidate documents that meet the requirements according to the reordering result to obtain a retrieval result.

[0247] It should be understood that in the embodiment of the present application, the processor 502 may be a central processing unit (CPU), and the processor 502 may also be other general-purpose processors, digital signal processors (DSP), application-specific integrated circuits (ASIC), field-programmable gate arrays (FPGA) or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components, etc. Among them, the general-purpose processor may be a microprocessor or the processor may also be any conventional processor, etc.

[0248] It can be understood by those skilled in the art that all or part of the processes in the method for implementing the above embodiment can be completed by instructing the relevant hardware through a computer program. The computer program includes program instructions, and the computer program can be stored in a storage medium, which is a computer-readable storage medium. The program instructions are executed by at least one processor in the computer system to implement the process steps of the embodiment of the above method.

[0249] Therefore, the present invention also provides a storage medium. The storage medium may be a computer-readable storage medium. The storage medium stores a computer program, wherein when the computer program is executed by a processor, the processor executes the following steps:

[0250] The original query information is obtained; the query is reconstructed according to the original query information and then input into the search engine to obtain search results; the search results are cleaned and divided into sentences to obtain relevant documents; the relevant documents are sorted, and documents related to the original query information are screened to obtain candidate documents; the original query information is combined with prompt words to generate a hypothetical document using a large language model, and the hypothetical document is spliced ​​with the original query information, and the similarity with the candidate document is calculated and sorted to obtain a retrieval result; the retrieval result is combined with the original query information to obtain an extended query information; the extended query information is input into the large language model to generate a corresponding answer.

[0251] The form of the prompt word includes at least one of generating an answer using provided document information, generating an answer by combining context information with own knowledge, and providing an answer according to query requirements, wherein the query requirements include associating the query with a specific document.

[0252] In one embodiment, when the processor executes the computer program to implement the step of reconstructing the query based on the original query information and inputting it into the search engine to obtain search results, the processor specifically implements the following steps:

[0253] The query is reconstructed according to the original query information in combination with the large language model to obtain a query reconstruction result; the query reconstruction result is input into a search engine for searching to obtain a search result.

[0254] In one embodiment, when the processor executes the computer program to implement the step of performing query reconstruction based on the original query information in combination with the large language model to obtain a query reconstruction result, the processor specifically implements the following steps:

[0255] Generate prompt words according to the original query information; and use a large language model to combine the original query information, the prompt words and the search skills of the search engine to perform query reconstruction to obtain a query reconstruction result.

[0256] In one embodiment, when the processor executes the computer program to implement the step of performing text cleaning and sentence segmentation on the search results to obtain relevant documents, the processor specifically implements the following steps:

[0257] A regular expression is used to set a masked word library, and the masked word library is used to clean the search results to obtain a cleaned result; punctuation marks are identified and classified for the cleaned result; Chinese sentences in the cleaned result are segmented according to Chinese punctuation marks, and English punctuation marks are processed using an avoidance function, and then the English sentences in the cleaned result are segmented to obtain relevant documents.

[0258] In one embodiment, when the processor executes the computer program to implement the step of processing English punctuation marks using the avoidance function and then segmenting the English sentences in the cleaning result, the processor specifically implements the following steps:

[0259] Regular expressions are used in advance to match the English periods in abbreviations, URLs, email addresses and decimals, and replaced with special characters; English sentences in the cleaning result are segmented according to the special characters, and after the English sentences are segmented, the special characters are restored to the corresponding English periods.

[0260] In one embodiment, when the processor executes the computer program to implement the step of sorting the relevant documents and screening the documents related to the original query information to obtain candidate documents, the processor specifically implements the following steps:

[0261] The relevant documents are sorted using TF-IDF, and documents related to the original query information are screened to obtain candidate documents.

[0262] In one embodiment, when the processor executes the computer program to implement the step of sorting the relevant documents using TF-IDF and screening the documents related to the original query information to obtain candidate documents, the processor specifically implements the following steps:

[0263] The related documents are sorted using TF-IDF, and related documents below a set threshold are filtered to obtain filtering results; a context acquisition strategy based on a greedy algorithm is used to combine the filtering results and surrounding sentences corresponding to the filtering results to obtain text; the repetition degree between paragraphs of the text is calculated using Jaccard similarity to remove repeated content in the text to obtain candidate documents.

[0264] In one embodiment, when the processor executes the computer program to implement the steps of combining the original query information with the prompt word using a large language model to generate a hypothetical document, concatenating the hypothetical document with the original query information, calculating the similarity with the candidate documents and ranking them to obtain the search results, the processor specifically implements the following steps:

[0265] Generate a hypothetical document using a large language model based on the original query information combined with the prompt word; splice the hypothetical document with the original query information to form a splicing result; convert the candidate document and the splicing result into embedded vectors respectively; calculate the similarity between the vector corresponding to the candidate document and the vector corresponding to the splicing result; reorder according to the similarity, and filter the candidate documents that meet the requirements according to the reordering result to obtain a retrieval result.

[0266] The storage medium may be a USB flash drive, a mobile hard disk, a read-only memory (ROM), a magnetic disk, or an optical disk, etc., which are computer-readable storage media that can store program codes.

[0267] Those of ordinary skill in the art will appreciate that the units and algorithm steps of each example described in conjunction with the embodiments disclosed herein can be implemented in electronic hardware, computer software, or a combination of the two. In order to clearly illustrate the interchangeability of hardware and software, the composition and steps of each example have been generally described in terms of function in the above description. Whether these functions are performed in hardware or software depends on the specific application and design constraints of the technical solution. Professional and technical personnel can use different methods to implement the described functions for each specific application, but such implementation should not be considered to be beyond the scope of the present invention.

[0268] In the several embodiments provided by the present invention, it should be understood that the disclosed devices and methods can be implemented in other ways. For example, the device embodiments described above are only schematic. For example, the division of each unit is only a logical function division, and there may be other division methods in actual implementation. For example, multiple units or components can be combined or integrated into another system, or some features can be ignored or not executed.

[0269] The steps in the method of the embodiment of the present invention can be adjusted in order, combined and deleted according to actual needs. The units in the device of the embodiment of the present invention can be combined, divided and deleted according to actual needs. In addition, the functional units in the various embodiments of the present invention can be integrated into one processing unit, or each unit can exist physically separately, or two or more units can be integrated into one unit.

[0270] If the integrated unit is implemented in the form of a software functional unit and sold or used as an independent product, it can be stored in a storage medium. Based on this understanding, the technical solution of the present invention is essentially or the part that contributes to the prior art, or all or 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 and includes several instructions for a computer device (which can be a personal computer, terminal, or network device, etc.) to perform all or part of the steps of the method described in each embodiment of the present invention.

[0271] The above is only a specific embodiment of the present invention, but the protection scope of the present invention is not limited thereto. Any technician familiar with the technical field can easily think of various equivalent modifications or replacements within the technical scope disclosed by the present invention, and these modifications or replacements should be included in the protection scope of the present invention. Therefore, the protection scope of the present invention shall be based on the protection scope of the claims.

Claims

1. A real-time retrieval enhancement generation method based on the industrial brain, characterized in that: include: Get original query information; Reconstructing the query based on the original query information and inputting it into the search engine to obtain search results; Performing text cleaning and sentence segmentation on the search results to obtain relevant documents; Sorting the relevant documents and screening the documents related to the original query information to obtain candidate documents; The original query information is combined with the prompt word using a large language model to generate a hypothetical document. After the hypothetical document is spliced ​​with the original query information, the similarity with the candidate documents is calculated and sorted to obtain the retrieval results. Combining the search result with the original query information to obtain extended query information; Inputting the expanded query information into a large language model to generate a corresponding answer; The original query information is combined with the prompt word using a large language model to generate a hypothetical document, and the hypothetical document is spliced ​​with the original query information and then the similarity with the candidate documents is calculated and sorted to obtain the retrieval results, including: Generate a hypothetical document using a large language model based on the original query information combined with the prompt word; splicing the hypothetical document with the original query information to form a splicing result; Convert the candidate document and the concatenation result into embedding vectors respectively; Calculating the similarity between the vector corresponding to the candidate document and the vector corresponding to the concatenation result; Re-ranking is performed according to the similarity, and candidate documents meeting the requirements are screened according to the re-ranking result to obtain the retrieval result.

2. The real-time retrieval enhancement generation method based on industrial brain according to claim 1 is characterized in that: The query reconstruction based on the original query information is input into the search engine to obtain search results, including: Reconstructing the query based on the original query information in combination with the large language model to obtain a query reconstruction result; Inputting the query reconstruction result into a search engine for searching to obtain search results; The query reconstruction is performed according to the original query information in combination with the large language model to obtain a query reconstruction result, including: Generate prompt words according to the original query information; The query is reconstructed by using a large language model combined with the original query information, prompt words, and the search engine's search skills to obtain the query reconstruction result.

3. The real-time retrieval enhancement generation method based on industrial brain according to claim 1 is characterized in that: The text cleaning and sentence segmentation of the search results to obtain relevant documents includes: Using a regular expression, setting a masking word library, and using the masking word library to clean the search results to obtain a cleansing result; Recognizing and classifying punctuation marks on the cleaning results; The Chinese sentences in the cleaning result are segmented according to Chinese punctuation marks, and the English punctuation marks are processed by using an avoidance function, and then the English sentences in the cleaning result are segmented to obtain relevant documents.

4. The real-time retrieval enhancement generation method based on industrial brain according to claim 3 is characterized in that: The method of using the avoidance function to process English punctuation marks and then segmenting the English sentences in the cleaning result includes: Pre-use regular expressions to match periods in abbreviations, URLs, email addresses, and decimals, and replace them with special characters; The English sentences in the cleaning result are segmented according to the special characters, and when the English sentences are segmented, the special characters are restored to corresponding English periods.

5. The real-time retrieval enhancement generation method based on industrial brain according to claim 1 is characterized in that: The step of sorting the relevant documents and screening the documents relevant to the original query information to obtain candidate documents includes: The relevant documents are sorted using TF-IDF, and documents related to the original query information are screened to obtain candidate documents.

6. The real-time retrieval enhancement generation method based on industrial brain according to claim 5 is characterized in that: The method of sorting the relevant documents using TF-IDF and screening the documents related to the original query information to obtain candidate documents includes: Sort the relevant documents using TF-IDF, and filter relevant documents below a set threshold to obtain a filtering result; Using a context acquisition strategy based on a greedy algorithm, combining the filtering result and surrounding sentences corresponding to the filtering result to obtain text; The Jaccard similarity is used to calculate the degree of repetition between paragraphs of the text, so as to remove the repeated contents in the text and obtain candidate documents.

7. The real-time retrieval enhancement generation method based on industrial brain according to claim 1 is characterized in that: The prompt word may be in the form of generating an answer using provided document information, generating an answer by combining context information with own knowledge, or providing an answer according to a query requirement, wherein the query requirement includes associating a query with a specific document.

8. A real-time search enhancement generation device based on the industrial brain, characterized in that: An original query acquisition unit, used to acquire original query information; A search unit, configured to reconstruct a query based on the original query information and then input the query into a search engine to obtain search results; A cleaning and segmentation unit, used for performing text cleaning and sentence segmentation on the search results to obtain relevant documents; A screening unit, used to sort the relevant documents and screen the documents related to the original query information to obtain candidate documents; A retrieval unit is used to generate a hypothetical document by combining the original query information with the prompt word using a large language model, and then the hypothetical document is spliced ​​with the original query information, and the similarity with the candidate documents is calculated and sorted to obtain the retrieval result; An expansion unit, used to combine the search result with the original query information to obtain expanded query information; A generating unit, configured to input the expanded query information into a large language model to generate a corresponding answer; The retrieval unit comprises: A document generation subunit is used to generate a hypothetical document using a large language model according to the original query information combined with a prompt word; a splicing subunit is used to splice the hypothetical document with the original query information to form a splicing result; a conversion subunit is used to convert the candidate document and the splicing result into an embedding vector respectively; a calculation subunit is used to calculate the similarity between the vector corresponding to the candidate document and the vector corresponding to the splicing result; a reordering subunit is used to reorder according to the similarity, and screen the candidate documents that meet the requirements according to the reordering results to obtain the retrieval results.

9. A computer device, characterized in that: The computer device comprises a memory and a processor, wherein a computer program is stored in the memory, and when the processor executes the computer program, the method according to any one of claims 1 to 7 is implemented.