Course recommendation method based on sorting perception local contrast learning

CN122045504APending Publication Date: 2026-05-15XI'AN PETROLEUM UNIVERSITY
View PDF 0 Cites 0 Cited by

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
XI'AN PETROLEUM UNIVERSITY
Filing Date
2026-01-16
Publication Date
2026-05-15

AI Technical Summary

Technical Problem

Existing contrastive learning methods fail to explicitly consider the recommendation ranking results in recommendation scenarios, resulting in insufficient correlation between the ranking results and the ranking target, which affects the accuracy and stability of course recommendations.

Method used

A ranking-aware local contrastive learning mechanism is introduced. By constructing a local contrastive sample set, positive and negative contrastive samples are selected based on the ranking results under the current model training state. The contrastive learning is limited to the local candidate course range and jointly optimized with the ranking loss function to enhance the correlation between user representation and high-ranking courses.

Benefits of technology

It improves the accuracy and stability of course recommendation ranking, reduces training complexity, and enhances the training efficiency and stability of the model, especially showing stronger ranking and discrimination capabilities in scenarios where user interests are implicit or interaction data is sparse.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN122045504A_ABST
    Figure CN122045504A_ABST
Patent Text Reader

Abstract

The invention discloses a course recommendation method based on sorting perception local contrast learning, and belongs to the technical field of recommendation systems and online education. The method comprises the following steps: acquiring historical interaction data of a user and a course and constructing initial vectorization representation; performing feature modeling on the user and the course through a sorting model, and outputting a predicted sorting score; dynamically constructing a local comparison learning sample set of sorting perception based on the current sorting result, namely selecting a course with a high prediction score from the user positive feedback courses as a positive comparison sample, and selecting a local course from the user non-interaction courses as a negative comparison sample; constructing local contrast regular loss of sorting perception to enhance the correlation between user representation and high-sorting courses; and performing joint optimization on the comparison regular loss and the sorting loss, training to obtain a course recommendation model, and finally generating a personalized course recommendation sorting result. According to the invention, through a local contrast learning mechanism of sorting perception, sorting accuracy and model stability of course recommendation are effectively improved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention relates to the field of computer technology, and more particularly to the field of recommendation systems and online education technology, specifically to a course recommendation method based on ranking-aware local contrastive learning. Background Technology

[0002] With the rapid development of online education platforms and the increasing number of course resources, how to provide personalized course recommendations based on users' interests and learning needs has become one of the urgent problems that online education platforms need to solve.

[0003] Most existing course recommendation methods are based on the historical interaction behavior between users and courses, generating recommendation results by constructing user interest models and course feature models. Among them, deep learning-based recommendation methods are widely used in course recommendation scenarios due to their strong feature representation capabilities. In recent years, some studies have introduced ranking models based on attention mechanisms or Transformer structures to improve the accuracy of recommendation ranking by modeling the complex relationship between users and courses.

[0004] On the other hand, contrastive learning, as an effective representation learning method, has gradually been introduced into recommender systems to enhance the stability and robustness of user and course representations. However, existing contrastive learning methods in recommender scenarios typically do not explicitly consider the recommendation ranking result itself. The construction of their contrast samples often relies on random strategies or global sample sets, making it difficult to effectively coordinate with the ranking objective and potentially interfering with the learning process of the ranking model.

[0005] Therefore, how to introduce a contrastive learning mechanism that can perceive the ranking results and remain consistent with the ranking goal on the basis of the existing ranking model, so as to improve the course recommendation performance without changing the original ranking model structure, remains a problem to be solved in the current technology. Summary of the Invention

[0006] To address the problem of insufficient correlation between existing contrastive learning methods and course recommendation ranking objectives, this invention proposes a course recommendation method based on ranking-aware local contrastive learning, comprising the following steps:

[0007] 1) Data acquisition and preprocessing steps: Acquire historical interaction data between users and courses in the online education platform. The historical interaction data includes at least user identifiers, course identifiers, and user interaction behavior information on courses. Preprocess the historical interaction data to construct a user-course interaction sample set, wherein the interaction behavior is at least one of the user's browsing, learning, collecting, rating, or selecting of courses.

[0008] 2) Initial representation construction step: Based on the user-course interaction sample set, an initial vectorized representation is constructed for each user and each course, and the initial vectorized representation is used to represent user interest features and course content features;

[0009] 3) Ranking Representation Learning Step: Input the initial vectorized representation of the user and the initial vectorized representation of the course into the ranking model, perform feature modeling on the user and course through the ranking model, and output the updated user representation vector and course representation vector; wherein, the ranking model is used to explicitly characterize the ranking relationship between the user and the course, and calculate the predicted ranking score of the user for the course based on the user representation vector and the course representation vector.

[0010] 4) Ranking-Aware Contrast Sample Construction Step: During model training, based on the predicted ranking score, a ranking-aware local contrast learning sample set is constructed for each user. The construction process includes:

[0011] a) Select courses with higher predicted ranking scores from the user's positive feedback courses as positive comparison samples;

[0012] b) Select several courses from those courses where the user did not interact as negative comparison samples;

[0013] The selection of positive and negative comparison samples is based on the ranking results under the current model training state.

[0014] 5) Calculation steps for ranking-aware local contrast regularization: Based on the positive and negative contrast samples, a ranking-aware local contrast regularization constraint is constructed. By contrast learning the loss function, the similarity between the user representation vector and the course representation vector corresponding to the positive contrast sample is increased, and the similarity between the user representation vector and the course representation vector corresponding to the negative contrast sample is decreased, thereby enhancing the correlation between the user representation and the high-ranking courses.

[0015] 6) Joint optimization step: The ranking-aware local contrastive regularization loss is jointly optimized with the ranking loss function used to characterize the user's preference for course ranking. The model parameters are updated through backpropagation to obtain the trained course recommendation model.

[0016] 7) Course recommendation generation steps: Using the trained course recommendation model, calculate the user's ranking score for candidate courses based on the user representation vector and the course representation vector, and generate personalized course recommendation ranking results for the user based on the ranking score.

[0017] In step 4), the selection method for the positive contrast samples in the ranking-aware contrast sample construction step is specifically as follows: based on user u's historical positive feedback course set under the current model training state. The predicted ranking scores are used for sorting, where the predicted ranking scores are calculated by the ranking model and are expressed as follows:

[0018] s(u, i) = f(e) u e i (1)

[0019] Where eu represents the representation vector of user u, ei represents the representation vector of course i, and f(·) is the scoring function of the ranking model; the historical positive feedback courses are ranked from high to low according to the predicted ranking scores s(u, i), and the courses with the highest scores in the ranking results are selected to form a positive comparison sample set:

[0020]

[0021] Where K is a preset positive integer used to control the number of positive comparison samples.

[0022] In step 4), in the ranking-aware contrast sample construction step, the selection process of the positive contrast samples is not based on a random strategy, but is dynamically determined by the predicted ranking results output by the ranking model in the current training round or the current iteration stage. The selection of the positive contrast samples changes with the update of the model parameters so that the contrast learning process is consistent with the learning process of the ranking model, thereby guiding the model to focus on strengthening the representation learning of highly relevant courses in the user ranking results.

[0023] In step 4), the negative contrast samples are selected in the sorting-aware contrast sample construction step as follows:

[0024] For each user, several courses are selected from the set of courses for which the user has no historical interaction behavior as negative contrast samples. These negative contrast samples are used to characterize courses that are not highly relevant to the user's interests or are not relevant at all. The selection of these negative contrast samples is limited to a local candidate course range, which includes the course set in the current training batch and / or the pre-selected candidate course set, to form a ranking-aware local contrast learning constraint.

[0025] In step 5), the ranking-aware local contrastive learning constraint is achieved by limiting the scope of the contrastive learning samples. Specifically, during the contrastive learning process, the similarity relationship between the user representation vector and the course representation vectors corresponding to the positive and negative contrastive samples is calculated only within the local candidate course range, without applying contrastive constraints to courses in the entire course set simultaneously. The local candidate course range is limited according to the current training batch, the size of the candidate course set, or a preset threshold, so that the contrastive learning focuses on courses related to the current ranking task, thereby reducing global interference unrelated to the ranking objective.

[0026] Furthermore, this invention limits the contrastive learning constraint to a local range of candidate courses relevant to the current ranking task, rather than imposing the constraint on the entire course set. This local contrastive learning strategy effectively reduces noise interference from irrelevant courses, allowing the model to focus more on distinguishing courses that the user might be interested in within the current recommendation context.

[0027] In course recommendation tasks, the number of candidate courses is usually large. If a global contrastive learning strategy is adopted, it is easy to introduce a large number of negative samples that are irrelevant to the ranking task, affecting the stability of model training. This invention uses a local contrastive learning mechanism to effectively reduce training complexity and improve the training efficiency and stability of the model while ensuring ranking discrimination ability.

[0028] In step 6), the ranking-aware local contrastive regularization loss is calculated by modeling the relative similarity between the user representation vector and the positive and negative contrastive sample course representation vectors. Specifically, it includes: constructing a contrastive learning loss function based on the similarity between the user representation vector and the positive and negative contrastive sample course representation vectors, to encourage the user representation vector to move closer to the positive contrastive sample course representation vector and further away from the negative contrastive sample course representation vector in the representation space; wherein, the ranking-aware local contrastive regularization loss is introduced as a regularization term into the model training process to constrain the learning direction of the user representation vector and the course representation vector, so that they are consistent with the highly relevant courses output by the ranking model.

[0029] During model training, the ranking loss function, which characterizes users' preferences for course ranking, is jointly optimized with the ranking-aware local contrast regularization loss. Specifically, in each training iteration, the ranking loss function is calculated based on the predicted ranking score output by the ranking model, and the ranking-aware local contrast regularization loss is calculated based on the constructed positive and negative contrast samples. The two are then combined according to preset weights to form the total loss function, which is used to update the model parameters through backpropagation. The ranking loss function ensures the accuracy of the course recommendation results, while the ranking-aware local contrast regularization loss constrains the representation space distribution of the user representation vector and the course representation vector to enhance the model's ability to distinguish highly ranked courses.

[0030] In step 3), the ranking model is a neural network model based on the attention mechanism, which is used to model the relationship between the user representation vector and the course representation vector. The ranking model uses the attention mechanism to weight the correlation between the user and multiple candidate courses to learn the relative preference order of the user for different courses and output a predicted score for ranking.

[0031] The course recommendation method described above is applied to online education platforms. By analyzing users' historical learning behavior and course interaction data, it generates personalized course recommendation ranking results for users to assist them in making course selections and learning decisions.

[0032] This invention effectively enhances the consistency between user representations, course representations, and the ranking target by introducing a ranking-aware local contrastive learning mechanism during the ranking model training process. Compared with existing technologies, this invention can improve the accuracy and stability of course recommendation ranking without increasing the complexity of model inference.

[0033] Experimental results show that the present invention can achieve better recommendation results in course recommendation and ranking tasks, especially in scenarios where user interests are implicit or interaction data is sparse, demonstrating stronger ranking discrimination ability and generalization performance.

[0034] Compared with the prior art, the present invention has the following beneficial effects:

[0035] The method of this invention effectively improves the accuracy and stability of course recommendation ranking, while also having good model versatility and engineering applicability. Attached Figure Description

[0036] Figure 1 This is a schematic diagram illustrating the specific steps of an embodiment of a course recommendation method based on ranking-aware local contrastive learning according to the present invention.

[0037] Figure 2 This is a schematic diagram of the module connections in an embodiment of a course recommendation method based on ranking-aware local contrastive learning according to the present invention. Detailed Implementation

[0038] The following detailed description of a course recommendation method based on ranking-aware local contrastive learning, as described in this invention, is provided with reference to specific embodiments. It should be understood that the following embodiments are for illustrative purposes only and are not intended to limit the scope of protection of this invention.

[0039] like Figure 1 As shown, the course recommendation method proposed in this invention mainly includes the following steps:

[0040] 1) Obtain user's historical learning behavior data and course feature data;

[0041] 2) Construct a ranking model based on the attention mechanism to model the correlation between users and candidate courses;

[0042] 3) During model training, a ranking-aware local contrastive regularization mechanism is introduced to perform contrastive learning constraints on the local course sets in the ranking results.

[0043] 4) Train the model parameters by jointly optimizing the ranking loss function and the ranking-aware local contrast regularization term;

[0044] 5) Use the trained model to score and rank the candidate courses, and output the final personalized course recommendation results.

[0045] In this embodiment, the user's historical learning behavior includes, but is not limited to, the following information:

[0046] The user has already selected the course sequence;

[0047] User ratings, reviews, or clicks on courses;

[0048] Implicit feedback information such as the user's learning time and completion progress.

[0049] Course features include course category, course content tags, difficulty level, and course text or multimodal features.

[0050] By using an embedding layer, user behavior sequences and course features are mapped into low-dimensional dense vectors, resulting in user representation vector u and course representation vector v, respectively. i .

[0051] In this embodiment, the ranking model adopts a recommendation model based on the ranking objective, which is used to model the relative preference relationship between users and multiple candidate courses.

[0052] The model jointly models the user representation and the candidate course set through a multi-head self-attention mechanism, learning the relationships between different courses and the importance of courses relative to user interests, and outputting a predicted score s for each candidate course. i .

[0053] In this way, the model can learn users' ranking preferences for courses from the overall candidate set level, rather than just making independent binary classification predictions.

[0054] During model training, based on the predicted ranking score, a ranking-aware local contrastive learning sample set is constructed for each user. The construction process includes:

[0055] a) Select courses with higher predicted ranking scores from the user's positive feedback courses as positive comparison samples;

[0056] b) Select several courses from those courses where the user did not interact as negative comparison samples;

[0057] The selection of positive and negative comparison samples is based on the ranking results under the current model training state.

[0058] Based on the positive and negative contrast samples, a ranking-aware local contrast regularization constraint is constructed. Through the contrast learning loss function, the similarity between the user representation vector and the course representation vector corresponding to the positive contrast sample is increased, and the similarity between the user representation vector and the course representation vector corresponding to the negative contrast sample is decreased, thereby enhancing the correlation between the user representation and the high-ranked courses.

[0059] The ranking-aware local contrastive regularization loss is jointly optimized with the ranking loss function used to characterize users' preferences for course ranking. The model parameters are then updated through backpropagation to obtain the trained course recommendation model.

[0060] Using the trained course recommendation model, the user's ranking score for candidate courses is calculated based on the user representation vector and the course representation vector, and a personalized course recommendation ranking result is generated for the user based on the ranking score.

[0061] The advantages of the course recommendation method provided by this invention are illustrated below through specific comparative experiments.

[0062] The experiment was conducted using the MOOCCube dataset from the public education platform. Instances of the dataset are shown in Table 1. It contains 706 courses, 38,181 instructional videos, 106,056 knowledge concepts, and course selection and video viewing records of 199,199 users. After numerically encoding the dataset, stratified sampling was performed by user ID to ensure no overlap between users in the training, validation, and test sets. The training, validation, and test sets were divided in a 7:2:1 ratio. Evaluation metrics included Recall@20 and NDCG@20.

[0063] To verify the effectiveness of the method proposed in this invention, the following comparative model is set up:

[0064] 1) A ranking recommendation model based on ranking objectives is adopted, which is trained using only the ranking loss function and does not introduce a contrastive learning module.

[0065] 2) Based on 1), a standard global contrastive learning mechanism is introduced to constrain the discriminativeness between user representation and course representation through random positive and negative sample construction.

[0066] 3) Only introduce a ranking-aware local contrastive learning regularization term to construct local contrastive samples based on the Top-K ranking results;

[0067] 4) During the training of the ranking model, a global contrastive learning loss and a ranking-aware local contrastive learning regularization term are introduced to jointly optimize the user representation and the course representation.

[0068] Table 1 Examples of MoocCube datasets

[0069]

[0070] The experimental results are shown in Table 2. The results show that, when using only the ranking model, the ranking recommendation model based on the ranking objective can learn the user's preference order for courses well. However, when the user's interest boundaries are vague or the candidate courses are highly similar, the recommendation results still have some instability.

[0071] When only the standard contrastive learning mechanism is introduced, the model improves in terms of representation discriminability, but its improvement on the final ranking performance is limited because the construction of contrastive samples does not fully consider the ranking position information.

[0072] In contrast, by introducing only ranking-aware local contrastive learning, the model achieved improvements in both Recall@20 and NDCG@20 metrics, indicating that constructing local contrastive samples based on ranking results can effectively enhance the model's ability to model the differences between adjacent candidate courses.

[0073] Furthermore, when both global contrastive learning and ranking-aware local contrastive learning regularization terms are introduced simultaneously, the model achieves optimal performance on both evaluation metrics. Experimental results show that this joint optimization strategy can significantly improve the recommendation ranking quality by further refining the differences in user preferences for local ranking candidate courses while ensuring the overall distinguishability of user and course representations.

[0074] Table 2 Comparison and Analysis of Experimental Results

[0075]

[0076] The comparative experiments above demonstrate that the course recommendation method proposed in this invention has significant advantages in the following aspects:

[0077] 1) By introducing a ranking-aware local contrastive learning mechanism, the model can explicitly focus on the relative differences between courses in the Top-K ranking results during training, which can effectively improve the accuracy of recommendation ranking.

[0078] 2) By combining global contrastive learning with sorting-aware local contrastive regularization, the ability to discriminate local sorting is further enhanced while ensuring the overall structural stability of the representation space;

[0079] 3) This method does not require the introduction of additional manual annotation information and can be directly trained on existing user interaction data, making it highly feasible for engineering implementation.

[0080] like Figure 2 As shown, the present invention also provides a course recommendation system based on ranking-aware local contrastive learning, which is used to implement personalized course recommendations for users in online education platforms.

[0081] The data acquisition module collects user behavior data on the online education platform, including but not limited to: user course selection behavior data, user course video viewing data, and time-series information during the user's learning process. The data acquisition module transmits the collected raw behavior data to the feature encoding module, providing foundational data support for subsequent model training and inference.

[0082] The feature encoding module preprocesses and numerically encodes the raw behavioral data obtained by the data acquisition module. Its specific functions include: mapping user IDs and course IDs to low-dimensional dense vectors; constructing a user learning behavior sequence in chronological order; and embedding course attribute features. Through the feature encoding module, a unified-dimensional user embedding representation and course embedding representation are formed.

[0083] The ranking modeling module is used to model the preference relationship between users and candidate courses. Internally, it adopts a ranking modeling structure based on an attention mechanism. This module takes user embeddings and candidate course embeddings as inputs, learns the relative preference order between users and multiple candidate courses through multiple layers of ranking modeling units, and outputs a predicted ranking score for each candidate course.

[0084] The ranking-aware local contrastive learning module, connected to the ranking modeling module, is used to construct local contrastive learning constraints based on the current ranking results. Specifically, this module selects top-ranked courses from the candidate courses as a positive sample set based on the ranking scores output by the ranking modeling module. Simultaneously, it constructs a negative sample set from the ranking results, selecting courses adjacent to or with low relevance to the positive samples. This allows for contrastive learning constraints between the user representation and the course representation within the local ranking space. Through this module, the model pays closer attention to the fine-grained differences among the top-ranked courses.

[0085] The Global Contrastive Learning module enhances the model's representation discrimination capability from the perspective of the global representation space. This module constructs user representations under different learning perspectives or different interaction subsequences, and compares and learns different representations of the same user or the same course, making semantically consistent representations closer in the vector space and different semantic representations more distinct.

[0086] The joint optimization and model training module is used to uniformly train and optimize the ranking modeling module, the ranking-aware local contrastive learning module, and the global contrastive learning module. This module weights and sums the ranking loss, the ranking-aware local contrastive learning loss, and the global contrastive learning loss to form a joint optimization objective function, and updates the model parameters through the backpropagation algorithm.

[0087] The recommendation result output module is used to rank candidate courses based on the predicted ranking score output by the ranking modeling module after the model training is completed or during the model inference stage, and output the top-ranked courses in the ranking results as the final recommendation results to the user.

[0088] In actual operation, the data acquisition module collects and structures learners' course selection behavior, course viewing behavior, and time-series interaction data on the online education platform, constructing a basic behavioral feature structure reflecting the evolution of learners' interests. The feature encoding module maps learner behavioral features and course content features to a unified vector space, forming user and course representations. The ranking modeling module models the relative preference relationship between learners and candidate courses based on an attention mechanism, outputting ranking scores for candidate courses to characterize learners' potential preference order for different courses. Building on this, the ranking-aware local contrastive learning module dynamically constructs local positive and negative sample pairs based on the current ranking results, introducing contrast constraints within the top-ranked courses to enhance the model's ability to identify fine-grained differences between highly relevant courses. Simultaneously, the global contrastive learning module imposes consistency constraints on user and course representations from the perspective of the overall representation space, improving the stability and robustness of the representations. Finally, through the joint optimization module, the ranking loss, local contrast loss and global contrast loss are weighted and fused to achieve collaborative optimization of the course recommendation ranking model, thereby forming a closed loop for personalized course recommendation in online education scenarios and improving the accuracy and reliability of the recommendation results.

[0089] In summary, the course recommendation method based on ranking-aware local contrastive learning proposed in this invention can effectively improve recommendation performance in online education scenarios and has good practical application value.

[0090] The above description is only a preferred embodiment of the present invention and is not intended to limit the present invention. Any modifications, equivalent substitutions, improvements, etc., made within the spirit and principles of the present invention should be included within the scope of protection of the present invention.

Claims

1. Characterized by, The method includes the following steps: 1) Data acquisition and preprocessing steps: acquiring historical interaction data between users and courses in the online education platform, wherein the historical interaction data includes at least user identifiers, course identifiers, and user interaction behavior information with courses; The historical interaction data is preprocessed to construct a user-course interaction sample set, wherein the interaction behavior is at least one of the user's browsing, learning, collecting, rating or selecting courses; 2) Initial representation construction step: Based on the user-course interaction sample set, an initial vectorized representation is constructed for each user and each course, and the initial vectorized representation is used to represent user interest features and course content features; 3) Ranking Representation Learning Step: Input the initial vectorized representation of the user and the initial vectorized representation of the course into the ranking model, perform feature modeling on the user and course through the ranking model, and output the updated user representation vector and course representation vector; wherein, the ranking model is used to explicitly characterize the ranking relationship between the user and the course, and calculate the predicted ranking score of the user for the course based on the user representation vector and the course representation vector. 4) Ranking-Aware Contrast Sample Construction Step: During model training, based on the predicted ranking score, a ranking-aware local contrast learning sample set is constructed for each user. The construction process includes: a) Select courses with higher predicted ranking scores from the user's positive feedback courses as positive comparison samples; b) Select several courses from those courses where the user did not interact as negative comparison samples; The selection of positive and negative comparison samples is based on the ranking results under the current model training state. 5) Calculation steps for ranking-aware local contrast regularization: Based on the positive and negative contrast samples, a ranking-aware local contrast regularization constraint is constructed. By contrast learning the loss function, the similarity between the user representation vector and the course representation vector corresponding to the positive contrast sample is increased, and the similarity between the user representation vector and the course representation vector corresponding to the negative contrast sample is decreased, thereby enhancing the correlation between the user representation and the high-ranking courses. 6) Joint optimization step: The ranking-aware local contrastive regularization loss is jointly optimized with the ranking loss function used to characterize the user's preference for course ranking. The model parameters are updated through backpropagation to obtain the trained course recommendation model. 7) Course recommendation generation steps: Using the trained course recommendation model, calculate the user's ranking score for candidate courses based on the user representation vector and the course representation vector, and generate personalized course recommendation ranking results for the user based on the ranking score.

2. The course recommendation method according to claim 1, characterized in that, In the ranking-aware contrast sample construction step, the selection method of the positive contrast samples is specifically as follows: based on user u's historical positive feedback course set under the current model training state. The predicted ranking scores are used for sorting, where the predicted ranking scores are calculated by the ranking model and are expressed as follows: s(u,i)=f(e u ,e i ) (1) Where eu represents the representation vector of user u, ei represents the representation vector of course i, and f(·) is the scoring function of the ranking model; the historical positive feedback courses are ranked from high to low according to the predicted ranking scores s(u, i), and the courses with the highest scores in the ranking results are selected to form a positive comparison sample set: Where K is a preset positive integer used to control the number of positive comparison samples.

3. The course recommendation method according to claim 1, characterized in that, In the ranking-aware contrast sample construction step, the selection process of the positive contrast samples is not based on a random strategy, but rather dynamically determined by the predicted ranking results output by the ranking model in the current training round or the current iteration stage. The selection of the positive contrast samples changes with the update of the model parameters to keep the contrast learning process consistent with the learning process of the ranking model, thereby guiding the model to focus on strengthening the representation learning of highly relevant courses in the user ranking results.

4. The course recommendation method according to claim 1, characterized in that, In the ranking-aware contrast sample construction step, the negative contrast samples are selected as follows: for user u, several courses are selected from the set of courses for which the user has not generated historical interaction behavior as negative contrast samples. The negative contrast samples are used to characterize courses that are low or unrelated to the user's interests. The selection of negative contrast samples is limited to the range of local candidate courses. The range of local candidate courses includes the set of courses in the current training batch and / or the set of candidate courses obtained through pre-screening, so as to constitute the local contrast learning constraint of ranking awareness.

5. The course recommendation method according to claim 1, characterized in that, The ranking-aware local contrastive learning constraint is achieved by limiting the scope of the contrastive learning samples. Specifically, during the contrastive learning process, the similarity relationship between the user representation vector and the course representation vectors corresponding to the positive and negative contrastive samples is calculated only within the local candidate course range, without applying contrastive constraints to courses in the entire course set simultaneously. The local candidate course range is limited based on the current training batch, the size of the candidate course set, or a preset threshold, so that the contrastive learning focuses on courses related to the current ranking task, thereby reducing global interference unrelated to the ranking objective.

6. The course recommendation method according to claim 1, characterized in that, The ranking-aware local contrastive regularization loss is calculated by modeling the relative similarity between the user representation vector and the positive and negative contrastive sample course representation vectors. Specifically, it includes constructing a contrastive learning loss function based on the similarity between the user representation vector and the positive and negative contrastive sample course representation vectors, to encourage the user representation vector to move closer to the positive contrastive sample course representation vector and further away from the negative contrastive sample course representation vector in the representation space. The ranking-aware local contrastive regularization loss is introduced as a regularization term into the model training process to constrain the learning direction of the user representation vector and course representation vector, ensuring they align with the highly relevant courses output by the ranking model.

7. The course recommendation method according to claim 1, characterized in that, During model training, the ranking loss function, which characterizes users' preferences for course ranking, is jointly optimized with the ranking-aware local contrast regularization loss. Specifically, in each training iteration, the ranking loss function is calculated based on the predicted ranking score output by the ranking model, and the ranking-aware local contrast regularization loss is calculated based on the constructed positive and negative contrast samples. The two are then combined according to preset weights to form the total loss function, which is used to update the model parameters through backpropagation. The ranking loss function ensures the accuracy of the course recommendation results, while the ranking-aware local contrast regularization loss constrains the representation space distribution of the user representation vector and the course representation vector to enhance the model's ability to distinguish highly ranked courses.

8. The course recommendation method according to claim 1, characterized in that, The ranking model is a neural network model based on an attention mechanism, used to model the relationship between user representation vectors and course representation vectors. The ranking model uses an attention mechanism to weight the correlation between users and multiple candidate courses to learn the relative preference order of users for different courses and output a predicted score for ranking.

9. The course recommendation method according to claim 1, characterized in that, The course recommendation method described above is applied to online education platforms. By analyzing users' historical learning behavior and course interaction data, it generates personalized course recommendation ranking results for users to assist them in making course selections and learning decisions.