Graph neural network-based big language model enhanced recommendation item index method and system
By constructing a co-occurrence graph of items using a graph neural network and performing hierarchical clustering, an index of semantically similar items is generated. This solves the problem of fusing collaborative signals and attribute features in large language model recommendation systems, improves recommendation accuracy and computational efficiency, and adapts to dynamic interactive changes.
Patent Information
- Application Number
- CN202610031821.4
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2026-01-12
- Publication Date
- 2026-05-15
AI Technical Summary
Existing technologies struggle to effectively integrate collaborative signals and attribute features in large language model recommendation systems. Improper hierarchical structure design leads to low computational efficiency and makes it difficult to adapt to dynamic changes in user-item interactions.
A graph neural network is used to construct an attribute-enhanced item co-occurrence graph. Item embeddings are generated through graph representation learning. By combining hierarchical clustering and path encoding, index identifiers for semantically similar items are generated and integrated into a large language model recommendation system.
It improves the accuracy and stability of recommendation systems, reduces computational overhead, supports dynamic updates, and adapts to different datasets and business scenarios.
Smart Images

Figure CN122045484A_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the fields of recommendation systems and natural language processing technology, specifically to a method and system for indexing recommendation items based on a large language model (LLM) enhanced by a graph neural network (GNN), which is suitable for personalized recommendation scenarios that require natural language interaction through a large language model. Background Technology
[0002] In recent years, large language models (LLMs) have gained strong natural language understanding and generation capabilities by being trained on large-scale corpora. This enables recommendation systems to interactively express themselves and generate recommendation results in natural language, thereby promoting the gradual expansion of recommendation tasks from traditional numerical rating prediction to natural language generative recommendation.
[0003] In large language model-based recommender systems, the model typically receives user information and item identifiers in text format and outputs a recommendation list or explanation. Therefore, the representation of item identifiers / item indices directly affects the model's ability to model and generalize relationships between items, making it a crucial factor influencing recommendation performance. Inappropriate item identifier design can lead to the model's difficulty in learning the connections between items, and may even result in recommendations that are inconsistent with or incorrect to the user's actual preferences (a phenomenon that can be viewed as an "illusion" in generative models within the recommendation context).
[0004] Meanwhile, real-world recommendation systems often deal with user and item collections of millions or even larger scale. To adapt to the word segmentation and input mechanisms of large language models, the item index should be compatible with the model's vocabulary and word segmenter, avoiding the introduction of too many new tokens that would significantly increase the model's size, training, and inference overhead. Furthermore, the item index should also carry certain learnable semantic structure information to support the model in recognizing similar items, learning collaborative associations, and improving cross-scenario generalization capabilities.
[0005] Existing recommendation item indexing schemes based on large language models typically face the following technical challenges: (1) The problem of fusion and adaptation of collaborative signals and attribute features: collaborative signals such as co-occurrence of items and attribute features of items have different sources and different forms of expression. It is necessary to avoid excessive parameter tuning of specific datasets and reduce generalization ability while effectively fusing them. (2) The length-semantic trade-off of hierarchical indexes: If the hierarchical structure is too deep, it will increase the consumption of input tokens and reduce the inference efficiency; if it is too shallow, it may weaken the ability to encode the association of items. (3) Efficiency issues in the construction and updating of large-scale dynamic graphs: The continuous changes in user-project interactions will lead to the dynamic evolution of co-occurrence structures. The indexing scheme should support efficient initialization construction and incremental updates to avoid full recalculation after interaction changes.
[0006] In existing technologies, schemes such as Random Indexing (RID) and Sequential Indexing (SID) are simple to implement, but they struggle to encode the true strength of relationships between items and often fail to explicitly integrate item attribute information, leading to insufficient semantic expression. Traditional matrix factorization and other ID-based representation methods are difficult to directly collaborate with word segmentation mechanisms in large language model scenarios, potentially causing a decline in recommendation quality. Some neural representation learning methods rely on specific pre-training objectives, limiting their cross-domain transfer capabilities and failing to fully utilize explicit graph structure information. Collaborative Indexing (CID) encodes collaborative relationships through weighted co-occurrence graphs and recursive clustering, offering certain advantages over simpler schemes, but still suffers from the following shortcomings: First, it primarily relies on collaborative signals while underutilizing item attribute features; second, the depth of the hierarchical structure often needs to be indirectly controlled through multiple hyperparameters, requiring improvement in cross-dataset stability and generalization; third, some clustering methods rely on matrix factorization or feature decomposition calculations, resulting in high computational costs and difficulty in adapting to the incremental update requirements of dynamic graphs.
[0007] Therefore, existing technologies struggle to simultaneously address the semantic expressive power, generalization ability, computational efficiency, and dynamic adaptation capabilities required for large language model recommendations, necessitating a new project index construction scheme to resolve these issues. Summary of the Invention
[0008] This invention aims to provide a method and system for enhancing recommendation item indexing based on a large language model using graph neural networks. This method addresses the problems in existing technologies, such as insufficient semantic expression of item indexes, limited generalization ability across datasets, high computational overhead, and difficulty in supporting dynamic updates. As a result, it improves the overall performance of recommendation systems based on large language models in terms of recommendation accuracy, stability, and engineering deployment efficiency.
[0009] Technical solution: A method for enhancing recommendation item indexing based on a large language model using graph neural networks, comprising the following steps: S1. Construct an attribute-enhanced co-occurrence graph for projects: Obtain user-project interaction history data and project attribute data; construct co-occurrence relationships between projects based on user-project interaction history, and determine edge weights based on co-occurrence frequency; construct attribute feature vectors for each project node, where the attribute feature vectors are the encoded results of project metadata, which includes at least brand, category, and / or price; perform sparsification processing on the co-occurrence graph, retaining a preset number of K strongly correlated edges for each node according to edge weight, to obtain a sparse co-occurrence graph; S2. Graph Representation Learning to Generate Item Embeddings: A graph neural network is used to learn the representation of the sparse co-occurrence graph. Item node attribute features and graph structure information are fused through neighborhood message passing to obtain the embedding vectors for each item. The training of the graph neural network can employ an unsupervised objective function, which includes one or more combinations of contrastive learning loss (such as InfoNCE), graph reconstruction loss (such as graph autoencoder reconstruction loss), and similarity constraint loss (such as cosine similarity constraint). S3. Construct a hierarchical clustering tree: Perform hierarchical agglomerative clustering on the item embedding vectors and construct a hierarchical clustering tree based on the preset maximum tree depth h, branch factor k, and leaf node capacity n. The clustering process can adopt the Ward link criterion to recursively divide the item set with the goal of minimizing intra-class variance until the stopping conditions are met (including reaching a depth of h and / or the number of leaf node items not exceeding n). S4. Generate path-coded item indexes: Perform a breadth-first traversal of the hierarchical clustering tree, assign hierarchical codes to each level node, and assign leaf codes to items within leaf nodes; concatenate the code sequences along the path from the root node to the leaf node to obtain the corresponding item indexes, allowing semantically similar items to share longer index prefixes. The length of the item index is constrained by the maximum tree depth h, and the size of the coding space is related to the leaf node capacity n; S5. Integration into the large language model recommendation: The item index is used to replace the original item identifier and written into the prompt template of the large language model recommendation; by utilizing the index prefix sharing characteristic after word segmentation, the large language model is guided to learn the semantic relationship between items to achieve recommendation output.
[0010] Further, step S1 includes the following sub-steps: S11, Project Attribute Coding.
[0011] Project attributes are encoded by type to form project node feature vectors.
[0012] Map the textual brand information to an embedded lookup. For hierarchical categories, the average is taken by embedding at each level, and the calculation method is as follows:
[0013] For multiple categories (such as different genres of music), a multi-heat vector is used. The project characteristics are obtained by piecing together the following parts:
[0014] In practice, setting =64, continuous attributes (such as price, popularity) are obtained through Standardization is used to balance the differences in scales.
[0015] S12. Construct a weighted co-occurrence graph
[0016] Construct an undirected weighted graph , where nodes represent items with attribute features, edges represent co-occurrence relationships derived from user interaction sequences, and weights are used to quantify the strength of association.
[0017] For any user Its interaction sequence is Establish edges between all projects The sum of the edge sets of all users is obtained ,side weight Defined as co-occurrence frequency, calculated as follows:
[0018] in As an indicator function, items that frequently co-occur among different users have stronger semantic similarity than items that only occasionally co-occur. Unlike binary adjacency matrices that treat all co-occurrence relationships equally, our weighted form preserves fine-grained differences in association strength, which the graph neural network will utilize during neighborhood aggregation.
[0019] S13, Scalability-Oriented Graph Sparsity
[0020] For datasets with overly dense co-occurrence graphs, we employ edge pruning to retain only the most salient connections. For each node... According to the border rights The adjacent edges are sorted, and only the top K connections with the highest weights are retained. This sparsity strategy reduces memory consumption and accelerates GCN training without significantly degrading representation quality. As an optional implementation, K can be 100; however, K can be set to other values depending on the data size and computing power.
[0021] S14, Integration of Synergistic Signals and Content Signals
[0022] The undirected weighted graph obtained based on the above steps It presents a community structure, with highly connected subgraphs corresponding to semantically consistent project clusters. This is achieved through attribute features... By embedding these features into graph nodes and deriving the graph structure from co-occurrence patterns, we construct a unified representation that simultaneously encodes content similarity (through node features) and collaborative similarity (through edge topology and their weights). This attribute-enhanced graph serves as input to subsequent GNN-based learning stages.
[0023] Furthermore, step S2 specifically includes: S21. Graph Neural Network Structure and Forward Propagation A two-layer graph convolutional network (GCN) is used to learn the representation of the attribute-enhanced sparse co-occurrence graph obtained in step S1, in order to fuse node attribute features and graph structure information to generate an embedded representation of the item. Its forward propagation process is as follows:
[0024] in, This represents the initial node feature matrix constructed in Phase 1, where N is the number of project nodes. For feature dimension, Denotes the set of edges. The edge weights are used to characterize the co-occurrence strength of items; The operation uses symmetric normalization for neighborhood aggregation:
[0025] in, The adjacency matrix after adding self-loops, This is the corresponding degree matrix. This is a learnable weight matrix. First layer. Aggregate first-order neighborhood features to generate hidden representations The hidden dimension is set to =32, the ReLU activation function introduces nonlinearity, enabling the model to capture complex interaction patterns. Second layer Further aggregation of second-order neighborhood information generates the final embedding. Output dimension =16. The two-layer structure strikes a balance between representational power and computational efficiency.
[0026] S22, Unsupervised training objectives
[0027] Since the item index needs to be constructed before the recommendation model is trained, it is difficult to rely on supervised label signals such as clicks and purchases. Therefore, an unsupervised objective based on graph structure is used to train the graph convolutional network. As an optional implementation, the unsupervised objective includes one or more of the following: (i) Contrastive learning loss (CON) based on InfoNCE; (ii) Reconstruction loss of graph autoencoder (GAE) with negative sampling; (iii) The objective of maximizing cosine similarity on the observation edge (COS).
[0028] InfoNCE contrast loss will be for each Treat them as positive sample pairs and compare them with all other nodes:
[0029] in, This indicates that the embedding is processed line by line. Normalization =0.5 represents the temperature parameter.
[0030] The GAE reconstruction loss represents the learning process as a link prediction task:
[0031] in The second term is the expectation of the sigmoid function, which is approximated by negative sampling.
[0032] The Cosine Similarity Maximization (COS) objective directly maximizes the consistency between connected nodes.
[0033] S23, Training Process and Optimization
[0034] The GCN parameters were optimized using the Adam optimizer, with the learning rate set to [value missing]. The validation set loss employs an early stopping strategy with a patience value set to 10 epochs. The validation set is constructed by randomly removing 10% of the edges from the training graph. After training, the final node embeddings are extracted. Used for subsequent clustering.
[0035] S24. Item embeddings obtained after training It can simultaneously reflect the co-occurrence relationship and attribute similarity of projects, providing a feature basis for subsequent hierarchical clustering; at the same time, the lower output dimension helps to reduce the computational cost of clustering and improve the efficiency of index building.
[0036] Furthermore, step S3 specifically includes: S31. After obtaining the node embeddings, hierarchical agglomerative clustering is used to construct a tree structure to organize items hierarchically according to semantic similarity. As an optional implementation, the Ward linking criterion can be used to generate the clustering tree with the goal of minimizing intra-cluster variance, thus obtaining a relatively compact cluster structure. This can be achieved by setting the maximum tree depth. branching factor and maximum leaf node capacity This allows for direct constraints on the size of the clustering tree structure, facilitating subsequent index encoding.
[0037] S32, From the complete project collection Starting with a depth of 0, we can process any subset... Perform recursive partitioning. When Either stop recursion and create leaf nodes when the depth reaches h; otherwise, for the embedded set... Running Ward agglomerative clustering will divide the dendrogram into exactly... and in each Continue recursively.
[0038] Ward link minimizes the intra-cluster sum of squares:
[0039] In each step of the merging process, the cluster pairs that minimize the overall WCSS increment are selected for merging; when it is necessary to obtain... In the case of individual clusters, the corresponding splitting position can be selected on the tree diagram to obtain... The resulting hierarchical structure is used for subsequent index path encoding, allowing items within the same subtree to share a longer prefix, thereby improving the semantic consistency of the index.
[0040] Furthermore, step S4, the path encoding allocation based on breadth-first search (BFS), specifically includes: S41. After constructing the hierarchical clustering tree (T), the hierarchical position of the items in the tree structure is encoded, and a unique index identifier is assigned to each item. The path encoding strategy is used to represent items as a token sequence composed of multiple encoding units, so that items in the same subtree can share a longer index prefix, which facilitates the subsequent large language model to learn item similarity by using prefix overlap after word segmentation.
[0041] S42. The encoding scheme follows the principle that the degree of overlap in index prefixes corresponds to the semantic similarity of items. That is, if items are grouped into the same leaf cluster at a deeper level, they share a longer common prefix; if they are in different subtrees that are far apart, they share a shorter prefix or none at all. This principle makes it more likely that when using a sub-token segmenter (such as SentencePiece), related item indices will be segmented into sub-token sequences with overlapping parts, thus reflecting similarity at the token level.
[0042] S43. Use breadth-first search to traverse the clustering tree T level by level, processing all nodes at depth d before processing nodes at depth d + 1. For leaf nodes at depth d... Projects in Its index identifier is formed by concatenating the codes on the root-to-leaf path:
[0043] in, Nodes assigned during BFS traversal The encoding, Encode the leaf nodes of item i. For example...Figure 3 As shown, items within the same subtree share a longer prefix: all items in the left subtree of the root node share a longer prefix. 0 The beginning, and the items under the right subtree are all named... 1 beginning.
[0044] S44. The size of the encoding vocabulary is determined by the parameter n, not by the branching factor. In traditional configurations (For example As an optional implementation, hierarchical encoding allows the same encoded value to be reused cyclically at different depths. However, since the encoding has a fixed position in the index sequence, the same encoded value will not cause ambiguity at different depths. At the same time, the encoding within a leaf node remains unique within the same leaf node, thus ensuring that the entire index identifier is distinguishable globally.
[0045] S45, Control and Trade-offs Index Length
[0046] The index length is bounded by (h+1), allowing a trade-off between index compactness and discriminative power through the maximum depth (h): when (h) is small, the index is shorter and token consumption is lower, but leaf node capacity may be larger; when (h) is large, finer-grained leaf clusters can be formed and discriminative power is improved, but the index length increases accordingly. As an optional implementation, BFS encoding with h ∈ {2, 3, 4, 5} and vocabulary size n ∈ {100, 500, 1000} can achieve a balance between these goals, generating a compact index (3-6 tokens) while maintaining sufficient discriminative power.
[0047] S46. Integration with Large Language Model-Based Recommendation. We integrate the generated item index into the OpenP5 framework by replacing the original item IDs with path encoding in all prompt templates. For example, in a sequence recommendation task, the prompt could be written as: "Considering Beauty user_6 has interacted with Beauty items item_". <0> <4> <4> <3> <11> ,item_ <0> <4> <4> <8> <5> "What is the next recommendation for the user?" During training, the large language model learns that items with the same or similar prefixes are more likely to co-occur in user interaction sequences, thereby improving the consistency and stability of the recommendation results.
[0048] The graph neural network framework constructed in this invention employs a local message-passing mechanism, exhibiting good scalability. A two-layer GCN (with hidden dimensions of...) Output dimension is The time complexity of neighborhood aggregation is O(n). Its growth is linear with the number of edges, rather than cubic with the number of nodes. For sparse co-occurrence graphs, if Then this complexity can be further simplified to Using mini-batch training with a batch size of b can also limit memory overhead to a small amount. Furthermore, this memory requirement is independent of the overall size of the graph. For the obtained... Hierarchical clustering of embeddings for Ward links superficially requires While achieving the same complexity, depth-constrained hierarchical clustering with a maximum depth of h and a branching factor of k is used, making the complexity of the first... The layer only processes The total complexity is obtained by considering each project. Furthermore, the constant factor is significantly reduced. In practical deployments, the complexity of Ward clustering can be reduced to near-linearity using an approximate nearest neighbor method. .
[0049] Beneficial effects: Compared with existing project indexing and recommendation integration technologies, this invention has the following technical effects: Strong heterogeneous signal fusion capability: It unifies the modeling of collaborative signals (graph structure and edge weights) formed by user interaction co-occurrence relationships with item attribute features (node feature vectors), and generates high-order item representations through graph neural networks, so that the resulting item index can simultaneously reflect collaborative associations and content similarity, which is suitable for recommendation scenarios with rich attribute information.
[0050] Index length is controllable and easy to configure across scenarios: The index tree is built based on hierarchical clustering and the maximum depth is controlled. branching factor The tree structure is directly constrained by parameters such as leaf node capacity, making the item index length and granularity configurable. This reduces the cost of repeated parameter tuning caused by the uncontrollable tree structure and facilitates migration and use in different datasets and business scenarios.
[0051] Scalable and supports dynamic adaptation: Reduces training and update overhead through graph sparsification and localized graph convolution; When interaction relationships or co-occurrence strengths change, the computational cost of full reconstruction can be reduced by updating edge structure / weights and incrementally updating embeddings, thereby improving system deployment and maintenance efficiency. Attached Figure Description
[0052] Figure 1 This is an overall flowchart of the method described in this invention; Figure 2 It is a project cluster diagram; Figure 3 It is a project index diagram based on a clustering tree; Figure 4 This example illustrates the impact of clustering depth on recommendation performance. Figure 5 This relates to the impact of clustering parameters on recommendation performance; Figure 6 The impact of different unsupervised objectives on recommendation performance; Figure 7 This involves a correlation analysis between clustering quality and recommendation performance. Figure 8 It is the speedup of the process based on graph neural networks (GNN) relative to spectral clustering (SC). Detailed Implementation
[0053] This invention provides a method and system for enhancing recommendation item indexing based on a large language model using graph neural networks. It addresses the following problems in existing collaborative indexing schemes: insufficient utilization of item attribute information; sensitivity of the index tree structure to hyperparameters and weak generalization across datasets; and high computational cost for building and updating on large-scale item graphs. Preferably, this invention employs a "five-stage" approach to progressively transform raw user interaction data into item index identifiers with semantic structure. The overall process can be found in [link to relevant documentation]. Figure 1 , Figure 1 This demonstrates the process of starting with raw user-item interaction data, sequentially proceeding through graph construction, representation learning, hierarchical clustering, and path encoding, and finally integrating it into an LLMs suggestion template. The collaborative efforts of these modules ensure that the generated item index maintains its compactness while preserving co-occurrence patterns and attribute semantic structure information, thus enhancing LLMs' ability to understand the recommendation context.
[0054] Overall, the implementation steps of this invention include: (1) Graph construction stage: Construct an attribute-enhanced co-occurrence graph of projects, in which edge structure and edge weight are used to characterize co-occurrence signals, and node features are used to characterize project content / attribute information, so that subsequent learning can utilize multi-source information at the same time.
[0055] (2) Representation learning stage: A two-layer graph convolutional network (GCN) is used to perform unsupervised representation learning on the co-occurrence graph. The neighborhood topology, edge weights and node attribute features are fused through local message passing to obtain a low-dimensional embedding representation for characterizing the similarity of items.
[0056] (3) Clustering and tree building stage: Apply hierarchical agglomerative clustering based on Ward links to the embedded project to generate a hierarchical clustering tree structure with controllable depth, and directly constrain the tree structure through parameters such as maximum depth, branching factor and leaf capacity.
[0057] (4) Path encoding stage: Breadth-first traversal (BFS) is performed on the hierarchical clustering tree to assign hierarchical codes to internal nodes and leaf codes to items within leaf nodes, forming an item index so that semantically similar items have a longer shared part in the index prefix.
[0058] (5) Recommendation Integration Stage: The item index is written into the LLMs recommendation suggestion template to replace the original item identifier, so that the LLMs can learn the semantic relationship between items by using token-level prefix overlap after sub-segmentation, thereby improving the stability and interpretability of the recommendation.
[0059] For ease of understanding and implementation, the symbols and definitions involved in this invention are explained below: 1) Construct a co-occurrence diagram for the project.
[0060] The user set is represented as , Represents the number of users; a collection of items is represented as User-project interaction history is represented as , Includes each user For projects that have been interacted with, the co-occurrence graph is represented as follows: The set of edges , It is a weighting function, when the project and When items co-occur in the same user's interaction history, this invention introduces edges into the item co-occurrence graph. The weights Determined by co-occurrence frequency.
[0061] Figure 2 The structure of the resulting item clustering graph is shown: nodes carry attribute information (such as price, category, brand), and edges connect items that co-occur in the user's interaction history. This graph topology is based on the assumption that items involved in the same user's temporally similar consumption behaviors are semantically related.
[0062] 2) Construct node features with enhanced attributes.
[0063] For each project Let its attribute feature vector be This includes metadata such as category, brand, and price. Category attributes are represented using one-hot encoding, and continuous attributes are standardized to eliminate dimensional differences. The initial node feature matrix is... ,in , The feature dimension is used. A two-layer graph convolutional network processes this matrix to generate node embeddings. , It is the output embedding dimension, and its forward propagation representation is: .
[0064] 3) Hierarchical clustering trees are rooted trees constructed by recursively partitioning item embeddings. The hierarchical clustering tree described includes three parameters: maximum depth. h branching factor k And the maximum leaf size n. Starting from the root node containing all items V, for any subset of the tree containing items... The internal nodes of , their corresponding embedded Z[ Apply Ward's agglomerative clustering algorithm and segment it into... k Cluster I1, ..., Ik The recursion continues on each cluster until the condition is met. .
[0065] 4) Define a path-encoded project index identifier. For projects with a maximum depth of... h The maximum leaf capacity is n Hierarchical tree Encoding is assigned to all nodes using a breadth-first traversal. For non-leaf nodes, their child nodes are... k Receive sequentially from combinations 0, 1, ... k -1 hierarchical encoding, items within each leaf node from Obtain the unique leaf node code from the project. The index identifier is the encoded string on the path from the root to its leaf node. ,in each This represents the encoding at depth j.
[0066] This invention designs item index identifiers for LLM-based recommender systems while simultaneously satisfying three competing objectives: encoding collaborative signals in user interactions, integrating semantic information from item attributes, and maintaining computational efficiency in large-scale scenarios. This problem can be formalized as an optimization objective that balances these requirements. Let... For the co-occurrence graph of the project, edge weights Indicates the co-occurrence frequency; This is a matrix of project attributes. The goal is to learn a representation function. Mapping attribute-containing graphs into node embeddings Then, a hierarchical partitioning that satisfies the depth and leaf capacity constraints is constructed. The final identifier mapping From tree Path encoding generation.
[0067] This embodiment verifies and evaluates the method of the present invention on five publicly available benchmark datasets. These datasets cover different recommendation application domains and vary in terms of user scale, interaction sparsity, and attribute information richness, so as to test the applicability and effectiveness of the method of the present invention from multiple dimensions.
[0068] (I) Data Acquisition and Preprocessing
[0069] The datasets used in this embodiment are derived from the recommendation evaluation corpus compiled by the OpenP5 public repository. Table 1 provides statistical information for each dataset. These datasets cover e-commerce, entertainment, music, and other scenarios, with a user base of approximately 1,000 to 10,000 and an interaction sparsity of approximately 92.19% to 99.78%, making them suitable for evaluating recommendation performance in both relatively dense and highly sparse scenarios. Each dataset contains structured attribute information, facilitating the verification of the technical solution of "integrating project attribute features and co-occurrence patterns" in this invention.
[0070] In the preprocessing stage, a k-core filtering strategy is preferred to remove users and items with fewer than a threshold (e.g., 10 interactions) to reduce the impact of noise and extreme sparsity on graph construction and representation learning. The construction of item attribute features is configured according to the field format of different datasets: 1) For the Amazon Movies and Beauty datasets, extract the first-level leaf category tokens from the brand information and category paths, map them into 64-dimensional embedding vectors through a learnable lookup table, and concatenate the mean vectors of the brand embeddings and category embeddings to form a 128-dimensional dense feature vector; 2) For the MovieLens dataset, construct its genre indicator field as a multi-hot vector feature; 3) For the Last.fm dataset, convert the JSON attribute IDs into multi-hot vector features.
[0071] Through the above processing, a consistent and usable representation of project attributes can be obtained on different datasets to support the subsequent training of graph neural networks and the construction of clustering indexes.
[0072] Table 1. Statistical characteristics of each dataset
[0073] (II) Evaluation Indicators
[0074] We use the hit rate (HR) and normalized discounted cumulative gain (NDCG) to evaluate the quality of recommendations at K ∈ {5, 10}.
[0075] set up For the test user set, For the Top-K recommendation list, For a set of related projects, the hit rate is calculated as follows:
[0076] exist Under the agreement , It is equivalent to the average of the hit indicators.
[0077]
[0078] in ,exist Configure it. =1, if the ranking of the target project is ,but Otherwise, it is 0.
[0079] (iii) Sequence Baseline
[0080] CL4SRec: A contrastive self-supervised learning approach based on three sequence enhancement methods (pruning / masking / rearrangement).
[0081] DuoRec: A comparative regularization that combines model-level augmentation with hard positive sample sampling.
[0082] MAERec: A graph mask autoencoder that uses a transfer path mask.
[0083] SASRec: Self-attention sequence model with positional encoding.
[0084] FMLP-Rec: A full MLP recommendation model based on frequency domain filtering.
[0085] GRU4Rec: A GRU session model for ordering optimization.
[0086] RepPad: A parameterless sequence enhancement method that replaces zero-padding with repeated history.
[0087] SimpleX: Combines a large proportion of negative samples with the cosine contrast loss of a lightweight encoder.
[0088] NGCF: Messaging on the user-project graph to capture higher-order connectivity.
[0089] CID: Constructing a hierarchical structure using co-occurrence graphs and recursive spectral clustering.
[0090] SID: Assigned based on the time sequence of user data (co-occurring items are assigned similar IDs).
[0091] RID: Randomly assign an item ID, which is then segmented to adapt it to LLMs.
[0092] This embodiment validates the method of the present invention on multiple public datasets, and evaluates it using metrics such as hit rate and normalized loss cumulative gain in both sequence recommendation and direct recommendation tasks (exemplary results are shown in Tables 2 and 3). To verify the adaptability to changes in the prompt template, it is preferable to set up two scenarios for comparison: training template and no template. If necessary, statistical tests can be used to verify the significance of the differences. The validation results show that compared with random indexing, sequential indexing, and indexing schemes based solely on cooperative signals, the indexing method proposed in this invention can more stably improve the recommendation effect, especially in scenarios with rich attribute information, sparse interactions, or significant long tails. This is because the present invention jointly models the item attribute features and co-occurrence structure information through graph neural networks, enabling semantically similar items to form a more consistent sharing relationship on the index prefix, which is beneficial for large language models to learn item associations.
[0093] Table 2. Experimental results on order recommendation
[0094] Table 3. Experimental results on direct recommendations
[0095] Furthermore, this embodiment analyzes the impact of index tree structure parameters on the performance (exemplary results are shown in...). Figure 4 , Figure 5 The results show that maximum depth, branching factor, and leaf capacity represent a trade-off between index length and discriminative power. The optimal value range can be set according to project size and sparsity to achieve more robust results. Furthermore, this embodiment compares different unsupervised training objectives and different clustering tree construction methods (exemplary results are shown in...). Figure 6 (Table 4) The results show that the embedding representations obtained by training with contrastive learning or reconstructed class targets are generally more conducive to subsequent clustering and index construction; the effect of this invention can be achieved by constructing the index tree using hierarchical agglomerative clustering or recursive partitioning.
[0096] Table 4. Impact of different clustering algorithms on the performance of collaborative indexes
[0097] Figure 7 The correlation analysis results between clustering quality and recommendation performance are presented.
[0098] Further verification of scalability under large-scale data conditions (exemplary results are shown in Table 5). Figure 8 The results show that the implementation method of this invention based on local message passing and mini-batch training can maintain a relatively slow growth in computational overhead when the data scale increases, and demonstrates a significant efficiency advantage after reaching a certain scale, thus meeting the actual deployment requirements.
[0099] Table 5. Runtime on Yelp datasets as dataset size increases
Claims
1. A method for enhancing recommendation item indexing based on a large language model using graph neural networks, characterized in that, Includes the following steps: S1. Construct an attribute-enhanced and weighted co-occurrence graph based on user-item interaction history data. Nodes in the item co-occurrence graph are used to represent recommended items, edges are used to represent co-occurrence relationships between items, and edge weights are used to characterize co-occurrence strength. Attribute information is injected into each project node based on project attribute data, and differential encoding is used to obtain the corresponding attribute feature vector. The weighted co-occurrence graph is then pruned in descending order of edge weights, and a preset number of edge weights with the maximum value is retained for each project node. By dividing adjacent edges, a sparse co-occurrence graph is obtained; S2. The sparse co-occurrence graph is trained unsupervised based on the graph neural network. The attribute feature vectors of the project nodes and the graph structure information are fused through the symmetric normalized neighborhood aggregation operation to obtain the embedding vector of each project. The training employs at least two of the following loss functions to construct a combined loss function: contrastive learning loss, graph autoencoder reconstruction loss, and cosine similarity constraint loss. The model parameters are iteratively updated using the Adam optimization algorithm, and combined with an early stopping strategy, the output is an item embedding vector that can simultaneously characterize collaborative association and content similarity. S3. Perform hierarchical agglomerative clustering based on the project embedding vectors, using the Ward linking criterion, with the objective of minimizing intra-cluster variance, and according to a preset maximum depth. The branching factor k and leaf node capacity n constrain the tree structure when the number of cluster subset items is ≤ n or the tree depth reaches a certain threshold. Clustering is stopped when the time is right, and a hierarchical clustering tree is constructed that balances semantic distinguishability and index compactness; S4. Perform a breadth-first traversal of the hierarchical clustering tree, assign hierarchical codes to nodes at each level of the tree, and assign leaf codes to items within leaf nodes. The encoded sequences along the path from the root node to the leaf node are concatenated to generate the project index; S5. Write the project index into the prompt template recommended by the big language model, replace the original project identifier, and use the prefix overlap relationship after segmenting the project index by the big language model to learn the semantic association between projects.
2. The method for enhancing recommendation item indexing based on a large language model using graph neural networks according to claim 1, characterized in that, The construction of the attribute feature vector in step S1 includes: Text-type attributes are mapped to text attribute vectors of a preset dimension using an embedded lookup table; For each hierarchical category attribute, obtain the category embedding vector of each level, and average the category embedding vectors of each level to obtain the hierarchical category attribute vector. Multi-valued categorical attributes are represented using multi-hot vectors to obtain multi-valued categorical attribute vectors; The text attribute vector, hierarchical category attribute vector, and multi-value category attribute vector are concatenated to form the attribute feature vector.
3. The method for enhancing recommendation item indexing based on a large language model using graph neural networks according to claim 1, characterized in that, The graph neural network is a graph convolutional network, and its forward propagation process satisfies: The expression for calculating the first hidden layer is: The symmetric normalized neighborhood aggregation operation is represented as: The adjacency matrix is represented as: Project embedding vector output in, Represents the initial node feature matrix. Let be the set of edges. Represents edge weight, This is the output of the first hidden layer. Embed vectors for the final project. This represents the neighborhood aggregation operation with symmetric normalization. for The corresponding degree matrix, It is a learnable weight matrix. It is an adjacency matrix. It is an identity matrix.
4. The method for enhancing recommendation item indexing based on a large language model using graph neural networks according to claim 1, characterized in that, The stopping condition for hierarchical agglomerative clustering in step S3 is: The number of items in the current cluster subset is less than or equal to the leaf node capacity. Or the current tree depth has reached its maximum depth. Among them, branching factor Values range from 5 to 50; leaf node capacity Values range from 100 to 1000, maximum depth The value ranges from 2 to 5.
5. The method for enhancing recommendation item indexing based on a large language model using graph neural networks according to claim 1, characterized in that, The path encoding in step S4 adopts a cyclic allocation strategy, which enables nodes at different levels to reuse the same encoding, and distinguishes the reused encoding by the hierarchical position and path position of the node in the hierarchical clustering tree; the item index consists of 3 to 6 word segmentation units.
6. The method for enhancing recommendation item indexing based on a large language model using graph neural networks according to claim 1, characterized in that, The method supports incremental updates, specifically: Co-occurrence graph update: When the user-item interaction relationship changes, only the set of edges and their weights in the co-occurrence graph are updated; Embedding vector update: Based on the updated co-occurrence graph, the graph neural network parameters are updated and the item embedding vectors are updated using mini-batch training. Only the item embedding vectors affected by interaction changes are recalculated to avoid full retraining. Clustering tree preservation: Under the condition that the hierarchical clustering tree structure remains unchanged, the hierarchical clustering tree is kept unreconstructed, and only the embedding associations of items within the leaf nodes are updated.
7. A large language model-enhanced recommendation item indexing system based on graph neural networks, characterized in that, include: The graph construction module is used to acquire user-project interaction history data and project attribute data, and construct a weighted project co-occurrence graph based on the user-project interaction history data, where nodes represent projects, edges represent project co-occurrence relationships, and edge weights are used to characterize co-occurrence strength; and generate attribute feature vectors for each node based on the project attribute data; the graph construction module is also used to perform sparsification processing on the weighted project co-occurrence graph to retain a preset number of edge weights for each project node. By dividing adjacent edges, a sparse co-occurrence graph is obtained; Representation learning module: used to perform unsupervised training on the sparse co-occurrence graph based on a graph neural network to obtain the embedding vectors of each item; Clustering tree construction module: used to perform hierarchical agglomerative clustering based on the embedding vectors, and according to a preset maximum depth. branching factor Leaf node capacity Construct a hierarchical clustering tree; Index Encoding Module: Used to perform breadth-first traversal of the hierarchical clustering tree, assign hierarchical codes to nodes in the tree and assign leaf codes to items within leaf nodes, and concatenate the encoding sequences on the path from the root node to the leaf node to generate an item index; Recommendation Integration Module: This module is used to write the item index into the suggestion template recommended by the large language model to replace the original item identifier, thereby enabling the large language model to generate or retrieve recommendations based on the item index after word segmentation.
8. The system according to claim 7, characterized in that, The graph construction module includes a graph sparsification unit, which sorts each item node in descending order of edge weight and retains the nodes before sorting. Adjacent edges are used to form the sparse co-occurrence graph.
9. The system according to claim 7, characterized in that, The representation learning module includes an unsupervised training unit, which is used to construct a combined loss function based on at least two unsupervised training objectives and to iteratively update the parameters of the graph neural network using the Adam optimization algorithm. The learning rate is a preset learning rate, and an early stopping strategy is adopted during the training process, terminating the training when the validation metric no longer improves within a preset number of rounds.
10. The system according to claim 7, characterized in that, The system is applicable to project recommendation scenarios based on user interaction history, and the project recommendation scenarios include at least one of e-commerce product recommendation, audio-visual content recommendation, and music content recommendation.