Wine field knowledge multipath retrieval enhancement generation method

By employing multi-path retrieval methods and compression models, the problems of insufficient accuracy and recall in knowledge retrieval in the wine field were solved, enabling efficient and accurate knowledge base construction and answer generation.

CN120910187APending Publication Date: 2025-11-07BEIFANG UNIV OF NATITIES
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202510825427.3
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2025-06-19
Publication Date
2025-11-07

AI Technical Summary

Technical Problem

Existing knowledge retrieval methods in the wine industry suffer from insufficient accuracy and recall when faced with complex knowledge structures and technical terms, making it difficult to comprehensively cover user questions and knowledge bases.

Method used

By employing a multi-path retrieval method that combines sparse retrieval, graph retrieval, and dense retrieval, a diversified knowledge base for the wine field is constructed. Furthermore, the accuracy and recall of retrieval results are improved through re-ranking and compression models, ultimately generating high-quality answers.

Benefits of technology

It significantly improves the accuracy and recall rate of information retrieval in the wine knowledge base, generates higher quality answers, and can more comprehensively capture users' query intent while reducing interference from irrelevant information.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN120910187A_ABST
    Figure CN120910187A_ABST
Patent Text Reader

Abstract

The invention discloses a multi-path retrieval enhancement generation method for wine field knowledge. The method comprises the following steps: acquiring a knowledge document and segmenting the knowledge document into semantic independent text blocks; extracting data from the text blocks to construct a wine field knowledge base; questioning by means of the wine field knowledge base, and expanding user questions into multiple parallel questions; multi-path retrieval is carried out on the parallel questions, and TopK text blocks are obtained from each retrieval path; reordering all the retrieved text blocks by using a reordering model, and selecting TopN text blocks; compressing the reordered text block contents by using a compression model, extracting core contents, and organizing the core contents into context contents; and transmitting the user question and the context content to a large language model LLM to generate a final answer. According to the method, unique advantages of different retrieval modes are brought into full play, the retrieval precision and recall rate are greatly improved, meanwhile, key steps such as user question extension, reordering and compression are supplemented, and the quality and accuracy of generated answers are greatly improved.
Need to check novelty before this filing date? Find Prior Art

Description

TECHNICAL FIELD

[0001] The present application relates to the technical field of domain knowledge retrieval enhancement generation, and particularly to a wine domain knowledge multi-path retrieval enhancement generation method. BACKGROUND

[0002] The implementation of domain knowledge retrieval enhancement generation mainly includes a template matching based method, a semantic parsing based method and a representation learning based method. The template matching based method constructs strict problem templates for specific knowledge domains and user questions, and then generates query expressions by template matching to further generate final answers, but the performance depends on the number of templates, and it is difficult to comprehensively cover user questions and knowledge bases. The semantic parsing based method obtains semantic information by parsing user questions, converts user questions into logical forms and further generates structured queries, so as to query and obtain answers in a knowledge base, but the cascade error of semantic parsing may reduce the accuracy of answers. The representation learning based method embeds knowledge bases and user questions into a continuous low-dimensional vector space, and can quickly realize knowledge reasoning by calculating a corresponding score function, which is the mainstream technology of current intelligent question answering research. In recent years, many research institutions and scholars have made extensive expansion and improvement on related technologies based on the representation learning method, but the retrieval of domain knowledge is mainly realized through a single retrieval path. Although the precision and recall rate of retrieval results are improved to a certain extent through optimization of knowledge structure and other strategies, the performance is still insufficient when facing complex knowledge structure, numerous professional terms and detailed wine domain knowledge. SUMMARY

[0003] The purpose of the present application is to overcome the shortcomings and deficiencies of the prior art, and to provide a wine domain knowledge multi-path retrieval enhancement generation method, which can utilize sparse retrieval, graph retrieval and dense retrieval through diversified retrieval structures, and can perform parallel retrieval by comprehensively utilizing the three paths, so as to fully exert the unique advantages of different retrieval methods, obtain related knowledge from multiple dimensions, greatly broaden the vision of information retrieval, greatly improve the precision and recall rate of retrieving related context content from a wine domain knowledge base, and at the same time, assist in user question expansion, reordering, compression and other key steps, and greatly improve the quality of the finally generated answers.

[0004] To achieve the above purpose, the technical scheme provided by the present application is as follows: a wine domain knowledge multi-path retrieval enhancement generation method, comprising the following steps:

[0005] S1: obtaining knowledge documents of the wine domain, and preprocessing the knowledge documents to divide them into text blocks with uniform format and independent semantics;

[0006] S2: Data analysis is performed on the segmented text blocks, knowledge data is accurately extracted, and diversified storage is performed, thereby constructing a wine field knowledge base;

[0007] S3: With the help of the constructed wine field knowledge base, the user makes related inquiries, and to ensure a comprehensive understanding of the user's inquiry intention, the user's inquiry is expanded in multiple angles and multiple levels to form multiple parallel inquiries with similar semantics;

[0008] S4: For the multiple parallel inquiries formed by expansion, relevant knowledge is retrieved in the constructed wine field knowledge base. In order to broaden the vision of knowledge retrieval, a multi-path retrieval method is proposed, that is, three paths of sparse retrieval, graph retrieval and dense retrieval are integrated for parallel retrieval, and the unique advantages of different retrieval paths are fully utilized to realize multi-dimensional knowledge acquisition. Among them, the graph retrieval is good at processing structured knowledge and can provide interrelated retrieval results. The dense retrieval uses a pre-trained model to realize semantic matching and can capture deep semantics. Sparse retrieval has high efficiency advantage when dealing with large-scale or massive knowledge. Using the multi-path retrieval method can effectively improve the accuracy and recall rate of the retrieval stage. Finally, the TopK text blocks with the highest score are retrieved from each path;

[0009] S5: Use the open source reordering model to comprehensively evaluate the multiple text blocks retrieved from the three paths, and then accurately sort them. Then, from these re-ordered text blocks, select the TopN text blocks with the highest relevance score;

[0010] S6: Modify the normalization block in the general language model part layer from the original layer normalization algorithm to the arctangent algorithm, reduce the calculation of input sample mean and variance, achieve the effect of improving quality and increasing speed, then perform instruction fine-tuning training on the modified general language model to obtain a compressed model, and then use the compressed model to perform more detailed content screening on the TopN text blocks obtained after reordering. Extract the most core content in each text block that is most relevant to the user's inquiry, and organize these extracted content into the final context content;

[0011] S7: Deeply integrate the user's inquiry with the context content obtained after compression, and then pass them together to the large language model LLM to generate the final answer.

[0012] Further, in step S1, the collected open-source knowledge documents in the field of wine, including scientific papers, review articles, technical reports, national standards, local standards of provinces and regions, and classic works, are screened according to the indexes of authority, timeliness, practicality and contribution, and only high-quality knowledge documents are retained; then the retained knowledge documents are preprocessed: segmentation and standardization. Through segmentation, the knowledge documents are decomposed into smaller, semantically independent units, and standardization ensures the uniformity of documents from different sources in format. After preprocessing, the knowledge documents are converted into text blocks with uniform format and independent semantics.

[0013] Further, the specific operation steps of step S2 are as follows:

[0014] S21: Use Jieba segmentation tool to accurately segment and extract word units from text blocks, and then calculate the TF-IDF score of each word unit through BM25 algorithm to generate a statistical dictionary that can accurately reflect the focus of text content, and add detailed metadata to the statistical dictionary, including specific content of text blocks, document name and page information, to form a complete information dictionary, and then use these full information dictionaries to build a PKL file library;

[0015] S22: Use embedding model to accurately vectorize the text blocks, convert complex semantic information into numerical form, and form embedding vectors suitable for efficient processing by computers, and then use these embedding vectors to build a vector database;

[0016] S23: Use LLM to extract knowledge tuples from text blocks, and add detailed metadata and embedding vectors corresponding to text blocks to the knowledge tuples to form full information tuples containing all key information, and then use these full information tuples to build a knowledge graph;

[0017] After steps S21-S23, the knowledge data in the text blocks is stored in the PKL file library, the vector database and the knowledge graph in three different data structures, which complement each other and together constitute a comprehensive and efficient knowledge base in the field of wine.

[0018] Further, in step S3, the semantic information of the user's question and the potential related knowledge points are considered comprehensively, and the user's question is expanded in multiple angles and multiple levels, including question restatement, synonym replacement and question refinement, to form multiple parallel questions with similar semantics, so as to more comprehensively and accurately capture the user's questioning intention.

[0019] Further, the specific operation steps of step S4 are as follows:

[0020] S41: Sparse retrieval shoulders the heavy task of efficient retrieval in multi-path retrieval. BM25 algorithm is adopted. For multiple parallel questions formed by expansion, word frequency information is used for retrieval. The BM25 scores of each question and each text block in the PKL file library constructed in step S21 are quickly calculated. Then all text blocks are sorted, and the TopK text blocks with the highest scores are quickly extracted;

[0021] S42: Graph retrieval plays a role in processing structured knowledge in multi-path retrieval. Multiple parallel questions formed by expansion are analyzed in detail. Entities and relationships are extracted as much as possible. A series of triples are constructed, which can accurately depict the interaction and connection between entities. Then, these triples are used for accurate retrieval in the knowledge graph constructed in step S23 to obtain full information tuples directly related to user questions, including text block specific content and its corresponding embedding vector. Then, the similarity scores between the embedding vectors of all retrieved text blocks and the embedding vector of the user question are calculated. If these similarity scores exceed the pre-set threshold score_threshold, it indicates that the retrieved text blocks are sufficient to meet the demand, and the TopK text blocks with the highest similarity scores are directly retained.

[0022] S43: Dense retrieval is a key component responsible for semantic understanding in multi-path retrieval. If the similarity scores calculated in step S42 do not reach the pre-set threshold score_threshold, search will continue in the vector database constructed in step S22 for multiple parallel questions formed by expansion. The similarity scores between the embedding vectors of each question and the embedding vectors of all text blocks in the vector database are calculated to find the most relevant text blocks for each question. The TopK text blocks with the highest similarity scores are retained.

[0023] Further, in step S5, an open-source reordering model with deep text understanding capability is used to comprehensively evaluate the multiple text blocks retrieved from the three paths, and then accurately sort them to ensure that the most relevant and most informative content is presented first, and irrelevant or redundant parts are naturally filtered out. Then, from these reordered text blocks, the TopN text blocks with the highest relevance are selected.

[0024] Further, the specific operation steps of step S6 are as follows:

[0025] S61: Modify the normalization block in the general language model glm-large-chinese partial layer from the original layer normalization LayerNorm algorithm to the arctangent Arctangent algorithm. The original LayerNorm algorithm relies on mean and variance to achieve normalization effect. When there are extreme values in the input sample, the mean and variance will be biased, resulting in unstable normalization effect. Moreover, calculating the mean and variance of the input sample will produce a large computational overhead, slowing down the model speed. The Arctangent algorithm can directly compress extreme values through nonlinear mapping, effectively reducing the influence of extreme values on the model, and does not need to calculate the mean and variance of the input sample, which can effectively improve the model speed. The Arctangent algorithm is as follows:

[0026]

[0027] In the formula, x represents the input of the Arctangent algorithm, which is a multi-dimensional tensor, ArcT(x) represents the calculation result of the Arctangent algorithm on the input x, which is also a multi-dimensional tensor, W and B represent the weight and bias respectively, both of which are vector parameters, π represents the circular constant, arctan() represents the arctangent function, and a represents the scaling factor, which is a scalar parameter that can be learned during training.

[0028] S62: For the glm-large-chinese model modified in step S61, use wine domain knowledge data to perform instruction fine-tuning training, so that it can obtain context compression capability while improving quality and speed, and obtain a compression model.

[0029] S63: Use the compression model obtained in step S62 to perform more detailed content screening on the TopN text blocks obtained after step S5 reordering, extract the most core content in each text block that is most relevant to the user's question, and organize these extracted content into the final context content.

[0030] Further, in step S7, the user's question is deeply integrated with the context content obtained after step S6 compression, and then through a carefully designed prompt word framework, it is transmitted to the open source LLM to generate the final answer.

[0031] Compared with the prior art, the present application has the following advantages and beneficial effects:

[0032] 1. The present application designs a domain knowledge base construction route, fully utilizes the respective advantages of PKL file library, vector database and knowledge graph, and performs all-round analysis and structured storage on the complex knowledge in the wine field, with high integration degree and fast response speed.

[0033] 2. This invention proposes a multi-path retrieval method, which comprehensively utilizes three paths—sparse retrieval, graph retrieval, and dense retrieval—for parallel retrieval. This fully leverages the unique advantages of different retrieval methods, acquires relevant knowledge from multiple dimensions, greatly broadens the scope of information retrieval, and significantly improves the accuracy and recall of retrieval.

[0034] 3. This invention replaces the layer normalization algorithm in a portion of the layers of the general language model with the arctangent algorithm, and uses wine domain knowledge data to fine-tune and train it to obtain a compression model that improves quality and speed. This model is used to compress multi-path retrieval results quickly and accurately, which can significantly shorten the length of the context content passed to the LLM, reduce the interference of irrelevant information, and greatly improve the quality and accuracy of the LLM-generated answers.

[0035] In summary, this invention can significantly improve the quality of the contextual content passed to the LLM by constructing a diversified knowledge base in the wine field, using multi-path retrieval methods, and fine-tuning the training compression model to compress the retrieval results, thereby improving the final result generation. Attached Figure Description

[0036] Figure 1 This is a framework diagram of the method of the present invention.

[0037] Figure 2 Build a roadmap for the domain knowledge base.

[0038] Figure 3 A framework diagram generated for multi-path retrieval and enhancement.

[0039] Figure 4 This is a diagram illustrating multi-path retrieval. Detailed Implementation

[0040] The present invention will be further described in detail below with reference to the embodiments and accompanying drawings, but the embodiments of the present invention are not limited thereto.

[0041] like Figure 1 As shown in the figure, this embodiment discloses an enhanced generation method for multi-path retrieval of knowledge in the wine field, the specific details of which are as follows:

[0042] 1) Knowledge document acquisition and preprocessing:

[0043] The collected open-source scientific papers, review articles, technical reports, national standards, provincial and regional local standards, and classic works in the wine field are screened according to indicators such as authority, timeliness, practicality, and contribution, retaining only high-quality knowledge documents. Then, the retained knowledge documents undergo segmentation and standardization preprocessing to transform them into uniformly formatted and semantically independent text blocks. This includes the following steps:

[0044] 1.1) Knowledge document acquisition:

[0045] Through platforms such as Web of Science, CNKI, and IEEE Xplore, open-source scientific papers, review articles, and technical reports were collected. National and local standards were obtained from the National Standard Information Public Service Platform, the National Group Standard Information Platform, and the Local Standard Information Service Platform. Classic works from Dangdang, CNKI, Amazon, and Google Books were also collected. These knowledge documents cover various fields such as wine brewing, production, tasting, quality, production area, industry, market, and viticulture. Then, strict screening criteria were set for the knowledge documents. In terms of authority, only journal articles with an impact factor greater than 3.0 in comprehensive fields such as agriculture and food science were retained. For specialized journals in the wine field, the standard was appropriately relaxed, and articles with an impact factor above 1.5 were selected. In terms of timeliness, articles published within the past five years were prioritized, and classic theories or long-term effective content were appropriately relaxed in terms of time restrictions. In terms of practicality, articles that directly guide actual production, scientific research, or education were emphasized, and articles that are overly theoretical or lack practical value were excluded. Finally, through the LLM model based on summaries and article contributions, articles with little significance to the construction of the knowledge base were excluded, and only high-quality knowledge documents were retained.

[0046] 1.2) Knowledge document preprocessing:

[0047] As shown in Figure 2 , during the document preprocessing stage, the selected knowledge documents were segmented and standardized. Segmentation allows long documents to be broken down into smaller, meaningful units, facilitating subsequent operations and analysis. Standardization ensures consistency in format across different sources, making information entry more standardized and readable. After this stage, the knowledge documents are transformed into text blocks with uniform format and independent semantics, laying the foundation for subsequent data analysis.

[0048] 2) Data analysis and knowledge base construction:

[0049] As shown in Figure 2 , during the data analysis stage, a series of diversified analysis strategies were used to process the text blocks to ensure that the knowledge data contained in the text blocks could be deeply analyzed and accurately extracted. During the knowledge base construction stage, the refined knowledge data was orderly integrated and stored in three different data structures: PKL file library, vector database, and knowledge graph, collectively forming a comprehensive and efficient knowledge base in the field of wine. The process includes the following steps:

[0050] 2.1) Use the Jieba word segmentation tool to accurately segment and extract word units from the text block, and then calculate the TF-IDF score of each word unit through the BM25 algorithm to generate a statistical dictionary that accurately reflects the focus of the text content. Add detailed metadata to the statistical dictionary, including the specific content of the text block, the name of the document it belongs to, and the page number, etc. Form a complete "full information dictionary", and then use these "full information dictionaries" to build a PKL file library.

[0051] 2.2) Use the embedded model BAAI / bge-large-zh-v1.5 to accurately vectorize the text block, converting complex semantic information into numerical form, forming embedded vectors suitable for efficient computer processing. This process not only ensures the accuracy of information during storage and flow, but also maximizes the preservation of deep meanings and contextual details in the text. The original semantics of the text block will be captured and compressed into high-dimensional embedded vectors, and then these embedded vectors will be used to build a vector database.

[0052] 2.3) Use LLM to extract knowledge tuples from the text block, and add detailed metadata and embedded vectors corresponding to the text block to the knowledge tuples to form "full information tuples" containing all key information. Then use these "full information tuples" to build a knowledge graph, which will construct more than 320,000 related data.

[0053] 2.4) After the above steps, the knowledge data in the text block is stored in three different data structures: PKL file library, vector database, and knowledge graph. The knowledge graph provides an intuitive representation of complex relationships between knowledge due to its powerful semantic network and association analysis capabilities. The vector database realizes fast retrieval and similarity matching of knowledge through vector representation in high-dimensional space. The PKL file library ensures fast access to knowledge. The three work together to form a comprehensive and efficient knowledge base in the field of wine.

[0054] 3) Preprocessing:

[0055] For example, Figure 3As shown, the pre-processing stage will comprehensively consider the semantic information of the user's question and the potential related knowledge points, and according to the preset expansion parameter extend_num = 2, the user's question is expanded in multiple angles and multiple levels to ensure a comprehensive understanding of the user's question intention. The specific expansion methods include: question restatement, converting the user's question into different expressions to cover a wider range of possible search words and phrases; synonym replacement, identifying and replacing the keywords in the question with their synonyms to ensure that relevant information can be matched; question refinement, splitting the user's question into more specific sub-questions for retrieval from different angles, etc. Through the above multi-level expansion methods, extend_num semantic similar parallel questions will be formed to more comprehensively and accurately capture the user's question intention.

[0056] 4) Multi-path retrieval:

[0057] For the multiple parallel questions formed by expansion, relevant knowledge is retrieved in the constructed wine field knowledge base. In order to broaden the vision of knowledge retrieval, a multi-path retrieval method is proposed, such as Figure 4 As shown, sparse retrieval, graph retrieval and dense retrieval are integrated for parallel retrieval to fully utilize the unique advantages of different retrieval paths to achieve multi-dimensional knowledge acquisition. Graph retrieval is good at processing structured knowledge and can provide interrelated retrieval results. Dense retrieval uses pre-trained models to achieve semantic matching and can capture deep semantics. Sparse retrieval has high efficiency advantage when dealing with large-scale or massive knowledge. Using the multi-path retrieval method can effectively improve the accuracy and recall rate of the retrieval stage. Finally, the top K = 3 text blocks with the highest scores will be retrieved from each retrieval path. It includes the following steps:

[0058] 4.1) Sparse retrieval shoulders the heavy responsibility of efficient retrieval in multi-path retrieval. BM25 algorithm is used to retrieve each question using basic term frequency information, which can quickly calculate the BM25 score of the question and each text block in the PKL file library, and then sort all text blocks to quickly extract the top K text blocks with the highest scores.

[0059] 4.2) The atlas retrieval plays a role in processing structured knowledge in multi-path retrieval, carefully analyzing each question, extracting entities and relationships as much as possible, and then constructing a series of triples that can accurately depict the interaction and connection between entities. Then use these triples to accurately search in the knowledge graph to obtain "full information tuples" directly related to the user's question, which includes the specific content of the text block and its corresponding embedding vector. Then calculate the similarity scores between all retrieved text block embedding vectors and the user's question embedding vector. If the similarity scores exceed the pre-set threshold score_threshold = 0.85, it means that the retrieved text blocks are sufficient to meet the demand, and dense retrieval will not be performed. Directly retain the TopK text blocks with the highest similarity scores;

[0060] 4.3) Dense retrieval is a key component responsible for semantic understanding in multi-path retrieval. If the similarity score calculated in the atlas retrieval does not reach the pre-set threshold, it will continue to search in the vector database for the question, calculate the similarity scores between the question's embedding vector and all text block embedding vectors in the vector database, find the most relevant text blocks to the question, and retain the TopK text blocks with the highest similarity scores.

[0061] 5) Reordering:

[0062] As shown in Figure 3 , in the post-processing stage, the open-source reordering model BAAI / bge-reranker-large with deep text understanding ability is used to comprehensively evaluate the 3xTopKx(extend_num+1) = 27 text blocks retrieved from the three retrieval paths for the expansion of the multiple parallel questions, and then accurately rank them to ensure that the most relevant and most informative content is presented first, and irrelevant or redundant parts are naturally filtered out. Then select the TopN = 6 text blocks with the highest relevance from these reordered text blocks.

[0063] 6) Compression:

[0064] The normalization block in the general language model part layer is modified from the original layer normalization algorithm to the arctangent algorithm, reducing the calculation of input sample mean and variance, achieving the effect of improving quality and increasing speed. Then the modified general language model is fine-tuned to obtain a compressed model, and then the compressed model is used to perform more detailed content filtering on the TopN text blocks obtained after reordering, as shown in Figure 3 , extract the most core content in each text block that is most relevant to the user's question, and organize these extracted content into the final context content. It includes the following steps:

[0065] 6.1) Modify the input_layernorm block and post_attention_layernorm block in the last 12 layers of the general language model glm-large-chinese from the original layer normalization LayerNorm algorithm to the arctangent Arctangent algorithm. The original LayerNorm algorithm relies on mean and variance to achieve normalization effect. When there are extreme values in the input sample, the mean and variance will be pulled off, resulting in unstable normalization effect. Moreover, calculating the mean and variance of the input sample will produce a large computational overhead, slowing down the model speed. The Arctangent algorithm can directly compress extreme values through nonlinear mapping, effectively reducing the impact of extreme values on the model, and does not need to calculate the mean and variance of the input sample, which can effectively improve the model speed. The Arctangent algorithm is as follows:

[0066]

[0067] In the formula, x represents the input of the Arctangent algorithm, which is a multi-dimensional tensor, ArcT(x) represents the calculation result of the Arctangent algorithm on the input x, which is also a multi-dimensional tensor, W and B represent the weight and bias respectively, both of which are vector parameters, π represents the circular constant, arctan() represents the inverse tangent function, and α represents the scaling factor, which is a scalar parameter that can be learned during training.

[0068] 6.2) For the glm-large-chinese model modified in structure, use wine domain knowledge data to conduct instruction fine-tuning training, so that it can obtain the ability of context compression while improving quality and speed, and obtain a compression model compress-Wine.

[0069] 6.3) Use the compression model compress-Wine to perform more detailed content screening on the TopN text blocks obtained after reordering, extract the most core content in each text block that is most relevant to the user's question, and organize these extracted content into the final context content.

[0070] 7) Answer generation:

[0071] As Figure 3 shown, the user's question is deeply integrated with the context content obtained after compression, and then through the well-designed prompt word framework, it is passed to the open source LLM, such as GLM-4, to generate the final answer.

[0072] The multi-path retrieval enhancement generation method of the wine field knowledge described above in this embodiment is called MPRAG. To verify the effectiveness of the method, the context precision (CP), context relevancy (CR), context recall, answer similarity (AS), answer relevancy (AR), faithfulness (F), and answer correctness (AC) in the RAGAS evaluation framework are used as evaluation indicators. Performance comparison analysis was conducted with multiple open-source retrieval enhancement generation methods such as llm-graph-builder (LGB), DBGPT, and RAGflow on the self-built question and answer test dataset Wine (as shown in Table 1), and the experimental results are shown in Table 2.

[0073] Table 1 Dataset Wine Question Category Statistics

[0074]

[0075] Table 2 Experimental Results Analysis Table

[0076]

[0077] The experimental results can fully prove the effectiveness of the method. By expanding the user's question, the user's query intention can be captured more comprehensively and accurately. Using multi-path retrieval can take advantage of the complementary advantages of the three retrieval paths, achieving a better balance between knowledge association, semantic understanding, and retrieval efficiency. The main role of these two steps is to expand the retrieval range, thereby improving the recall rate of retrieval. Using reordering can accurately evaluate the degree of fit between each retrieved text block and the user's question, ensuring that the selected text block can establish a deep association with the user's question. Compression can significantly reduce the length of the context content passed to the LLM, thereby reducing the interference of irrelevant information. These two steps can effectively enhance the precision of retrieval by refining the retrieved context content. Through the above steps, the quality of the context content passed to the LLM can be significantly improved, thereby making the answer generated by the LLM more accurate.

[0078] Experimental conclusion: in view of the problem that the method of using a single retrieval path to realize the retrieval of domain knowledge performs poorly in the face of complex knowledge structure, numerous professional terms and complex process details of the wine domain knowledge, the wine domain knowledge multi-path retrieval enhancement generation method is provided. The performance comparison experiment results on the self-built question and answer test data set Wine show that the use of the method has obvious improvement on the retrieval accuracy and recall rate, and the quality of the finally generated answer is better than that of the prior art. In the follow-up research, the adaptive selection mechanism based on the semantic information of the user's question will be explored to further improve the retrieval strategy, which has good application prospect and is worth promoting.

[0079] The above embodiments are preferred embodiments of the present application, but the embodiments of the present application are not limited to the above embodiments, and any changes, modifications, substitutions, combinations, simplifications made without departing from the spirit and principles of the present application should be equivalent replacement methods, which are all included in the protection scope of the present application.

Claims

1. A method for generating multi-path search enhancement of knowledge in the field of wine, characterized in that, Comprise the following steps: S1: acquire the knowledge documents in the field of wine, and pre-process the knowledge documents, and cut into text blocks with uniform format and independent semantics; S2: data analysis is performed on the cut-out text blocks, and the knowledge data therein is accurately extracted and diversified stored, so as to build a wine field knowledge base; S3: with the help of the built wine field knowledge base, the user makes related inquiries, in order to ensure the comprehensive understanding of the user's inquiry intention, the user's inquiry is expanded in multiple angles and multiple levels, forming multiple parallel inquiries with similar semantics; S4: for the multiple parallel inquiries formed by expansion, search related knowledge in the built wine field knowledge base, in order to broaden the vision of knowledge search, a multi-path search method is proposed, that is, integrating sparse search, graph search and dense search three paths for parallel search, giving full play to the unique advantages of different search paths to realize multi-dimensional knowledge acquisition, among them, the graph search is good at processing structured knowledge, and can provide interrelated search results, the dense search uses pre-training model to realize semantic matching, and can capture deep semantic, the sparse search has high efficiency advantage when dealing with large-scale or massive knowledge, using the multi-path search method can effectively improve the accuracy and recall rate of the search stage, finally the TopK text blocks with the highest score are searched from each path; S5: use the open source reordering model to comprehensively evaluate the multiple text blocks retrieved from the three paths, and then accurately sort, and then select the TopN text blocks with the highest relevance score from these re-ordered text blocks; S6: modify the normalization block in the general language model part layer from the original layer normalization algorithm to the arctangent algorithm, reduce the calculation of input sample mean and variance, realize the effect of improving quality and increasing speed, then perform instruction fine-tuning training on the modified general language model to obtain a compressed model, and then use the compressed model to perform more detailed content screening on the TopN text blocks obtained after reordering, extract the most core content in each text block that is most relevant to the user's inquiry, and organize these extracted content into the final context content; S7: deeply fuse the user's inquiry with the context content obtained after compression, and then pass them to the large language model LLM together to generate the final answer.

2. The method of claim 1, wherein, In step S1, the collected open source knowledge documents in the field of wine, including scientific papers, review articles, technical reports, national standards, local standards of provinces and regions, and classic works, are screened according to the indexes of authority, timeliness, practicality and contribution, and only high-quality knowledge documents are retained; then the retained knowledge documents are pre-processed: cutting and standardization, through cutting, the knowledge documents are decomposed into smaller, semantically independent units, and standardization ensures the uniformity of documents from different sources in format, after pre-processing, the knowledge documents are converted into text blocks with uniform format and independent semantics.

3. The method of claim 2, wherein the method further comprises: The specific operation steps of step S2 are as follows: S21: Use Jieba word segmentation tool to accurately segment and extract word units from the text block, then calculate the TF-IDF score of each word unit using the BM25 algorithm, generate a statistical dictionary that accurately reflects the focus of the text content, and attach detailed metadata to the statistical dictionary, including the specific content of the text block, the name of the document it belongs to, and the page number information, forming a complete full-information dictionary, then use these full-information dictionaries to build a PKL file library; S22: Use the embedding model to accurately vectorize the text block, convert complex semantic information into numerical form, and form embedding vectors suitable for efficient computer processing, then use these embedding vectors to build a vector database; S23: Use LLM to extract knowledge tuples from the text block, and attach detailed metadata and embedding vectors corresponding to the text block to the knowledge tuples, forming full-information tuples containing all key information, then use these full-information tuples to build a knowledge graph; After steps S21-S23, the knowledge data in the text block is stored in the PKL file library, vector database and knowledge graph in three different data structures, which complement each other and together form a comprehensive and efficient knowledge base in the field of wine.

4. The method of claim 3, wherein, In step S3, the semantic information of the user's question and the potential related knowledge points are considered comprehensively, and the user's question is expanded in multiple angles and multiple levels, including question restatement, synonym replacement and question refinement, to form multiple parallel questions with similar semantics, so as to more comprehensively and accurately capture the user's question intention.

5. The method of claim 4, wherein, The specific operation steps of step S4 are as follows: S41: Sparse retrieval plays an important role in efficient retrieval in multi-path retrieval, using BM25 algorithm, for the multiple parallel questions formed by expansion, using word frequency information for retrieval, quickly calculating the BM25 score of each question and each text block in the PKL file library constructed in step S21, and then sorting all text blocks to quickly extract the TopK text blocks with the highest score; S42: Graph retrieval plays a role in processing structured knowledge in multi-path retrieval, carefully analyzing the multiple parallel questions formed by expansion, and extracting entities and relationships as much as possible, then constructing a series of triples that can accurately depict the interaction and connection between entities, then using these triples to perform accurate retrieval in the knowledge graph constructed in step S23, obtaining full-information tuples related to the user's question, including the specific content of the text block and its corresponding embedding vector, then calculating the similarity scores between the embedding vectors of all retrieved text blocks and the embedding vector of the user's question, if these similarity scores exceed the pre-set threshold score_threshold, it indicates that the retrieved text blocks are sufficient to meet the demand, and the TopK text blocks with the highest similarity scores are directly retained; S43: Dense retrieval is a key component of multi-path retrieval responsible for semantic understanding. If the similarity score calculated in step S42 does not reach the pre-set threshold score_threshold, a plurality of parallel questions formed by expansion will be searched in the vector database constructed in step S22, and the similarity scores between the embedding vectors of each question and the embedding vectors of all text blocks in the vector database will be calculated to find the most relevant text blocks for each question, and the TopK text blocks with the highest similarity scores will be retained.

6. The method of claim 5, wherein the method further comprises: In step S5, the open-source reordering model with deep text understanding capability is used to comprehensively evaluate the multiple text blocks retrieved from the three paths, and then accurately rank them to ensure that the most relevant and most informative content is presented first, and irrelevant or redundant parts are naturally filtered out. Then, from these reordered text blocks, the TopN text blocks with the highest relevance are selected.

7. The method of claim 6, wherein the method further comprises: The specific operation steps of step S6 are as follows: S61: Modify the normalization block in the general language model glm-large-chinese partial layer from the original layer normalization LayerNorm algorithm to the Arctangent algorithm. The Arctangent algorithm directly compresses extreme values through nonlinear mapping, effectively reducing the influence of extreme values on the model, and does not need to calculate the mean and variance of the input sample, which can effectively improve the model speed. The Arctangent algorithm is as follows: In the formula, x represents the input of the Arctangent algorithm, which is a multi-dimensional tensor, ArcT(x) represents the calculation result of the Arctangent algorithm on the input x, which is also a multi-dimensional tensor, W and B represent the weight and bias respectively, both of which are vector parameters, π represents the circular constant, arctan() represents the inverse tangent function, and a represents the scaling factor, which is a scalar parameter that can be learned during training. S62: For the glm-large-chinese model modified in step S61, use wine domain knowledge data to perform instruction fine-tuning training, so that it can improve quality and speed while obtaining context compression capability, and obtain a compression model. S63: Use the compression model obtained in step S62 to perform more detailed content filtering on the TopN text blocks obtained after step S5, extract the most core content in each text block that is most relevant to the user's question, and organize these extracted content into the final context content.

8. The method of claim 7, wherein the method further comprises: In step S7, the user's question is deeply integrated with the context content obtained after step S6, and then through a carefully designed prompt word framework, it is passed to the open-source LLM to generate the final answer.