Course recommendation method, device and medium based on large language model and sequence modeling

By employing large language models and sequence modeling methods, a shared semantic space for users and courses is constructed, enabling dynamic course recommendations. This addresses the issues of static user modeling and inaccurate recommendation results in online education platforms, achieving personalized and interpretable course recommendations.

CN121167038BActive Publication Date: 2026-03-31北京中科闻歌科技股份有限公司
View PDF 2 Cites 0 Cited by

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2025-09-12
Publication Date
2026-03-31

AI Technical Summary

Technical Problem

Existing online education platforms' course recommendation systems cannot dynamically reflect changes in users' knowledge acquisition and learning goals, resulting in a lack of accuracy and interpretability in the recommendation results, as well as a lack of measurement of the adaptability to learning progress and the rationality of knowledge progression.

Method used

By employing a method based on large language models and sequence modeling, multi-dimensional user features are constructed by integrating users' completed course records, generated text information, and attribute information. User representation vectors are generated and matched with course semantic representation vectors in a shared semantic space to dynamically recommend courses.

Benefits of technology

It achieves personalized course recommendations, possesses strong semantic understanding, ability matching and model efficiency, and provides recommendation results that are highly interpretable, rich in representation capabilities and flexible in structure.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN121167038B_ABST
    Figure CN121167038B_ABST
Patent Text Reader

Abstract

The application discloses a course recommendation method based on a large language model and sequence modeling, and is applied to personalized learning path recommendation of an online education platform. When a user recommendation request is received, the method fuses user completed course records, generates text information and attribute information, constructs multi-dimensional user features, and generates a user representation vector. The similarity between the vector and a course semantic representation vector (generated based on course original content by a large language model analysis and belonging to the same shared semantic space as the user vector) in a course vector library is calculated. After filtering the completed courses, the top k unfinished courses are selected as the recommendation result according to the similarity, so that accurate personalized recommendation can be realized.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention relates to the field of computer technology applications, and in particular to a course recommendation method, device, and medium based on large language models and sequence modeling. Background Technology

[0002] With the rapid development of digital education platforms, personalized recommendation technology is increasingly widely used in online teaching scenarios, becoming an important means to improve learning efficiency, assist in teaching path planning, and optimize the distribution of learning resources. Against this backdrop, the Dual-Tower Recommendation Model (DSSM) has been widely adopted due to its clear structure and high inference efficiency. This model constructs separate user and course towers, uses embedding technology to encode user and course information into vectors, and completes recommendation ranking based on the similarity between vectors. Current mainstream methods typically use the aggregation of users' historical course ID sequences, tag preferences, or course embeddings to construct user vectors, while converting static information such as course titles, descriptions, tags, and content types into course vectors. Based on this, the system uses a point-to-point similarity training method to optimize the model by constructing positive and negative sample pairs, achieving certain results.

[0003] Despite this, existing recommender systems still have significant limitations in practical teaching applications. First, current user modeling typically constructs user vectors based on static interests or course click behavior, failing to dynamically reflect changes in knowledge acquisition and stage-specific learning goals. It ignores the dynamic growth of users during the learning process and cannot reflect their evolutionary path in knowledge acquisition. Second, courses have sequential learning relationships and knowledge dependency structures. Recommending based solely on interests or tag similarity struggles to reflect teaching objectives, knowledge structures, and semantic content, resulting in inaccurate and uninterpretable recommendations. In other words, recommended courses exceed the user's current knowledge level, failing to provide truly valuable learning path planning. Furthermore, the evaluation of recommendation results lacks a systematic measure of "adaptability to learning progress" or "reasonableness of knowledge progression," further hindering the practicality of recommender systems in education. Therefore, how to conduct user modeling based on users' actual learning trajectories has become a critical issue that current educational recommender systems urgently need to address. Summary of the Invention

[0004] To address the aforementioned technical problems, the technical solution adopted by this invention is as follows:

[0005] According to a first aspect of the present invention, a course recommendation method based on large language models and sequence modeling is provided. The method is applied to a personalized learning path recommendation scenario on an online education platform. Upon receiving a recommendation request from a user, the following steps are performed:

[0006] S100 integrates the user's completed course learning records, user-generated text information, and user attribute information to construct multi-dimensional user features and generate user representation vectors.

[0007] S200, calculate the similarity between the user representation vector and the semantic representation vectors of each course in the current course vector library to obtain n similarity values; wherein, the semantic representation vectors of courses in the current course vector library are generated based on the original teaching content of the course through deep semantic parsing of a large language model, and are in the same shared semantic space as the user representation vector.

[0008] S300: Based on the user's completed course learning records, identify and filter out all similarity values ​​corresponding to the user's completed courses from n similarity values, retaining the similarity values ​​of the remaining incomplete courses, denoted as h; sort the h similarity values ​​obtained after filtering in descending order. If h ≥ k, select the courses corresponding to the first k similarity values ​​after sorting as recommended courses; if h < k, select all h similarity values ​​corresponding to the courses as recommended courses, where k is the preset number of recommendations.

[0009] According to a second aspect of the present invention, an electronic device is provided, including a processor and a memory; the processor executes the steps of the method described in the first aspect of the present invention by invoking a program or instructions stored in the memory.

[0010] According to a third aspect of the present invention, a computer-readable storage medium is provided that stores a program or instructions that cause a computer to perform the steps of the method described in the first aspect of the present invention.

[0011] The present invention has at least the following beneficial effects:

[0012] This invention provides a course recommendation method based on large language models and sequence modeling. Taking the original course content as input, it utilizes a large language model to perform deep semantic parsing of the course, generating a knowledge semantic vector representation of the course. Simultaneously, the system constructs a user's knowledge acquisition trajectory based on their historical learning behavior and generates a dynamic representation of the user's ability state through sequence modeling and semantic feedback enhancement from the language model. Finally, based on the vector matching results in the shared representation space, a personalized recommended course list is generated. This invention balances semantic understanding, ability matching, and model efficiency, possessing strong interpretability, rich representation capabilities, and flexible structure.

[0013] It should be understood that the description in this section is not intended to identify key or essential features of the embodiments of the present invention, nor is it intended to limit the scope of the invention. Other features of the invention will become readily apparent from the following description. Attached Figure Description

[0014] To more clearly illustrate the technical solutions in the embodiments of the present invention, the accompanying drawings used in the description of the embodiments will be briefly introduced below. Obviously, the accompanying drawings described below are only some embodiments of the present invention. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort.

[0015] Figure 1 A flowchart illustrating the course recommendation method based on large language models and sequence modeling provided in this embodiment of the invention. Detailed Implementation

[0016] The technical solutions of the embodiments of the present invention will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of the present invention, and not all embodiments. Based on the embodiments of the present invention, all other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of the present invention.

[0017] Unless otherwise defined, all technical and scientific terms used herein have the same meaning as commonly understood by one of ordinary skill in the art to which this invention pertains. The terminology used herein in the description of this invention is for the purpose of describing particular embodiments only and is not intended to be limiting of the invention. The term "and / or" as used herein includes any and all combinations of one or more of the associated listed items.

[0018] It should be noted that some exemplary embodiments are described as processes or methods depicted as flowcharts. Although the flowcharts describe the steps as sequential processes, many of these steps can be performed in parallel, concurrently, or simultaneously. Furthermore, the order of the steps can be rearranged. A process can be terminated when its operation is complete, but it may also have additional steps not included in the figures. A process can correspond to a method, function, procedure, subroutine, subroutine, etc.

[0019] Current online education platforms primarily use tag-based matching or collaborative filtering for personalized course recommendations, which presents two main problems. Firstly, course content is typically coded using only pre-defined knowledge point tags or manual scoring, failing to reflect teaching objectives, knowledge structure, and semantic content, resulting in inaccurate and uninterpretable recommendation results. Secondly, user modeling is usually based on static interests or course click behavior to construct user vectors, unable to dynamically reflect changes in knowledge acquisition and stage-specific learning goals, thus hindering the rational planning of learning paths. These shortcomings significantly limit the depth, adaptability, and intelligence of traditional methods.

[0020] This invention aims to improve the semantic understanding and dynamic matching accuracy of personalized course recommendations in online education platforms. Addressing the problems of traditional recommendation methods relying on fixed sets of knowledge points and static, singular user representations, this invention proposes a course recommendation method that integrates large language models and sequence modeling. It automatically extracts structured knowledge from teaching texts, generates course semantic vectors, and dynamically constructs the user's ability status by combining the user's learning trajectory and language feedback information. Finally, it achieves semantic alignment between courses and users in a shared representation space, generating a personalized recommendation list with enhanced intelligence, adaptability, and interpretability.

[0021] Furthermore, this embodiment of the invention provides a course recommendation method based on large language models and sequence modeling, applied to personalized learning path recommendation scenarios in online education platforms. Upon receiving a recommendation request from a user, it executes the following... Figure 1 The following steps are shown:

[0022] S100 integrates the user's completed course learning records, user-generated text information, and user attribute information to construct multi-dimensional user features and generate user representation vectors.

[0023] In this embodiment of the invention, the user's completed course learning records include quantitative indicators such as learning duration, completion rate, and grades. User-generated text information includes, but is not limited to, course learning notes, post-class evaluations, questions, and descriptions of learning objectives, reflecting the user's learning needs and preferences. User attribute information may include school, major, education level, age, gender, professional title, job level, hobbies, and learning time period, reflecting the user's basic profile.

[0024] S200, calculate the similarity between the user representation vector and the semantic representation vectors of each course in the current course vector library, and obtain n similarity values.

[0025] In this embodiment of the invention, the similarity between the user representation vector generated by S100 and the semantic representation vector of each course in the current course vector library can be calculated based on the cosine similarity algorithm to obtain n similarity values, where n is the total number of courses in the course vector library.

[0026] S300: Based on the user's completed course learning records, identify and filter out all similarity values ​​corresponding to the user's completed courses from n similarity values, retaining the similarity values ​​of the remaining incomplete courses, denoted as h; sort the h similarity values ​​obtained after filtering in descending order. If h ≥ k, select the courses corresponding to the first k similarity values ​​after sorting as recommended courses; if h < k, select all h similarity values ​​corresponding to the courses as recommended courses, where k is the preset number of recommendations.

[0027] In this embodiment of the invention, k > 0, and can be dynamically adjusted according to the actual scenario, such as k = 20 or k = 30.

[0028] Furthermore, the semantic representation vector of each course in the current course vector library is obtained through the following steps:

[0029] S10: Retrieve the core teaching text information for each course from the course database, including course teaching objectives, a list of chapter titles, and a set of knowledge point phrases.

[0030] In this embodiment of the invention, the course teaching objectives are derived from the structured syllabus officially released by the course (submitted by the teacher and reviewed and confirmed by the platform). These are standardized texts that describe the overall teaching positioning and expected outcomes of the course, such as "mastering the principles and implementation of basic machine learning algorithms" and "possessing practical skills in using Python for data analysis".

[0031] The chapter titles are taken from the chapter hierarchy in the course syllabus, ordered according to the teaching progress, and include chapter titles and section titles (such as "Chapter 2 Supervised Learning → 2.1 Linear Regression → 2.1.1 Univariate Linear Regression"), reflecting the progressive logic and structural framework of the course knowledge.

[0032] The knowledge point phrase set is generated by parsing the course syllabus content (including chapter content descriptions, teaching focuses, and core concept explanations) using a large language model. The specific process is as follows:

[0033] Employing a large language model consistent with user text parsing (such as Qwen1.5-7B-Chat), the system uses a preset prompt to guide precise extraction: "Please extract all core knowledge points from the following course outline, with the following requirements: 1. Presented in the form of professional terminology phrases (1-5 characters per phrase); 2. Covering the key concepts, methods, and theories involved in the course; 3. Removing redundant expressions. Example: If the content is 'Explanation of the iterative principle and implementation steps of the gradient descent algorithm', 'gradient descent' should be extracted."

[0034] The model returns a set of structured phrases (such as “feature engineering”, “logistic regression”, and “model evaluation”), which are then deduplicated and filtered for relevance (retaining phrases with a match of ≥0.8 with the course objectives) to form the final set of knowledge point phrases.

[0035] S11 uses a unified coding strategy to vectorize the core teaching text information of the course, generating a structured embedded representation, including teaching objective embedded vectors, chapter title embedded sequences, and knowledge point phrase embedded sequences.

[0036] The teaching objective embedding vector is generated as follows: the course teaching objectives (single sentences or short texts) extracted from S10 are used as input and encoded using the Qwen Embedding model, which is consistent with the user text encoding; the [CLS] position vector output by the model (designed specifically for aggregating global semantics of single texts) is taken as the teaching objective embedding vector, with a dimension of 1024. This vector focuses on the high-level teaching positioning of the course (such as "cultivating data analysis skills") and captures the core teaching intent of the course.

[0037] The chapter title embedding sequence is generated as follows: The list of chapter titles extracted from S10 is sorted according to teaching level and progress (e.g., the natural order of "Chapter → Section → Subsection"). Each title text (e.g., "2.1 Linear Regression") is individually input into the Qwen Embedding model to generate a 1024-dimensional embedding vector for the corresponding title. All title vectors are arranged in their original order to form the chapter title embedding sequence (shape p×1024, where p is the total number of chapter titles). This sequence preserves the structural hierarchy and progressive logic of course knowledge, such as the organizational relationship of "basic concepts → advanced methods → practical applications".

[0038] The knowledge point phrase embedding sequence is generated in the following way:

[0039] The set of knowledge phrases generated by S10 is sorted according to knowledge relevance, such as following a logical chain of "basic concepts → core methods → application scenarios." Each phrase (e.g., "gradient descent") is individually input into the Qwen Embedding model to generate a 1024-dimensional embedding vector. All phrase vectors are arranged in sorted order to form a knowledge phrase embedding sequence (shape q×1024, where q is the total number of knowledge phrases). This sequence accurately covers the core knowledge units of the course, strengthening the semantic capture of course content details.

[0040] S12 concatenates the teaching objective embedding vector, chapter title embedding sequence, and knowledge point phrase embedding sequence into a unified input sequence, and inputs it into the Transformer encoding module for cross-structure semantic fusion to generate a fused representation sequence.

[0041] Specifically, the unified input sequence is constructed in the following way:

[0042] The three types of embedding representations generated by S11 are concatenated in the following manner to form a structured input sequence: (1) A special marker vector [CLS] (1024-dimensional, learnable parameter, used to aggregate the global semantics of the course) is added before the teaching objective embedding vector (1024-dimensional); a special marker vector [SEC] (1024-dimensional, learnable parameter, identifying the start of the chapter structure) is added before the chapter title embedding sequence; a special marker vector [KWD] (1024-dimensional, learnable parameter, identifying the start of the knowledge point set) is added before the knowledge point phrase embedding sequence; and concatenated in the order of "[CLS] + teaching objective embedding vector + [SEC] + chapter title embedding sequence + [KWD] + knowledge point phrase embedding sequence" to form a unified input sequence with a total length of (1+1+p+1+q=p+q+3) (each element has a dimension of 1024).

[0043] In this embodiment of the invention, the Transformer encoding module is a stacked structure containing two encoder layers, and adopts a sine and cosine position encoding mechanism to preserve sequence information; wherein, each encoder layer is composed of the following sub-layers connected in sequence: multi-head self-attention sub-layer, first residual connection and layer normalization layer, feedforward neural network sub-layer and second residual connection and layer normalization layer.

[0044] Specifically, the forward cosine positional encoding mechanism applies sine and cosine positional encoding to the concatenated unified input sequence to generate a 1024-dimensional position vector PE(pos) (pos is the position index of the element in the sequence), and adds it element by element to the embedding vector of the corresponding element in the sequence to preserve the temporal order and positional association of each structure (such as the order of chapters, the subordinate position of knowledge points and chapters).

[0045] The multi-head self-attention sublayer employs an 8-head scaled dot product attention mechanism, with each attention head having a dimension of 128 (1024 / 8). It captures cross-structural semantic dependencies by calculating the association weights between any two elements in the sequence (such as the matching degree between a teaching objective and a chapter, or the subordinate relationship between a knowledge point and a chapter). Specifically, this includes: generating query (Q), key (K), and value (V) matrices from the input features (1024 dimensions) through a linear transformation, where Q, K, and V are all 1024-dimensional; and splitting Q, K, and V by head, with each attention head corresponding to a 128-dimensional (1024 / 8) submatrix Q. r K r V r (r=1, 2, ..., 8); Each head calculates association weights through scaled dot product attention: Attention(Q r K r V r )=softmax[((Q r K r T) / (d k ) 1 / 2 ], where d k For single-head dimension, it can be 128, (d k ) 1 / 2 To avoid the softmax gradient disappearing due to excessively large inner product values, the weight matrix reflects the correlation strength between any two elements in the sequence (such as the matching degree between teaching objectives and a certain chapter, and the subordinate relationship between knowledge points and their respective chapters). The outputs of the 8 heads are concatenated and mapped back to 1024 dimensions through linear transformation to obtain multi-head fusion features, realizing the global capture of cross-structure semantic dependencies (such as the three-layer association of "teaching objectives-chapter-knowledge points").

[0046] The first residual connection and layer normalization layer are used to add the multi-head self-attention output to the sub-layer input (residual connection), and then stabilize the feature distribution through layer normalization LN(x+MultiHead(x)).

[0047] The feedforward neural network sublayer contains two linear transformations, with ReLU activation in between. The hidden layer dimension is 4096 (4×1024), and the formula is FFN(x)=W2•ReLU(W1•x+b1)+b2, which enhances the non-linear expression of features. ReLU() is the activation function.

[0048] The second residual connection and layer normalization layer are used to add the feedforward network output to the sub-layer input (residual connection), and then optimize the feature distribution through layer normalization LN(x+FFN(x)). Here, x is the input feature, W1 and W2 are the first and second learnable weight matrices, respectively, and b1 and b2 are the first and second learnable bias terms, respectively.

[0049] After processing by two layers of encoders, the output is a fused representation sequence with the same length as the input sequence (p+q+3), and each element has a dimension of 1024. This sequence has aggregated the cross-structural semantic relationships between teaching objectives, chapter structure, and knowledge points, such as the intrinsic relationship between the teaching objective 'mastering regression algorithm' and the chapter '2.1 linear regression' and the knowledge point 'gradient descent'.

[0050] S13, perform mean pooling on the fused representation sequence to obtain the overall semantic representation vector of the course;

[0051] S14: Input the overall semantic representation vector of the course into the second fully connected neural network, output the final semantic representation vector of the course, and store it in the course vector library.

[0052] In this embodiment of the invention, the second fully connected neural network has a three-layer progressive structure, specifically configured as follows: Input layer: receives a 1024-dimensional overall semantic representation vector of the course, with the same number of neurons as the input dimension (1024), responsible for receiving the course semantic features fused from upstream; Hidden layer: contains 512 neurons (half the input dimension), uses the ReLU activation function to introduce a non-linear transformation, and configures a BatchNorm layer to normalize the features (calculate the mean and variance along the feature dimension, and adjust the distribution through learnable parameters γ and β), stabilizing the feature distribution during training; Output layer: contains 64 neurons, has no activation function, maps the hidden layer features to a 64-dimensional space through a linear transformation, and outputs the final course semantic representation vector. This vector has the same dimension as the user representation vector output in S105, ensuring that the two are in the same shared semantic space, providing a dimension-matched vector basis for the similarity calculation in S200.

[0053] Furthermore, S100 specifically includes:

[0054] S101 arranges the user's completed course learning records in ascending order according to timestamps to form a time-series course sequence.

[0055] S102, the semantic representation vectors of knowledge point phrases corresponding to each course in the time-series course sequence are concatenated sequentially to obtain a sequence of semantic representation vectors of knowledge point phrases; the sequence of semantic representation vectors of knowledge point phrases is input into the user trajectory modeling network to output the user knowledge trajectory vector.

[0056] The semantic representation vector of the knowledge point phrase is obtained by fusing the knowledge point phrase embedding sequence. In one illustrative embodiment, the semantic representation vector of the knowledge point phrase is obtained by performing average pooling on the knowledge point phrase embedding sequence.

[0057] In this embodiment of the invention, the user trajectory modeling network is a single-layer gated recurrent unit (GRU) network, used to capture the temporal dependencies and knowledge progression patterns of the user's course learning sequence, and its specific configuration is as follows:

[0058] Input layer: Receives a sequence of course semantic representation vectors (of shape T×d, where T is the number of courses the user has completed and d is the dimension of a single course semantic representation vector), and inputs the sequence into the network in the order of learning timestamps;

[0059] Hidden layer: Contains 256 neurons (consistent with the final output dimension), uses the tanh activation function to handle hidden state updates, and dynamically filters redundant information (such as low-association courses learned in the early stages) and retains key knowledge trajectory features (such as associations with core courses learned recently) through the reset gate and update gate of GRU.

[0060] Output processing: The hidden state of the network at the final moment of the entire sequence is taken as the output to obtain a user knowledge trajectory vector with a dimension of 256, which is the user's mastery state vector of the knowledge space at the current moment; in order to enhance the generalization ability of the model, a dropout layer with a dropout rate of 0.2 is set between the hidden layer and the output.

[0061] S103, Input the user-generated text information into the large language model to obtain a natural language summary of the user-generated text information, and encode the generated natural language summary to obtain the corresponding semantic feedback vector.

[0062] In this embodiment of the invention, the large language model adopts the Qwen1.5-7B-Chat model. The model is guided to focus on the user's knowledge gaps and key concerns through a preset prompt. The prompt is in the form of: "Please summarize the knowledge points that the user has not yet mastered, the learning topics they are interested in, and their potential learning needs from the following user text, and output a concise natural language summary (no more than 200 words)."

[0063] After generating a structured natural language summary based on user text, the large language model uses the QwenEmbedding encoder, which is consistent with the semantic representation vector encoding logic of the course, to vectorize the summary and generate a semantic feedback vector with a dimension of 1024. This vector can accurately capture the user's subjective learning feedback (such as "fuzzy understanding of the backpropagation principle of neural networks"), personalized needs (such as "wanting to learn practical cases of Python visualization tools"), and implicit knowledge preferences, thereby making up for the limitations of modeling only through objective behavioral data.

[0064] S104, the user attribute information is encoded to obtain the attribute vector corresponding to each attribute, and all attribute vectors are fused to obtain the user interest vector.

[0065] In this embodiment of the invention, each attribute is implemented through a user ID embedding layer, transforming each attribute into a 64-dimensional attribute vector. Specifically, user attribute information includes categorical attributes (such as school, major, education level, hobbies, professional title, etc.) and numerical attributes (such as age, study period preference, etc.). Differentiated encoding methods are used for different types of attributes: for categorical attributes, encoding is performed through an independent embedding layer (using user attribute values ​​as input, not user IDs). Each categorical attribute is mapped to a 64-dimensional dense attribute vector (the dimension can be adjusted according to the scenario). For example, "major = computer science" is encoded as vector v. 专业 ∈R 64For numerical attributes, standardization is first performed (e.g., normalization to the [0,1] interval), and then transformed into a 64-dimensional attribute vector through a linear mapping layer to ensure consistency with the dimensionality of categorical attribute vectors. After encoding, m attribute vectors {v1, v2, ..., v...} are obtained. m}, where m is the total number of attributes. R is the real number space.

[0066] In one embodiment of the present invention, a user interest vector can be obtained by performing average pooling on all attribute vectors. This method assigns equal weights to each attribute through simple averaging, making it suitable for scenarios where the importance of attributes differs little, and is computationally efficient.

[0067] In another embodiment of the present invention, a user interest vector is obtained by dynamically weighting and fusing all attribute vectors through an attention mechanism, which enables key attributes to receive higher weights.

[0068] Among them, the user interest vector satisfies the following condition: U interest =∑ m i=1 (α) i •v i ), where U interest Let α be the user interest vector. i Let v be the attention weight for the i-th attribute, where i ranges from 1 to m, and m is the total number of attributes. i Let ∑ be the attribute vector of the i-th attribute. m i=1 α i =1, and α i =exp(s i ) / ∑ m j=1 exp(s j ), s i For the attention score of the i-th attribute, s j Let s be the attention score for the j-th attribute, where j ranges from 1 to m, and exp() is the natural exponential function; i =W a •(v i +q)+b a W a W is a learnable weight matrix. a ∈R 1×64 q is a learnable query vector, q∈R 64 b a For learnable bias terms, b a ∈R, • denotes the vector dot product operation. Attention score is used to measure the correlation between horizontal attributes and user interests.

[0069] S105, the knowledge trajectory vector, semantic feedback vector and user interest vector are concatenated into an initial fusion vector, and input into the first fully connected neural network to output the user representation vector.

[0070] Specifically, the knowledge trajectory vector (256-dimensional), output by S102, the semantic feedback vector (1024-dimensional), output by S103, and the user interest vector (64-dimensional), output by S104, are concatenated in sequence to form an initial fusion vector with dimensions of 256+1024+64=1344. This initial fusion vector is then input into the first fully connected neural network for cross-feature interaction modeling, outputting a 64-dimensional user representation vector to comprehensively represent the user's knowledge structure, learning needs, and interest preferences.

[0071] The first fully connected neural network has a four-layer progressive structure, with the following specific configuration:

[0072] Input layer: Receives an initial fusion vector of 1344 dimensions, with the number of neurons matching the input dimension (1344).

[0073] The first hidden layer contains 672 neurons (half the input dimension), uses the ReLU activation function, and is configured with a BatchNorm layer for feature normalization to suppress distribution shifts during training.

[0074] The second hidden layer contains 336 neurons (half the dimension of the first hidden layer), uses the ReLU activation function, and is a Dropout layer with a dropout rate of 0.3 to enhance the model's generalization ability and avoid overfitting.

[0075] Output layer: Contains 64 neurons, no activation function, outputs the final 64-dimensional user representation vector; this vector has the same dimension as the course semantic representation vector in the course vector library, ensuring that the two are in the same shared semantic space, providing a basis for subsequent similarity calculation.

[0076] In this embodiment of the invention, the above method is implemented through an end-to-end recommendation model. This model takes multi-source user data and core course text as input, optimizes all learnable parameters through joint training, and finally outputs personalized course recommendation results.

[0077] The recommendation model comprises three core sub-modules, which work together to achieve the complete process of "user modeling - course modeling - matching recommendation". The three core sub-modules are the user vector generation sub-model, the course vector generation sub-model, and the course vector matching module.

[0078] The user vector generation sub-model is used to fuse multi-dimensional user data into a unified user representation vector, specifically including:

[0079] User trajectory modeling module: The input is a time-series sequence of courses that the user has completed (sorted by learning timestamps). The module processes the course semantic representation vector sequence through a single-layer GRU network (256-dimensional hidden layer, tanh activation, dropout rate 0.2) and outputs a 256-dimensional knowledge trajectory vector to capture the temporal progression pattern of the user's knowledge acquisition.

[0080] User text semantic parsing module: The input is text information generated by the user (study notes, questions, etc.). First, it generates a natural language summary focusing on knowledge gaps through the Qwen1.5-7B-Chat model. Then, it is encoded by the Qwen Embedding encoder and outputs a 1024-dimensional semantic feedback vector to capture the user's subjective learning needs and preferences.

[0081] User attribute fusion module: The input is user attribute information (categorical + numerical). First, a 64-dimensional attribute vector is generated through an embedding layer and a linear mapping layer. Then, an additive attention mechanism (including a learnable query vector q and a weight matrix W) is used. a Bias term b a Dynamic weighted fusion outputs a 64-dimensional user interest vector, reflecting the basic user profile characteristics;

[0082] Feature fusion module: The input consists of a knowledge trajectory vector (256-dimensional), a semantic feedback vector (1024-dimensional), and a user interest vector (64-dimensional). After being concatenated into an initial fusion vector of 1344 dimensions, it outputs a 64-dimensional user representation vector through a four-layer fully connected network (1344→672→336→64), realizing cross-feature interaction and dimensional unification.

[0083] The course vector generation sub-model is used to transform the core teaching text of a course into standardized semantic representation vectors of the course, specifically including:

[0084] Course text parsing module: The input is the core teaching text in the course database (teaching objectives, list of chapter titles, set of knowledge point phrases), and the module extracts structured text units (such as chapter titles sorted by hierarchy, knowledge points sorted by knowledge relevance).

[0085] Course text vectorization module: The Qwen Embedding encoder (which is consistent with the user text encoding) generates a 1024-dimensional teaching objective embedding vector, a p×1024-dimensional chapter title embedding sequence, and a q×1024-dimensional knowledge point phrase embedding sequence, respectively.

[0086] Cross-structure semantic fusion module: concatenates three types of embedded sequences into a unified input sequence (including [CLS] / [SEC] / [KWD] special tags), processes it through a two-layer Transformer encoder (8-head self-attention, 4096-dimensional feedforward network), and outputs a fused representation sequence;

[0087] Course vector optimization module: Take the [CLS] vector (1024-dimensional) of the fused representation sequence, output a 64-dimensional course semantic representation vector through a three-layer fully connected network (1024→512→64), and store it in the course vector library as a matching benchmark.

[0088] The course vector matching module is used to calculate the semantic similarity between users and courses and generate recommendation results. The inputs are the 64-dimensional user representation vector output by the user vector generation sub-model and the 64-dimensional course semantic representation vector in the course vector library. The course vector matching module calculates the matching score between users and each course using the cosine similarity formula, sorts and filters completed courses based on the score, and outputs the top k courses as a recommendation list (as described in S300).

[0089] The recommendation model employs an end-to-end joint training approach. The learnable parameters of all sub-modules (including GRU network weights, attention mechanism parameters, fully connected network weights, Transformer parameters, etc.) are simultaneously optimized through backpropagation, with the specific settings as follows:

[0090] 1. The loss function design adopts an improved hinged ranking loss, focusing on optimizing the ranking logic of "positive sample scores are higher than negative samples". The formula is: L = max(0, λ - score(u, c)). + ) + score(u, c - ));

[0091] Where u is the user representation vector, c + For courses that receive positive user feedback (such as user clicks, completion of learning, or a rating of ≥4 stars), c - For negative sample courses (such as courses that users have seen but haven't clicked, or courses that differ significantly from users' historical preferences); score(u, c) + ) for u and c + The cosine similarity between them, score(u, c) - ) for u and c - The cosine similarity between the samples. λ is the boundary margin hyperparameter, ensuring that the score of positive samples is at least 0.2 higher than that of negative samples, thus enhancing the discriminative power of the recommendation list; the batch loss is the mean of the single-sample loss.

[0092] 2. Training parameter configuration

[0093] Optimizer: The AdamW optimizer is used, with a weight decay coefficient of 0.01 (to suppress overfitting), an exponential decay rate of 0.9 for the first moment estimate, and an exponential decay rate of 0.999 for the second moment estimate;

[0094] Learning rate: The initial learning rate is \(1e-4\), and a cosine annealing scheduling strategy is adopted (decreasing according to the cosine curve with each training round) to avoid oscillations in the later stage;

[0095] Batch size: 128 (balancing training efficiency and gradient stability);

[0096] Training rounds: The number of training rounds is dynamically adjusted based on the accuracy of the validation set recommendation (e.g., NDCG@k). Training is stopped when there is no improvement for 5 consecutive rounds (early stop strategy).

[0097] 3. Advantages of joint training

[0098] Joint optimization of all module parameters ensures that: user representation vectors and course semantic representation vectors dynamically adapt to the same shared semantic space during training, avoiding semantic misalignment caused by phased training; the parameters of modules such as attention mechanism and Transformer can adaptively learn the feature importance of recommendation tasks (e.g., for vocational education users, the "professional title" attribute has a higher weight; for academic courses, the "knowledge point matching degree" has a higher weight); the end-to-end process reduces human intervention, and the model can directly learn the mapping relationship from "input" to "recommendation result" from the raw data, improving implementation efficiency.

[0099] After the recommendation model is trained, an efficient recommendation service is implemented through engineered deployment, covering the entire process of vector library construction, user vector updating, online retrieval, and recommendation interpretation, as detailed below:

[0100] I. Efficient Deployment of Course Vector Library

[0101] The course semantic representation vector (64-dimensional) is generated using a batch computation mechanism, specifically including:

[0102] Triggering conditions: When a new course is added to the course database, the course content is updated (such as syllabus revision), or the model is iterated, the course vectors are recalculated in batches.

[0103] Vector storage: The calculated course vectors are written to the Faiss vector retrieval service, and an Approximate Nearest Neighbor (ANN) index is constructed to accelerate retrieval. The IVF_FLAT index type (inverted file + flattening) is adopted, the number of cluster centers is set to 2048 (dynamically adjusted according to the total number of courses), and the vectors are subjected to L2 normalization to ensure the consistency of similarity calculation.

[0104] Index optimization: The index is pre-trained through Faiss's train interface to make the cluster centers fit the course vector distribution. When searching, nprobe=32 (the number of cluster centers to be probed) is set to achieve a balance between search efficiency (millisecond response) and accuracy, supporting tens of thousands of concurrent queries per second.

[0105] II. Hybrid Update Strategy for User Representation Vectors

[0106] To balance the timeliness of vector updates with computational cost, a hybrid strategy of "offline batch updates + real-time incremental updates" is adopted:

[0107] 1. Offline batch update

[0108] Triggering mechanism: Every day at midnight (during low traffic hours), a batch update is performed based on the previous day's full user behavior logs (including course learning records, text generation behavior, and attribute changes);

[0109] Processing flow: Reconstruct the user time-series course sequence (supplement the new courses learned that day), update the user-generated text library (merge the notes / questions of the day), synchronize attribute change records, and recalculate the entire user representation vector through the user vector generation sub-model to generate the latest user representation vector and overwrite the historical versions in the vector library;

[0110] Applicable scenarios: When users accumulate a lot of behavior (such as learning multiple courses in a single day or generating a large amount of text) or their attribute information changes (such as adjusting their major or updating their interests), the vector is used to ensure that it fully reflects the user's latest status.

[0111] 2. Real-time update mode

[0112] Triggering conditions: Incremental updates are triggered immediately when a user completes a single course (triggering a trajectory update) or submits important text (such as post-course evaluations or learning objectives).

[0113] Processing logic:

[0114] For course learning records: new course vectors are appended to the end of the original time series, and knowledge trajectory vectors are incrementally calculated through the GRU network (reusing historical hidden states to avoid recalculation of the entire sequence).

[0115] For new text: Qwen1.5-7B-Chat is called in real time to generate a summary and encode it, and then weighted and fused with the historical semantic feedback vector (recent text has higher weight).

[0116] Fusion Update: The incrementally calculated trajectory vector, semantic feedback vector and historical user interest vector are re-concatenated, and the updated user representation vector is quickly generated through the feature fusion module and synchronized to the online vector library;

[0117] Advantages: Ensures that recommendations can quickly respond to the latest behavior as soon as the user finishes learning or expressing their needs, improving real-time performance (update delay ≤ 10 seconds).

[0118] III. Online Recommendation and Explanation Process

[0119] When a user initiates a recommendation request, the system performs the following steps:

[0120] 1. Highly efficient Top-K search

[0121] Vector Acquisition: Read the user's current representation vector from the online vector library (prioritize the real-time updated version; if no real-time update is triggered, use the offline batch updated version).

[0122] Similarity retrieval: The Faiss index is called to perform a Top-K (K=50, with reserved filtering space) approximate nearest neighbor retrieval, returning the 50 course vectors with the highest cosine similarity to the user vector;

[0123] Results filtering and sorting: Filter completed courses from the search results, sort the remaining courses in descending order of similarity, and take the top k courses as the candidate recommendation list.

[0124] 2. Recommendation Explanation Generation

[0125] The integrated recommendation explanation module generates natural language reasons based on candidate courses and user characteristics, enhancing the credibility of recommendations.

[0126] Input information: user knowledge trajectory (e.g., "already studied 'Linear Algebra' and 'Probability and Statistics'"), core course content (e.g., "includes matrix factorization and eigenvalue applications"), user text feedback (e.g., "want to learn the mathematical foundations of machine learning");

[0127] Generation logic: The Qwen1.5-7B-Chat model is invoked, and a structured explanation is generated under the guidance of a prompt: "Based on your learning record (you have mastered the basics of linear algebra) and your learning needs (to supplement your mathematical knowledge for machine learning), we recommend 'Matrix Analysis'—this course covers core knowledge points such as eigenvalue decomposition, which is highly matched with your knowledge trajectory and can help you connect with subsequent machine learning courses."

[0128] Application scenarios: Explanatory text is displayed synchronously with the recommendation list, or returned in real time when a user asks "why is this course recommended", supporting conversational interaction.

[0129] This invention also provides an electronic device, including: at least one processor; and a memory communicatively connected to the at least one processor; wherein the memory stores instructions executable by the at least one processor, the instructions being configured to perform the method described in this invention.

[0130] This invention also provides a computer-readable storage medium storing computer-executable instructions for performing the methods described in this invention.

[0131] It should be understood that the various forms of processes shown above can be used to reorder, add, or delete steps. For example, the steps described in this invention can be executed in parallel, sequentially, or in different orders, as long as the desired result of the technical solution disclosed in this invention can be achieved, and this is not limited herein.

[0132] The specific embodiments described above do not constitute a limitation on the scope of protection of this invention. Those skilled in the art should understand that various modifications, combinations, sub-combinations, and substitutions can be made according to design requirements and other factors. Any modifications, equivalent substitutions, and improvements made within the spirit and principles of this invention should be included within the scope of protection of this invention.

Claims

1. A course recommendation method based on a large language model and sequence modeling, characterized in that, The method is applied to the personalized learning path recommendation scene of an online education platform. When a recommendation request sent by a user is received, the following steps are performed: S100, the user's completed course learning records, user-generated text information, and user attribute information are fused to construct multi-dimensional user features and generate a user representation vector; S200, the similarity between the user representation vector and each course semantic representation vector in the current course vector library is calculated, obtaining n similarity values; wherein the course semantic representation vector in the current course vector library is generated based on the course original teaching content through deep semantic analysis of a large language model, and is in the same shared semantic space as the user representation vector; S300, based on the user's completed course learning records, all similarity values corresponding to the user's completed courses are identified and filtered from the n similarity values, and the remaining similarity values of the unfinished courses are retained, denoted as h; the h similarity values obtained after filtering are sorted in descending order, if h≥k, the top k courses corresponding to the sorted similarity values are selected as the recommended courses; if h Each course semantic representation vector in the current course vector library is obtained by the following steps: S10, the core teaching text information of each course is obtained from the course database, including course teaching objectives, chapter title lists, and knowledge point phrase sets, wherein the knowledge point phrase sets are generated by analyzing the course outline content through a large language model; S11, the course core teaching text information is vectorized using a unified encoding strategy to generate structured embedding representations, including teaching objective embedding vectors, chapter title embedding sequences, and knowledge point phrase embedding sequences; S12, the teaching objective embedding vectors, chapter title embedding sequences, and knowledge point phrase embedding sequences are concatenated into a unified input sequence and input into a Transformer encoding module for cross-structure semantic fusion to generate a fusion representation sequence; S13, the fusion representation sequence is subjected to mean pooling processing to obtain a course overall semantic representation vector; S14, the course overall semantic representation vector is input into a second fully connected neural network to output the final course semantic representation vector, which is stored in the course vector library.

2. The method of claim 1, wherein, S100 specifically includes: S101, arrange the user's completed course learning records in ascending order of timestamp to form a time sequence course sequence; S102, concatenate the knowledge point phrase semantic representation vectors corresponding to each course in the time sequence course sequence in turn to obtain a knowledge point phrase semantic representation vector sequence; input the knowledge point phrase semantic representation vector sequence into a user trajectory modeling network to output a user knowledge trajectory vector; wherein the knowledge point phrase semantic representation vector is obtained by fusing the knowledge point phrase embedding sequence; S103, input the user-generated text information into a large language model to obtain a natural language summary of the user-generated text information, and encode the generated natural language summary to obtain a corresponding semantic feedback vector; S104, encode the user attribute information row features, obtain attribute vectors corresponding to each attribute, and fuse all attribute vectors to obtain a user interest vector; S105, splice the knowledge trajectory vector, the semantic feedback vector, and the user interest vector into an initial fusion vector, and input the initial fusion vector into a first fully connected neural network to output the user representation vector.

3. The method of claim 2, wherein, The user trajectory modeling network is a single-layer gated recurrent unit network.

4. The method of claim 2, wherein, In S104, all attribute vectors are dynamically weighted and fused by an attention mechanism to obtain a user interest vector.

5. The method of claim 4, wherein, The user interest vector satisfies the following condition: U interest =∑ m i=1 (α i •v i ), where U interest is the user interest vector, α i is the attention weight of the i-th attribute, i takes values from 1 to m, m is the total number of attributes, v i is the attribute vector of the i-th attribute, α i =exp(s i ) / ∑ m j=1 exp(s j ), s i is the attention score of the i-th attribute, s j is the attention score of the j-th attribute, j takes values from 1 to m, exp() is the natural exponential function; s i =W a •(v i +q)+b a , W a is a learnable weight matrix, q is a learnable query vector, b a is a learnable bias term, and • denotes vector dot product operation.

6. The method of claim 1, wherein, The Transformer encoding module is a stacked structure containing two layers of encoders, and adopts a sine-cosine position encoding mechanism to preserve sequence information; each layer of encoder is sequentially connected by the following sublayers: a multi-head self-attention sublayer, a first residual connection and a layer normalization layer, a feedforward neural network sublayer, and a second residual connection and a layer normalization layer.

7. The method of claim 2, wherein, The first fully connected neural network is a four-layer progressive structure, and the second fully connected neural network is a three-layer progressive structure.

8. An electronic device, comprising: comprise a processor and a memory; The processor is configured to execute the steps of the method according to any one of claims 1 to 7 by invoking programs or instructions stored in the memory.

9. A computer-readable storage medium, characterized in that, The computer readable storage medium is configured to store programs or instructions for enabling a computer to execute the steps of the method according to any one of claims 1 to 7.

Citation Information

Patent Citations

  • Online course recommendation method and system based on large language model

    CN118152656A

  • Intelligent curriculum recommendation method based on implicit vector space

    CN119150918A