Explanatable course recommendation system and method fused with multi-level semantic enhancement
By introducing a multi-level semantically enhanced interpretable course recommendation system into an online education platform, and using the LightGCN graph model and large language model to generate personalized explanatory text, the problem of insufficient professionalism and explanation in course recommendations in educational scenarios is solved, thereby improving the interpretability of the recommendation system and learner trust.
Patent Information
- Application Number
- CN202511573010.9
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-10-30
- Publication Date
- 2026-02-10
AI Technical Summary
In online education platforms, existing course recommendation systems lack professionalism and relevance in educational scenarios, fail to generate course selection suggestions that meet learners' needs, and lack effective explanation mechanisms.
Design an interpretable course recommendation system that integrates multi-level semantic enhancement. Through interactive data processing, interaction pattern capture, contrastive learning enhancement, and a large language model semantic adapter module, end-to-end optimization from structured interaction to natural language interpretation is achieved. Personalized explanatory text is generated using the LightGCN graph model and the large language model.
It improves the interpretability and professionalism of course recommendations, generates personalized explanatory texts with logical consistency and clear evidence chains, and enhances learners' trust in the recommendation results and their decision-making support capabilities.
Smart Images

Figure CN121502072A_ABST
Abstract
Description
TECHNICAL FIELD
[0001] The present application relates to the field of intelligent education, in particular to an explainable course recommendation system and method fusing multi-level semantic enhancement. BACKGROUND
[0002] The rise of online education platforms has brought about the problem of course resource overload, and recommendation systems alleviate this challenge through precise matching. However, pure recommendation results are not enough to meet the needs, and the system also needs to explain the recommendation reasons to the learners. High-quality explanations can not only enhance the trust in the recommendation results, but also reveal the matching logic between courses and learner needs, assisting in learning decision optimization.
[0003] In recent years, large language models have shown significant potential in the field of explainable recommendation, and their ability to generate personalized explanations through semantic reasoning has been preliminarily verified. For example, the framework proposed in the literature Qiyao Ma, Xubin Ren, and Chao Huang. 2024. XRec: Large Language Models for Explainable Recommendation. In Findings of the Association for Computational Linguistics: EMNLP 2024, pages 391-402, Miami, Florida, USA. Association for Computational Linguistics. generates user-understandable natural language recommendation reasons through semantic alignment technology. This framework has achieved good results in the e-commerce scenario, and can generate explanation texts that meet the needs of user shopping decision-making, effectively improving the explainability of the recommendation system and user experience, but there is no similar framework in the education scenario.
[0004] When directly migrating existing frameworks to the education scenario, there are many challenges. First, the learner-course interaction in the education scenario has stronger semantic dependency, and traditional collaborative information conversion methods are difficult to fully capture the deep semantic association between learners and courses. Second, the feature representation of education resources often contains multiple levels of information (such as course difficulty, knowledge point system, teaching goals, etc.), and simple feature conversion cannot effectively preserve these hierarchical education feature information. These problems lead to the generated course recommendation explanations often lack the professionalism and pertinence specific to the education scenario, and cannot provide truly valuable course selection suggestions for learners. Therefore, how to design a more suitable collaborative information conversion mechanism for the education scenario to generate more professional and targeted course recommendation explanations has become a key problem that needs to be solved. SUMMARY
[0005] An interpretable course recommendation system and method are provided to design a collaborative information conversion mechanism more suitable for an educational scenario to generate more professional and targeted course recommendation explanations.
[0006] The technical solution of the present application is: The interpretable course recommendation system fusing multi-level semantic enhancement comprises an interactive data processing module, an interactive mode capturing module, a contrast learning enhancement module, a large language model semantic adapter module and a personalized explanation generation module, sequentially completes a hierarchical modeling process of data standardization, graph feature learning, contrast enhancement, semantic adaptation and explanation generation, and thus realizes end-to-end optimization from structured interaction to natural language explanation. The interactive data processing module is responsible for converting original educational data into learner-course interaction data and structured learner-course fusion data; based on data cleaning and standardization, the interactive data processing module introduces a prompt word generation mechanism based on a large language model, generates course portraits and learner portrait summaries, and unifies encoding of the two and the interaction records, providing semantic input features for subsequent graph model learning; The interactive mode capturing module utilizes a light graph convolution network LightGCN to model the implicit relationship between learners and courses; through multi-layer propagation and aggregation operations, the module can capture multi-order neighborhood dependencies and generate graph convolution initial embeddings containing potential behavior patterns; The contrast learning enhancement module introduces a double-channel contrast target based on the graph structure, constructs positive and negative sample pairs on the user side and the course side, and obtains contrast-enhanced embeddings with higher semantic discriminability and generalization ability by jointly optimizing the contrast loss and the ranking loss; The contrast-enhanced embeddings are then input into the large language model semantic adapter module to realize mapping and alignment across modal semantic spaces; the module adopts a multi-head cross-attention mechanism and a hybrid expert network structure, introduces temperature scaling and noise disturbance in the gating mechanism, and utilizes a multi-scale convolution fusion layer to capture hierarchical features, thereby generating cross-model semantic adaptation embeddings compatible with the semantic space of the large language model; Finally, the personalized explanation generation module injects the adapted cross-model semantic adaptation embeddings and the learner-course fusion data into the large language model input template, adds bias to the query, key and value states of the learner and course embeddings in the attention mechanism, and realizes semantic linkage between the recommendation result and the explanation generation process.
[0007] Further, the interactive data processing module specifically comprises: An original education field data set containing learner information and course information is acquired, interaction records are filtered, and graph kernel decomposition is applied for quality constraint, while a mapping relationship between learner ID and course ID is constructed, and standardized learner-course interaction data is output; course basic information is extracted, and combined with learner historical feedback, a course prompt word template is constructed, the course prompt word template is input into a large language model, and a course portrait abstract is generated; based on the historical course comments of the learner and the aforementioned course portrait abstract, a learner prompt word template is constructed, input into the large language model, and a learner portrait abstract is generated; finally, the generated course portrait and learner portrait are combined, and learner-course fusion data is output; the learner-course fusion data includes user ID, course ID, course title, learner portrait abstract, course portrait abstract, and explanation text.
[0008] Further, the interaction mode capturing module is specifically as follows: An implicit interaction mode between learners and courses is captured by using a LightGCN graph model to generate graph convolution initial embeddings of learners and courses; the LightGCN graph model includes: an interaction graph construction layer for converting learner-course interaction data into a bipartite graph structure and constructing a symmetric normalized adjacency matrix; an embedding initialization layer for generating a default 64-dimensional initial representation vector for each learner and course node by using the Xavier initialization method, and constructing a learner embedding matrix and a course embedding matrix, respectively; a graph convolution message passing layer for using sparse matrix multiplication to aggregate neighbor node information layer by layer according to a propagation depth of L=4, so that each node obtains interaction information from 0 order to 4 order in turn; an embedding aggregation layer for performing equal-weight summation of the initialized embedding and the embedding obtained by each layer of propagation to form a final representation, and using a Bayesian personalized ranking BPR loss combined with L2 regularization to optimize the model; after sequentially passing through the above four layers, graph convolution initial embeddings of learner and course nodes are finally obtained.
[0009] Further, the contrast learning enhancement module is specifically as follows: The contrast learning mechanism based on the InfoNCE loss function is adopted to improve the discriminability and robustness of the embedding representation by constructing positive and negative sample pairs. The mechanism includes three layers: an interactive mapping construction layer for establishing a bidirectional interactive dictionary on the learner-course bipartite graph; a contrast sample construction layer for selecting "other learners who choose the same target course" as positive samples for each anchor learner on the user side according to the bidirectional interactive dictionary, and selecting randomly sampled non-anchor learners as negative samples; on the course side, selecting "other selected courses of the anchor course corresponding learners" as positive samples with the anchor course as the center, and selecting randomly sampled courses as negative samples; an embedding representation optimization layer for L2 normalization of all sample embeddings, using cosine similarity as the metric and adopting temperature parameter scaling, and introducing light dropout in the training stage to enhance generalization; the user side and the course side calculate the contrast learning loss, and jointly optimize the Bayesian personalized ranking loss of the embedding aggregation layer with weights to form the overall objective; the contrast learning enhancement module is processed in turn, and finally the contrast-enhanced embedding representation of the learner and the course is output, providing more discriminative input for subsequent semantic adaptation and explanation generation.
[0010] Further, the large language model semantic adapter module is specifically as follows: An embedding conversion network architecture with multi-stage interaction is adopted to convert the low-dimensional learner and course contrast-enhanced embedding into high-dimensional cross-model semantic adaptation embedding aligned with the semantic space of the large language model through a multi-head cross-attention mechanism and a hybrid expert weighting strategy based on noise gating and temperature scaling; the embedding conversion network includes: a multi-head cross-attention layer that adopts multiple attention heads and introduces position enhancement parameters and residual normalization mechanism to capture the semantic interaction relationship between learner and course embeddings; a hybrid expert mapping layer that includes multiple linear whitening projection experts PWLayer to map low-dimensional input embeddings to high-dimensional semantic space; an intelligent gating layer that performs softmax weighting fusion on the outputs of each expert based on learnable temperature scaling and noise gating mechanism, and introduces a load balancing loss to promote uniform use of experts; a hierarchical feature fusion layer that uses one-dimensional convolution with kernel sizes of 1, 3, and 5 to extract multi-scale features, and uses a sigmoid gating mechanism to perform residual fusion on the original embedding and expert fusion results, thereby generating the final 4096-dimensional cross-model semantic adaptation embedding; the cross-model semantic adaptation embedding will be injected into the subsequent module through a special placeholder, providing support for semantic space alignment and personalized recommendation result explanation generation with subsequent modules.
[0011] Further, the personalized explanation generation module is specifically as follows: Based on a large language model, combined with high-dimensional learner and course cross-model semantic adaptation embedding and learner-course fusion data, a personalized recommendation explanation text is finally generated for each user-course pair; the personalized explanation generation module includes: an input text construction layer, including the following processing steps: step (1) input text template construction: combining the fusion data with two registered special markers <USER_EMBED> and <ITEM_EMBED> into a structured template, <USER_EMBED> and <ITEM_EMBED> are special placeholders registered by the tokenizer, corresponding to the cross-model semantic adaptation embedding of the learner and the course, which will be directly filled with high-dimensional embedding in the subsequent steps; step (2) tokenizer tokenization and token sequence encoding: convert the input text into a token sequence through the tokenizer, and obtain an initial embedding matrix through the model embedding layer; step (3) template special marker embedding filling: accurately positioning the positions of <USER_EMBED> and <ITEM_EMBED> in the sequence, replacing the input embedding at the corresponding position with the cross-model semantic adaptation embedding adapted by the large language model semantic adapter module, and further inputting the embeddings and positions of the two into the model, so that the self-attention layer performs additive injection on the Q / K / V state at the corresponding position; wherein, Q / K / V state is the query Query, key Key, and value Value vector of the self-attention layer participating in attention calculation at each time step, additive injection refers to directly adding external learner / course embedding to the hidden state of Q, K, and V at the corresponding time step to affect attention weight calculation and context aggregation, thereby strengthening personalized information expression; large language model reasoning and text generation: after the model fuses the above-mentioned explicit injection representation and context information, it generates a personalized recommendation explanation text.
[0012] Further, the structured template is: "user record:<USER_EMBED>course record:<ITEM_EMBED>course name: {title} user profile: {user_summary} course profile:{item_summary}"; wherein, "user record" represents the learner behavior and profile field set after fusion processing, "course record" represents the structured content and metadata field set of the course; {title} is the course name string; {user_summary} is the summary text of the learner profile; {item_summary} is the summary text of the course profile.
[0013] An explainable course recommendation method fusing multi-level semantic enhancement, comprising: The first stage, data preprocessing and initialization: obtain the original dataset containing learner information and course information:
[0014] wherein, represents the learner ID; represents the course ID; is the content of the learner's review of the course; is the interaction timestamp; is the interaction legitimacy flag; represents the number of different learners in the original dataset; represents the number of different courses in the original dataset; To ensure data quality, filter constraints based on graph kernel decomposition are adopted on the user-course bipartite graph:
[0015] are processed, wherein the edge set:
[0016] represents the learner-course pair with non-empty interaction; represents the set of learner nodes in the bipartite graph, the set of course nodes in the bipartite graph; The core subgraph that satisfies the following formula is retained:
[0017] wherein, represents the degree of node in graph ; represents the threshold value of k-core decomposition, which is a positive integer, used to specify nodes connected to at least k-core , represents the set of learners and courses that satisfy the k-core constraint; obtains the core interaction set after k-core constraint:
[0018] Subsequently, the index mapping function of the learner and the course is constructed:
[0019] wherein, , is the standardized integer index; represents the learner ID mapping function, which maps the original learner identifier to the standardized continuous integer index , which facilitates subsequent matrix processing, wherein ; This indicates a course ID mapping function that maps the original course identifier to... Mapped to normalized consecutive integer indices ,in ; Based on this mapping, a standardized interaction matrix is generated:
[0020] Based on this, extract the basic information for each course:
[0021] in, Indicates course A structured set of basic information. Course name, For the field to which the course belongs, For prerequisite requirements, The course description text; combined with a collection of historical learner feedback for the course:
[0022] Build course prompt templates And input the large language model used to generate course profile summaries. The course profile summary is as follows:
[0023] For each learner, based on their historical learning record:
[0024] Build learner prompt templates Input a large language model used to generate learner profiles The learner profile is obtained as follows:
[0025] Ultimately, the merged learner profile Combined with course profiles, learner-course integrated data is formed:
[0026] in This serves as a reference explanatory text for real learner-course interaction pairs, used for subsequent model training supervision and offline evaluation comparison, and is not directly used as display content; the learner-course fusion data is output as a JSON file for subsequent personalized recommendation result interpretation generation. The second stage, graph neural network feature learning: Standardized learner-course interaction data is input into the interaction pattern capture module for deep feature learning. The interaction pattern capture module uses a lightweight graph convolutional network, LightGCN, to capture the implicit interaction patterns between learners and courses, thereby generating initial graph convolutional embeddings of learner and course nodes. This module contains four layers, with the following structure: The interaction graph construction layer builds a bipartite graph structure based on learner-course interaction data, assuming the learner set is:
[0027] The set of interaction relationships is:
[0028] Therefore, an adjacency matrix can be constructed:
[0029] in, This represents the learner-course interaction matrix, where T is the transpose; to avoid the influence of degree differences, [the following is omitted as it is not explicitly stated in the original text]. Perform symmetric normalization:
[0030] in, Let be a degree matrix, and the elements within the degree matrix are... Indicates the first Each node represents the learner's connectivity. An embedding initialization layer is used to assign a learnable low-dimensional representation vector to each node, and Xavier initialization is employed, as shown in the formula:
[0031] in Indicates the embedding dimension. and These represent the initial embedding matrices for the learner and the course, respectively. In the graph convolutional message-passing layer, LightGCN only retains a linear aggregation of neighbor features, without weight matrices and activation functions; the node representation propagates in the l-th layer as follows:
[0032] in For the number of propagation layers, For the normalized adjacency matrix, Indicates the first The node representation matrix of the layer; The embedding aggregation layer performs equal-weighted aggregation of the initial embeddings and the embeddings obtained from propagation through each layer to form the final node representation:
[0033] Among them, matrix The former The final representation of the learner node corresponding to each row. ,back The final representation of the corresponding course node. ; To optimize the target layer BPR loss, LightGCN employs a Bayesian personalized ranking loss during training to maximize the difference in learners' preference scores for positive sample courses.
[0034] in, , , These represent the embedding vectors of the learner, the positive sample course, and the negative sample course, respectively. This represents a sampled triple. For learners, This is a positive sample course that the learner has already interacted with. For negative sample courses; This represents a batch of sample sets, where each element is a triplet. , This indicates the number of triples in this batch; The sigmoid function; combined with L2 regularization, the complete optimization objective is:
[0035] in, The regularization coefficient is used to prevent overfitting. Through the graph neural network feature learning process in this stage, the system can effectively capture the potential interaction structure features between learners and courses, obtain the initial graph convolution embedding, and lay the foundation for subsequent work. The third stage is contrastive learning feature enhancement: the graph convolution is initially embedded into the contrastive learning enhancement module; the contrastive learning enhancement module adopts an InfoNCE-based contrastive learning mechanism, which improves the quality of the learner and course embedded representations by constructing positive and negative sample pairs; the loss function of this mechanism is defined as follows: For any anchor point sample Its positive samples are The negative sample set is Let the embedding vector corresponding to the sample be... After L2 normalization, we get:
[0036] in, Represents the embedding vector L2 norm; the similarity is defined as cosine similarity:
[0037] where, and denote the normalized embedding vectors of two samples; on this basis, the temperature parameter is defined as , which is used to adjust the smoothness of the similarity distribution between samples, and then the contrastive learning loss function is defined as
[0038] where, denotes the contrastive learning loss centered on the anchor sample , denotes the cosine similarity between the anchor sample and its positive sample, denotes the cosine similarity between the anchor sample and the i-th negative sample, denotes the cosine similarity between the anchor sample and the i-th negative sample, r denotes the summation operation on all negative samples; the contrastive loss of the learner side and the course side is calculated in this way; The contrastive learning mechanism includes the following three sub-layers: Interactive mapping construction layer: used to construct the bidirectional interactive dictionary of learners-courses and courses-learners to represent the selection relationship between learners and courses; Contrastive sample construction layer: based on the interactive mapping, for each learner, select the positive sample learner with similar course selection behavior and the randomly sampled negative sample learner; at the same time, for each course, select the positive sample course commonly selected by similar learners and the randomly sampled negative sample course; Embedding representation optimization layer: L2 normalization is performed on all sample embedding vectors, and the temperature scaling mechanism is applied to calculate the similarity distribution, and the InfoNCE contrastive loss of the learner level and the course level is calculated respectively; the specific process is as follows: The learner-level InfoNCE loss is derived from the self-supervised modeling assumption that "learners who select the same or similar courses should have similar embedding representations"; for each anchor learner , its positive sample is other learners who select its positive sample course , and the negative sample is a randomly sampled set of learners ; after L2 normalization of the embedding vector, the above formula is used to calculate:
[0039] The course-level InfoNCE loss is derived from the self-supervised modeling assumption that "courses commonly selected by similar learners should have similar embedding representations"; for each anchor course , its positive sample is another course selected by the same learner , negative samples are randomly sampled course sets ; the calculation method is the same as above, and the following is obtained:
[0040] Finally, the contrast loss of the learner side and the course side is weighted and the Bayesian personalized ranking loss is jointly optimized to form the overall optimization objective:
[0041] wherein, represents the final joint optimization objective function, represents the Bayesian personalized ranking loss, represents the weighting coefficient of the contrast learning loss, represents the InfoNCE contrast loss of the learner side, represents the InfoNCE contrast loss of the course side; through the above three layers of processing in turn, the contrast learning enhanced learner and course embedding representation is finally obtained, thereby significantly improving the representation discriminability and personalized performance in subsequent recommendation or matching tasks; In the fourth stage, the large language model semantic adapter module is used for high-dimensional semantic conversion of the contrast-enhanced embedding of the learner and the course. First, the multi-head cross-attention layer uses 4 attention heads to model the interaction relationship between the learner and the course features in depth, and the attention calculation formula is as follows:
[0042] wherein, , , represent the query, key, and value matrices, respectively; represents the dimension of the key vector; is a normalization function used to calculate the attention distribution; key is the attention head index; Then, the mixed expert mapping layer inputs the cross-attention enhanced learner and course embedding into 8 linear whitening projection experts for feature transformation, and the calculation formula of each expert is as follows:
[0043] wherein, is the input embedding; is the first layer weight matrix of the th expert, used to linearly transform the input to the hidden dimension; is the first layer bias vector of the th expert; is a whitening normalization function; is the second layer weight matrix of the th expert, used to map the intermediate results after nonlinear transformation back to the output space; is the second layer bias vector of the th expert; is the output vector of the th expert, as the input of the subsequent layer or participating in fusion with the outputs of other experts; Then, the intelligent gating layer dynamically calculates the fusion weight of each expert based on the noise gating and temperature scaling mechanism, and the formula is:
[0044] wherein, is the gating weight matrix, is the input feature vector, is a random noise term, is a temperature parameter for adjusting the smoothness of the weight distribution; according to the calculated weight vector , the expert output is weighted and fused to obtain the comprehensive semantic representation:
[0045] At the same time, in order to balance the load of each expert, a load balancing loss is introduced:
[0046] wherein MSE is the mean square error function, and expert_load is the average load proportion of each expert; Finally, the hierarchical feature fusion layer uses one-dimensional convolution with kernel size of 1, 3 and 5 to extract multi-scale features, and through the gating mechanism, the fusion results are residually fused with the original embedding:
[0047] wherein, is the gating coefficient vector; indicates that the one-dimensional convolution with kernel size of 1, 3 and 5 is adopted to extract multi-scale features, and the results are fused; is the input embedding; indicates the multiplication operation of corresponding elements; the output is the high-dimensional cross-model semantic adaptation embedding; The fifth stage is the generation of personalized recommendation result explanation text: Based on the large language model, combined with the cross-model semantic adaptation embedding of high-dimensional learners and courses output by the semantic adapter module and learner-course fusion data, personalized recommendation explanation text for each user-course pair is finally generated; this stage corresponds to the personalized explanation generation module, including the input text construction layer and the large language model. The input text construction layer contains three units: Input text template construction: combining data with three registered special tags<USER_EMBED> ,<ITEM_EMBED> ,<EXPLAIN_POS> Combined into a structured template,<USER_EMBED> and<ITEM_EMBED> These are special placeholders that have been registered, corresponding to cross-model semantic adaptation embeddings for learners and courses, respectively;<EXPLAIN_POS> To explain the starting position marker, the model is instructed to generate personalized explanatory text after this point; Tokenizer encoding and embedding initialization: The above input template is converted into a token sequence using a tokenizer. ,in, For length is The input sequence, For the first s A discrete text token; subsequently, it is mapped to the initial input embedding matrix through the model embedding layer:
[0048] in, This represents the word embedding mapping function of the model, used to map each token to a dimensional ( ) word. Continuous vector representation; The initial embedding matrix consists of all token embeddings. For sequence length, Embed dimensions into the model; Embedded padding of template placeholders: Let , Let them represent the cross-model semantic adaptation embeddings of the learner and the course output by the semantic adapter module, respectively; let... , for<USER_EMBED> and<ITEM_EMBED> If the position index is in the sequence, then the embedding at the corresponding position will be replaced with:
[0049] in, Depend on It was copied, but semantic embedding replacement was performed; Representation matrix In location index The vector at that position is replaced with ; Representation matrix In location index The vector at that position is replaced with ; Subsequently, additive injection is performed on the query, key, and value states at each time step in the self-attention layer:
[0050] This enhances the flow of personalized information and contextual interaction within the multi-head attention mechanism; based on this injection mechanism, the calculation formula for the self-attention layer can be expressed as:
[0051] in, , , This is the query, key, and value matrix after injection. The dimension of the key vector; Embedded sequence after injection processing As input to a large language model,<EXPLAIN_POS> After tagging, autoregressive generation is initiated, outputting personalized recommendation explanation text:
[0052] in, express<EXPLAIN_POS> Location index, For generating large language models for personalized interpretation, The generated explanatory text sequence is then used; finally, the large language model, by integrating personalized embeddings and contextual semantics, achieves highly relevant and interpretable recommendation text generation for each learner-course pair, forming a complete personalized explanatory output.
[0053] Furthermore, within the embedded aggregation layer, the aggregation operation is achieved by summing the embeddings of each layer and scaling them proportionally according to the number of layers.
[0054] Furthermore, in contrastive learning feature enhancement, either single negative sample or multiple negative sample construction methods are used. If the single negative sample form is used, the summation term in the denominator degenerates into a single-term calculation, while the formula still maintains the same structure.
[0055] The beneficial effects of this invention are as follows: This invention belongs to the field of smart education and provides an interpretable course recommendation system and method that integrates multi-level semantic enhancement. The method includes a three-level feature enhancement mechanism: First, it utilizes graph neural networks to mine the potential relationships between learners and courses from sparse interaction data, generating initial graph convolutional embeddings. Second, it constructs positive and negative sample pairs based on a contrastive learning mechanism, optimizing the initial graph convolutional embeddings into contrastive enhanced embeddings by narrowing the vector distance between learners with similar preferences and courses with similar features. Third, it designs a semantic adapter for a large language model that integrates multi-head cross-attention and hybrid expert strategies, adapting the contrastive enhanced embeddings across dimensions to the heterogeneous semantic space of the large language model, generating cross-model semantically adapted embeddings. This invention, through its three-level enhancement architecture, effectively reduces the cross-model semantic gap between graph convolutional models and large language models, and significantly improves the interpretability of educational recommendations based on the cross-model semantically adapted embeddings and learner-course educational profiles. Attached Figure Description
[0056] Figure 1 This is a schematic diagram of the overall structure of the present invention; Figure 2 This is a schematic diagram of the interactive mode capture module of the present invention; Figure 3 This is a schematic diagram of the contrastive learning enhancement module of the present invention; Figure 4 This is a schematic diagram of the structure of the large language model semantic adapter module of the present invention; Figure 5 This is a schematic diagram of the personalized interpretation generation module of the present invention. Detailed Implementation
[0057] The present invention will now be described in detail with reference to the accompanying drawings and specific embodiments. These embodiments are based on the technical solution of the present invention and provide detailed implementation methods and specific operating procedures. However, the scope of protection of the present invention is not limited to the following embodiments.
[0058] Please see Figure 1 This study proposes an interpretable course recommendation system that integrates multi-level semantic enhancement to address the problems of sparse interactive data, insufficient semantic alignment, and inconsistent interpretation of results in educational recommendation scenarios. The system comprises five collaborative modules: an interactive data processing module, an interactive pattern capture module, a contrastive learning enhancement module, a large language model semantic adapter module, and a personalized interpretation generation module. These modules sequentially complete a hierarchical modeling process involving data standardization, graph feature learning, contrastive enhancement, semantic adaptation, and interpretation generation, thereby achieving end-to-end optimization from structured interaction to natural language interpretation.
[0059] The interactive data processing module is responsible for transforming raw educational data into learner-course interaction data and structured, high-quality learner-course integrated data. Based on data cleaning and standardization, this module introduces a prompt word generation mechanism based on a large language model to generate course profiles and learner profile summaries. These summaries, along with the interaction records, are uniformly encoded to provide semantically rich input features for subsequent graph model learning, enabling a unified semantic representation of learner and course information.
[0060] Building upon this, the interaction pattern capture module utilizes Lightweight Graph Convolutional Networks (LightGCN) to model the implicit relationships between learners and the course. Through multi-layer propagation and aggregation operations, the module is able to capture multi-order neighborhood dependencies, generating initial graph convolutional embeddings containing potential behavioral patterns.
[0061] To further enhance the discriminativeness of the embedded representation, the contrastive learning enhancement module introduces a dual-channel contrastive objective based on the graph structure. Positive and negative sample pairs are constructed on the user side and the course side, respectively. By jointly optimizing the contrastive loss and the ranking loss, a contrastive enhancement embedding with higher semantic discriminativeness and generalization ability is obtained.
[0062] The contrast-enhanced embeddings are then fed into the large language model semantic adapter module to achieve mapping and alignment across the semantic space. This module employs a multi-head cross-attention mechanism and a hybrid expert network structure. Temperature scaling and noise perturbation are introduced into the gating mechanism to improve the diversity and controllability of expert selection. Multi-scale convolutional fusion layers are used to capture hierarchical features, thereby generating cross-model semantically adapted embeddings compatible with the semantic space of the large language model.
[0063] Finally, the personalized explanation generation module injects the adapted cross-model semantic embedding and learner-course fusion data into the input template of the large language model. By applying additive biases to the query, key, and value states of the learner and course embeddings in the attention mechanism, semantic linkage between the recommendation results and the explanation generation process is achieved. The model can thus generate logically consistent personalized explanation texts with clear evidence chains, ensuring that the recommendation reasons align with learner interests and course attributes. This system and method improve the interpretability of recommendation results, providing a solution for transparent course recommendations in smart education scenarios.
[0064] Please see Figure 1The interactive data processing module 1 acquires the original educational domain dataset containing learner and course information, filters interaction records such as comments (filtering user / course validity and empty short text), applies graph kernel decomposition for quality constraints, and constructs a mapping relationship between learner IDs and course IDs, outputting standardized learner-course interaction data. Based on this, it extracts basic course information (including course name, domain, prerequisites, and course description), and combines it with learner historical feedback to construct a course prompt word template. This template is input into a large language model to generate a course profile summary conforming to JSON format and not exceeding 150 characters. Further, based on learners' historical course comments and the aforementioned course profile summary, a learner prompt word template is constructed and input into the large language model to generate a learner profile summary conforming to JSON format and not exceeding 150 characters. Finally, combining the generated course profile and learner profile, and optionally fusing explanatory data for specific courses, it outputs learner-course fused data. The learner-course fused data includes user ID, course ID, course title, learner profile summary, course profile summary, and explanatory text. The explanatory text here is a "reference explanation" generated by the large language model based on interactive feedback. It is used for subsequent model training supervision and offline evaluation comparison, and is not directly used as the content to be displayed.
[0065] Please see Figure 1 , Figure 2 The interaction pattern capture module 2 uses the LightGCN graph model to capture the implicit interaction patterns between learners and courses, generating initial graph convolutional embeddings for learners and courses. The LightGCN graph model includes: an interaction graph construction layer 201, which transforms learner-course interaction data into a bipartite graph structure and constructs a symmetric normalized adjacency matrix; an embedding initialization layer 202, which uses the Xavier initialization method to generate a default 64-dimensional initial representation vector for each learner and course node, constructing learner embedding matrices and course embedding matrices respectively; a graph convolutional message passing layer 203, which aggregates neighbor node information layer by layer using sparse matrix multiplication at a propagation depth of L=4 layers, so that each node sequentially obtains interaction information from order 0 to order 4; and an embedding aggregation layer 204, which performs an equal-weighted summation of the initial embeddings and the embeddings obtained from each layer's propagation to form the final representation, and uses Bayesian Personalized Ranking (BPR) loss combined with L2 regularization for model optimization. After passing through the above four layers, the initial graph convolutional embeddings for learner and course nodes are finally obtained.
[0066] Please see Figure 1 , Figure 3The contrastive learning enhancement module 3 employs a contrastive learning mechanism based on the InfoNCE loss function, constructing positive and negative sample pairs to improve the discriminativeness and robustness of the embedding representation. This mechanism comprises three layers: an interaction mapping construction layer 301, used to establish a bidirectional interaction dictionary (learner-to-course, course-to-learner) on the learner-course bipartite graph; a contrastive sample construction layer 302, which, based on the aforementioned bidirectional interaction dictionary, selects "other learners who have selected the same target course" as positive samples for each anchor learner on the user side, and randomly samples non-anchor learners as negative samples; on the course side, with the anchor course as the center, it selects "other courses selected by the learner corresponding to this anchor course" as positive samples, and randomly samples courses as negative samples; and an embedding representation optimization layer 303, which performs L2 normalization on all sample embeddings, uses cosine similarity as a metric and employs a temperature parameter for scaling, and introduces mild dropout during the training phase to enhance generalization; the contrastive learning loss is calculated separately on the user side and the course side, and is jointly optimized with the Bayesian personalized ranking loss of the embedding aggregation layer 204 using weights to form the overall objective. After being processed sequentially by the contrastive learning enhancement module, the final output is a contrastive enhanced embedding representation of the learner and the course, providing a more discriminative and high-quality input for subsequent semantic adaptation and interpretation generation.
[0067] Please see Figure 1 , Figure 4 The large language model semantic adapter module 4 adopts a multi-stage interactive embedding transformation network architecture. Through a multi-head cross-attention mechanism and a hybrid expert weighting strategy based on noise gating and temperature scaling, it transforms the low-dimensional learner and course contrast enhancement embedding into a high-dimensional cross-model semantic adaptation embedding aligned with the semantic space of the large language model. The embedding transformation network includes: (1) a multi-head cross-attention layer 401: employing multiple attention heads and introducing position enhancement parameters and residual normalization mechanisms to capture the semantic interaction between learners and course embeddings; (2) a hybrid expert mapping layer 402: containing multiple linear whitening projection experts (PWLayer) to map low-dimensional input embeddings to a high-dimensional semantic space; (3) a smart gating layer 403: based on learnable temperature scaling and noise gating mechanisms, performing softmax weighted fusion on the outputs of each expert, and introducing load balancing loss to promote the uniform use of experts; (4) a hierarchical feature fusion layer 404: using one-dimensional convolutions with kernel sizes of 1, 3, and 5 to extract multi-scale features, and using a sigmoid gating mechanism to perform residual fusion on the original embeddings and expert fusion results, thereby generating the final 4096-dimensional cross-model semantic adaptation embedding. The cross-model semantic adaptation embedding will be injected into subsequent modules through special placeholders to provide support for semantic space alignment with subsequent modules and the generation of personalized recommendation results.
[0068] Please see Figure 1 , Figure 5The personalized explanation generation module 5 is based on the large language model 502, and combines high-dimensional cross-model semantic adaptation embedding of learners and courses with learner-course fusion data to finally generate personalized recommendation explanation text for each user-course pair. The personalized explanation generation module 5 includes: an input text construction layer 501, which includes the following processing steps: Step (1) Input text template construction: combining the fusion data with two registered special tags<USER_EMBED> ,<ITEM_EMBED> Combined into a structured template (e.g., "user record:")<USER_EMBED> course record:<ITEM_EMBED> The course name is set to {title}, the user profile to {user_summary}, and the course profile to {item_summary}. Here, "user record" represents the set of learner behavior and profile fields after fusion processing, and "course record" represents the set of structured content and metadata fields for the course.<USER_EMBED> and<ITEM_EMBED> These are special placeholders registered by the tokenizer, corresponding to the cross-model semantic adaptation embeddings of learners and courses, respectively, and will be directly filled by high-dimensional embeddings in subsequent steps; {title} is the course name string; {user_summary} is a summary text of the learner profile; {item_summary} is a summary text of the course profile. Step (2) Token segmentation and token sequence encoding: The input text is converted into a token sequence by the tokenizer, and the initial embedding matrix is obtained through the model embedding layer. Step (3) Template special markers for embedding filling: precise positioning<USER_EMBED> and<ITEM_EMBED> At each position in the sequence, the cross-model semantic adaptation embedding adapted by the large language model semantic adapter module 4 directly replaces the corresponding input embedding. The embeddings and positions of both are then further fed into the model, enabling the self-attention layer to perform additive injection of the Q / K / V states at the corresponding positions. Here, Q / K / V states are the query, key, and value vectors that the self-attention layer uses for attention calculation at each time step. Additive injection refers to directly adding the external learner / course embedding to the hidden states of Q, K, and V at the corresponding time step to influence attention weight calculation and context aggregation, thereby strengthening personalized information expression. Large Language Model Inference and Text Generation 502: After fusing the above explicitly injected representations and contextual information, the model generates personalized recommendation explanation text.
[0069] Referring to the accompanying drawings, the method of using this invention is as follows: The first stage, data preprocessing and initialization: (1) Obtaining the original dataset containing learner information and course information:
[0070] in, Indicates the learner ID; Indicates the course ID; This refers to learners' comments on the course. For interaction timestamps; Mark the legality of the interaction; This represents the number of different learners in the original dataset; This represents the number of distinct courses in the original dataset. To ensure data quality, a filtering constraint based on k-core decomposition is used for the user-course bipartite graph.
[0071] Processing is performed on the edge set.
[0072] This indicates the existence of learner-course pairs with non-empty interactions; This represents the set of learner nodes in a bipartite graph. The set of course nodes in a bipartite graph. Retain the core subgraph that satisfies the following formula:
[0073] in, Represents a node In the figure The degree; The threshold for k-core decomposition is a positive integer used to specify the minimum number of elements to retain. A node connected to a peer node; , This represents the set of learners and courses that satisfy the k-core constraint.
[0074] The core interaction set after obtaining the k-core constraints:
[0075] Next, construct the index mapping function between learners and courses:
[0076] in, , For normalized integer indexes; This represents a learner ID mapping function that maps the original learner identifier to... Mapped to normalized consecutive integer indices This facilitates subsequent matrix processing, where ; This indicates a course ID mapping function that maps the original course identifier to... Mapped to normalized consecutive integer indices ,in .
[0077] Based on this mapping, a standardized interaction matrix is generated:
[0078] Based on this, extract the basic information for each course:
[0079] in, Indicates course A structured set of basic information. Course name, For the field to which the course belongs, For prerequisite requirements, This is the course description text, combined with a collection of historical learner feedback for the course.
[0080] Build course prompt templates And input the large language model used to generate course profile summaries. To obtain a course profile:
[0081] Furthermore, for each learner, based on their historical learning record:
[0082] Build learner prompt templates Input a large language model used to generate learner profiles The learner profile is obtained as follows:
[0083] Ultimately, the generated learner profiles and course profiles are merged to form learner-course integrated data:
[0084] in, This serves as a reference explanatory text for real learner-course interaction pairs, used for subsequent model training supervision and offline evaluation comparisons, and is not directly used as display content. The learner-course fusion data is output as a JSON file for subsequent generation of personalized recommendation results.
[0085] The second stage, graph neural network feature learning: Standardized learner-course interaction data is input into interaction pattern capture module 2 for deep feature learning. Interaction pattern capture module 2 uses a lightweight graph convolutional network (LightGCN) to capture the implicit interaction patterns between learners and courses, thereby generating initial graph convolutional embeddings of learner and course nodes. This module contains four layers, with the following structure: (1) Interaction graph construction layer 201: Construct a bipartite graph structure based on learner-course interaction data. Let the learner set be:
[0086] The set of interaction relationships is:
[0087] Therefore, an adjacency matrix can be constructed:
[0088] in, Let T represent the learner-course interaction matrix, where T is the transpose. To avoid the influence of degree differences, ... Perform symmetric normalization:
[0089] in, Let be a degree matrix, and the elements within the degree matrix are... Indicates the first The connectivity of each node (i.e., the learner).
[0090] (2) Embedded initialization layer 202 assigns a learnable low-dimensional representation vector to each node and initializes it using Xavier, as shown in the formula:
[0091] in Indicates the embedding dimension. and These represent the initial embedding matrices for the course and the learner, respectively.
[0092] (3) Graph convolutional message passing layer 203, LightGCN only retains the linear aggregation of neighbor features, without weight matrix and activation function. Node representation propagates in layer l as follows:
[0093] in For the number of propagation layers, For the normalized adjacency matrix, Indicates the first The node representation matrix of the layer.
[0094] (4) Embedding aggregation layer 204, the initial embedding and the embeddings obtained from each layer are aggregated with equal weight to form the final node representation:
[0095] Among them, matrix The former The final representation of the learner node corresponding to each row. ,back The final representation of the corresponding course node. In the actual implementation, the aggregation operation is achieved by summing the embeddings of each layer and scaling them proportionally according to the number of layers.
[0096] (5) Optimize the target layer (BPR loss). During the training phase, LightGCN uses Bayesian Personalized Ranking (BPR) loss to maximize the difference in learners' preference scores for positive sample courses:
[0097] in, , , These represent the embedding vectors of the learner, the positive sample course, and the negative sample course, respectively. This represents a sampled triple. For learners, This is a positive sample course that the learner has already interacted with. For negative sample courses; This represents a batch of samples, where each element is a triplet. , This indicates the number of triples in this batch; Let be the sigmoid function. Combined with L2 regularization, the complete optimization objective is:
[0098] in, is the regularization coefficient used to prevent overfitting. Through this stage of graph neural network feature learning, the system can effectively capture the potential interaction structure features between learners and courses, obtaining the initial graph convolution embedding, laying the foundation for subsequent work.
[0099] The third stage, contrastive learning feature enhancement: The graph convolutional initial embedding is input into contrastive learning enhancement module 3. Module 3 employs an InfoNCE-based contrastive learning mechanism, constructing positive and negative sample pairs to improve the quality of the learner and course embedding representations. The loss function of this mechanism is defined as follows: For any anchor point sample Its positive samples are The negative sample set is Let the embedding vector corresponding to the sample be... After L2 normalization, we get:
[0100] in, Represents the embedding vector The L2 norm. Similarity is defined in the form of cosine similarity:
[0101] in, and Let represent the normalized embedding vectors of the two samples, respectively. Based on this, the temperature parameter is defined as... To adjust the smoothness of the similarity distribution between samples, the contrastive learning loss function is defined as:
[0102] in, Indicates anchor point sample Contrast learning loss centered on the center This represents the cosine similarity between the anchor sample and its positive samples. Indicates the anchor point sample and the first r Cosine similarity between negative samples This represents the summation operation over all negative samples. In this embodiment, the contrastive loss for both the learner side and the course side is calculated according to this definition. In specific implementations, either single-negative-sample or multi-negative-sample construction methods can be used. If the single-negative-sample form is used, the summation term in the denominator degenerates into a single-term calculation, while the formula still maintains the same structure.
[0103] The contrastive learning mechanism comprises the following three sub-layers: (1) Interaction mapping construction layer 301: used to construct a bidirectional interaction dictionary between learners and courses and between courses and learners, so as to represent the selection relationship between learners and courses; (2) Contrast sample construction layer 302: Based on the interaction mapping, positive sample learners with similar course selection behavior and randomly sampled negative sample learners are selected for each learner; at the same time, positive sample courses and randomly sampled negative sample courses are selected for each course. (3) Embedding representation optimization layer 303: L2 normalizes all sample embedding vectors and applies a temperature scaling mechanism to calculate the similarity distribution, calculating the learner-level and course-level InfoNCE contrastive loss respectively. Specifically: The learner-level InfoNCE loss is derived from the self-supervised modeling assumption that "learners who choose the same or similar courses should have similar embedded representations." For each anchor learner... Its positive samples are other learners who have jointly selected its positive sample courses. Negative samples are a set of learners randomly sampled. The embedding vector, after L2 normalization, is calculated using the formula above:
[0104] The course-level InfoNCE loss is derived from the self-supervised modeling assumption that "courses jointly chosen by similar learners should have similar embedded representations." For each anchor course... Its positive sample is another course selected by the same learner. Negative samples are randomly sampled sets of courses. The calculation method is the same as above, yielding:
[0105] Ultimately, the contrastive loss between the learner side and the course side is weighted. Compared with Bayesian personalized ranking loss Joint optimization leads to an overall optimization objective:
[0106] in, This represents the final joint optimization objective function. This represents the Bayesian personalized ranking loss. This represents the weighting coefficients of the contrastive learning loss. This represents the learner-side InfoNCE contrastive loss. This represents the InfoNCE contrastive loss on the course side. Through the above three layers of sequential processing, we finally obtain learner and course embedding representations enhanced by contrastive learning, thereby significantly improving the discriminative and personalized performance of the representations in subsequent recommendation or matching tasks.
[0107] The fourth stage, semantic adaptation of the large language model: The contrast-enhanced embeddings of learners and courses are fed into the semantic adapter module 4 of the large language model for high-dimensional semantic transformation. First, the multi-head cross-attention layer 401 uses four attention heads to deeply model the interaction relationship between learners and course features. Its attention calculation formula is as follows:
[0108] in, , , These represent the query, key, and value matrices, respectively. Indicates the dimension of the key vector; This is a normalization function used to calculate the attention distribution; key For attention head index.
[0109] Then, the hybrid expert mapping layer 402 inputs the cross-attention-enhanced learner and the course embedding into eight linear whitening projection experts (PWLayer). The feature transformation is performed, and the calculation formula for each expert is as follows:
[0110] in, Embedded for input; For the first The first-level weight matrix of each expert is used to weight the input. Linear transformation to hidden dimensions; For the first The first-level bias vector of each expert; For whitening normalization function; For the first The second layer of weights for each expert is used to map the intermediate results after nonlinear transformation back to the output space; For the first The second-level bias vector of each expert; For the first The output vector of each expert is used as input to subsequent layers or is fused together with the outputs of other experts.
[0111] Next, the intelligent gating layer 403 dynamically calculates the fusion weights of each expert based on noise gating and temperature scaling mechanisms, using the following formula:
[0112] in, For the gated weight matrix, For the input feature vector, For random noise, The temperature parameter is used to adjust the smoothness of the weight distribution. This is based on the calculated weight vector. Output to various experts We perform weighted fusion to obtain a comprehensive semantic representation:
[0113] Meanwhile, in order to balance the load of each expert, load balancing loss is introduced:
[0114] Where MSE is the mean squared error function, and expert_load is the average load ratio of each expert.
[0115] Finally, the hierarchical feature fusion layer 404 uses one-dimensional convolutions with kernel sizes of 1, 3, and 5 to extract multi-scale features, and performs residual fusion with the original embedding through a gating mechanism:
[0116] in, This is the gating coefficient vector; Indicates to Multi-scale features were extracted using one-dimensional convolutions with kernel sizes of 1, 3, and 5, and the results were then fused. Embedded for input; This indicates element-wise multiplication. The output is... This is a high-dimensional cross-model semantic adaptation embedding.
[0117] The fifth stage involves generating personalized recommendation explanation text: Based on the large language model, and combining the high-dimensional cross-model semantic adaptation embedding of learners and courses output by the semantic adapter module 4 with learner-course fusion data, personalized recommendation explanation text is finally generated for each user-course pair. This stage corresponds to the personalized explanation generation module 5, which includes the input text construction layer 501 and the large language model 502.
[0118] The input text construction layer 501 contains three units: (1) Input text template construction: combining the merged data with three registered special tags<USER_EMBED> ,<ITEM_EMBED> ,<EXPLAIN_POS> Combined into a structured template, for example: "user record:<USER_EMBED> course record:<ITEM_EMBED> course name: {title} user profile: {user_summary}course profile: {item_summary}<EXPLAIN_POS> "In this context, "user record" represents the set of learner behavior and profile fields after fusion processing, and "course record" represents the set of structured content and metadata fields for the course;<USER_EMBED> and<ITEM_EMBED> These are special placeholders that have been registered, corresponding to cross-model semantic adaptation embeddings for learners and courses, respectively;<EXPLAIN_POS> To explain the starting position marker, the model is instructed to generate personalized explanatory text after this point. `{title}` is the course name string; `{user_summary}` and `{item_summary}` are summary text summaries of the learner profile and course profile, respectively. (2) Tokenizer encoding and embedding initialization: The above input template is converted into a token sequence using a tokenizer. ,in, For length is The input sequence, For the first s Each text token is discretized. It is then mapped to the initial input embedding matrix via the model's embedding layer.
[0119] in, This represents the word embedding mapping function of the model, used to map each token to a dimensional ( ) word. Continuous vector representation; The initial embedding matrix consists of all token embeddings. For sequence length, Embed dimensions into the model.
[0120] (3) Embedded filling of template placeholders: Let , Let represent the cross-model semantic adaptation embeddings of the learner and the course, respectively, output by the semantic adapter module 4; , for<USER_EMBED> and<ITEM_EMBED> If the position index is in the sequence, then the embedding at the corresponding position will be replaced with:
[0121] in, Depend on Obtained by copying, but in a specific location (<USER_EMBED> and<ITEM_EMBED> Semantic embedding replacement was performed at () location; Representation matrix In location index (Right now<USER_EMBED> The vector at the location of the token is replaced with ; Representation matrix In location index (Right now<ITEM_EMBED> The vector at the position of the token is replaced with .
[0122] Subsequently, additive injection is performed on the query, key, and value states at each time step in the self-attention layer:
[0123] This enhances the flow of personalized information and contextual interaction within the multi-head attention mechanism. Based on this injection mechanism, the calculation formula for the self-attention layer can be expressed as:
[0124] in, , , This is the query, key, and value matrix after injection. The dimension of the key vector.
[0125] Embedded sequence after injection processing As input to the large language model 502, in<EXPLAIN_POS> After tagging, autoregressive generation is initiated, outputting personalized recommendation explanation text:
[0126] in, express<EXPLAIN_POS> Location index, For generating large language models for personalized interpretation, This generates a sequence of explanatory text. Ultimately, the large language model, by integrating personalized embeddings and contextual semantics, achieves highly relevant and interpretable recommendation text generation for each learner-course pair, forming a complete personalized explanatory output.
[0127] The above-described embodiments are merely one implementation of the present invention, and while the descriptions are specific and detailed, they should not be construed as limiting the scope of the invention. It should be noted that those skilled in the art can make various modifications and improvements without departing from the concept of the present invention, and these all fall within the protection scope of the present invention. Therefore, the protection scope of this invention should be determined by the appended claims.
Claims
1. An interpretable course recommendation system integrating multi-level semantic enhancement, characterized in that, It includes an interactive data processing module, an interactive pattern capture module, a contrastive learning enhancement module, a large language model semantic adapter module, and a personalized interpretation generation module. These modules sequentially complete a hierarchical modeling process of data standardization, graph feature learning, contrastive enhancement, semantic adaptation, and interpretation generation, thereby achieving end-to-end optimization from structured interaction to natural language interpretation. The interactive data processing module is responsible for transforming raw educational data into learner-course interaction data and structured learner-course integrated data. Based on data cleaning and standardization, this interactive data processing module introduces a prompt word generation mechanism based on a large language model to generate course profiles and learner profile summaries, and encodes them together with the interaction records to provide semantic input features for subsequent graph model learning. The interaction pattern capture module uses the Lightweight Graph Convolutional Network (LightGCN) to model the implicit relationship between learners and courses. Through multi-layer propagation and aggregation operations, the module can capture multi-order neighborhood dependencies and generate graph convolutional initial embeddings containing potential behavioral patterns. The contrastive learning enhancement module introduces a dual-channel contrastive target on the basis of graph structure, constructs positive and negative sample pairs on the user side and the course side respectively, and obtains contrastive enhancement embedding with higher semantic discriminativeness and generalization ability by jointly optimizing contrastive loss and ranking loss. The contrast-enhanced embeddings are then fed into the semantic adapter module of the large language model to achieve mapping and alignment across the semantic space. This module employs a multi-head cross-attention mechanism and a hybrid expert network structure. It introduces temperature scaling and noise perturbation into the gating mechanism and uses multi-scale convolutional fusion layers to capture hierarchical features, thereby generating cross-model semantic adaptation embeddings that are compatible with the semantic space of large language models. Finally, the personalized explanation generation module injects the adapted cross-model semantic adaptation embedding and learner-course fusion data into the input template of the large language model. By applying additive bias to the query, key, and value states of the learner and course embeddings in the attention mechanism, the semantic linkage between the recommendation results and the explanation generation process is achieved.
2. The interpretable course recommendation system with multi-level semantic enhancement as described in claim 1, characterized in that, The interactive data processing module is specifically as follows: This process involves acquiring a raw education-related dataset containing learner and course information, filtering interaction records, applying graph kernel decomposition for quality constraints, constructing a mapping relationship between learner IDs and course IDs, and outputting standardized learner-course interaction data. Basic course information is extracted, and combined with learner historical feedback, a course prompt word template is constructed. This template is then input into a large language model to generate a course profile summary. Based on learners' historical course comments and the aforementioned course profile summary, a learner prompt word template is constructed and input into the large language model to generate a learner profile summary. Finally, combining the generated course profile and learner profile, learner-course fusion data is output. The learner-course integrated data includes user ID, course ID, course title, learner profile summary, course profile summary, and explanatory text.
3. The interpretable course recommendation system with multi-level semantic enhancement as described in claim 1, characterized in that, The interaction mode capture module is specifically as follows: The LightGCN graph model is used to capture the implicit interaction patterns between learners and courses, generating initial graph convolutional embeddings for learners and courses. The LightGCN graph model includes: an interaction graph construction layer, which transforms learner-course interaction data into a bipartite graph structure and constructs a symmetric normalized adjacency matrix; an embedding initialization layer, which uses the Xavier initialization method to generate a default 64-dimensional initial representation vector for each learner and course node, constructing learner embedding matrices and course embedding matrices respectively; a graph convolutional message passing layer, which aggregates neighbor node information layer by layer using sparse matrix multiplication at a propagation depth of L=4 layers, allowing each node to sequentially obtain interaction information from order 0 to order 4; and an embedding aggregation layer, which performs an equal-weighted summation of the initial embeddings and the embeddings obtained from each propagation layer to form the final representation, and uses Bayesian personalized ranking (BPR) loss combined with L2 regularization for model optimization; after passing through the above four layers, the initial graph convolutional embeddings for learner and course nodes are finally obtained.
4. The interpretable course recommendation system with multi-level semantic enhancement as described in claim 1, characterized in that, The contrastive learning enhancement module is as follows: A contrastive learning mechanism based on the InfoNCE loss function is adopted to improve the discriminativeness and robustness of the embedding representation by constructing positive and negative sample pairs. This mechanism consists of three layers: an interaction mapping construction layer, which is used to build a bidirectional interaction dictionary on the learner-course bipartite graph; a contrastive sample construction layer, which selects "other learners who have selected the same target course" as positive samples for each anchor learner on the user side based on the bidirectional interaction dictionary, and uses randomly sampled non-anchor learners as negative samples; on the course side, with the anchor course as the center, "other courses selected by the learner corresponding to the anchor course" are selected as positive samples, and randomly sampled courses are used as negative samples; and an embedding representation optimization layer, which performs L2 normalization on all sample embeddings, uses cosine similarity as a metric and adopts a temperature parameter for scaling, and introduces mild dropout during the training phase to enhance generalization. The contrastive learning loss is calculated separately for the user side and the course side, and then jointly optimized with the Bayesian personalized ranking loss of the embedded aggregation layer to form an overall objective. After being processed sequentially by the contrastive learning enhancement module, the final output is a contrastive enhanced embedded representation of the learner and the course, providing a more discriminative input for subsequent semantic adaptation and interpretation generation.
5. The interpretable course recommendation system with multi-level semantic enhancement as described in claim 1, characterized in that, The specific details of the large language model semantic adapter module are as follows: We employ a multi-stage interactive embedding transformation network architecture, using a multi-head cross-attention mechanism and a hybrid expert weighting strategy based on noise gating and temperature scaling to transform low-dimensional learner-course contrastive enhancement embeddings into high-dimensional cross-model semantically adapted embeddings aligned with the semantic space of a large language model. The embedding transformation network includes: a multi-head cross-attention layer: employing multiple attention heads and introducing position enhancement parameters and residual normalization mechanisms to capture the semantic interaction between learners and course embeddings; a hybrid expert mapping layer: containing multiple linear whitening projection experts (PWLayer) to map low-dimensional input embeddings to a high-dimensional semantic space; and an intelligent gating layer: based on learnable temperature scaling and noise gating mechanisms, performing softmax weighted fusion on the outputs of each expert and introducing load balancing loss to promote the even use of experts. Layered feature fusion layer: One-dimensional convolution with kernel sizes of 1, 3, and 5 is used to extract multi-scale features, and the original embedding and expert fusion results are fused using a sigmoid gating mechanism to generate the final 4096-dimensional cross-model semantic adaptation embedding. The cross-model semantic adaptation embedding will be injected into subsequent modules through special placeholders to support semantic space alignment with subsequent modules and the generation of personalized recommendation results.
6. The interpretable course recommendation system with multi-level semantic enhancement as described in claim 1, characterized in that, The personalized explanation generation module is as follows: Based on a large language model, combined with high-dimensional cross-model semantic adaptation embedding of learners and courses and learner-course fusion data, a personalized recommendation explanation text for each user-course pair is finally generated; the personalized explanation generation module includes: an input text construction layer, which includes the following processing steps: Step (1) Input text template construction: combining the fusion data with two registered special tags<USER_EMBED> ,<ITEM_EMBED> Combined into a structured template,<USER_EMBED> and<ITEM_EMBED> These are special placeholders registered by the tokenizer, corresponding to the cross-model semantic adaptation embeddings of learners and courses, and will be directly filled by high-dimensional embeddings in subsequent steps; Step (2) Token segmentation and token sequence encoding: The input text is converted into a token sequence by the tokenizer, and the initial embedding matrix is obtained through the model embedding layer; Step (3) Template special markers for embedding filling: Precise positioning<USER_EMBED> and<ITEM_EMBED> At each position in the sequence, the cross-model semantic adaptation embedding, adapted by the large language model semantic adapter module, directly replaces the corresponding input embedding. The embeddings and positions of both are then passed into the model, enabling the self-attention layer to perform additive injection on the Q / K / V states at the corresponding positions. Here, Q / K / V states are the query, key, and value vectors that the self-attention layer uses for attention calculation at each time step. Additive injection refers to directly adding the external learner / course embedding to the hidden states of Q, K, and V at the corresponding time step to influence attention weight calculation and context aggregation, thereby strengthening personalized information expression. Large language model inference and text generation: After fusing the above explicitly injected representations and contextual information, the model generates personalized recommendation explanation text.
7. The interpretable course recommendation system with multi-level semantic enhancement as described in claim 6, characterized in that, The structured template is: "user record:<USER_EMBED> course record:<ITEM_EMBED> The code snippet shows a course profile with the following structure: `course name:{title} user profile: {user_summary} course profile: {item_summary}`. Here, "user record" represents the fused set of learner behavior and profile fields, and "course record" represents the set of structured course content and metadata fields. `{title}` is the course name string; `{user_summary}` is a summary textual description of the learner profile; and `{item_summary}` is a summary textual description of the course profile.
8. A method for interpretable course recommendation that integrates multi-level semantic enhancement, characterized in that, include: Phase 1, Data Preprocessing and Initialization: Obtaining the raw dataset containing learner and course information: in, Indicates the learner ID; Indicates the course ID; This refers to learners' comments on the course. For interaction timestamps; Mark the legality of the interaction; This represents the number of different learners in the original dataset; This represents the number of distinct courses in the original dataset. To ensure data quality, a filtering constraint based on graph kernel decomposition is used for the user-course bipartite graph. Processing is performed, where the edge set is: This indicates the existence of learner-course pairs with non-empty interactions; This represents the set of learner nodes in a bipartite graph. The set of course nodes in a bipartite graph; retain the core subgraph that satisfies the following formula: in, Represents a node In the figure The degree of; The threshold for k-core decomposition is a positive integer used to specify the minimum number of elements to retain. A node connected to a peer node; , This represents the set of learners and courses that satisfy the k-core constraint; The core interaction set after obtaining the k-core constraints: Next, construct the index mapping function between learners and courses: in, , For normalized integer indexes; This represents a learner ID mapping function that maps the original learner identifier to... Mapped to normalized consecutive integer indices This facilitates subsequent matrix processing, where ; This indicates a course ID mapping function that maps the original course identifier to... Mapped to normalized consecutive integer indices ,in ; Based on this mapping, a standardized interaction matrix is generated: Based on this, extract the basic information for each course: in, Indicates course A structured set of basic information. Course name, For the field to which the course belongs, For prerequisite requirements, The course description text; combined with a collection of historical learner feedback for the course: Build course prompt templates And input the large language model used to generate course profile summaries. The course profile summary is as follows: For each learner, based on their historical learning record: Build learner prompt templates Input a large language model used to generate learner profiles The learner profile is obtained as follows: Ultimately, the merged learner profile Combined with course profiles, learner-course integrated data is formed: in This serves as a reference explanatory text for real learner-course interaction pairs, used for subsequent model training supervision and offline evaluation comparison, and is not directly used as display content; the learner-course fusion data is output as a JSON file for subsequent personalized recommendation result interpretation generation. The second stage, graph neural network feature learning: Standardized learner-course interaction data is input into the interaction pattern capture module for deep feature learning. The interaction pattern capture module uses a lightweight graph convolutional network, LightGCN, to capture the implicit interaction patterns between learners and courses, thereby generating initial graph convolutional embeddings of learner and course nodes. This module contains four layers, with the following structure: The interaction graph construction layer builds a bipartite graph structure based on learner-course interaction data, assuming the learner set is: The set of interaction relationships is: Therefore, an adjacency matrix can be constructed: in, This represents the learner-course interaction matrix, where T is the transpose; to avoid the influence of degree differences, [the following is omitted]. Perform symmetric normalization: in, Let be a degree matrix, and the elements within the degree matrix are... Indicates the first Each node represents the learner's connectivity. An embedding initialization layer is used to assign a learnable low-dimensional representation vector to each node, and Xavier initialization is employed, as shown in the formula: in Indicates the embedding dimension. and These represent the initial embedding matrices for the learner and the course, respectively. In the graph convolutional message-passing layer, LightGCN only retains a linear aggregation of neighbor features, without weight matrices and activation functions; the node representation propagates in the l-th layer as follows: in For the number of propagation layers, For the normalized adjacency matrix, Indicates the first The node representation matrix of the layer; The embedding aggregation layer performs equal-weighted aggregation of the initial embeddings and the embeddings obtained from propagation through each layer to form the final node representation: Among them, matrix The former The final representation of the learner node corresponding to each row. ,back The final representation of the corresponding course node. ; To optimize the target layer BPR loss, LightGCN employs a Bayesian personalized ranking loss during training to maximize the difference in learners' preference scores for positive sample courses. in, , , These represent the embedding vectors of the learner, the positive sample course, and the negative sample course, respectively. This represents a sampled triple. For learners, This is a positive sample course that the learner has already interacted with. For negative sample courses; This represents a batch of sample sets, where each element is a triplet. , This indicates the number of triples in this batch; The sigmoid function; combined with L2 regularization, the complete optimization objective is: in, The regularization coefficient is used to prevent overfitting. Through the graph neural network feature learning process in this stage, the system can effectively capture the potential interaction structure features between learners and courses, obtain the initial graph convolution embedding, and lay the foundation for subsequent work. The third stage is contrastive learning feature enhancement: the graph convolution is initially embedded into the contrastive learning enhancement module; the contrastive learning enhancement module adopts an InfoNCE-based contrastive learning mechanism, which improves the quality of the learner and course embedded representations by constructing positive and negative sample pairs; the loss function of this mechanism is defined as follows: For any anchor point sample Its positive samples are The negative sample set is Let the embedding vector corresponding to the sample be... After L2 normalization, we get: in, Represents the embedding vector The L2 norm; similarity is defined in the form of cosine similarity: in, and Let represent the normalized embedding vectors of the two samples respectively; based on this, the temperature parameter is defined as... To adjust the smoothness of the similarity distribution between samples, the contrastive learning loss function is defined as: in, Indicates anchor point sample Contrast learning loss centered on the center This represents the cosine similarity between the anchor sample and its positive samples. Indicates the anchor point sample and the first r Cosine similarity between negative samples This represents the summation operation over all negative samples; the contrastive loss on the learner side and the course side are calculated according to this definition. The contrastive learning mechanism comprises the following three sub-layers: Interaction Mapping Construction Layer: Used to construct a bidirectional interaction dictionary between learners and courses, and between courses and learners, to represent the selection relationship between learners and courses; Contrast sample construction layer: Based on interaction mapping, positive sample learners with similar course selection behavior and randomly sampled negative sample learners are selected for each learner; at the same time, positive sample courses and randomly sampled negative sample courses are selected for each course that are commonly selected by similar learners. Embedding representation optimization layer: L2 normalization is performed on all sample embedding vectors, and a temperature scaling mechanism is applied to calculate the similarity distribution. The InfoNCE contrastive loss at the learner level and course level is calculated separately; details are as follows: The learner-level InfoNCE loss is derived from the self-supervised modeling assumption that "learners who choose the same or similar courses should have similar embedded representations"; for each anchor learner Its positive samples are other learners who have jointly selected its positive sample courses. Negative samples are a set of learners randomly sampled. The embedding vector, after L2 normalization, is calculated using the formula above: The course-level InfoNCE loss is derived from the self-supervised modeling assumption that "courses jointly chosen by similar learners should have similar embedded representations"; for each anchor course Its positive sample is another course selected by the same learner. Negative samples are randomly sampled sets of courses. The calculation method is the same as above, yielding: Ultimately, the contrastive loss between the learner side and the course side is weighted. Compared with Bayesian personalized ranking loss Joint optimization leads to an overall optimization objective: in, This represents the final joint optimization objective function. This represents the Bayesian personalized ranking loss. This represents the weighting coefficients of the contrastive learning loss. This represents the learner-side InfoNCE contrastive loss. The InfoNCE contrastive loss represents the course side; through the above three layers of sequential processing, the learner and course embedding representations enhanced by contrastive learning are finally obtained, thereby significantly improving the discriminative and personalized performance of the representation in subsequent recommendation or matching tasks; The fourth stage, semantic adaptation of the large language model: The contrast-enhanced embeddings of learners and courses are fed into the semantic adapter module of the large language model for high-dimensional semantic transformation. First, the multi-head cross-attention layer uses four attention heads to deeply model the interaction relationship between learners and course features. The attention calculation formula is as follows: in, , , These represent the query, key, and value matrices, respectively. Indicates the dimension of the key vector; This is a normalization function used to calculate the attention distribution; key For attention head index; Then, the hybrid expert mapping layer inputs the cross-attention-enhanced learner and course embeddings into eight linear whitening projection experts respectively. The feature transformation is performed, and the calculation formula for each expert is as follows: in, Embedded for input; For the first The first-level weight matrix of each expert is used to weight the input. Linear transformation to hidden dimensions; For the first The first-level bias vector of each expert; For whitening normalization function; For the first The second layer of weights for each expert is used to map the intermediate results after nonlinear transformation back to the output space; For the first The second-level bias vector of each expert; For the first The output vector of each expert can be used as input to subsequent layers or fused together with the outputs of other experts. Next, the intelligent gating layer dynamically calculates the fusion weights of each expert based on noise gating and temperature scaling mechanisms, using the following formula: in, For the gated weight matrix, For the input feature vector, For random noise, The temperature parameter is used to adjust the smoothness of the weight distribution; based on the calculated weight vector... Output to various experts We perform weighted fusion to obtain a comprehensive semantic representation: Meanwhile, in order to balance the load of each expert, load balancing loss is introduced: Where MSE is the mean squared error function, and expert_load is the average load ratio of each expert; Finally, the hierarchical feature fusion layer uses one-dimensional convolutions with kernel sizes of 1, 3, and 5 to extract multi-scale features, and performs residual fusion with the original embedding through a gating mechanism: in, This is the gating coefficient vector; Indicates to Multi-scale features were extracted using one-dimensional convolutions with kernel sizes of 1, 3, and 5, and the results were then fused. Embedded for input; This represents element-wise multiplication; the output is... This is a high-dimensional cross-model semantic adaptation embedding; The fifth stage is the generation of personalized recommendation result explanation text: Based on the large language model, combined with the cross-model semantic adaptation embedding of high-dimensional learners and courses output by the semantic adapter module and learner-course fusion data, personalized recommendation explanation text for each user-course pair is finally generated; this stage corresponds to the personalized explanation generation module, including the input text construction layer and the large language model. The input text construction layer contains three units: Input text template construction: combining data with three registered special tags<USER_EMBED> ,<ITEM_EMBED> ,<EXPLAIN_POS> Combined into a structured template,<USER_EMBED> and<ITEM_EMBED> These are special placeholders that have been registered, corresponding to cross-model semantic adaptation embeddings for learners and courses, respectively;<EXPLAIN_POS> To explain the starting position marker, the model is instructed to generate personalized explanatory text after this point; Tokenizer encoding and embedding initialization: The above input template is converted into a token sequence using a tokenizer. ,in, For length is The input sequence, For the first s A discrete text token; subsequently, it is mapped to the initial input embedding matrix through the model embedding layer: in, This represents the word embedding mapping function of the model, used to map each token to a dimensional ( ) word. Continuous vector representation; The initial embedding matrix consists of all token embeddings. For sequence length, Embed dimensions into the model; Embedded padding of template placeholders: Let , Let them represent the cross-model semantic adaptation embeddings of the learner and the course output by the semantic adapter module, respectively; let... , for<USER_EMBED> and<ITEM_EMBED> If the position index is in the sequence, then the embedding at the corresponding position will be replaced with: in, Depend on It was copied, but semantic embedding replacement was performed; Representation matrix In location index The vector at that position is replaced with ; Representation matrix In location index The vector at that position is replaced with ; Subsequently, additive injection is performed on the query, key, and value states at each time step in the self-attention layer: This enhances the flow of personalized information and contextual interaction within the multi-head attention mechanism; based on this injection mechanism, the calculation formula for the self-attention layer can be expressed as: in, , , This is the query, key, and value matrix after injection. The dimension of the key vector; Embedded sequence after injection processing As input to a large language model,<EXPLAIN_POS> After tagging, autoregressive generation is initiated, outputting personalized recommendation explanation text: in, express<EXPLAIN_POS> Location index, For generating large language models for personalized interpretation, The generated explanatory text sequence is then used; finally, the large language model, by integrating personalized embeddings and contextual semantics, achieves highly relevant and interpretable recommendation text generation for each learner-course pair, forming a complete personalized explanatory output.
9. The interpretable course recommendation method with multi-level semantic enhancement as described in claim 8, characterized in that, In the embedded aggregation layer, the aggregation operation is achieved by summing the embeddings of each layer and scaling them proportionally according to the number of layers.
10. The interpretable course recommendation method with multi-level semantic enhancement according to claim 8, characterized in that, In contrastive learning feature enhancement, either single negative sample or multiple negative sample construction methods are used. If the single negative sample form is used, the summation term in the denominator degenerates into a single-term calculation, while the formula still maintains the same structure.