Music recommendation method and system based on knowledge graph
By constructing a heterogeneous knowledge graph with timestamps and a time-aware model, and combining soft-assignment clustering and cluster-aware recall, the challenges of multimodal representation and temporal evolution in music recommendation systems are solved. This achieves efficient long-tail coverage and cold-start processing, and improves the interpretability and scalability of the recommendation system.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- HUNAN INST OF INFORMATION TECH
- Filing Date
- 2026-01-20
- Publication Date
- 2026-05-01
AI Technical Summary
Existing technologies in music recommendation systems suffer from several drawbacks: lack of efficient and consistent alignment methods for multimodal representations; knowledge graphs are mostly static representations that fail to capture fine-grained temporal evolution and dynamic user behavior; clustering has bottlenecks in scalability and real-time performance; weak coverage of cold start and long-tail items; difficulty in balancing accuracy and diversity in recommendation systems; and insufficient overall interpretability and business controllability.
By constructing a heterogeneous knowledge graph with timestamps, introducing a time-aware heterogeneous graph model, attaching multimodal vectors to graph nodes and fusing graph structure with temporal attention, and using soft-assignment clustering and community detection to construct multi-granularity clusters, combined with cluster-aware recall strategy and content voting allocation, dynamic querying and interpretability are achieved.
It enhances the ability to model complex association patterns and temporal preferences, strengthens the handling of long-tail coverage and cold start, balances the hit rate and diversity of the recommendation system, and improves business interpretability and scalability.
Smart Images

Figure CN121958602A_ABST
Abstract
Description
A music recommendation method and system based on knowledge graph Technical Field
[0001] This invention relates to the field of intelligent music recommendation technology, specifically to a music recommendation method and system based on knowledge graphs. Background Technology
[0002] With the maturity of large-scale pre-trained models in the fields of speech, image, and text, the music and media fields can simultaneously extract high-quality features from audio spectrograms, lyric semantics, and cover visuals. Meanwhile, graph neural networks and time-aware models enable the joint modeling of complex entity relationships and temporal evolution, while near-nearest neighbor indexing and incremental clustering techniques provide feasible paths for large-scale real-time retrieval and updates. Looking ahead, recommendation systems that combine multimodal semantics, dynamic spectrograms, and interpretable clustering will better balance personalized hits, long-tail coverage, and business interpretability.
[0003] However, existing technologies still have significant shortcomings. Multimodal representations often lack efficient consistency alignment methods, resulting in insufficient cross-modal semantic fusion. Knowledge graphs are mostly static representations or only make simple associations, making it difficult to characterize fine-grained temporal evolution and user behavior dynamics. In addition, large-scale graph computing and clustering have bottlenecks in terms of scalability and real-time performance, weak cold start and long-tail project coverage, and recommendation systems struggle to balance accuracy and diversity. Furthermore, overall interpretability and business controllability still need further improvement. Summary of the Invention
[0004] To address the above issues and overcome the shortcomings of existing technologies, this invention provides a music recommendation method and system based on knowledge graphs. Addressing the problems of traditional knowledge graph and recommendation systems based on vector or relational representations, which struggle to simultaneously express heterogeneous entity relationships, modal information, and temporal evolution, and lack sufficient characterization of complex interaction semantics, this solution constructs a timestamped heterogeneous knowledge graph and introduces a time-aware heterogeneous graph. The model appends multimodal vectors to graph nodes and fuses graph structure with temporal attention, thereby simultaneously encoding structural relationships, content features, and temporal decay information in node embedding. Furthermore, clustering is used as a virtual node soft-injection topology to achieve interpretable semantic connectivity and dynamic query capabilities. Addressing the poor scalability, weak composite interest processing capabilities, and semantic uninterpretability issues of traditional single-granularity clustering and pure graph-structured communities, this scheme employs a vector space... The algorithm combines nearest neighbor indexing to achieve large-scale, low-latency soft-assignment clustering, while running modularly optimized community detection on the knowledge graph to discover interaction-driven communities. Subsequently, it constructs multi-granularity clusters and hierarchical structures using cluster fusion and topic model-based semantic annotation. Addressing the limitations of existing recall strategies that rely solely on vector nearest neighbors or graph paths for long-tail coverage and cold-start performance, as well as the difficulty in balancing hit rate and diversity, this scheme employs cluster-aware fusion recall. First, it uses an approximate nearest neighbor index to map users to the nearest user cluster and topic cluster, efficiently sampling candidates within each cluster. Then, it utilizes high-weight meta-paths in the knowledge graph to expand long-tail candidates according to a threshold to enhance coverage. For cold-start items, it adopts a soft-assignment hybrid strategy of content vector mapping and neighborhood voting, and explores and inherits through weight control.
[0005] The technical solution adopted in this invention is as follows: A music recommendation method based on knowledge graphs, the method comprising the following steps:
[0006] Step S1: Multimodal data collection. Collect and preprocess audio, lyrics, cover images, metadata, and user behavior data. Map each modality to a unified vector representation through a pre-trained model, and use contrastive learning to align different modalities to obtain consistent and comparable multimodal embedding vectors.
[0007] Step S2: Knowledge graph construction. A timestamped knowledge graph is built based on heterogeneous patterns, and a time-aware heterogeneous graph is used. The model learns node embeddings that integrate graph structure, multimodal vectors, and temporal information, and then soft-injects clustering information as virtual nodes into the graph;
[0008] Step S3: Multi-granularity clustering, using vector space... The algorithm performs dense clustering of songs, users, and conversations, and uses soft assignment to handle composite interests; then, it uses community detection on the knowledge graph structure to discover interaction-based communities, and uses... Topic models perform semantic annotation and hierarchical organization for clusters, resulting in multi-granular and interpretable cluster sets;
[0009] Step S4: Fusion Recall, map user vectors to the nearest user cluster and topic cluster, retrieve candidate songs from within the clusters, and expand recall through knowledge graph paths. For cold start items, use soft allocation of content projection and neighborhood voting to integrate new songs or new users into the cluster structure.
[0010] Step S5: Adaptive perception optimization, perform deep ranking of the recalled candidates based on cluster perception, input cluster distribution, cluster similarity and knowledge graph meta-path attention, train multi-task objectives, and adopt an incremental update strategy to ensure that the model and clusters adapt to new data.
[0011] Step S6: Intelligent recommendation, mapping new users to the existing clustering space and calculating the soft assignment probability, obtaining a candidate set based on fusion recall; then using a cluster-aware ranking model to calculate the final score and generate a recommendation list.
[0012] Further, in step S1, the multimodal data collection specifically includes the following steps:
[0013] Step S11: Data Collection. Collect and preprocess multimodal data, transforming audio, lyrics, cover images, metadata, and user behavior data sequences into a unified vector representation. Align the feature spaces of different modalities through contrastive learning to ensure consistency and comparability of inputs for subsequent clustering and knowledge graph construction; extract from audio signals... Spectrum and using pre-trained models Generate an embedding and use it on the cover image. Extracting visual features, lyrics usage Model encoding involves one-hot encoding of metadata containing artist and genre information, and using [a specific encoding method] on user behavior data sequences. Capture timing dynamics, and then through... The loss function is used to jointly train a multimodal encoder, making the different modal representations of the same song closer together and the representations of different songs further apart;
[0014] Step S12: Knowledge Graph Entity Injection. Entity recognition and knowledge graph entity injection are performed on the preprocessed multimodal data. Songs, artists, albums, and tags are used as knowledge graph nodes, and the learned vector representations are appended to the nodes. Timestamps are also introduced to capture static relationships and encode dynamic user interactions. Named entity recognition tools are used. Entities are extracted from lyrics and metadata and linked to a knowledge graph as nodes, with each node having a multimodal vector and a temporal attribute attached.
[0015] Furthermore, in step S2, the knowledge graph construction specifically includes the following steps:
[0016] Step S21: Define the heterogeneous patterns of the knowledge graph, use a time-aware graph neural network to learn node embeddings, and integrate graph structure, multimodal vectors, and temporal information; employ heterogeneous graphs. The model introduces a time attention mechanism to encode neighborhood information and weight historical interactions based on timestamps;
[0017] Step S22: Clustering information injection. The generated clusters are attached to existing nodes as virtual nodes, and reverse connections are established. Specifically, after the initial embedding learning, cluster node placeholders are reserved, and clustering information is injected as edge weights through soft allocation probability. The topology of the knowledge graph reflects the clustering semantics.
[0018] Furthermore, in step S3, multi-granularity clustering specifically includes the following steps:
[0019] Step S31: Define the clustering objective function to perform dense clustering of songs, users, and sessions in the vector embedding space, using... Algorithm combination The index implements clustering while introducing soft assignment to handle composite interests, ensuring that the clustering results support efficient retrieval and diversity; multimodal vectors are input into... In the algorithm, the center is updated in each batch, and then... Constructing an approximate nearest neighbor index accelerates allocation, thereby generating song clusters, user clusters, and topic clusters;
[0020] Step S32: Define the community detection objective function, and use the community detection algorithm on the graph structure of the knowledge graph to discover interest communities based on interactions. The algorithm captures topological clustering in the user and song subgraphs and merges it with vector space clustering to generate multi-granularity clustering results; it extracts the user and song interaction subgraphs from the knowledge graph and runs... Optimize the modular function to generate community clusters, and then merge vector clusters and graph clusters through a cluster fusion matrix;
[0021] Step S33: Semantic annotation. The generated clusters are semantically annotated and layered using a hierarchical strategy, dividing the clusters into a topic layer, a singer and style layer, and a short-term conversation layer, corresponding to coarse-grained, medium-grained, and fine-grained granularity, respectively. The topic model extracts keywords from lyrics and tags within clusters as annotations, supporting explanation and multi-level recall; specifically, it runs on the lyrics and tag set of each cluster. The topic model generates topic distributions and extracts them. Keywords serve as clustering labels, and a hierarchical clustering tree is constructed to represent nested relationships.
[0022] Furthermore, in step S4, the fusion recall specifically includes the following steps:
[0023] Step S41: Online recall, mapping the user query vector to the nearest user cluster and topic cluster, retrieving candidate songs from the corresponding song cluster, and expanding the recall coverage of long-tail items by using cluster-related paths in the knowledge graph; specifically, using the HNSW index to find the cluster to which the user belongs, then sampling the top-N candidate songs from the cluster, and expanding additional candidates through knowledge graph paths;
[0024] Step S42: Cold start allocation. For new songs or new users during a cold start, soft clustering allocation is performed through content vector mapping and knowledge graph neighborhood voting, inheriting clustering preferences and introducing uncertainty. Specifically, the new item vector is projected onto the existing clustering space, soft probabilities are calculated, and the allocation is adjusted in combination with voting from the knowledge graph neighborhood.
[0025] Furthermore, in step S5, the adaptive perception optimization specifically includes the following steps:
[0026] Step S51: Perceptual depth ranking. The recalled candidates are subjected to perceptual depth ranking by clustering. A neural network model is used as input for user cluster distribution, candidate cluster similarity, and knowledge graph meta-path features. Multi-task loss is optimized to balance click-through rate and diversity. Specifically, the following steps are employed: The model uses a wide layer to process cluster similarity and a deep layer to process sequence embeddings and path attention. Training objectives include click prediction and diversity regularization.
[0027] Step S52: Incremental update. Each batch of new data triggers an incremental update, and a full re-clustering operation is performed every 24 hours to update the knowledge graph nodes and edges.
[0028] Further, in step S6, the intelligent recommendation collects new user data, maps new users to the existing clustering space, and calculates the soft assignment probability; then, in the recall stage, it maps new users to the nearest user cluster and topic cluster, retrieves candidate songs from the corresponding song cluster, and expands long-tail candidates using high-weight paths in the knowledge graph; finally, in the ranking stage, it uses a cluster-aware deep model to calculate scores, generates a ranking list, and recommends songs according to the ranking list.
[0029] The present invention provides a music recommendation system based on a knowledge graph, comprising a multimodal data collection module, a knowledge graph construction module, a multi-granularity clustering module, a fusion recall module, an adaptive perception optimization module, and an intelligent recommendation module;
[0030] The multimodal data collection module collects and preprocesses audio, lyrics, cover images, metadata, and user behavior data. It maps each modality to a unified vector representation through a pre-trained model, aligns different modalities using contrastive learning, obtains consistent and comparable multimodal embedding vectors, and sends the data to the knowledge graph construction module.
[0031] The knowledge graph construction module receives data from the multimodal data collection module, builds a time-stamped knowledge graph based on heterogeneous patterns, and uses a time-aware heterogeneous graph. The model learns to embed nodes that integrate graph structure, multimodal vectors, and temporal information. Then, it soft-injects clustering information as virtual nodes into the graph and sends the data to the multi-granularity clustering module.
[0032] The multi-granularity clustering module receives data sent by the knowledge graph construction module and performs clustering in vector space using... The algorithm performs dense clustering of songs, users, and conversations, and uses soft assignment to handle composite interests; then, it uses community detection on the knowledge graph structure to discover interaction-based communities, and uses... The topic model performs semantic annotation and hierarchical organization for clusters, resulting in a multi-granular and interpretable cluster set, and sends the data to the fusion and recall module;
[0033] The fusion recall module receives data sent by the multi-granularity clustering module, maps user vectors to the nearest user cluster and topic cluster, retrieves candidate songs from within the clusters, expands the recall through knowledge graph paths, uses soft allocation of content projection and neighborhood voting for cold start items, integrates new songs or new users into the cluster structure, and sends the data to the adaptive perception optimization module.
[0034] The adaptive perception optimization module receives data sent by the fusion recall module, performs deep sorting of recall candidates based on cluster perception, inputs cluster distribution, cluster similarity and knowledge graph meta-path attention, trains multi-task objectives, adopts an incremental update strategy to ensure that the model and clusters evolve adaptively with new data, and sends the data to the intelligent recommendation module.
[0035] The intelligent recommendation module receives data sent by the adaptive perception optimization module, maps new users to the existing clustering space and calculates the soft assignment probability, obtains a candidate set based on fusion recall, and then calculates the final score and generates a recommendation list using a clustering-aware ranking model.
[0036] The beneficial effects achieved by the present invention using the above solution are as follows:
[0037] (1) To address the problems of traditional knowledge graphs and recommendation systems based on vector or relational singular representations, which struggle to simultaneously express heterogeneous entity relationships, modal information, and temporal evolution, as well as insufficient characterization of complex interaction semantics, this solution constructs a heterogeneous knowledge graph with timestamps and introduces a time-aware heterogeneous graph. The model appends multimodal vectors to graph nodes and integrates graph structure with temporal attention, thereby simultaneously encoding structural relationships, content features, and temporal decay information in node embedding. In addition, clustering is used as a virtual node soft injection topology to achieve interpretable semantic connectivity and dynamic query capabilities, thus significantly improving the ability to model complex association patterns and temporal preferences.
[0038] (2) To address the problems of poor scalability, weak processing capability of composite interests, and lack of semantic interpretability in traditional single-granularity clustering and pure graph-structured communities, this scheme adopts a vector space... The algorithm combines nearest neighbor indexes to achieve large-scale, low-latency soft-assignment clustering, while running modularly optimized community detection on the knowledge graph to discover interaction-driven communities. Subsequently, it uses cluster fusion and topic model-based semantic annotation to construct multi-granularity clusters and hierarchical structures, ultimately enabling clustering to scale to massive amounts of data, handle mixed interests, and provide clear and interpretable topic labels to support multi-level recall and retrieval.
[0039] (3) In view of the problem that existing recall strategies usually rely on vector nearest neighbors or graph paths to have limited performance in long-tail coverage and cold start, and it is difficult to balance hit rate and diversity, this solution uses cluster-aware fusion recall. First, the approximate nearest neighbor index is used to map users to the nearest user cluster and topic cluster and to efficiently sample candidates within the cluster. Then, the high-weight meta-path in the knowledge graph is used to expand long-tail candidates according to the threshold to enhance coverage. For cold start items, a soft allocation hybrid strategy of content vector mapping and neighborhood voting is adopted, and exploration and inheritance are controlled by weight, so as to balance retrieval efficiency, long-tail hit rate and candidate set diversity, and improve business interpretability. Attached Figure Description
[0040] Figure 1 is a schematic diagram of a music recommendation method based on knowledge graph provided by the present invention;
[0041] Figure 2 is a schematic diagram of a music recommendation system based on a knowledge graph provided by the present invention;
[0042] Figure 3 is a schematic diagram of step S1;
[0043] Figure 4 is a schematic diagram of step S2.
[0044] Figure 5 is a schematic diagram of step S3;
[0045] Figure 6 is a schematic diagram of step S4.
[0046] Figure 7 is a schematic diagram of step S5.
[0047] The accompanying drawings are provided to further illustrate the invention and form part of the specification. They are used together with the embodiments of the invention to explain the invention and do not constitute a limitation thereof. Detailed Implementation
[0048] The technical solutions of the present invention will be clearly and completely described below with reference to the accompanying drawings of the embodiments of the present invention. Obviously, the described embodiments are only some embodiments of the present invention, and not all embodiments. All other embodiments obtained by those skilled in the art based on the embodiments of the present invention without creative effort are within the scope of protection of the present invention.
[0049] In the description of this invention, it should be understood that the terms "upper", "lower", "front", "rear", "left", "right", "top", "bottom", "inner", "outer", etc., indicate the orientation or positional relationship based on the orientation or positional relationship shown in the accompanying drawings. They are only for the convenience of describing this invention and simplifying the description, and do not indicate or imply that the device or element referred to must have a specific orientation, or be constructed and operated in a specific orientation. Therefore, they should not be construed as limitations on this invention.
[0050] Example 1, referring to Figure 1, provides a music recommendation method based on knowledge graphs, which includes the following steps:
[0051] Step S1: Multimodal data collection. Collect and preprocess audio, lyrics, cover images, metadata, and user behavior data. Map each modality to a unified vector representation through a pre-trained model, and use contrastive learning to align different modalities to obtain consistent and comparable multimodal embedding vectors.
[0052] Step S2: Knowledge graph construction. A timestamped knowledge graph is built based on heterogeneous patterns, and a time-aware heterogeneous graph is used. The model learns node embeddings that integrate graph structure, multimodal vectors, and temporal information, and then soft-injects clustering information as virtual nodes into the graph;
[0053] Step S3: Multi-granularity clustering, using vector space... The algorithm performs dense clustering of songs, users, and conversations, and uses soft assignment to handle composite interests; then, it uses community detection on the knowledge graph structure to discover interaction-based communities, and uses... Topic models perform semantic annotation and hierarchical organization for clusters, resulting in multi-granular and interpretable cluster sets;
[0054] Step S4: Fusion Recall, map user vectors to the nearest user cluster and topic cluster, retrieve candidate songs from within the clusters, and expand recall through knowledge graph paths. For cold start items, use soft allocation of content projection and neighborhood voting to integrate new songs or new users into the cluster structure.
[0055] Step S5: Adaptive perception optimization, perform deep ranking of the recalled candidates based on cluster perception, input cluster distribution, cluster similarity and knowledge graph meta-path attention, train multi-task objectives, and adopt an incremental update strategy to ensure that the model and clusters adapt to new data.
[0056] Step S6: Intelligent recommendation, mapping new users to the existing clustering space and calculating the soft assignment probability, obtaining a candidate set based on fusion recall; then using a cluster-aware ranking model to calculate the final score and generate a recommendation list.
[0057] Example 2, referring to Figures 1 and 3, is based on the above example. In step S1, the multimodal data collection specifically includes the following steps:
[0058] Step S11: Data Collection. Collect and preprocess multimodal data, transforming audio, lyrics, cover images, metadata, and user behavior data sequences into a unified vector representation. Align the feature spaces of different modalities through contrastive learning to ensure consistency and comparability of inputs for subsequent clustering and knowledge graph construction; extract from audio signals... Spectrum and using pre-trained models Generate an embedding and use it on the cover image. Extracting visual features, lyrics usage Model encoding involves one-hot encoding of metadata containing artist and genre information, and using [a specific encoding method] on user behavior data sequences. Capture timing dynamics, and then through... The loss function is used to jointly train a multimodal encoder, making the different modal representations of the same song similar and the representations of different songs more distinct, as shown below:
[0059] ;
[0060] in, This represents the contrastive learning loss function, which is a scalar that needs to be minimized. , and They represent the first Audio, lyrics, and visual modal vector representations of each sample; This indicates that the cosine similarity is taken. This represents the temperature coefficient, which controls the softening of similarity. Indicates batch size, set to Optimize usage The optimizer uses a learning rate of 0.001 and iterates until the loss converges or reaches its maximum. , This represents an exponential function with the natural constant as its base. Represents a logarithmic function with the natural constant as its base;
[0061] Step S12: Knowledge Graph Entity Injection. Entity recognition and knowledge graph entity injection are performed on the preprocessed multimodal data. Songs, artists, albums, and tags are used as knowledge graph nodes, and the learned vector representations are appended to the nodes. Timestamps are also introduced to capture static relationships and encode dynamic user interactions. Named entity recognition tools are used. Entities are extracted from lyrics and metadata, and these entities are linked to a knowledge graph as nodes. Each node is appended with a multimodal vector and a temporal attribute, as shown below:
[0062] ;
[0063] in, Represents a text fragment Linked knowledge graph entities; Represents a set of entities in a knowledge graph; and These represent text fragments. and entity vector representation express and Cosine similarity between them; This indicates an indicator function, with a value of 1 if the condition is true and 0 otherwise. This represents a time window in days, used to filter time-series related entities; optimization is achieved through threshold filtering. Link only entities with a similarity higher than a threshold.
[0064] Example 3, referring to Figures 1 and 4, is based on the above examples. In step S2, the knowledge graph construction specifically includes the following steps:
[0065] Step S21: Define the heterogeneous patterns of the knowledge graph, use a time-aware graph neural network to learn node embeddings, the embeddings integrate graph structure, multimodal vectors and temporal information, and adopt heterogeneous graphs. The model introduces a time attention mechanism to encode neighborhood information and weights historical interactions based on timestamps; it is represented as follows:
[0066] ;
[0067] in, Represents a node In the Layer embedding; Represents the neighboring nodes of u; Indicates the relation type; Indicates the timestamp of the relationship; Indicates attention weight; , , Represents the learnable projection matrix; Indicates the time decay rate; Indicates the current time; number of floors Embedded Dimensions Training uses link prediction auxiliary loss, optimizer Learning rate ;
[0068] Step S22: Clustering information injection. The generated clusters are attached to existing nodes as virtual nodes, and reverse edges are established. Specifically, after the initial embedding learning, cluster node placeholders are reserved, and clustering information is injected as edge weights using soft-assignment probabilities. The topological structure of the knowledge graph reflects the clustering semantics, as shown below:
[0069] ;
[0070] in, Indicates the song Belongs to clustering The soft assignment probability, as a component in the knowledge graph. arrive Edge weights; Indicates the song Multimodal vectors; , Representing clustering The mean and variance; This represents the total number of clusters, set to 100; after injection, the knowledge graph uses... Storage, supports Query path.
[0071] By performing the above operations, this solution addresses the problems of traditional knowledge graph and recommendation systems based on vector or relational singular representations, which struggle to simultaneously express heterogeneous entity relationships, modal information, and temporal evolution, as well as their insufficient characterization of complex interaction semantics. Instead, it constructs a timestamped heterogeneous knowledge graph and introduces a time-aware heterogeneous graph. The model appends multimodal vectors to graph nodes and integrates graph structure with temporal attention, thereby simultaneously encoding structural relationships, content features, and temporal decay information in node embedding. In addition, clustering is used as a virtual node soft injection topology to achieve interpretable semantic connectivity and dynamic query capabilities, thus significantly improving the ability to model complex association patterns and temporal preferences.
[0072] Example 4, referring to Figures 1 and 5, is based on the above examples. In step S3, multi-granularity clustering specifically includes the following steps:
[0073] Step S31: Define the clustering objective function to perform dense clustering of songs, users, and sessions in the vector embedding space, using... Algorithm combination The index implements clustering while introducing soft assignment to handle composite interests, ensuring that the clustering results support efficient retrieval and diversity; multimodal vectors are input into... In the algorithm, the center is updated in each batch, and then... A near-nearest neighbor index is constructed to accelerate allocation, thereby generating song clusters, user clusters, and topic clusters, as shown below:
[0074] ;
[0075] in, The scalar representing the clustering loss needs to be minimized. Indicates the first Vectors of samples; Indicates the center of cluster m; Indicates the soft allocation coefficient. ; Indicates the softening temperature; Represents the sample size; using The size is 1024, and the number of iterations is 50.
[0076] Step S32: Define the community detection objective function, and use the community detection algorithm on the graph structure of the knowledge graph to discover interest communities based on interactions. The algorithm captures topological clustering in the user and song subgraphs and merges it with vector space clustering to generate multi-granularity clustering results; it extracts the user and song interaction subgraphs from the knowledge graph and runs... The modular function is optimized to generate community clusters. Then, vector clusters and graph clusters are merged using a clustering fusion matrix, as shown below:
[0077] ;
[0078] in, Represents a modular fraction, which is a scalar that needs to be maximized; This represents the edge weight between nodes i and j; Indicate the degree of node i; This represents the total number of sides; This represents the community discrimination function, which is 0 if i and j are in the same community and otherwise. The algorithm has a resolution of 1.0 and iterates until... Stable; during fusion, use Clustering is performed with a similarity threshold of 0.5.
[0079] Step S33: Semantic annotation. The generated clusters are semantically annotated and layered using a hierarchical strategy, dividing the clusters into a topic layer, a singer and style layer, and a short-term conversation layer, corresponding to coarse-grained, medium-grained, and fine-grained granularity, respectively. The topic model extracts keywords from lyrics and tags within clusters as annotations, supporting explanation and multi-level recall; specifically, it runs on the lyrics and tag set of each cluster. The topic model generates topic distributions and extracts them. Keywords serve as clustering labels, and a hierarchical clustering tree is constructed to represent nested relationships, as shown below:
[0080] ;
[0081] in, Represents the topic distribution vector of cluster m; Represents the collection of documents within cluster m; The words representing document d; K=10 represents the number of topics; This indicates that topic z corresponds to word w. Prior distribution; variational Bayesian method, 50 iterations; top-5 keywords as labels, hierarchical tree constructed by cluster center distance, threshold value set to 0.3.
[0082] By performing the above operations, this solution addresses the problems of poor scalability, weak composite interest processing capability, and semantic uninterpretability inherent in traditional single-granularity clustering and pure graph-structured communities. It employs a vector space... The algorithm combines nearest neighbor indexes to achieve large-scale, low-latency soft-assignment clustering, while running modularly optimized community detection on the knowledge graph to discover interaction-driven communities. Subsequently, it uses cluster fusion and topic model-based semantic annotation to construct multi-granularity clusters and hierarchical structures, ultimately enabling clustering to scale to massive amounts of data, handle mixed interests, and provide clear and interpretable topic labels to support multi-level recall and retrieval.
[0083] Example 5, referring to Figures 1 and 6, is based on the above examples. In step S4, the fusion recall specifically includes the following steps:
[0084] Step S41: Online recall maps the user query vector to the nearest user cluster and topic cluster, retrieves candidate songs from the corresponding song cluster, and expands the recall coverage to cover long-tail items using cluster-related paths in the knowledge graph. Specifically, it uses the HNSW index to find the cluster to which the user belongs, then samples the top-N candidate songs from the cluster, and expands additional candidates through knowledge graph paths, as shown below:
[0085] ;
[0086] in, This represents the recall candidate set for user u; , Let m represent the user vector and the user cluster center m, respectively. The song cluster m represents the songs in the song cluster; p represents the knowledge graph path. Indicates path weight; Indicates the weight threshold; Represents the number of samples within a cluster and the path depth. ;
[0087] Step S42: Cold start allocation. For new songs or new users during a cold start, soft clustering allocation is performed through content vector mapping and knowledge graph neighborhood voting, inheriting clustering preferences and introducing uncertainty. Specifically, the new item vector is projected onto the existing clustering space, soft probabilities are calculated, and the allocation is adjusted in conjunction with the voting from the knowledge graph neighborhood, as shown below:
[0088] ;
[0089] in, This indicates that the new term vector belongs to the cluster. The soft allocation coefficient; Represents the vector of new terms; Indicates the cluster center; Indicates the voting weight of the neighborhood; This represents the neighborhood nodes of a new item vector in the knowledge graph; optimization is completed in one calculation, with the allocation coefficient threshold set to 0.1 to filter low-probability clusters.
[0090] By performing the above operations, this solution addresses the limitations of existing recall strategies that rely solely on vector nearest neighbors or graph paths in long-tail coverage and cold-start performance, as well as the difficulty in balancing hit rate and diversity. Instead, it employs cluster-aware fusion recall. First, it uses an approximate nearest neighbor index to map users to the nearest user cluster and topic cluster, efficiently sampling candidates within each cluster. Then, it utilizes high-weight meta-paths in the knowledge graph to expand long-tail candidates according to a threshold, enhancing coverage. For cold-start items, it adopts a soft-allocation hybrid strategy combining content vector mapping and neighborhood voting, and uses weighted exploration and inheritance to balance retrieval efficiency, long-tail hit rate, and candidate set diversity, thereby improving business interpretability.
[0091] Example 6, referring to Figures 1 and 7, is based on the above examples. In step S5, the adaptive perception optimization specifically includes the following steps:
[0092] Step S51: Perceptual depth ranking. The recalled candidates are subjected to perceptual depth ranking by clustering. A neural network model is used as input for user cluster distribution, candidate cluster similarity, and knowledge graph meta-path features. Multi-task loss is optimized to balance click-through rate and diversity. Specifically, the following steps are employed: The model uses a wide layer to process cluster similarity and a deep layer to process sequence embeddings and path attention. Training objectives include click prediction and diversity regularization, as shown below:
[0093] ;
[0094] in, Indicates the song For users The score; Indicates the fusion weights; , Indicates the clustering assignment coefficient; express arrive Average attention along the path; Indicates loss; and These represent actual clicks and predicted clicks, respectively. Represents the diversity regularization weight; Indicates clustering in batches The proportion; training use Optimizer ;
[0095] Step S52: Incremental update. Each batch of new data triggers an incremental update, and a full re-clustering operation is performed every 24 hours to update the knowledge graph nodes and edges, as shown below:
[0096] ;
[0097] in, Indicates time Clustering center; Indicates the learning rate; This represents a new data vector; batch size = 100.
[0098] Example 7, referring to Figure 1, is based on the above examples. In step S6, the intelligent recommendation collects new user data, maps new users to the existing clustering space, and calculates the soft assignment probability. Then, in the recall stage, new users are mapped to the nearest user cluster and topic cluster, and candidate songs are retrieved from the corresponding song clusters. At the same time, long-tail candidates are expanded using high-weight paths in the knowledge graph. Finally, in the ranking stage, a cluster-aware deep model is used to calculate scores, generate a ranking list, and recommend songs according to the ranking list.
[0099] Example 8, referring to Figure 2, is based on the above examples. The present invention provides a music recommendation system based on a knowledge graph, including a multimodal data collection module, a knowledge graph construction module, a multi-granularity clustering module, a fusion recall module, an adaptive perception optimization module, and an intelligent recommendation module.
[0100] The multimodal data collection module collects and preprocesses audio, lyrics, cover images, metadata, and user behavior data. It maps each modality to a unified vector representation through a pre-trained model, aligns different modalities using contrastive learning, obtains consistent and comparable multimodal embedding vectors, and sends the data to the knowledge graph construction module.
[0101] The knowledge graph construction module receives data from the multimodal data collection module, builds a time-stamped knowledge graph based on heterogeneous patterns, and uses a time-aware heterogeneous graph. The model learns to embed nodes that integrate graph structure, multimodal vectors, and temporal information. Then, it soft-injects clustering information as virtual nodes into the graph and sends the data to the multi-granularity clustering module.
[0102] The multi-granularity clustering module receives data sent by the knowledge graph construction module and performs clustering in vector space using... The algorithm performs dense clustering of songs, users, and conversations, and uses soft assignment to handle composite interests; then, it uses community detection on the knowledge graph structure to discover interaction-based communities, and uses... The topic model performs semantic annotation and hierarchical organization for clusters, resulting in a multi-granular and interpretable cluster set, and sends the data to the fusion and recall module;
[0103] The fusion recall module receives data sent by the multi-granularity clustering module, maps user vectors to the nearest user cluster and topic cluster, retrieves candidate songs from within the clusters, expands the recall through knowledge graph paths, uses soft allocation of content projection and neighborhood voting for cold start items, integrates new songs or new users into the cluster structure, and sends the data to the adaptive perception optimization module.
[0104] The adaptive perception optimization module receives data sent by the fusion recall module, performs deep sorting of recall candidates based on cluster perception, inputs cluster distribution, cluster similarity and knowledge graph meta-path attention, trains multi-task objectives, adopts an incremental update strategy to ensure that the model and clusters evolve adaptively with new data, and sends the data to the intelligent recommendation module.
[0105] The intelligent recommendation module receives data sent by the adaptive perception optimization module, maps new users to the existing clustering space and calculates the soft assignment probability, obtains a candidate set based on fusion recall, and then calculates the final score and generates a recommendation list using a clustering-aware ranking model.
[0106] It should be noted that, in this document, the terms “comprising,” “including,” or any other variations thereof are intended to cover non-exclusive inclusion, such that a process, method, article, or apparatus that comprises a list of elements includes not only those elements but also other elements not expressly listed, or elements inherent to such process, method, article, or apparatus.
[0107] Although embodiments of the invention have been shown and described, it will be understood by those skilled in the art that various changes, modifications, substitutions and alterations can be made to these embodiments without departing from the principles and spirit of the invention.
[0108] The present invention and its embodiments have been described above. This description is not restrictive, and the accompanying drawings are only one embodiment of the present invention; the actual structure is not limited thereto. In conclusion, if those skilled in the art are inspired by this description and design similar structures and embodiments without departing from the spirit of the invention, such designs should fall within the protection scope of the present invention.
Claims
1. A music recommendation method based on knowledge graphs, characterized in that: The method includes the following steps: Step S1: Multimodal data collection, collecting and preprocessing audio, lyrics, cover images, metadata, and user behavior data, mapping each modality to a unified vector representation through a pre-trained model, and aligning different modalities using contrastive learning to obtain consistent and comparable multimodal embedding vectors; Step S2: Knowledge graph construction, building a timestamped knowledge graph based on heterogeneous patterns, and using time-aware heterogeneous graphs... The model learns node embeddings that integrate graph structure, multimodal vectors, and temporal information, and then soft-injects clustering information as virtual nodes into the graph; Step S3: Multi-granularity clustering, using... The algorithm performs dense clustering of songs, users, and conversations, and uses soft assignment to handle composite interests; then, it uses community detection on the knowledge graph structure to discover interaction-based communities, and uses... The topic model performs semantic annotation and hierarchical organization for clusters, resulting in a multi-granular and interpretable cluster set; Step S4: Fusion Recall, mapping user vectors to the nearest user clusters and topic clusters, retrieving candidate songs from within the clusters, and expanding recall through knowledge graph paths, using soft assignment with content projection and neighborhood voting for cold start items to integrate new songs or users into the cluster structure; Step S5: Adaptive Perception Optimization, performing deep ranking of recall candidates based on cluster perception, inputting cluster distribution, cluster similarity, and knowledge graph meta-path attention, training multi-task objectives, and using an incremental update strategy to ensure that the model and clusters adapt to new data; Step S6: Intelligent Recommendation, mapping new users to the existing cluster space and calculating soft assignment probabilities, obtaining a candidate set based on fusion recall, and then using a cluster perception ranking model to calculate the final score and generate a recommendation list.
2. The music recommendation method based on knowledge graphs according to claim 1, characterized in that: In step S3, multi-granularity clustering specifically includes the following steps: Step S31: Define the clustering objective function, and perform dense clustering of songs, users, and sessions in the vector embedding space, using... Algorithm combination The index implements clustering while introducing soft assignment to handle composite interests, ensuring that the clustering results support efficient retrieval and diversity; multimodal vectors are input into... In the algorithm, the center is updated in each batch, and then... Constructing an approximate nearest neighbor index accelerates allocation, thereby generating song clusters, user clusters, and topic clusters; Step S32: Define a community detection objective function, and use a community detection algorithm on the graph structure of the knowledge graph to discover interest communities based on interactions. The algorithm captures topological clustering in the user and song subgraphs and merges it with vector space clustering to generate multi-granularity clustering results; it extracts the user and song interaction subgraphs from the knowledge graph and runs... Optimize the modular function to generate community clusters, and then merge vector clusters and graph clusters through a cluster fusion matrix; Step S33: Semantic annotation, perform semantic annotation and hierarchical strategy on the generated clusters, and divide the clusters into topic layer, singer and style layer, and short-term conversation layer, corresponding to coarse-grained, medium-grained, and fine-grained, respectively; use The topic model extracts keywords from lyrics and tags within clusters as annotations, supporting interpretation and multi-level recall; specifically, it runs on the lyrics and tag set of each cluster. The topic model generates topic distributions and extracts them. Keywords serve as clustering labels, and a hierarchical clustering tree is constructed to represent nested relationships.
3. The music recommendation method based on knowledge graphs according to claim 1, characterized in that: In step S2, the knowledge graph construction specifically includes the following steps: Step S21: Define the heterogeneous pattern of the knowledge graph, use a time-aware graph neural network to learn node embeddings, the embeddings integrating graph structure, multimodal vectors, and temporal information; adopt heterogeneous graphs The model introduces a time attention mechanism to encode neighborhood information and weight historical interactions based on timestamps; Step S22: Clustering information injection, the generated clusters are attached to existing nodes as virtual nodes and reverse connections are established; Specifically, after the initial embedding learning, cluster node placeholders are reserved, and clustering information is injected as edge weights through soft allocation probability, and the topological structure of the knowledge graph reflects the clustering semantics.
4. The music recommendation method based on knowledge graphs according to claim 1, characterized in that: In step S4, the fusion recall specifically includes the following steps: Step S41: Online recall, mapping the user query vector to the nearest user cluster and topic cluster, retrieving candidate songs from the corresponding song cluster, and simultaneously expanding the recall coverage of long-tail items using cluster-related paths in the knowledge graph; specifically, using the HNSW index to find the cluster to which the user belongs, then sampling the top-N candidate songs from the cluster, and expanding additional candidates through knowledge graph paths; Step S42: Cold start allocation, for new songs or new users in a cold start, performing soft clustering allocation through content vector mapping and knowledge graph neighborhood voting, inheriting clustering preferences and introducing uncertainty; specifically, projecting the new item vector onto the existing cluster space, calculating the soft probability, and adjusting the allocation in conjunction with knowledge graph neighborhood voting.
5. The music recommendation method based on knowledge graphs according to claim 1, characterized in that: In step S5, the adaptive perception optimization specifically includes the following steps: Step S51: Perception depth ranking, performing cluster perception depth ranking on the recall candidates, using a neural network model to input user cluster distribution, candidate cluster similarity, and knowledge graph meta-path features, and optimizing multi-task loss to balance click-through rate and diversity; specifically, adopting The model uses a wide layer to process cluster similarity and a deep layer to process sequence embedding and path attention. The training objectives include click prediction and diversity regularization. Step S52: Incremental update. Each batch of new data triggers an incremental update, and a full re-clustering operation is performed every 24 hours to update the knowledge graph nodes and edges.
6. The music recommendation method based on knowledge graphs according to claim 1, characterized in that: In step S6, the intelligent recommendation collects new user data, maps new users to the existing clustering space, and calculates the soft assignment probability; then, in the recall phase, it maps new users to the nearest user cluster and topic cluster, retrieves candidate songs from the corresponding song cluster, and expands long-tail candidates using high-weight paths in the knowledge graph. Finally, in the ranking stage, a cluster-aware deep model is used to calculate scores, generate a ranked list, and recommend songs according to the ranked list.
7. The music recommendation method based on knowledge graphs according to claim 1, characterized in that: In step S1, the multimodal data collection specifically includes the following steps: Step S11: Data collection, collecting and preprocessing multimodal data, converting audio, lyrics, cover images, metadata, and user behavior data sequences into a unified vector representation, aligning the feature spaces of different modalities through contrastive learning to ensure consistency and comparability of the inputs for subsequent clustering and knowledge graph construction; extracting from audio signals Spectrum and using pre-trained models Generate an embedding using the cover image. Extracting visual features, lyrics usage Model encoding involves one-hot encoding of metadata containing artist and genre information, and using [a specific encoding method] on user behavior data sequences. Capture timing dynamics, and then through... A loss function is used to jointly train a multimodal encoder, making the different modal representations of the same song similar and the representations of different songs more distinct. Step S12: Knowledge graph entity injection. Entity recognition and knowledge graph entity injection are performed on the preprocessed multimodal data. Songs, artists, albums, and tags are used as knowledge graph nodes, and the learned vector representations are appended to the nodes. Timestamps are also introduced to capture static relationships and encode dynamic user interactions. Named entity recognition tools are used. Entities are extracted from lyrics and metadata and linked to a knowledge graph as nodes, with each node having a multimodal vector and a temporal attribute attached.
8. A knowledge graph-based music recommendation system, used to implement the knowledge graph-based music recommendation method as described in any one of claims 1-7, characterized in that: It includes a multimodal data collection module, a knowledge graph construction module, a multi-granularity clustering module, a fusion recall module, an adaptive perception optimization module, and an intelligent recommendation module.
9. A music recommendation system based on knowledge graphs according to claim 8, characterized in that: The multimodal data collection module collects and preprocesses audio, lyrics, cover images, metadata, and user behavior data. It maps each modality to a unified vector representation using a pre-trained model and aligns different modalities using contrastive learning to obtain consistent and comparable multimodal embedding vectors. The data is then sent to the knowledge graph construction module. The knowledge graph construction module receives the data from the multimodal data collection module, builds a timestamped knowledge graph based on heterogeneous patterns, and uses a time-aware heterogeneous graph... The model learns node embeddings that integrate graph structure, multimodal vectors, and temporal information. Subsequently, it soft-injects clustering information as virtual nodes into the graph and sends the data to a multi-granularity clustering module. This multi-granularity clustering module receives the data from the knowledge graph construction module and performs clustering in the vector space using... The algorithm performs dense clustering of songs, users, and conversations, and uses soft assignment to handle composite interests; Then, community detection is used on the knowledge graph structure to discover interaction-based communities, and... The topic model performs semantic annotation and hierarchical organization for clusters, resulting in a multi-granular and interpretable cluster set, and sends the data to the fusion and recall module; The fusion recall module receives data from the multi-granularity clustering module, maps user vectors to the nearest user cluster and topic cluster, retrieves candidate songs from within the clusters, and expands the recall through knowledge graph paths. For cold-start items, it uses soft allocation via content projection and neighborhood voting to integrate new songs or users into the cluster structure, and sends the data to the adaptive perception optimization module. The adaptive perception optimization module receives data from the fusion recall module, performs deep sorting of the recall candidates based on cluster perception, inputs cluster distribution, cluster similarity, and knowledge graph meta-path attention, trains a multi-task objective, and uses an incremental update strategy to ensure the model and clusters adaptively evolve with new data, and sends the data to the intelligent recommendation module. The intelligent recommendation module receives data from the adaptive perception optimization module, maps new users to the existing cluster space and calculates the soft allocation probability, and obtains a candidate set based on the fusion recall. Then, a cluster-aware ranking model is used to calculate the final score and generate a recommendation list.