CN-121998732-A - Recommendation method and system based on knowledge tree prompt and article multivariate relation modeling
Abstract
The invention discloses a recommendation method and a recommendation system based on knowledge tree prompt and article multivariate relation modeling, and relates to the technical field of intelligent recommendation; the method comprises the steps of dynamically constructing a knowledge tree from an extended map based on a user history basket sequence and generating a knowledge tree prompt to enhance semantic understanding of a large language model on articles in the vertical field, inputting the user sequence and the knowledge prompt into the large language model to extract sequence characterization, dynamically constructing an article hypergraph based on multi-dimensional similarity of the articles, extracting article multi-element relation characterization by utilizing a hypergraph convolution network, and finally predicting the next basket article of the user by merging the two characterization through a frequency perception gating unit. The method effectively relieves the problem of single long tail effect and relationship modeling in the traditional recommendation, and remarkably improves the accuracy and the interpretability of the next basket recommendation.
Inventors
- WANG CHANGDONG
- MAI ZIFENG
- LAI PEIYUAN
- TANG JI
- ZHOU FEI
- ZHOU HUIYU
Assignees
- 中山大学
- 广西壮族自治区信息中心(广西壮族自治区大数据研究院)
- 广西智桂通科技有限公司
- 广东技术师范大学
Dates
- Publication Date
- 20260508
- Application Date
- 20260112
Claims (8)
- 1. A recommendation method based on knowledge tree prompt and article multiple relation modeling is characterized by comprising the following steps: Constructing an initial knowledge graph based on the article attribute information, and adding a basket purchased by a user in a history manner and a contained relation between the basket and the article as a newly added entity and relation on the basis of the initial knowledge graph to form an expanded knowledge graph; According to the user history purchasing basket sequence, dynamically constructing a knowledge tree from the expanded knowledge graph, performing breadth-first traversal on the knowledge tree, extracting a triple structure, and generating a knowledge tree prompt in a natural language form based on a preset prompt template; The method comprises the steps of inputting a user history basket sequence and knowledge tree prompts into a large language model together, extracting the embedded representation of the last token output by the model, and taking the embedded representation as a sequence representation of fused semantic information; dynamically constructing an article hypergraph based on the similarity among articles, and extracting the multivariate relation representation of the articles in the hypergraph by using a hypergraph convolution network; Based on the historical purchasing frequency of the user on the articles, the sequence characterization and the article multivariate relation characterization are weighted and fused through a frequency-aware gating unit, and an article prediction result of the next basket of the user is generated.
- 2. The recommendation method based on knowledge tree prompting and item multivariate relation modeling according to claim 1, wherein an initial knowledge graph is constructed based on item attribute information, and based on the initial knowledge graph, a basket purchased by a user historically and inclusion relations between the basket and items are added as newly added entities and relations to form an expanded knowledge graph, comprising: an article entity and an article attribute entity are used as nodes, an association relationship between the article and the attribute is used as an edge, an initial knowledge graph is constructed, the article entity in the initial knowledge graph represents a recommended commodity or service, and the article attribute entity represents the characteristics, the category or the label of the article; Acquiring historical purchase information of a user, defining each purchase of the user as a basket entity, distributing a unique identifier for each basket entity, adding the basket entity into the initial knowledge graph, constructing inclusion relation edges pointing to all article entities contained in the basket from the basket entity, and generating basket-article association; and in the initial knowledge graph, generating an expanded knowledge graph with a three-layer structure of basket entity, article entity and article attribute entity according to the newly added basket entity and the inclusion relationship.
- 3. The recommendation method based on knowledge tree prompting and item multivariate relation modeling according to claim 1, wherein the dynamically constructing a knowledge tree from the expanded knowledge graph according to the user history purchasing basket sequence, performing breadth-first traversal on the knowledge tree, and extracting a triplet structure comprises: Mapping each basket in the user history purchase basket sequence into a corresponding basket entity node in the expanded knowledge graph, and taking each basket entity node as a root node of a knowledge tree; performing cluster search in the expanded knowledge graph by taking the root node as a starting point, and building a comprehensive scoring function by integrating the association strength, the information novelty and the correlation with a user sequence in the search process, and reserving N optimal paths with highest scores according to the comprehensive scoring function when each layer is expanded; stopping searching when the searching depth reaches a preset threshold value or the path score is lower than the preset threshold value, obtaining a path set taking the root node as a starting point, and constructing a dynamic knowledge tree taking a basket entity as a root, an article entity contained in the basket as a middle layer and an attribute entity associated with the article as a leaf node; And performing breadth-first traversal on each dynamic knowledge tree, and sequentially recording a head entity, a relation and a tail entity corresponding to each edge in the traversal process to generate a triplet sequence arranged according to the traversal order.
- 4. A method of recommending modeling based on knowledge tree cues and item multi-relations according to claim 3, characterized in that for the triplet sequence, knowledge tree cues in natural language form are generated based on a preset cue template, comprising: Hierarchical marking is carried out on the triplet sequence, the triplet sequence is divided into different levels according to the types of head entities in the triples, and the triples are ordered in the same level according to the predefined relation priority, so that a structured triplet list is generated; According to the relation type in the triplet, matching the corresponding natural language sentence pattern template from a preset prompting template library, filling the head entity, the relation and the tail entity in the triplet into the corresponding slot positions of the selected template, and generating a knowledge tree prompt in a natural language form; Arranging and splicing knowledge tree prompts corresponding to each basket in the user historical purchasing basket sequence according to the purchasing time sequence, and inserting time sequence related words between different knowledge tree prompts to form a serialized knowledge description text; and detecting and merging redundant information of the generated knowledge tree prompt, and intelligently cutting the prompt text according to the context length limit of the large language model to generate a final knowledge tree prompt.
- 5. The recommendation method based on knowledge tree hints and item multivariate relation modeling according to claim 1, wherein inputting the user history basket sequence and knowledge tree hints together into a large language model extracts an embedded representation of the last token output by the model as a sequence representation of fused semantic information, comprising: Formatting an item list in each history basket in a user history basket sequence into a natural language description short sentence, and combining the description short sentence with the corresponding knowledge tree prompt to generate a description-knowledge block; Sequentially arranging the description-knowledge blocks according to the purchase time, and respectively adding task guide sentences and semantic characterization extraction instructions at the beginning and the end to form a structured combined input text; Converting the combined input text into a token sequence, inputting the token sequence into a large language model, carrying out context understanding and information fusion on the description-knowledge block by the large language model based on the task guide statement and the separation mark, and carrying out semantic summarization and compression on all input information according to the semantic representation extraction instruction; And acquiring a high-dimensional context-aware embedded vector generated by the large language model for the last token in the input sequence, and outputting the high-dimensional context-aware embedded vector as a sequence representation fusing the user historical behavior mode and the knowledge in the article field.
- 6. The recommendation method based on knowledge tree hints and item multivariate relation modeling according to claim 1, wherein dynamically constructing an item hypergraph based on similarity between items, extracting the multivariate relation representation of the items in the hypergraph using a hypergraph convolution network, comprises: Based on initial characterization of the articles, similarity scores between any two articles are calculated from predefined dimensions by utilizing a mixed expert network, and the similarity scores of the expert networks are dynamically fused to generate an article similarity matrix; Presetting a similarity scoring threshold value, and screening object pairs exceeding the preset similarity scoring threshold value in the object similarity matrix for the target object to form a candidate object set corresponding to the target object; taking each candidate article set as a superside, taking all articles in the set as nodes connected by the supersides, initially constructing a supergraph structure, performing redundancy elimination and merging operation on the supersides in the supergraph structure, and generating a dynamic article supergraph representing a multi-element cooperative relationship among the articles; And executing hypergraph convolution operation on the dynamic object hypergraph, enabling object nodes to aggregate information of neighbor nodes by stacking multiple layers of hypergraph convolution networks, and taking node representation output by the last layer of hypergraph convolution network as a multivariate relation representation of the object.
- 7. The recommendation method based on knowledge tree prompting and item multivariate relation modeling according to claim 1, wherein the step of generating an item prediction result of a next basket of the user by weighting and fusing the sequence characterization and the item multivariate relation characterization through a frequency-aware gating unit based on historical purchase frequency of the item by the user comprises the following steps: Extracting historical purchase times of a user on each article, carrying out normalization processing, obtaining frequency values of the user on the article re-purchase tendency, and constructing frequency vectors of the user according to the frequency values of all the articles; Inputting the sequence representation of the user and the frequency vector into a gating neural network, wherein the gating neural network calculates a corresponding gating value for each article, and the gating value approaches 1 to indicate a long-term preference of the user and approaches 0 to indicate a multi-element cooperative relationship among the articles; Converting the sign of the user into an interaction score knowledge value of the user and the article through a projection network, taking the interaction score knowledge value as a preference basic score, taking the gating value as a weight, and carrying out weighted summation on scores of the preference basic score and the article after linear mapping on the multivariate relation sign of the article to obtain a final prediction score of the article; And calculating the final prediction scores of all the articles, sorting according to the scores, selecting the top K articles with the highest scores based on the sorting results, and outputting the top K articles as the prediction result of the next basket of the user.
- 8. The recommendation system based on knowledge tree prompt and article multivariate relation modeling is characterized by being used for realizing the recommendation method based on knowledge tree prompt and article multivariate relation modeling according to any one of claims 1-7, and comprises a knowledge graph construction and expansion module, a knowledge tree prompt construction module, a large model sequence coding module, an article hypergraph construction module, a multi-article relation coding module and a frequency perception gating unit module; The knowledge graph construction and expansion module constructs an initial knowledge graph based on the article attribute information, and adds the basket purchased by the user in history and the inclusion relationship between the basket and the article as a newly added entity and relationship on the basis of the initial knowledge graph to form an expanded knowledge graph; The knowledge tree prompt construction module dynamically constructs a knowledge tree from the expanded knowledge graph according to the user history purchasing basket sequence, performs breadth-first traversal on the knowledge tree, extracts a triple structure, and generates a knowledge tree prompt in a natural language form based on a preset prompt template; the large model sequence coding module receives a user history basket sequence and knowledge tree prompts, extracts the embedded representation of the last token output by the model, and uses the embedded representation as a sequence representation of fusion semantic information; The article hypergraph construction module calculates multidimensional similarity to dynamically construct a hypergraph structure connected with the article based on the article basic representation, and generates an article hypergraph; The multi-article relation coding module extracts multi-article relation characterization of articles in the hypergraph by using a hypergraph convolution network, and acquires a multi-article cooperation mode in the next basket recommendation scene; The frequency-aware gating unit module performs weighted fusion on the sequence representation and the article multivariate relation representation through the frequency-aware gating unit based on the historical purchasing frequency of the articles by the user, and generates an article prediction result of the next basket of the user.
Description
Recommendation method and system based on knowledge tree prompt and article multivariate relation modeling Technical Field The invention relates to the technical field of intelligent recommendation, in particular to a recommendation method and system based on knowledge tree prompt and article multivariate relation modeling. Background With the rapid development of electronic commerce platforms, recommendation systems have become a key technical means for connecting users and commodities, and the core objective is to predict future purchase interests according to historical behavior data of users. In an actual shopping scenario, users tend to purchase multiple goods simultaneously in one transaction to meet diversified demands. This behavior pattern motivates the "next basket recommendation" task whose goal is not to predict a single item but rather a group of items that the user is likely to purchase next. However, the traditional next basket recommendation method relies on the article ID to carry out collaborative filtering modeling, so that cold start and long-tail commodities are difficult to effectively process, recommendation results are biased towards hot commodities, and diversity and fairness of recommendation are affected. In addition, the existing method is mostly based on binary relation modeling among articles, and complex multi-element association exists among articles in an actual shopping scene, such as collocation purchase, scene combination and the like, and the multi-level and multi-angle synergistic effect is difficult to capture only by relying on the binary relation. Furthermore, large language models are introduced into recommendation systems to enhance semantic understanding capabilities. However, in the vertical field, a large number of commodity names belong to the word "out of vocabulary" vocabulary, and without pre-training of large models, the models have limited understanding ability on these commodities, and "hallucinations" or false inferences are easily generated, which affect recommendation accuracy. In order to cope with the above challenges, the existing research begins to explore a method of combining knowledge maps and large models, so as to improve understanding ability of commodity semantics and model complex relationships among commodities through a graph structure. However, how to effectively integrate knowledge guidance and large model reasoning and how to dynamically model the cooperative relationship among multiple items is still a key problem to be solved in the current next basket recommendation system. Disclosure of Invention In order to solve the technical problems, the invention provides a recommendation method and a recommendation system based on knowledge tree prompt and article multivariate relation modeling, which deeply fuses knowledge in the field, models article multivariate relation, adapts to the recommendation method of semantic understanding requirements in the vertical field, and improves the accuracy, the interpretability and the practicability of next basket recommendation. The invention provides a recommendation method based on knowledge tree prompt and article multivariate relation modeling, which comprises the following steps: Constructing an initial knowledge graph based on the article attribute information, and adding a basket purchased by a user in a history manner and a contained relation between the basket and the article as a newly added entity and relation on the basis of the initial knowledge graph to form an expanded knowledge graph; According to the user history purchasing basket sequence, dynamically constructing a knowledge tree from the expanded knowledge graph, performing breadth-first traversal on the knowledge tree, extracting a triple structure, and generating a knowledge tree prompt in a natural language form based on a preset prompt template; The method comprises the steps of inputting a user history basket sequence and knowledge tree prompts into a large language model together, extracting the embedded representation of the last token output by the model, and taking the embedded representation as a sequence representation of fused semantic information; dynamically constructing an article hypergraph based on the similarity among articles, and extracting the multivariate relation representation of the articles in the hypergraph by using a hypergraph convolution network; Based on the historical purchasing frequency of the user on the articles, the sequence characterization and the article multivariate relation characterization are weighted and fused through a frequency-aware gating unit, and an article prediction result of the next basket of the user is generated. In the scheme, an initial knowledge graph is constructed based on article attribute information, and based on the initial knowledge graph, a basket purchased by a user in history and a contained relation between the basket and an article are added as a newly added e