Intelligent recommendation method, device and system based on knowledge graph
By obtaining user queries and determining the knowledge base of the business domain in the intelligent recommendation system, retrieving multi-source heterogeneous data and sorting LSI semantic models, the problems of insufficient real-time, accuracy and personalization of traditional intelligent recommendation methods are solved, and more efficient knowledge services are achieved.
Patent Information
- Application Number
- CN202411927128.2
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-12-25
- Publication Date
- 2025-04-18
AI Technical Summary
The traditional intelligent recommendation method based on knowledge graphs has cold start problems, sparseness defects, poor real-time and accuracy, insufficient compatibility of multi-source heterogeneous data, degraded multi-hop query performance, insufficient diversity and personalization of recommended results, making it difficult to meet users' knowledge service needs.
By obtaining user queries, determining the knowledge base corresponding to the business domain, searching and obtaining context information, and entering it with the user queries into a large language model to generate answers, and generating recommended content. This method introduces multi-source heterogeneous industry material data, constructs graph knowledge, uses mixed search methods, and combines LSI semantic models for precise sorting, improving the real-time, accuracy and personalization of recommendations.
It improves the real-time and accuracy of intelligent recommendations based on knowledge graphs, enhances the diversity and personalization of recommendation results, and can better meet users' knowledge service needs.
Smart Images

Figure CN119848244A_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of knowledge data processing technology, and in particular to an intelligent recommendation method, device and intelligent recommendation system based on knowledge graph. Background Art
[0002] With the continuous development of information technology, the application of knowledge service systems is becoming more and more extensive. For example, intelligent recommendation systems widely adopt collaborative filtering, content recommendation and hybrid recommendation, which can provide intelligent recommendation answers for users' query requests and play an important role in applications.
[0003] Traditional intelligent recommendation methods based on knowledge graphs and collaborative filtering methods predict user interests by analyzing user behavior data, while content recommendation methods rely on the features of items or content for recommendation. They have cold start problems and sparsity defects, and their recommendation results are often limited by the extraction accuracy and diversity of content features, with poor real-time and accuracy. At the same time, they lack compatibility with multi-source heterogeneous data, and the types and scope of data that can be processed are relatively limited. The performance of multi-hop queries drops sharply as the scale of knowledge expands. The diversity and personalization of recommendation results are insufficient, making it difficult to meet users' knowledge service needs. Summary of the invention
[0004] Based on this, it is necessary to provide an intelligent recommendation method, device and intelligent recommendation system based on knowledge graph, which can improve the real-time and accuracy of intelligent recommendation based on knowledge graph, and enhance the diversity and personalization of recommendation results.
[0005] An intelligent recommendation method based on knowledge graph, comprising:
[0006] Get the user query entered by the user in the current session;
[0007] Determine the knowledge base corresponding to the business domain involved in the current session according to the user query; wherein the knowledge base includes graph knowledge constructed according to business requirements using multi-source heterogeneous industry material data;
[0008] Determine the prompt template matching the current session according to the business domain involved in the current session and fill in the prompt;
[0009] Searching the knowledge base to obtain context information;
[0010] The context information and user query are input into a large language model to generate an answer, and the answer and prompt template are used to generate recommended content.
[0011] In one embodiment, the knowledge graph-based intelligent recommendation method further includes:
[0012] Introducing multi-source heterogeneous industry material data; wherein the multi-source heterogeneous industry material data includes basic industry data, open source industry data and text industry data;
[0013] Extract data metadata information based on data technology used for business characteristics, and associate and fuse heterogeneous industry material data based on data metadata classification;
[0014] Process multi-source heterogeneous data into data sets with unified specifications and integrate them into the data resource pool;
[0015] A knowledge system is constructed based on a data resource pool, entities, relationships and attributes are extracted from the data resource pool, and the knowledge base is constructed in an ontology mapping manner.
[0016] In one embodiment, searching the knowledge base to obtain context information includes:
[0017] Decompose the user query into multiple sub-queries, and perform reference resolution and query rewriting on each sub-query to obtain several query questions;
[0018] Performing knowledge retrieval on the query question based on the knowledge base to obtain preliminary retrieval results;
[0019] The preliminary search results are screened, context compressed and re-ranked to obtain context information suitable for a large language model.
[0020] In one embodiment, the process of reordering operations includes:
[0021] Build and train a reranker based on the reranking model and document embedding model;
[0022] Calculating the relevance scores between the preliminary search results and the query question, and inputting the preliminary search results and their relevance scores into a re-ranker for re-ranking;
[0023] The first reordered context information is taken out from the preliminary search results, the relevance score between the preliminary search results and the query question is recalculated, and then input into the re-ranker for re-ranking; the first reordered context information is taken out again;
[0024] The above reordering process is repeated until the required amount of context information is retrieved.
[0025] In one embodiment, the knowledge base also includes document knowledge constructed based on the document data and database knowledge stored in the database;
[0026] The performing knowledge retrieval on the query question based on the knowledge base to obtain preliminary retrieval results includes:
[0027] Based on the knowledge base, a hybrid retrieval method of knowledge graph retrieval, vector retrieval and database retrieval is used to perform knowledge retrieval on the query question to obtain preliminary retrieval results.
[0028] In one embodiment, the knowledge graph-based intelligent recommendation method further includes:
[0029] Acquire document data in various formats and pre-process the document data;
[0030] Based on the document segmentation algorithm, the preprocessed original document data is segmented to obtain text blocks, and the corresponding summaries, question-answering data and knowledge graphs of the text blocks are generated;
[0031] Vectorize the text blocks, summaries, and question-answer data and construct a vectorized index;
[0032] The vectorized index, knowledge graph and original document data are stored as document knowledge in a knowledge base.
[0033] In one embodiment, the vector retrieval process includes:
[0034] The text blocks in the document vector library are segmented into a set of knowledge sentences;
[0035] Using NLP technology to perform keyword extraction and part-of-speech tagging on user queries and knowledge sentence sets, performing entity extraction on user queries and knowledge sentence sets to obtain common entity vocabulary, and combining the keywords and entity vocabulary into a business subject vocabulary set;
[0036] The business subject vocabulary set is mapped to a low-dimensional space, and the similarity between the query question and the knowledge sentence set is calculated using a similarity calculation method to obtain a similar knowledge sentence set.
[0037] In one embodiment, the knowledge graph-based intelligent recommendation method further includes:
[0038] Train the LSI semantic model based on a set of similar knowledge sentences;
[0039] Input the query question into the LSI semantic model to obtain the similarity weights of the similar knowledge sentence set corresponding to the query question;
[0040] The knowledge sentences that best match the query question are obtained as context information based on the similarity weight sorting.
[0041] An intelligent recommendation device based on knowledge graph, comprising:
[0042] User session unit, used to obtain user queries entered by users in the current session;
[0043] A business determination unit, configured to determine a knowledge base corresponding to a business domain involved in the current session according to the user query; wherein the knowledge base includes graph knowledge constructed according to business requirements using multi-source heterogeneous industry material data;
[0044] A prompt matching unit, used to determine a prompt template matching the current session according to the business domain involved in the current session and fill in the prompt;
[0045] A knowledge retrieval unit, used to search the knowledge base to obtain context information;
[0046] The answer generation unit is used to input the context information and user query into the large language model to generate an answer, and generate recommended content from the answer and prompt template.
[0047] An intelligent recommendation system is used to execute the steps of the intelligent recommendation method based on knowledge graph.
[0048] As in the technical solution of the above-mentioned embodiment, the user query input by the user in the current session is obtained, and the knowledge base corresponding to the business domain involved in the current session is determined according to the user query. The knowledge base uses multi-source heterogeneous industry material data to build graph knowledge according to business requirements; the prompt template matching the current session is determined according to the business domain involved in the current session and the prompt is filled in, and the context information is retrieved in the knowledge base; the context information and the user query are input into the large language model to generate an answer and finally generate recommended content; this technical solution improves the real-time and accuracy of intelligent recommendations based on the knowledge graph, and the personalized recommendation based on the current context information improves the diversity and personalization of the recommendation results, meeting the user's knowledge service needs. BRIEF DESCRIPTION OF THE DRAWINGS
[0049] Figure 1 is a flow chart of an intelligent recommendation method based on knowledge graph according to an embodiment;
[0050] Figure 2 This is an example of a data connection and knowledge extraction flow chart;
[0051] Figure 3 This is an example flow chart of a method for constructing document knowledge in a knowledge base;
[0052] Figure 4 This is a schematic diagram of an example retrieval process;
[0053] Figure 5 This is a schematic diagram of an example intelligent recommendation algorithm;
[0054] Figure 6 is a schematic diagram of the structure of an intelligent recommendation device based on a knowledge graph according to an embodiment;
[0055] Figure 7 This is a recommendation flowchart of an example intelligent recommendation system. DETAILED DESCRIPTION
[0056] In order to make the purpose, technical solution and advantages of the present application more clearly understood, the present application is further described in detail below in conjunction with the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are only used to explain the present application and are not used to limit the present application.
[0057] In the embodiments of the present application, "at least one" means one or more, and "multiple" means two or more. For example, multiple objects refer to two or more objects. "Include" or "comprising" and other similar words mean that the information appearing before "include" or "comprising" covers the information listed after "include" or "comprising" and its equivalents, and does not exclude other information. The "and / or" mentioned in the embodiments of the present application indicates that there can be three kinds of relationships. The character " / " generally indicates that the objects associated before and after are in an "or" relationship.
[0058] refer to Figure 1 As shown, Figure 1 The flowchart of the intelligent recommendation method based on knowledge graph of an embodiment includes the following steps:
[0059] Step S10, obtaining a user query input by the user in the current session.
[0060] Specifically, the intelligent recommendation system can provide knowledge search, knowledge recommendation, and intelligent question-answering capabilities through the application capability service interface and application capability page integration. Users can enter query questions in the current session. For example, users can enter questions to obtain the desired knowledge. For example, if they want to know the relevant information about a certain city, they can enter a question such as "Which cities are connected by Zhongshan Expressway?" to ask questions, and the intelligent recommendation system will obtain the user query entered by the user.
[0061] Step S20, determining the knowledge base corresponding to the business domain involved in the current session according to the user query; wherein the knowledge base includes graph knowledge constructed according to business requirements using multi-source heterogeneous industry material data.
[0062] For example, various types of data from business data sources, including entity information, relationship information, and behavior information, can be collected, cleaned, parsed, and disambiguated to form a knowledge base for the business domain, including an entity library, a relationship library, and an attribute library, as a unified, comprehensive, standardized, and decentralized data and knowledge service for the business domain. Based on this, when in use, the knowledge base corresponding to the business domain involved in the current session can be determined according to the user query.
[0063] In one embodiment, the knowledge base may be constructed by the following methods, including:
[0064] S21, importing multi-source heterogeneous industry material data; wherein the multi-source heterogeneous industry material data includes basic industry data, open source industry data and text industry data.
[0065] Specifically, according to business requirements, we first connect to multi-source heterogeneous industry material data such as basic industry data, open source industry data, and text industry data.
[0066] S22, extracting data metadata information based on data technology and business characteristics, and associating and integrating heterogeneous industry material data based on data metadata classification.
[0067] Specifically, according to the business characteristics of data technology, data metadata information is extracted, and multi-source data is associated and fused according to data metadata classification.
[0068] S23, processes multi-source heterogeneous data into data sets with unified specifications and integrates them into the data resource pool.
[0069] Specifically, based on unified data standards, data clarity rules and algorithms are formulated, data cleaning tasks are formulated, and multi-source heterogeneous data are governed into data sets with unified formats, unified standards, and unified views and imported into the data resource pool.
[0070] S24, constructing a knowledge system based on the data resource pool, performing entity extraction, relationship extraction and attribute extraction on the data resource pool, and constructing the knowledge base in an ontology mapping manner.
[0071] Specifically, based on the data resource pool and according to the constructed knowledge system, entity extraction, relationship extraction and attribute extraction are carried out, and the knowledge base is constructed in accordance with the ontology mapping method to meet the business needs of industry knowledge graph development and application.
[0072] For example, Figure 2 As shown, Figure 2 It is an example of a data connection and knowledge extraction flow chart. The knowledge graph represents knowledge by organizing it into a network structure diagram. It connects various entities and the relationships between them, providing an intuitive structured representation of knowledge. The knowledge graph construction process generally includes data preprocessing, entity recognition, relationship extraction, attribute extraction, knowledge integration and storage. With the help of the powerful semantic understanding ability of the Large Language Model (LLM), the large language model can be used for entity recognition and relationship extraction to form triples for storage.
[0073] As in the above-mentioned embodiment, distributed storage and parallel processing technology are used to significantly accelerate the construction and update speed of the knowledge graph and improve the response speed of intelligent recommendations.
[0074] In one embodiment, the knowledge base construction is based on the knowledge model and knowledge acquisition data. By establishing a mapping relationship between the knowledge model and the knowledge acquisition data set, data is obtained from the data set and converted into entity sets such as ontologies, relationships, attributes, etc. defined by the knowledge model, and mapping relationships between entities are established to extract them into graph data. It can include processes such as knowledge model establishment, knowledge mapping, knowledge storage, and knowledge construction.
[0075] For knowledge extraction; the first step: read the data source; the second step: execute the knowledge acquisition process; if it is structured data, analyze the data situation and combine the mapping rules specified by experts; compile the mapping matching program; execute the mapping program to extract domain knowledge. If it is semi-structured data, parse the semi-structured data according to the data composition; select the semi-structured knowledge extraction method: including manual generation method, wrapper generation method, automatic extraction method, etc.; execute the knowledge acquisition method. If it is unstructured data, prepare the basic prediction library; annotate the existing data files to form a richer corpus; select the corresponding analysis model and conduct model training; evaluate the model to meet the accuracy and recall requirements; the third step: store and output the extracted knowledge.
[0076] For knowledge modeling; the process of abstracting and generalizing knowledge, its functions include ontology management, attribute management, relationship management and knowledge model management.
[0077] For knowledge mapping; establish a mapping process between knowledge model and physical model, map the ontology of knowledge model with data set or data table, map the attributes with data set or data table fields to generate specific entity data.
[0078] For knowledge construction; it supports incremental construction, full construction, automated construction, etc. of graphs, extracts knowledge from the data set according to the task construction configuration, generates entities and relationships according to the knowledge model definition, performs conflict detection on the generated entities and relationships, and executes conflict resolution strategies to complete knowledge construction and update.
[0079] In one embodiment, the knowledge base may also include document knowledge constructed based on document data and database knowledge stored in a database; accordingly, the knowledge base construction of this embodiment may include the following:
[0080] ① Based on the document knowledge data, preprocessing, document segmentation, vector embedding and other processing processes are performed to convert the original document data into document knowledge in the knowledge base; ② Through data preprocessing, entity recognition, relationship extraction, attribute extraction, knowledge integration and storage, various knowledge is organized into a network structure and saved in the knowledge base; ③ Database knowledge is introduced from traditional relational databases, analytical databases and other database libraries.
[0081] In one embodiment, Figure 3 As shown, Figure 3 This is an example flow chart of a method for building document knowledge in a knowledge base, which may include the following:
[0082] S201, acquiring document data in various formats, and preprocessing the document data.
[0083] Exemplarily, the original document is obtained, such as a document in a format such as word, pdf, html, Markdown, etc., and then necessary processing is performed.
[0084] S202, based on the document segmentation algorithm, the preprocessed original document data is segmented to obtain text blocks, and the corresponding summaries, question and answer data and knowledge graphs of the text blocks are generated.
[0085] For example, the title content and the body content are segmented by using a segmentation algorithm based on a title, and the chapter or title information of the segment is added to the head of each text block content, so that the segment content can better maintain the semantic information in the original document. The segmentation algorithm may include segmentation by paragraph recursion, segmentation by title, segmentation by line, segmentation by fixed delimiter, segmentation by title, segmentation by semantics, etc.
[0086] S203, vectorizing the text block, summary, and question-answer data and constructing a vectorized index.
[0087] Exemplarily, establishing a vectorized index is to extract data from the original data source and establish the index in an offline state. Establishing the data index includes the following steps: data indexing, text segmentation, text vectorization, etc.; among which, the data index cleans and extracts the original data, mainly converting multiple file formats such as PDF, HTML, Word, Markdown, etc. into plain text format, and dividing the overall text into atomic paragraphs so that the model can process it effectively.
[0088] S204, storing the vectorized index, knowledge graph and original document data as document knowledge in a knowledge base.
[0089] Specifically, text vectorization and index construction uses a language model to convert text into vector form. The vector will calculate its similarity with the user question vector in the subsequent information retrieval process, import the vector data into the vector library, and realize index construction.
[0090] As in the above-mentioned embodiment, by constructing document knowledge in the knowledge base, a retrieval mechanism based on retrieval enhancement can be constructed, thereby improving the generation quality, diversity and accuracy of subsequent large-scale language models, and enhancing the knowledge base, thereby improving the real-time and accuracy of intelligent recommendations.
[0091] In one embodiment, the knowledge contained in unstructured text data is analyzed and mined, including the following: 1) Sequence labeling, such as Chinese word segmentation, part-of-speech tagging, named entity recognition, semantic role labeling, etc. Each word in the sentence requires the model to give a classification category based on the context. 2) Classification tasks, such as text classification, sentiment calculation, etc., give a classification category overall. 3) Sentence relationship judgment, such as text implication, QA, semantic rewriting, natural language reasoning, etc. Given two sentences, determine whether the two sentences have a certain semantic relationship. 4) Generative tasks, such as machine translation, text summarization, poetry writing, picture description, etc., automatically generate another paragraph of text after inputting text content.
[0092] Step S30: determining a prompt template matching the current session according to the business domain involved in the current session and filling in the prompt.
[0093] In this step, intent recognition is performed based on the user's input to identify whether the user's request is a question and answer or a command call, the business domain involved in the session and the corresponding knowledge base are identified, the prompt template suitable for the session call is identified, and the prompt is filled in; the multi-modality corresponding to the user's command is identified, and the parameters are obtained to assemble the call instruction.
[0094] Step S40: searching the knowledge base to obtain context information.
[0095] In this step, entities are extracted from the query content entered by the user, and contextual information is established by querying the subgraph of related entities in the knowledge base for input into the large language model for recognition.
[0096] In one embodiment, reference Figure 4 As shown, Figure 4 is a schematic diagram of an example retrieval process. The above method for searching and obtaining context information in a knowledge base may include the following:
[0097] S41, pre-retrieval processing: decompose the user query into multiple sub-queries, and perform reference resolution and query rewriting processing on each sub-query to obtain several query questions.
[0098] Exemplarily, a multi-query retriever may be used, which uses a large language model to automatically generate multiple sub-queries for a given user input from multiple dimensions, thereby overcoming retrieval limitations and obtaining richer and more diverse retrieval results.
[0099] For example, some common coreference resolution scenarios can be integrated into the large language model as short examples to analyze and handle more complex coreference resolution problems. Coreference resolution can reduce the number of pronouns in user queries, thereby improving the retrieval system's understanding and accuracy of user queries.
[0100] Exemplarily, in order to further improve the query rewriting effect, this embodiment introduces an auxiliary model obtained by collecting domain data for supervised pre-training and fine-tuning as a rewriter. The auxiliary model is used to adjust user queries to better adapt to the processing requirements of fixed retrievers and large language models, thereby processing user queries with unclear expressions, unclear meanings or overly complex structures, thereby improving retrieval accuracy.
[0101] S42, knowledge retrieval: performing knowledge retrieval on the query question based on the knowledge base to obtain preliminary retrieval results.
[0102] In this step, database query, vector search, QA (question and answer) search, knowledge graph search, plug-in search, keyword search and other methods can be used.
[0103] In one embodiment, in order to improve the accuracy of the search results, multiple search strategies can be used to enhance the depth of the search, and the user query question is rewritten to generate one or more queries, and the query questions are distributed to different search method processes after query routing.
[0104] Accordingly, the method for obtaining preliminary search results by knowledge retrieval in the above step S42 can be based on the knowledge base and adopt a hybrid retrieval method of knowledge graph retrieval, vector retrieval and database retrieval to perform knowledge retrieval on the query question to obtain preliminary search results.
[0105] Knowledge graph retrieval is a technology that uses knowledge graph information to retrieve and provide information related to a specific task. Conventional knowledge graph retrieval generally includes steps such as entity recognition, relationship recognition, and query matching from queries. Each step often requires special fine-tuning of a small language model, and for different knowledge graphs, re-fine-tuning training is often required, which is time-consuming and costly.
[0106] In this embodiment, in order to better perform knowledge retrieval on multiple knowledge graphs, the semantic understanding ability and prompt word engineering of the large language model are used to extract entities from the query content entered by the user, and then context information is established by constructing a subgraph of entities related to the query.
[0107] For vector retrieval, this embodiment provides an optimized vector retrieval method, which may include the following:
[0108] (1) The text blocks in the document vector library are segmented into a set of knowledge sentences.
[0109] Since the input of the large language model is limited, further refining the segmentation of the segmented knowledge documents and further slicing the paragraphs to form a set of knowledge sentences can achieve better auxiliary recall effects.
[0110] (2) Using NLP (Natural Language Processing) technology to perform keyword extraction and part-of-speech tagging on user queries and knowledge sentence sets, perform entity extraction on user queries and knowledge sentence sets to obtain common entity vocabulary, and combine the keywords and entity vocabulary into a business subject vocabulary set.
[0111] Specifically, NLP related technologies are used to extract keywords from user queries and knowledge sentence sets, and then these keywords are tagged with parts of speech. Finally, non-noun keywords are filtered out, and entity extraction is performed on user queries and knowledge sentence sets to obtain common entity vocabulary, and the common entity vocabulary and keyword vocabulary are combined into a business subject vocabulary set.
[0112] (3) Mapping the business subject vocabulary set to a low-dimensional space, and using a similarity calculation method to calculate the similarity between the query question and the knowledge sentence set to obtain a similar knowledge sentence set.
[0113] Specifically, this step is based on the vector recall of fused keywords and general entities, maps the business subject vocabulary set obtained by business subject vocabulary extraction to a low-dimensional space, and then uses the similarity calculation method to perform similarity comparison calculation on the vectors of user queries and knowledge sentence sets to obtain the initial retrieval results.
[0114] For example, the vector recall process based on the fusion of keywords and general entities can be as follows:
[0115] Step s1: Input the user query, call the business subject vocabulary extraction module to perform text mining, obtain the business subject vocabulary of the user query, and enter step s2;
[0116] Step s2: The business subject vocabulary is called into the vector model for dimensionality reduction, and finally a business subject vocabulary vector is formed, and then the process goes to step s3;
[0117] Step s3: average the business topic vocabulary vector list by column and finally merge them into the final text vector;
[0118] Step s4: Input a knowledge sentence, call the business subject vocabulary extraction module to perform text mining, obtain the business subject vocabulary of the knowledge sentence, enter steps s2 and s3, obtain the text vector of the knowledge sentence, and then store it in the vector database. The specific steps are as follows:
[0119] Step 1: Obtain the subject vocabulary of the knowledge sentence;
[0120] Step 2: Vectorize the business topic vocabulary and combine them to form a sentence semantic vector;
[0121] Step 3: Build a multi-level index and store the knowledge sentence text, the business subject vocabulary of the knowledge sentence, and the sentence semantic vector into the vector database;
[0122] Step 4: Repeat Step 3 until all knowledge sentences are traversed;
[0123] Step s5: vectorize the user query obtained in step s1 and perform similarity calculation with the knowledge sentence set vector in the vector database to obtain multiple knowledge sentences that are most similar to the user query.
[0124] (4) Perform accurate sorting and recall based on the LSI (Latent Semantic Indexing) semantic model; the LSI model is a text topic model based on singular value decomposition (SVD).
[0125] As an example, the above precise sorting recall may include the following:
[0126] The LSI semantic model is trained based on a set of similar knowledge sentences; the query question is input into the LSI semantic model to obtain the similarity weights corresponding to the similar knowledge sentence set and the query question; the knowledge sentence that best matches the query question is obtained as context information according to the similarity weight sorting.
[0127] Exemplarily, the refined sorting and recall process based on the LSI latent semantic model may include the following:
[0128] Step s1: Obtain the knowledge sentence set retrieved for the first time and proceed to step s2;
[0129] Step s2: Train the LSI latent semantic model based on the knowledge sentence set obtained in step 1, save and wait for prediction, and enter step s3;
[0130] Step s3: Input the user query to be predicted, call the similarity retrieval model trained in step s2, obtain the weight of each knowledge sentence similar to the user query, and enter step s4;
[0131] Step s4: Sort the weighted knowledge sentence set in step s3, select the first three, and proceed to step s5;
[0132] Step s5: The knowledge sentences obtained in step s4 are the knowledge sentences that are most closely related to the user's query. The knowledge sentences are combined to form the final knowledge sentences for recognition by the large language model.
[0133] Step s6: End.
[0134] As mentioned above, the hybrid retrieval scheme searches the knowledge base by introducing a combined search method of keywords, entity recognition, dimensionality reduction processing, and LSI semantic models, which enhances the semantics and business nature of the feature dimensions, improves the accuracy of retrieval, and reduces the misjudgment rate.
[0135] S43, post-retrieval processing: screening, context compression and re-ranking operations are performed on the preliminary retrieval results to obtain context information suitable for a large language model.
[0136] Specifically, when the results obtained by the initial search are large and exceed the context length of the large language model, the context is compressed to remove redundant information and query irrelevant noise while maintaining semantics, thereby providing more effective context information for the large language model. Preferably, the unimportant signs in the context can be detected and removed by using an aligned and trained small model, and converted into a form that is difficult for humans to understand but easy for the large language model to understand, effectively improving system performance.
[0137] In one embodiment, to further improve the rearrangement performance, a model specifically used for rearrangement may be trained as a rearranger; accordingly, the process of the reordering operation may include:
[0138] A rearranger is constructed and trained based on the reranking model and the document embedding model; a relevance score between the preliminary search results and the query question is calculated, and the preliminary search results and their relevance scores are input into the rearranger for reranking.
[0139] As in the above-mentioned embodiment, with the re-ranking model and document embedding, the relevance and quality of the context are improved by optimizing the re-ranking process, thereby providing more reliable semantic support for the final answer generation.
[0140] In order to improve the accuracy of the reordering operation, preferably, this embodiment also provides a reordering technical solution.
[0141] (a) Calculating the relevance scores between the preliminary search results and the query question, and inputting the preliminary search results and their relevance scores into a re-ranker for re-ranking.
[0142] (b) Take the re-ranked first-rank context information from the preliminary retrieval results.
[0143] (c) returning to step (a) to calculate the relevance score between the preliminary search results and the query question, and then inputting the scores into the re-ranker for re-ranking;
[0144] (d) Return to step (b) and retrieve the first context information again.
[0145] (e) Repeat the above reordering process of steps (a) to (d) until the required amount of context information is retrieved.
[0146] As for the re-ranking scheme in the above-mentioned embodiment, compared with the conventional method of directly taking the top K preliminary search results after sorting, this embodiment calculates and takes out the first preliminary search result each time, and then re-ranks again, so that the sorting of the final K screened context information can be more accurate, which can greatly improve the accuracy of the subsequent large language model recognition answer.
[0147] The search scheme of the above embodiments can significantly improve the recall accuracy; it greatly alleviates the problem of irrelevant search results caused by using only vector search, and avoids the omission problem caused by using only literal search. Based on the accurate sorting of relevant knowledge through the LSI latent semantic model, the relevant knowledge that the user wants to know can be found more accurately.
[0148] Step S50: input the context information and user query into a large language model to generate an answer, and generate recommended content using the answer and prompt template.
[0149] Specifically, Figure 5 As shown, Figure 5 This is a schematic diagram of an example of an intelligent recommendation algorithm. Based on query services and understanding of user query intent, in knowledge graph applications, it uses natural language processing syntactic and semantic analysis technology as well as information retrieval and text generation technology to correctly understand the questions raised by users, extract key information from them, and search and match them with the knowledge graph. Finally, the obtained answers and prompt templates are used to generate recommended content and feedback to users.
[0150] The intelligent recommendation method based on knowledge graph of the present application uses distributed storage and parallel processing to efficiently construct knowledge graph, uses deep semantic mining of knowledge graph to combine personalized recommendation with user historical behavior and current context information, and optimizes the recommendation strategy of unstructured data based on vector library; adds entity extraction to keyword search to avoid the problem of missing keyword search, and associates through vectorization to avoid missing some important information through literal search such as keyword search; concatenates keywords and entity words for the first search to obtain domain knowledge that is roughly similar to the user's query, and then further refines these roughly similar domain knowledge through LSI latent semantic model, and finally recalls the knowledge points that are closest to the user's query. This technical solution solves the problem of irrelevant retrieval results caused by the simple use of vector search; combines keywords and entity words for dimensionality reduction and concatenation, enhances the semantics of feature dimensions and domain business, thereby avoiding the problem of missing due to the simple use of literal search; accurately sorts related knowledge through LSI latent semantic model, and can more accurately find the knowledge that users want to know.
[0151] An embodiment of an intelligent recommendation device based on knowledge graph is described below.
[0152] refer to Figure 6 As shown, Figure 6 The structure diagram of an intelligent recommendation device based on knowledge graph according to an embodiment includes:
[0153] A user session unit 10, used to obtain a user query input by a user in a current session;
[0154] A business determination unit 20, configured to determine a knowledge base corresponding to a business domain involved in the current session according to the user query; wherein the knowledge base includes graph knowledge constructed according to business requirements using multi-source heterogeneous industry material data;
[0155] The prompt matching unit 30 is used to determine the prompt template matched in the current session according to the business domain involved in the current session and fill in the prompt;
[0156] A knowledge retrieval unit 40, used to search the knowledge base to obtain context information;
[0157] The answer generation unit 50 is used to input the context information and user query into the large language model to generate an answer, and generate recommended content from the answer and prompt template.
[0158] The knowledge graph-based intelligent recommendation device of this embodiment can execute a knowledge graph-based intelligent recommendation method provided by the embodiment of the present application. The implementation principle is similar. The actions performed by each module in the knowledge graph-based intelligent recommendation device in each embodiment of the present application correspond to the steps in the knowledge graph-based intelligent recommendation method in each embodiment of the present application. For the detailed functional description of each module of the knowledge graph-based intelligent recommendation device, please refer to the description of the corresponding knowledge graph-based intelligent recommendation method shown in the previous text, which will not be repeated here.
[0159] An embodiment of the intelligent recommendation system is described below.
[0160] The present application provides an intelligent recommendation system, which is used to execute the steps of the intelligent recommendation method based on knowledge graph in any of the above embodiments. Figure 7 As shown, Figure 7 This is a recommendation flowchart of an example intelligent recommendation system. According to the user query input by the user, the user's intention is identified, the business domain involved in the session and the corresponding knowledge base are identified, the prompt template suitable for the session is identified, and the prompt is filled in. The multimodal corresponding to the user instruction is identified, and the parameter assembly call instruction is obtained. In knowledge retrieval, pre-retrieval processing, knowledge retrieval, post-retrieval processing, answer generation, etc. are performed in sequence to obtain the context information of the knowledge content related to the user's question. Finally, the final answer is generated through a large language model based on the context information obtained in the knowledge retrieval process.
[0161] The above embodiments only express several implementation methods of the present application, and the descriptions thereof are relatively specific and detailed, but they cannot be understood as limiting the scope of the invention patent. It should be pointed out that, for a person of ordinary skill in the art, several variations and improvements can be made without departing from the concept of the present application, and these all belong to the protection scope of the present application. Therefore, the protection scope of the patent of the present application shall be subject to the attached claims.
Claims
1. An intelligent recommendation method based on knowledge graph, characterized in that: include: Get the user query entered by the user in the current session; Determine the knowledge base corresponding to the business domain involved in the current session according to the user query; wherein the knowledge base includes graph knowledge constructed according to business requirements using multi-source heterogeneous industry material data; Determine the prompt template matching the current session according to the business domain involved in the current session and fill in the prompt; Searching the knowledge base to obtain context information; The context information and user query are input into a large language model to generate an answer, and the answer and prompt template are used to generate recommended content.
2. The intelligent recommendation method based on knowledge graph according to claim 1, characterized in that: Also includes: Introducing multi-source heterogeneous industry material data; wherein the multi-source heterogeneous industry material data includes basic industry data, open source industry data and text industry data; Extract data metadata information based on data technology and business characteristics, and associate and fuse heterogeneous industry material data based on data metadata classification; Process multi-source heterogeneous data into data sets with unified specifications and integrate them into the data resource pool; A knowledge system is constructed based on a data resource pool, entities, relationships and attributes are extracted from the data resource pool, and the knowledge base is constructed in an ontology mapping manner.
3. The intelligent recommendation method based on knowledge graph according to claim 1, characterized in that: Searching the knowledge base to obtain context information includes: Decompose the user query into multiple sub-queries, and perform reference resolution and query rewriting on each sub-query to obtain several query questions; Performing knowledge retrieval on the query question based on the knowledge base to obtain preliminary retrieval results; The preliminary search results are screened, context compressed and re-ranked to obtain context information suitable for a large language model.
4. The intelligent recommendation method based on knowledge graph according to claim 3 is characterized in that: The process of reordering operations includes: Build and train a reranker based on the reranking model and document embedding model; Calculating the relevance scores between the preliminary search results and the query question, and inputting the preliminary search results and their relevance scores into a re-ranker for re-ranking; The first reordered context information is taken out from the preliminary search results, the relevance score between the preliminary search results and the query question is recalculated, and then input into the re-ranker for re-ranking; the first reordered context information is taken out again; The above reordering process is repeated until the required amount of context information is retrieved.
5. The intelligent recommendation method based on knowledge graph according to claim 3 is characterized in that: The knowledge base also includes document knowledge constructed based on document data and database knowledge stored in a database; The step of performing knowledge retrieval on the query question based on the knowledge base to obtain preliminary retrieval results includes: Based on the knowledge base, a hybrid retrieval method of knowledge graph retrieval, vector retrieval and database retrieval is used to perform knowledge retrieval on the query question to obtain preliminary retrieval results.
6. The intelligent recommendation method based on knowledge graph according to claim 5, characterized in that: Also includes: Acquire document data in various formats and pre-process the document data; Based on the document segmentation algorithm, the preprocessed original document data is segmented to obtain text blocks, and the corresponding summaries, question-answering data and knowledge graphs of the text blocks are generated; Vectorize the text blocks, summaries, and question-answer data and construct a vectorized index; The vectorized index, knowledge graph and original document data are stored as document knowledge in a knowledge base.
7. The intelligent recommendation method based on knowledge graph according to claim 5, characterized in that: The vector retrieval process includes: The text blocks in the document vector library are segmented into a set of knowledge sentences; Using NLP technology to perform keyword extraction and part-of-speech tagging on user queries and knowledge sentence sets, performing entity extraction on user queries and knowledge sentence sets to obtain common entity vocabulary, and combining the keywords and entity vocabulary into a business subject vocabulary set; The business subject vocabulary set is mapped to a low-dimensional space, and the similarity between the query question and the knowledge sentence set is calculated using a similarity calculation method to obtain a similar knowledge sentence set.
8. The intelligent recommendation method based on knowledge graph according to claim 7, characterized in that: Also includes: Train the LSI semantic model based on a set of similar knowledge sentences; Input the query question into the LSI semantic model to obtain the similarity weights of the similar knowledge sentence set corresponding to the query question; The knowledge sentences that best match the query question are obtained as context information based on the similarity weight sorting.
9. An intelligent recommendation device based on knowledge graph, characterized in that: include: User session unit, used to obtain user queries entered by users in the current session; A business determination unit, configured to determine a knowledge base corresponding to a business domain involved in the current session according to the user query; wherein the knowledge base includes graph knowledge constructed according to business requirements using multi-source heterogeneous industry material data; A prompt matching unit, used to determine a prompt template matching the current session according to the business domain involved in the current session and fill in the prompt; A knowledge retrieval unit, used to search the knowledge base to obtain context information; The answer generation unit is used to input the context information and user query into the large language model to generate an answer, and generate recommended content from the answer and prompt template.
10. An intelligent recommendation system, characterized in that: Used to execute the steps of the knowledge graph-based intelligent recommendation method described in any one of claims 1-8.
Citation Information
Cited By
Recommendation method and device based on large language model
CN119988660A
Construction method, data processing method and device, electronic equipment and storage medium
CN120216705A
Large model retrieval enhancement generation method based on multi-source data adaptive fusion
CN120596616A
Knowledge recommendation method, device and equipment based on aerospace remote sensing map and medium
CN120804304A
Multi-modal knowledge base generation method, multi-modal information retrieval enhancement generation method and digital human multi-modal interaction method
CN121029962A