Disclosure of Invention
In order to solve the technical problems in the background technology, the invention provides a dynamic relevance enhancement search generation system and a method driven by an intelligent knowledge graph, which are beneficial to improving search efficiency, enabling a user to quickly locate required information, greatly shortening inquiry response time and improving answer quality.
In order to achieve the above technical solution, in a first aspect, the present invention provides an intelligent knowledge graph driven dynamic relevance enhancement search generation system, including:
the knowledge graph construction module is used for identifying and extracting entities and entity relations from a text document set with a large number of text documents so as to construct a structured knowledge graph and an index of the knowledge graph, and optimizing the index of the knowledge graph;
The related document collection module is used for carrying out depth analysis and relevance evaluation on the relation between the text documents in the text document set and the user query so as to extract related text documents from the text document set;
the retrieval enhancement generation module is used for retrieving related information from the knowledge graph according to the user query and the related text document, and combining the retrieved related information with the user query to generate an answer;
and the user interaction interface is used for submitting user inquiry and receiving answers.
Further, the system further comprises:
And the intelligent optimization and learning module is used for monitoring the performance of the system and performing self-optimization according to user feedback and user interaction data.
Further, the knowledge graph construction module includes:
the text segmentation and element extraction module is used for preprocessing each text document in the massive text documents to be segmented into a plurality of text blocks, and carrying out deep analysis on each text block through a large language model to identify entities and entity relations in each text document;
The relation extracting and constructing module is used for extracting the identified entity and entity relation through the large language model and constructing a knowledge graph based on the entity and entity relation;
And the map index construction module is used for constructing and optimizing the index of the knowledge map so as to improve the retrieval performance of the knowledge map.
Further, the related document collection module includes:
a static relevance evaluation module for capturing text documents from the set of text documents that have direct relevance to the user query;
a dynamic relevance evaluation module for obtaining text documents from the text document collection that have potential relevance to the user query;
And the comprehensive evaluation module is used for fusing the captured and acquired text documents with direct relevance and potential relevance to the user query, and performing overall relevance evaluation by adopting a weighted summation and machine learning model prediction mode so as to acquire the relevant text documents.
Further, the retrieval enhancement generation module includes:
the query understanding and expanding module is used for understanding the user query and expanding the user query based on the understanding result to generate a user query expression;
The query map acquisition module is used for acquiring a user query map corresponding to the user query expression from the constructed knowledge map;
The related document map acquisition module acquires a related document map corresponding to the related text document obtained by the related document collection module from the constructed knowledge map;
and the retrieval enhancement module is used for generating an answer based on the acquired user query graph and the related document graph.
Further, the retrieval enhancement module includes:
The searching unit is used for searching the related document map by taking the sub-map matching algorithm as a searching strategy based on the user query map so as to acquire a sub-map matched with or related to the user query;
The entity identification unit is used for identifying the entity related to the user query from the acquired subgraph through a keyword matching strategy and a retrieval enhancement technology based on the acquired user query map;
a text recognition unit for extracting relevant text blocks from text documents relevant to the recognized entities to generate a final response to the user query;
an information fusion and generation unit for fusing the generated final response using LLMs to generate an answer;
And the multi-hop query processing unit is used for identifying entity relation diagrams corresponding to the multi-hop user query questions from the knowledge graph, respectively searching and answering, and integrating the entity relation diagrams into a complete answer.
In a second aspect, the present invention provides a dynamic relevance enhancement search generation method driven by an intelligent knowledge graph, which includes the following steps:
identifying and extracting entities and entity relations from a text document set with a large number of text documents to construct a structured knowledge graph and an index of the knowledge graph, and optimizing the index of the knowledge graph;
Performing depth analysis and relevance evaluation on the relation between the text documents in the text document set and the user query so as to extract relevant text documents from the text document set;
and thirdly, according to the user inquiry and the related text document, related information is retrieved from the knowledge graph, and the retrieved related information is combined with the user inquiry to generate an accurate and comprehensive answer.
Further, the method further comprises:
And monitoring the performance of the system and performing self-optimization according to the user feedback and the user interaction data.
In a third aspect, the present invention provides a computer readable storage medium, where the computer readable storage medium includes a stored program, and when the program runs, the device where the computer readable storage medium is controlled to execute the above-described method for generating dynamic relevance enhancement search driven by an intelligent knowledge graph.
The invention has the beneficial effects that:
(1) The knowledge graph construction module identifies and extracts the entity and the entity relation from the text document set with a large number of text documents to construct the knowledge graph and the index of the knowledge graph, optimizes the index of the knowledge graph, remarkably improves the retrieval efficiency of the knowledge graph, enables a user to quickly locate required information, greatly shortens the query response time, improves the user experience, and enables the related document collection module to conduct deep analysis and relevance assessment on the relation between the text documents and the user query to extract related text documents, thereby ensuring the diversity and depth of retrieval results, and the retrieval enhancement generation module retrieves related information from the knowledge graph according to the user query and the related text documents and combines the retrieved related information with the user query to generate an answer, and is beneficial to realizing finer-granularity related content retrieval, so that the quality of the answer is improved.
(2) The knowledge graph construction module effectively solves the performance bottleneck problem of a large language model when processing long texts through intelligent text segmentation strategies and customized LLMs analysis, ensures the accurate identification of key entities, relations and attributes, and not only realizes the automatic extraction of the entities and the relations, but also ensures the richness and the structuring of the graph by utilizing advanced LLMs technology and graph database management tools. Through continuous optimization algorithm and parameter setting, the module can generate an accurate and efficient knowledge graph, and provides strong data support for various intelligent applications. Finally, the module remarkably improves the retrieval efficiency of the knowledge graph by adopting various index strategies and efficient index data structures. The method and the device enable the user to quickly locate the required information, greatly shorten the inquiry response time and improve the user experience.
(3) The related document collection module can effectively identify and extract documents which are not directly related but have critical supplementary effects on answering user questions through depth analysis and evaluation of complex relations between the documents and the user query, so that the diversity and depth of search results are greatly enriched, and the diversified query requirements of users are met.
(4) The retrieval enhancement generation module is based on the capability of a Large Language Model (LLMs), combines a knowledge graph construction module and a correlation document collection module, and performs knowledge graph construction on user inquiry and documents based on static and dynamic correlation evaluation results so as to realize finer-granularity correlation content retrieval. Through a retrieval enhancement generation (RAG) technology, the system can retrieve more relevant information from coarse-granularity relevant document knowledge maps and combine the information with user inquiry to generate more accurate and comprehensive answers, so that the quality of the answers is improved, and the system can process more complex multi-hop inquiry problems.
Detailed Description
The invention will be further described with reference to the drawings and examples.
It should be noted that the following detailed description is illustrative and is intended to provide further explanation of the invention. Unless defined otherwise, each technical and scientific term used in this example has the same meaning as commonly understood by one of ordinary skill in the art to which this invention belongs.
It is noted that the terminology used herein is for the purpose of describing particular embodiments only and is not intended to be limiting of exemplary embodiments according to the present invention. As used herein, the singular is also intended to include the plural unless the context clearly indicates otherwise, and furthermore, it is to be understood that the terms "comprises" and/or "comprising" when used in this specification are taken to specify the presence of stated features, steps, operations, devices, components, and/or combinations thereof.
In the present invention, terms such as "upper", "lower", "left", "right", "front", "rear", "vertical", "horizontal", "side", "bottom", etc. refer to an orientation or a positional relationship based on that shown in the drawings, and are merely relational terms, which are used for convenience in describing structural relationships of various components or elements of the present invention, and do not denote any one of the components or elements of the present invention, and are not to be construed as limiting the present invention.
In the present invention, terms such as "fixedly attached," "connected," "coupled," and the like are to be construed broadly and refer to either a fixed connection or an integral or removable connection, or both, as well as directly or indirectly via an intermediary. The specific meaning of the terms in the present invention can be determined according to circumstances by a person skilled in the relevant art or the art, and is not to be construed as limiting the present invention.
Wherein, the entity relationship refers to a relationship between entities. The BM25 algorithm and TF-IDF algorithm are ranking functions widely used in the field of information retrieval to evaluate the relevance of search queries to documents, and the present invention also relates to both algorithms in the relevance-enhanced retrieval process, since the specific application of both algorithms is well known to those skilled in the art and therefore not repeated herein.
Example 1:
as shown in fig. 1, this embodiment provides an intelligent knowledge graph driven dynamic relevance enhancement search generation system, which includes:
The knowledge graph construction module is used for identifying and extracting entities and entity relations from a text document set with a large number of text documents to construct a structured knowledge graph and an index of the knowledge graph, and optimizing the index of the knowledge graph.
The knowledge graph construction module comprises:
(1) The text segmentation and element extraction module is used for preprocessing each text document in the massive text documents to be segmented into a plurality of text blocks, and carrying out deep analysis on each text block through the large-scale language model (LLMs) so as to identify entities and entity relations in each text block.
Specifically, the method comprises the following steps:
Firstly, each text document in a mass of text documents is preprocessed to be divided into a plurality of text blocks, so that a Large Language Model (LLMs) can be processed more effectively, performance bottlenecks or memory limitations possibly encountered by LLMs when a large amount of text is processed are avoided, wherein the size of the text blocks is usually set according to specific conditions, and hundreds to thousands of tokens are generally contained in each text block, so that the capacity of LLMs can be fully utilized, and processing efficiency is not lowered due to overlong text.
Each block of text is then depth analyzed by LLMs to identify entities and entity relationships, and related attributes and declarations of entities in each block of text, based on the depth analysis results and using pre-customized hints (prompts).
The pre-customized prompt is formulated according to the specific field and content of the text data, so that the accuracy and the comprehensiveness of the extraction process are ensured. For example, in processing documents related to technical policies, specific vocabulary and sentence patterns related to technical companies, government agencies, policy regulations, etc. may be used as hints to improve accuracy of entity and relationship identification.
(2) And the relation extracting and constructing module is used for extracting the identified entity and entity relation through LLMs and constructing a knowledge graph based on the extracted entity and entity relation.
The knowledge graph is represented in the form of a graph structure, wherein each entity corresponds to one node, and the entity relationship is represented by edges. The metadata of the nodes includes attributes of the entities, such as types (e.g. people, organizations, places, etc.), descriptions (short text descriptions), etc., and the metadata of the edges includes detailed information of the relationships, such as relationship types (e.g. membership, collaboration, influence, etc.), and descriptions of the relationships (further description of the relationships).
In the process of constructing the knowledge graph, the following technical means are adopted.
First, the ability of LLMs in entity recognition and relationship extraction is exploited to ensure high accuracy extraction by training and optimizing LLMs.
Second, graph databases or specialized graph processing tools are employed to store and manage graph data, which provide efficient graph traversal and query capabilities.
Finally, through the construction algorithm and parameter setting of the constantly optimized atlas, an accurate and efficient knowledge atlas can be generated, and powerful support is provided for subsequent question-answering and reasoning tasks.
(3) And the map index construction module is used for constructing and optimizing the index of the knowledge map so as to improve the retrieval performance of the knowledge map.
The index of the knowledge graph not only contains basic information (such as name, type, description and the like) of the entity, but also relates to detailed information such as type and description of the relationship, and the index of the knowledge graph is optimized, so that the entity and entity relationship related to the user query can be rapidly positioned, and the query response time is greatly reduced.
The map index construction module comprises:
(A) And the parallel and distributed index optimization unit is used for constructing the index of the knowledge graph by adopting a data locality optimization technology.
Specifically, first, the knowledge-graph data is divided into a plurality of data blocks by using a MapReduce framework, and each data block is locally index-constructed on an independent node.
And then, merging the local indexes into a global index through a global merging algorithm, and adopting a rapid de-duplication technology based on a bloom filter in the global merging process to reduce the generation of repeated indexes and improve the merging efficiency.
Finally, the constructed index is stored into an index data structure, wherein the index data structure comprises a B-tree and a hash table.
In the process of constructing the local index, an intelligent task scheduling mechanism is also introduced to dynamically allocate the index construction and query tasks according to the real-time state of the current system resources (such as CPU, memory and network bandwidth).
(B) The adaptive dynamic index construction unit is used for dynamically adjusting the index granularity based on the liveness (such as update frequency and query frequency) of the entity and entity relation in the knowledge graph through an adaptive dynamic index construction algorithm (ADAPTIVE DYNAMIC Indexing Algorithm, ADIA) so as to more accurately adapt to the dynamic change of the graph data.
The index granularity calculation formula is as follows:
G(e,r)=α⋅log(Ae+1)+β⋅log(Ar+1)+γ
Wherein e is an entity, ae is the liveness of the entity e, r is an entity relationship, ar is the liveness of the entity relationship r, G is an index granularity, and alpha, beta and gamma are weight parameters which are dynamically adjusted according to requirements.
It should be noted that, according to the calculated index granularity, different index strategies are adopted, for example, an index strategy with a larger index granularity is adopted, for example, a multi-level hash table is combined with a b+ tree index to ensure quick access, and an index with a smaller index granularity is possible to adopt an index with a coarser granularity, for example, a compressed prefix tree, so as to save storage space.
(C) And the index parameter adjusting unit is used for monitoring the user query performance index through an index parameter dynamic adjusting Algorithm (DYNAMIC PARAMETER Tuning Algorithm, DPTA) so as to adjust the internal parameters of the index data structure in real time, so that the optimal query performance is achieved.
Wherein, the user inquiry performance index comprises response time and throughput, and the internal parameters of the index data structure comprise load factors of the hash table, the order of the B-tree and the like.
The specific parameter adjustment strategy is as follows:
I) Response time optimization-when it is detected that the user query response time exceeds a preset response time threshold, decreasing the load factor (collision probability) of the hash table or increasing the order of the B-tree to decrease the height of the tree.
II) throughput optimization type, namely, when the system load is low, the redundancy of indexes is properly increased (such as the number of indexes is increased) so as to improve the concurrent inquiry capability, and otherwise, when the system load is high, the redundancy is reduced so as to avoid resource contention.
In summary, the knowledge graph construction module effectively solves the performance bottleneck problem of the large language model when processing long texts through intelligent text segmentation strategies and customized LLMs analysis, ensures the accurate identification of key entities, relations and attributes, and not only realizes the automatic extraction of the entities and the relations, but also ensures the richness and the structuring of the graph by utilizing advanced LLMs technology and graph database management tools. Through continuous optimization algorithm and parameter setting, the module can generate an accurate and efficient knowledge graph, and provides strong data support for various intelligent applications. Finally, the module remarkably improves the retrieval efficiency of the knowledge graph by adopting various index strategies and efficient index data structures. The method and the device enable the user to quickly locate the required information, greatly shorten the inquiry response time and improve the user experience.
And (II) a related document collection module, which is used for carrying out deep analysis and relevance evaluation on the relation between the text documents in the text document collection and the user query so as to extract related text documents from the text document collection.
The related document collection module includes:
(1) A static relevance evaluation module for capturing text documents from the collection of text documents that have direct relevance to the user query.
Specifically, the static relevance evaluation module includes:
(A) And the text document preprocessing unit is used for preprocessing the text documents in the text document set.
The text document preprocessing unit includes:
and the stem extraction unit is used for reducing the vocabulary in each text document in the text document set to a basic form (stem) through stem extraction technology such as jieba, so that the matching omission caused by the morphological change (such as tense and single complex number) of the vocabulary is reduced, and the generalization capability of keyword matching is enhanced.
And the part-of-speech tagging unit is used for identifying the part of speech of each word in each text document, such as nouns, verbs and the like, so that non-critical words can be filtered in the matching process, words with high contribution to the theme of each text document are focused, and the accuracy of the relevance evaluation is further improved.
(B) And the TF-IDF algorithm optimizing unit is used for carrying out parameter optimization on the TF-IDF algorithm.
The TF-IDF algorithm formula is TF-IDF (t, d) =TF (t, d) ×IDF (t), TF (t, d) is word frequency of a term t in a text document d, IDF (t) is inverse text document frequency of the term t, the IDF (t) is calculated by the formula of IDF (t) =log (nt+1N), wherein N is total number of text documents, nt is number of text documents containing the term t, and +1 is used for avoiding zero denominator.
The TF-IDF algorithm optimizing unit includes:
And the text document analysis unit is used for analyzing the characteristics of the preprocessed text document, such as document length distribution, vocabulary diversity and the like, so as to adjust smooth items in IDF calculation (such as adding a document length normalization factor).
And the TF weight adjusting unit is used for adjusting the TF weight through nonlinear transformation (such as logarithm, square root and the like) according to the distribution condition of the keywords in each preprocessed text document so as to reduce the excessive influence of the high-frequency words on the whole score.
And the IDF parameter optimization unit is used for trying different IDF calculation formula variants (such as adding a document length normalization factor) through methods such as cross verification and the like, calculating recall accuracy of the variants, and further verifying so as to find an IDF calculation method which is most suitable for a text document set.
(C) And the BM25 algorithm optimization unit is used for performing parameter optimization on the BM25 algorithm.
Wherein, the BM25 algorithm formula is as follows:
Where q is the user query, d is the text document, qi is the term in the user query, f (qi, d) is the term frequency of the term qi in the user query in the text document d, avgdl is the average length of the text documents in the text document set, and k1 and b are adjustable parameters for controlling the influence of the term frequency and the document length on the score.
The BM25 algorithm optimizing unit includes:
An initial parameter setting unit is used for setting different initial values for k1 and b according to experience or literature recommendation.
And the grid searching unit is used for traversing k1 and b combinations with different initial values through a grid searching method and evaluating each combination (such as F1 score, average precision mean value and the like).
And a parameter selection unit for selecting the combination of k1 and b with the best performance as the final parameter setting according to the evaluation result.
(D) And the semantic similarity calculation unit is used for calculating the similarity between the user query and the preprocessed text documents in the text document set based on the parameter optimized BM25 algorithm and the TF-IDF algorithm so as to capture the text documents with direct relevance to the user query.
Semantic vectors are generated through a plurality of pre-training language models, and evaluation results of the plurality of pre-training language models are fused through an integrated learning method, so that the advantages of the pre-training language models are integrated, and the accuracy and the robustness of semantic similarity calculation are improved.
In conclusion, the module realizes efficient capturing and accurate evaluation of direct connection between the query and the document in the static relevance evaluation stage through text preprocessing, parameter optimization of TF-IDF and BM25 algorithm and semantic similarity calculation.
(2) A dynamic relevance evaluation module for obtaining text documents from the set of text documents that have potential relevance to the user query.
The dynamic relevance evaluation module comprises:
(A) And the text document screening and sorting unit is used for primarily screening and sorting the text documents in the text document set through a similarity matching method and a coarse-ranking model based on deep learning so as to improve the retrieval efficiency.
(B) And the information capturing unit is used for deeply fusing the user query and each text document in the text document combination through a Query Document Concatenation (QDC) technology so as to capture more abundant context information.
(C) And the related document acquisition unit is used for acquiring the text documents with high relevance and potential relevance to the user query from the text documents in the preliminary screening and sorting according to the captured context information through the classifier based on the models BigBird, roBERTa and the like.
The classifier integrates the forward selection strategy and the reverse selection strategy into a unified framework, and flexibly controls and optimizes the retrieval result by dynamically adjusting the selection threshold value and the weight.
In addition, the dynamic relevance evaluation module further comprises a user feedback unit, which is used for performing online learning and tuning on the two classifiers by utilizing behavior data such as clicking and browsing of a user so as to continuously improve the evaluation accuracy and adaptability of the two classifiers.
(3) And the comprehensive evaluation module is used for fusing the captured and acquired text documents with direct correlation and potential correlation with the user query, and performing overall correlation evaluation by adopting modes of weighted summation, machine learning model prediction and the like so as to acquire the correlated text documents.
The process fully considers the information of the text document in multiple dimensions, and ensures the comprehensiveness and accuracy of the evaluation result.
In summary, the related document collection module can effectively identify and extract documents which are not directly related but have critical complementary effects on answering user questions through the deep analysis and evaluation of complex relations between the documents and the user query, so that the diversity and depth of search results are greatly enriched, and the diversified query requirements of users are met.
And thirdly, a retrieval enhancement generation module is used for retrieving related information from the knowledge graph according to the user query and the acquired related text document, and combining the retrieved related information with the user query to generate an accurate and comprehensive answer.
The retrieval enhancement generation module includes:
(1) And the query understanding and expanding module is used for understanding the user query and expanding the user query based on the understanding result so as to generate the user query expression.
Specifically, first, a user query is deeply analyzed by using natural language processing technology to identify its intent, keywords and potential needs.
The user query is then expanded into a series of more specific, comprehensive user query expressions by query expansion techniques (e.g., query rewrite, synonym replacement, etc.) based on identifying its intent, keywords, and potential needs, so as to more accurately match the relevant content in the text document.
(2) And the query map acquisition module is used for acquiring a user query map corresponding to the user query expression from the constructed knowledge map.
(3) And the related document map acquisition module acquires and stores the related document map corresponding to the related text document obtained by the related document collection module from the constructed knowledge map.
(4) And the retrieval enhancement module is used for generating an answer based on the acquired user query graph and the related document graph.
Specifically, based on a user query graph, a sub-graph matching algorithm is adopted as a search strategy to search the content of the related document graph, and the method comprises the following steps:
First, a sub-graph that matches or correlates with the user query graph is retrieved from the correlated document graph. In the searching process, related document maps are traversed, and types, attributes and connection relations of nodes and edges are compared to find out a subgraph which is most consistent with a user query map. In order to improve the retrieval efficiency, the search process is accelerated by combining an indexing technology, graph traversal strategy optimization and a similarity evaluation method, so that the accuracy and the relevance of the retrieval result are ensured.
And then, sorting the retrieved subgraphs according to the similarity or other relevance indexes to obtain the most relevant information.
The retrieval enhancement module comprises:
(A) And the searching unit is used for searching the related document map by adopting a sub-map matching algorithm as a searching strategy based on the user query map so as to acquire a sub-map matched with or related to the user query.
In the searching process, related document maps are traversed, and types, attributes and connection relations of nodes and edges are compared to find out a subgraph which is most consistent with a user query map. In order to improve the retrieval efficiency, the search process is accelerated by combining an indexing technology, graph traversal strategy optimization and a similarity evaluation method, so that the accuracy and the relevance of the retrieval result are ensured.
(B) And the entity identification unit is used for identifying the entities related to the user query from the acquired subgraph through a keyword matching strategy and a retrieval enhancement (RETRIEVAL AUGMENTED GENERATION, RAG) technology, and extracting detailed information related to the entities.
Wherein the detailed information comprises association entities, relationship attributes and the like.
(C) And the text recognition unit is used for extracting relevant text blocks from the text documents relevant to the recognized entities so as to generate final responses to the user inquiry.
Specifically, the method comprises the following steps:
first, relevant text blocks are extracted from text documents associated with the identified entities, and the text blocks are prioritized and filtered according to similarity or other relevance index to accommodate a single contextual window of predefined size.
A final response to the user query is then generated based on the ranked and screened text blocks.
(D) And the information fusion and generation unit is used for fusing the generated final response by utilizing LLMs so as to generate an accurate and comprehensive answer.
Specifically, the method comprises the following steps:
first, the resulting final response is integrated into a unified presentation framework and the entity relationship structure from the related document map and the context information of the related content are considered.
The resulting response is then fused using LLMs text generation capabilities based on the unified representation and the entity relationship structure and context information to generate a consistent, accurate, and comprehensive answer.
Wherein, LLMs can capture the internal connection between the information in the generation process, and generate the answer text which is both logical and easy to understand.
(E) And the multi-hop query processing unit is used for identifying entity relation diagrams corresponding to a plurality of sub-questions in the user query (namely, entity relation diagrams corresponding to the user query questions of each hop) from the knowledge graph for complex multi-hop user query questions (namely, questions which can only find answers through a plurality of information sources or knowledge segments), respectively searching and answering, and finally integrating the sub-answers into a complete answer.
In summary, the search enhancement generation module performs knowledge graph construction on the user query and the document based on the capability of the Large Language Model (LLMs) and the static and dynamic correlation evaluation results by combining the knowledge graph construction module and the correlation document collection module, so as to realize finer granularity of correlation content search. Through a retrieval enhancement generation (RAG) technology, the system can retrieve more relevant information from coarse-granularity relevant document knowledge maps and combine the information with user inquiry to generate more accurate and comprehensive answers, so that the quality of the answers is improved, and the system can process more complex multi-hop inquiry problems.
And fourthly, an intelligent optimization and learning module which is used for monitoring the performance of the system and performing self-optimization according to user feedback and user interaction data.
The intelligent optimization and learning module comprises:
(1) The performance monitoring and evaluating module is used for monitoring the overall performance of the system to obtain the system performance index, collecting the system log and the user behavior data in real time, and evaluating the performance of the running state of the system.
The system performance index comprises a plurality of dimensions such as retrieval speed, answer accuracy, user satisfaction and the like.
(2) The user query pattern recognition module is used for recognizing and learning the query pattern, preference and change trend of the user by utilizing a machine learning algorithm (such as a sequence model (e.g. LSTM, GRU) and a attention mechanism), analyzing data such as query history, clicking behavior, residence time and the like of the user so as to construct a user portrait, and providing basis for personalized optimization.
(3) And the knowledge graph structure optimization module is used for adjusting the structure of the knowledge graph according to the identified user query mode and the acquired system performance index so as to optimize the relation links and attribute weights among the entities and the like, thereby being beneficial to improving the efficiency and accuracy of information retrieval.
For example, for frequently queried entities or relationships, their exposure or importance scores in the atlas may be increased, and for outdated or low value information, cleanup or downgrade processing may be performed.
(4) And the retrieval strategy optimization module is used for dynamically adjusting the retrieval strategy according to the user portraits and the performance evaluation result.
Specifically, new search strategies are continuously tried through optimization technologies such as an A/B test and a multi-arm slot machine algorithm, and selection and optimization are performed based on actual effects.
The retrieval strategy comprises a query rewrite rule, a ranking algorithm, an indexing strategy and the like.
(5) And the parameter automatic adjustment module is used for automatically adjusting key parameters (such as algorithm threshold, learning rate, weight attenuation and the like) in the system based on the performance evaluation result so as to achieve the optimal system performance.
Specifically, the parameter space is searched efficiently through algorithms such as gradient descent, bayesian optimization and the like, and the parameter combination which is most suitable for the current system state is found.
(6) And the continuous learning and evolution module is used for continuously drawing knowledge from new user interaction data and system feedback, and updating and optimizing own models and strategies.
Specifically, by continually drawing knowledge from new user exchanges of data and system feedback, updating and optimizing its own models and policies, the module can adapt gradually to changing user demands and environmental changes over time and accumulation of data, maintaining the competitiveness and advancement of the system.
In summary, the intelligent optimization and learning module is responsible for monitoring the performance of the system and performing self-optimization according to feedback and user interaction data. Through a machine learning algorithm, the system can identify and adapt to the query mode of the user, so that the structure and the retrieval strategy of the knowledge graph are optimized. In addition, the intelligent optimization and learning module can also automatically adjust parameters according to the performance indexes provided by the system evaluation and monitoring module so as to improve the retrieval efficiency and the answer accuracy.
And (V) a user interaction interface for submitting user queries and receiving answers, and for providing a mechanism for collecting user feedback.
Example 2:
The embodiment provides a dynamic relevance enhancement search generation method driven by an intelligent knowledge graph, which comprises the following steps:
S1, identifying and extracting entities and entity relations from a text document set with a large number of text documents to construct a structured knowledge graph and an index of the knowledge graph, and optimizing the index of the knowledge graph.
S11, preprocessing each text document in the massive text documents to divide the text documents into a plurality of text blocks, and performing deep analysis on each text block through a Large Language Model (LLMs) to identify entities and entity relations in each text document.
Each text document in the massive text documents is preprocessed to be divided into a plurality of text blocks, so that a large-scale language model (LLMs) can be processed more effectively, performance bottlenecks or memory limitations possibly encountered by LLMs when a large amount of text is processed are avoided, the size of the text blocks is usually set according to specific conditions, and hundreds to thousands of tokens are generally contained in each text block, so that the capacity of LLMs can be fully utilized, and processing efficiency is not lowered due to overlong text.
And B, carrying out depth analysis on each text block through LLMs so as to identify entities and entity relations in each text block and related attributes and statement of the entities based on the depth analysis result and by utilizing a pre-customized prompt (prompts).
The pre-customized prompt is formulated according to the specific field and content of the text data, so that the accuracy and the comprehensiveness of the extraction process are ensured. For example, in processing documents related to technical policies, specific vocabulary and sentence patterns related to technical companies, government agencies, policy regulations, etc. may be used as hints to improve accuracy of entity and relationship identification.
And S12, extracting the identified entity and entity relation through LLMs, and constructing a knowledge graph based on the extracted entity and entity relation.
The knowledge graph is represented in the form of a graph structure, wherein each entity corresponds to one node, and the entity relationship is represented by edges. The metadata of the nodes includes attributes of the entities, such as types (e.g. people, organizations, places, etc.), descriptions (short text descriptions), etc., and the metadata of the edges includes detailed information of the relationships, such as relationship types (e.g. membership, collaboration, influence, etc.), and descriptions of the relationships (further description of the relationships).
And S13, constructing and optimizing the index of the knowledge graph to improve the retrieval performance of the knowledge graph.
A, constructing an index of a knowledge graph by adopting a data locality optimization technology
And B, dynamically adjusting index granularity based on the activity degree (such as update frequency and query frequency) of the entity and entity relation in the knowledge graph through an adaptive dynamic index construction algorithm (ADAPTIVE DYNAMIC Indexing Algorithm, ADIA) so as to more accurately adapt to the dynamic change of the graph data.
And C, monitoring a user query performance index through an index parameter dynamic adjustment Algorithm (DYNAMIC PARAMETER Tuning Algorithm, DPTA) so as to adjust the internal parameters of the index data structure in real time, so that the optimal query performance is achieved.
And S2, carrying out deep analysis and relevance evaluation on the relation between the text documents in the text document set and the user query so as to extract relevant text documents from the text document set.
Static relevance evaluation, capturing text documents from the text document collection, wherein the text documents have direct relevance to the user query.
S21-1, preprocessing the text documents in the text document set.
The method specifically comprises the following steps:
the vocabulary in each text document in the text document set is restored to the basic form (word stem) through a word stem extraction technology such as jieba, so that the matching omission caused by the morphological change (such as tense and single complex number) of the vocabulary is reduced, and the generalization capability of keyword matching is enhanced.
The part of speech of each word in each text document, such as nouns, verbs and the like, is identified by using the part of speech tagging tool, so that non-critical words can be filtered in the matching process, words with high contribution to the theme of each text document are focused, and the accuracy of the relevance evaluation is further improved.
And S21-2, carrying out parameter optimization on the TF-IDF algorithm.
The method specifically comprises the following steps:
characteristics of the preprocessed text document, such as document length distribution and lexical diversity, are analyzed to adjust smooth terms in the IDF calculation (e.g., add a document length normalization factor).
According to the distribution condition of keywords in each preprocessed text document, TF weight is adjusted through nonlinear transformation (such as logarithm, square root and the like) so as to reduce excessive influence of high-frequency words on overall score;
Different IDF calculation formula variants (such as adding document length normalization factors) are tried through methods such as cross verification, recall accuracy of the variants is calculated, verification is further carried out, and therefore the IDF calculation method which is most suitable for a text document set is found.
And S21-3, parameter optimization is carried out on the BM25 algorithm.
And based on the parameter optimized BM25 algorithm and the TF-IDF algorithm, performing similarity calculation on the user query and the text documents preprocessed in the text document set to capture the text documents with direct relevance to the user query.
Dynamic relevance evaluation, obtaining a text document with potential relevance to the user query from the text document collection.
And S23, comprehensively evaluating, namely fusing the captured and acquired text documents with direct relevance and potential relevance to the user query, and performing overall relevance evaluation by adopting modes of weighted summation, machine learning model prediction and the like to acquire relevant text documents.
And S3, according to the user query and the related text document, related information is retrieved from the knowledge graph, and the retrieved related information is combined with the user query to generate an accurate and comprehensive answer.
And S31, understanding the user query, and expanding the user query based on the understanding result to generate a user query expression.
S32, acquiring a user query graph corresponding to the user query expression from the constructed knowledge graph.
And S33, acquiring and storing a related document map corresponding to the related text document obtained by the related document collection module from the constructed knowledge map.
And S34, generating an answer based on the acquired user query graph and the related document graph.
And S34-1, searching the related document map by adopting a sub-map matching algorithm as a searching strategy based on the user query map so as to acquire a sub-map matched with or related to the user query.
And S34-2, identifying the entity related to the user query from the acquired subgraph through a keyword matching strategy and a retrieval enhancement technology based on the acquired user query graph.
And S34-3, extracting relevant text blocks from the text documents relevant to the identified entities to generate final responses to the user queries.
And S34-4, fusing the generated final response by utilizing LLMs to generate an answer.
And S4, monitoring the performance of the system and performing self-optimization according to user feedback and user interaction data.
Example 3:
The present embodiment provides a computer readable storage medium, where the computer readable storage medium includes a stored program, and when the program runs, the device where the computer readable storage medium is controlled to execute the dynamic relevance enhancing search generating method driven by the intelligent knowledge graph described in embodiment 2.
The same or similar parts between the various embodiments in this specification are referred to each other. In particular, for the terminal embodiment, since it is substantially similar to the method embodiment, the description is relatively simple, and reference should be made to the description in the method embodiment for relevant points.
In the several embodiments provided by the present invention, it should be understood that the disclosed systems and methods may be implemented in other ways. For example, the system embodiments described above are merely illustrative, e.g., the division of the elements is merely a logical functional division, and there may be additional divisions when actually implemented, e.g., multiple elements or components may be combined or integrated into another system, or some features may be omitted or not performed. Alternatively, the coupling or direct coupling or communication connection shown or discussed with each other may be through some interface, system or unit indirect coupling or communication connection, which may be in electrical, mechanical or other form.
The units described as separate units may or may not be physically separate, and units shown as units may or may not be physical units, may be located in one place, or may be distributed on a plurality of network units. Some or all of the units may be selected according to actual needs to achieve the purpose of the solution of this embodiment.
In addition, it should be noted that, in the description corresponding to the flowcharts or the block diagrams in the figures, the operations or steps corresponding to different blocks may also occur in different orders than that disclosed in the description, and sometimes, there is no specific order between the different operations or steps. For example, two consecutive operations or steps may actually be performed substantially in parallel, they may sometimes be performed in reverse order, which may be dependent on the functions involved. Each block of the block diagrams and/or flowchart illustration, and combinations of blocks in the block diagrams and/or flowchart illustration, can be implemented by special purpose hardware-based systems which perform the specified functions or acts, or combinations of special purpose hardware and computer instructions.
The above description is only of the preferred embodiments of the present invention and is not intended to limit the present invention, but various modifications and variations can be made to the present invention by those skilled in the art. Any modification, equivalent replacement, improvement, etc. made within the spirit and principle of the present invention should be included in the protection scope of the present invention.