Multi-head self-attention exercise recommendation method based on learning time demand perception
Through the multi-head self-attention exercise recommendation method based on learning time demand perception, combined with learning behavior sequence and global representation, the problem of unreasonable learner time arrangement in the existing technology is solved, personalized exercise recommendation is achieved, and learning efficiency and experience are improved.
Patent Information
- Application Number
- CN202510884500.4
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-06-30
- Publication Date
- 2025-10-17
- Estimated Expiration
- 2045-06-30
AI Technical Summary
Existing personalized exercise recommendation methods fail to fully consider learners' learning rhythm and time arrangement needs within a limited time, and ignore recommending exercises that are suitable for their cognitive level and difficulty at the right time, resulting in a decline in learning efficiency and experience.
A multi-head self-attention exercise recommendation method based on learning time demand perception is adopted. Through the learning behavior sequence encoding module, the learner global representation network module and the exercise feature modeling module, combined with the learner's answer log, answer time and exercise difficulty information, a personalized exercise recommendation system is constructed to recommend exercises that are in line with the learner's cognitive level and appropriate difficulty.
It recommends exercises that match learners' cognitive levels and difficulty preferences at the right time, improves learning efficiency and learning experience, and accurately reflects learners' behavioral dynamics and time needs through deep learning models.
Smart Images

Figure CN120804168A_ABST
Abstract
Description
TECHNICAL FIELD
[0001] The application belongs to the technical field of personalized exercise recommendation, and particularly relates to a multi-head self-attention exercise recommendation method based on learning time demand perception. BACKGROUND
[0002] Existing personalized exercise recommendation methods mainly meet the knowledge needs of learners, and fail to fully consider the learning rhythm and time arrangement needs of learners within a limited time, generally ignoring the key factor of answering suitable difficulty exercises at the right time. This leads to the fact that the recommendation system cannot recommend exercises that meet the cognitive level and difficulty preference of learners at the right time, thereby affecting learning efficiency and learning experience.
[0003] From the perspective of methods, exercise recommendation methods mainly include collaborative filtering and matrix decomposition methods, sequence modeling methods, and graph neural network methods. The collaborative filtering method is based on the historical answer records of learners, and recommends by mining the similarity between learners or exercises. This method highly depends on historical interaction data, is easily affected by data sparsity and cold start problems, and leads to unstable recommendation effect. The matrix decomposition method extracts latent feature vectors by decomposing the learner-exercise interaction matrix for matching recommendation. However, the matrix decomposition method is essentially a static modeling method, and it is difficult to capture the dynamic behavior changes of learners in the learning process. The sequence modeling method can better reflect the behavior changes of learners, and the sequence modeling method mainly based on recurrent neural networks is gradually used for learning resource recommendation. The sequence modeling method can more accurately depict the dynamic behavior patterns of learners by analyzing the evolution of the answer sequence of learners. However, this kind of method mainly focuses on the local behavior sequence of learners, and fails to effectively integrate the structural information of learners in the overall learning network. In recent years, graph neural networks have been widely used in personalized learning resource recommendation tasks due to their ability to model complex structural relationships. By constructing a graph structure between learners and exercises, and using graph neural networks to extract semantic relationships between nodes, progress has been made in understanding global structural information.
[0004] From the perspective of learning needs, existing exercise recommendation methods primarily focus on meeting learners' knowledge needs. These mainly include knowledge-based exercise recommendation, cognitive diagnosis-based exercise recommendation, and deep knowledge tracing-based exercise recommendation. In exercise content-based recommendation, similar sentences related to a particular knowledge point are identified by analyzing the similarity between knowledge points and the similarity of exercise text, thereby improving recommendation accuracy. Other methods construct a knowledge structure graph that contains the relationships between knowledge points and calculate the weights of these relationships. This approach then recommends exercises with high error rates based on the learner's performance in a knowledge point error rate matrix. Other methods analyze learners' historical answer data to assess their cognitive level on specific test items. By combining the relationships between exercise resources and knowledge points, they recommend exercises that are both appropriate for the learner's cognitive level and consistent with their learning objectives. Exercise recommendation methods based on cognitive diagnostic models first assess the learner's mastery of each knowledge point through cognitive diagnosis, then predict the learner's performance on educational resources based on the assessment results. Finally, based on the predicted scores, they recommend exercises that meet the requirements. Since the mastery of knowledge points obtained by traditional cognitive diagnostic models is typically discrete, further continuous processing is required. After diagnosing the learner's level of mastery, some methods use probabilistic matrix decomposition technology to predict the learner's exercise answer scores and make recommendations. Other studies have improved traditional collaborative filtering algorithms by combining cognitive diagnosis, taking into account the learner's mastery of knowledge points and the answer history of similar learners, and recommending exercises to target learners through collaborative filtering algorithms. Deep knowledge tracking methods improve the accuracy of answer prediction by constructing a neural network model to track the learner's learning process and predict the answer status based on the learner's historical answer sequence. The dynamic key-value memory network model can automatically establish the relationship between exercises and implicit knowledge points, solving the problem of manually labeling the Q matrix in traditional cognitive diagnosis models. Some methods are based on improved graph-structured deep knowledge tracking models, which can better identify the causal relationship between knowledge points and use the knowledge point network structure to dynamically track the learner's knowledge status.
[0005] Existing technologies fail to jointly model local behavioral dynamics and global structural representations, making it difficult to fully reflect the interaction between individual learner behavior and group behavior.
[0006] In terms of learning needs, the key factor of learning time is ignored. It only meets the learners' knowledge needs and improves learning outcomes, but fails to fully consider the learners' needs for efficient learning within a limited time, that is, to recommend exercises of appropriate difficulty that match their cognitive level to learners at the right time.
[0007] In the actual learning process, learning time as an important indicator to measure learning efficiency is also very important in personalized exercise recommendation. Because different learners have individual differences in the answering rhythm and arrangement of the same exercise, if the individualized time needs of learners are not considered, and appropriate difficulty exercises that meet their cognitive level are not recommended at the right time, learners are likely to have unreasonable arrangements, which may reduce the learning efficiency of learners and may increase frustration. Learning time is an important factor affecting learning efficiency, which can reflect the differences of learners in time management and cognitive rhythm. Learners need to arrange learning tasks reasonably within a limited time, which can reduce learning pressure and improve learning effect.
[0008] The current method generally lacks accurate modeling of the learning time of learners when doing exercises and learning rhythm, which makes it difficult for the model to reflect the influence of learning time on learning rhythm and cognitive load. SUMMARY
[0009] To solve the above problems, the present application provides a multi-head self-attention exercise recommendation method based on learning time demand perception, which solves the problems of "what exercises to do" and "when to do" by combining the learning behavior sequence and global representation of learners according to the time needs of learners. In the recommendation process, the method fully considers the difficulty characteristics of exercises and the preferences of learners for exercise difficulty, and can recommend exercises that meet the current cognitive level of learners at the right time, so as to realize personalized exercise recommendation.
[0010] The technical scheme of the present application is as follows:
[0011] A multi-head self-attention exercise recommendation method based on learning time demand perception, comprising the following steps:
[0012] Step 1, obtaining the exercise log record of the learner, the log record including exercise sequence, answering time sequence, and exercise difficulty information;
[0013] Step 2, establishing a learning behavior sequence encoding module to extract learning behavior sequence representation;
[0014] Step 3, establishing a learner global representation network module to extract learner global representation;
[0015] Step 4, constructing an exercise feature modeling module to extract exercise feature representation;
[0016] Step 5, constructing a personalized exercise recommendation module to fuse the learning behavior sequence representation, learner global representation and exercise feature representation, and recommending the next exercise and answering time for the learner.
[0017] Further, in step 2, the specific working process of the learning behavior sequence encoding module is:
[0018] The input of the learning behavior sequence encoding module includes two parts, a question sequence e = [e1, e2, …, es, e i ,…,e s ] and a corresponding answer time sequence t = [t1, t2, …, ts, t i ,…,t s ], where s is the length of the learning behavior sequence of the current learner, i.e., the total number of time steps of the sequence, e i represents the question answered at the i-th time step, and t i is the answer time of the question at the i-th time step; e i and t i are first combined to form the joint input unit et i = (e i , t i ) at the i-th time step, and the joint input unit at each time step is converted to a unified vector representation through an embedding layer, and after embedding, a complete input sequence embedding matrix is formed:
[0019] x i = Embed et (et i );
[0020] X = [x1, x2, …, xs, x i ,…,x s ];
[0021] where x i is the vector representation of the question answered by the learner at the i-th time step; Embed et (·) is the embedding layer of the learning behavior sequence encoding module; and X is the input sequence embedding matrix.
[0022] Step 2.2, input the input sequence embedding matrix into the multi-head self-attention mechanism-long short-term memory network layer to obtain an attention output representation.
[0023] Step 2.3, a feedforward network and a residual connection are introduced to convert and normalize the attention output representation to obtain a final learning behavior sequence representation of the learner.
[0024] Further, the specific process of step 2.2 is as follows:
[0025] Step 2.2.1, use a long short-term memory network to model the input sequence embedding matrix to obtain the hidden state at each time step, and the hidden states of all time steps constitute a hidden state matrix:
[0026] H = LSTM(X) = [g1, g2, …, gs, g i ,…,gs ];
[0027] Where H is the hidden state matrix; LSTM(·) is the long short-term memory network; g i represents the temporal representation of the i-th time step;
[0028] Step 2.2.2: Add a multi-head self-attention mechanism based on the output of the long short-term memory network to capture the dependencies between time steps and dynamically allocate attention. The specific process is as follows:
[0029] First, map the hidden state matrix into the query matrix Q, key matrix L, and value matrix V:
[0030] Q=HW Q ;
[0031] =GW K ;
[0032] V=HW V ;
[0033] Among them, W Q 、W K 、W V is a matrix of different learnable parameters;
[0034] Subsequently, the attention output is calculated based on the scaled dot product attention mechanism. The core calculation process is as follows:
[0035]
[0036] Among them, Attention(·) is the scaled dot product attention mechanism; softmax(·) is the softmax function; T is the transpose symbol; d k is the dimension of each attention head;
[0037] Finally, the results of multiple attention heads are concatenated and a unified attention output representation is obtained through linear transformation:
[0038]
[0039] v = MultiHead(Q,K,V);
[0040] in, For the The result of an attention head; Respectively The query matrix, key matrix, and value matrix of each attention head; MultiHead(·) is a multi-head self-attention mechanism; represents the number of attention heads, W O is the projection matrix; v is the attention output representation;
[0041] The calculation formula of step 2.3 is:
[0042] S = LayerNorm(v + Dropout(ReLU(vW1 + b1)W2 + b2));
[0043] Wherein, S is a learning behavior sequence representation; LayerNorm(·) is a layer normalization; Dropout(·) is a random dropout operation; ReLU(·) is a kind of nonlinear activation function; W1, W2 are different learnable parameter matrices; b1, b2 are different learnable bias terms.
[0044] Further, in step 3, the specific working process of the learner global representation network module is:
[0045] Step 3.1, the interaction behavior between the learner and the exercise is constructed as a learner-exercise heterogeneous graph For all learners and exercise nodes, ε is the edge set, indicating the interaction relationship between the learner and the exercise; Each edge in the graph is assigned a weight: if the learner correctly completes a question, the weight of the edge is the number of attempts required to complete the question; If the learner fails to answer correctly, the edge weight is set to 0;
[0046] Step 3.2, construct an improved structural deep network embedding method layer; Specifically:
[0047] First, the constructed learner-exercise heterogeneous graph G is represented as an adjacency matrix A;
[0048] In the coding stage of the original structural deep network embedding method, the model inputs the adjacency vector of each node into the deep autoencoder, and maps it into a low-dimensional embedding vector representation; On this basis, the first-order proximity loss of the original structural deep network embedding method is improved, and the weighted cosine similarity is used as a constraint to measure the direction consistency of connected nodes in the embedding space; The improved first-order proximity loss function is:
[0049]
[0050] Wherein, is the index number of different nodes; are the first , the second node; is the weight of the edge ; are the low-dimensional embedding vector representations of ;
[0051] Then, a time-aware second-order proximal loss is designed; the interaction behavior matrix between learners and exercises is divided into multiple time slices according to a time window Each time slice A (t) represents the adjacency matrix in the t-th time slice; the improved time-aware second-order proximal loss function is:
[0052]
[0053] where e is a natural constant; δ is an adjustable attenuation factor; is the total number of time slices in the time window; is the decoding output of the t-th time slice; A (t) is the adjacency matrix in the t-th time slice; ||·|| F represents the Frobenius norm, represents its square;
[0054] The final optimization goal is the weighted sum of the three losses:
[0055]
[0056] where, is the total loss function of the improved structural deep network embedding method layer; α, β, λ are different hyperparameters for balancing the relative importance of the three losses; is an L2 norm regularization term;
[0057] Step 3.3, after inputting the learner-exercise heterogeneous graph into the improved structural deep network embedding method layer, the preliminary learner embedding representation R is obtained; then another multi-head self-attention mechanism-long short-term memory network layer is introduced to perform semantic enhancement on the preliminary learner embedding representation R, and finally the learner global representation R' is generated.
[0058] Further, in step 4, the specific working process of the exercise feature modeling module is:
[0059] Step 4.1, let the total number of answers of the exercise e j in the j-th time step be B j , where the number of correct answers of the exercise in the j-th time step is C j , then the answer accuracy r j of the exercise in the j-th time step is defined as:
[0060]
[0061] Step 4.2, in order to map the continuous answer accuracy value r j ∈[0,1] to discrete difficulty levels, the distribution of answer accuracy of all exercises is counted where N is the total number of exercises, and is divided into three equal intervals according to the sorted order; the discrete difficulty level of exercise e
[0062]
[0063] where d j is the difficulty level label of exercise e j answered at the jth time step, 0, 1, 2 represent easy, medium, and difficult, respectively; r (1 / 3) and r (2 / 3) represent the lower and upper tertile points of the correct answer rate set, respectively;
[0064] Step 4.3, map the difficulty level to the exercise feature representation through the embedding layer:
[0065] D j = Embed d (d j );
[0066] where D j is the exercise feature representation of exercise e d answered at the jth time step; Embed z (·) is the embedding layer of the exercise feature modeling module.
[0067] Further, in step 5, the specific working process of the personalized exercise recommendation module is:
[0068] Step 5.1, concatenate the learning behavior sequence representation S, the learner global representation R', and the exercise feature representation D to form the fusion feature Z:
[0069]
[0070] Step 5.2, after obtaining the fusion vector Z, use the linear transformation layer for prediction, and output the predicted probability distribution
[0071]
[0072] where Softmax(·) is the Softmax function; W z , b z are the weight matrix and the bias term, respectively; the output result represents the probability distribution of all candidate exercise-answer time combination categories, which is used to depict the comprehensive prediction of the learner's next learning behavior;
[0073] Step 5.3, the loss function of the personalized exercise recommendation module is:
[0074]
[0075] where M is the total number of all problem-answer time combination categories; y m ∈{0,1} represents the true label of the mth category; represents the probability distribution of the mth category prediction.
[0076] The beneficial technical effects brought by the present application are as follows.
[0077] Learning time fused learner learning behavior sequence modeling technology: the present application constructs a feature sequence of answer time and problem interaction characteristics by jointly encoding the learner answer sequence and the corresponding answer time, and models the time sequence change of the answer behavior by means of a deep learning model, more accurately reflecting the behavior dynamics and learning rhythm of the learner. Compared with the existing method, the present application can reveal the time demand of the learner when answering the question.
[0078] Learner global representation modeling technology: the present application adopts a graph neural network method to extract global features from the constructed heterogeneous bipartite graph between learners and problems, mine the behavior similarity and potential group connection of learners in the overall learning network, and improve the modeling effect of the knowledge state and behavior pattern of learners. The weight of the edge in the heterogeneous graph is represented by the number of attempts required by the learner to complete each question and the answer result, which describes the mastery and preference of the learner for different difficulty problems, thereby enriching the semantic expression of the graph structure. The existing sequence modeling method fails to utilize the mined global semantic information in combination with the learning behavior sequence modeling information for joint recommendation.
[0079] Joint modeling technology fusing local behavior sequence and global structure representation: the present application jointly inputs two types of features, i.e. local learning behavior sequence features and global learner structure representation, by means of a deep learning model, captures the individual dynamic change and group structure information of learners, can describe the learning behavior of individual learners while mining the potential association of the individual learners with the group in the overall learning network, and more accurately identifies the learning needs and learning state of the learners.
[0080] Multi-head self-attention problem recommendation technology based on learning time demand perception: in the problem recommendation process, the present application comprehensively considers the answer time demand of the learner, the problem difficulty feature, and the similar learner feature information mined based on global behavior similarity, not only focuses on what the learner does, but also focuses on when the learner does, dynamically models the answer rhythm and cognitive load of the learner, and recommends problems that meet the cognitive level and difficulty preference of the learner at the appropriate time, thereby improving the learning efficiency of the learner. The present application comprehensively fuses the time demand of the learner, the problem difficulty feature, and the similar learner feature mined from the global behavior similarity, and realizes more accurate recommendation. BRIEF DESCRIPTION OF DRAWINGS
[0081] Figure 1 The framework diagram of the multi-head self-attention question recommendation method based on learning time requirement perception of the application.
[0082] Figure 2 The recommended result visualization schematic diagram of the real learner numbered 527 in the embodiment of the application.
[0083] Figure 3 The recommended result visualization schematic diagram of the real learner numbered 13342 in the embodiment of the application. DETAILED DESCRIPTION
[0084] The application will be further described in detail below in combination with the drawings and specific embodiments:
[0085] The application aims to solve the following three key technical problems:
[0086] Key technical problem 1: learning behavior sequence modeling technology fusing learning time.
[0087] Learning time, as an important factor affecting learning efficiency, can reflect the differences of learners in time management and cognitive rhythm. By jointly modeling the questions and answering time information, extracting the time interaction features in the answer sequence, and focusing on the relationship between the answer sequence and the answering time, the recommended result is more in line with the learning rhythm and time requirement of the learner.
[0088] Key technical problem 2: modeling technology of global structure relationship and behavior similarity of learners.
[0089] Learners have complex structure relationships and behavior similarities in the overall learning network. By constructing a heterogeneous bipartite graph structure between learners and questions, and combining graph neural network technology to extract the potential semantic relationship between nodes, the global representation of learners is generated, effectively mining the structure relationship and behavior similarity of learners in the learning network, capturing the behavior rules of learners and the potential influence among groups.
[0090] Key technical problem 3: joint modeling technology fusing local behavior sequence and global structure representation.
[0091] Simultaneously considering the local behavior sequence features and global structure representation information of learners, the learning dynamics of individual learners are described, and the potential association in the overall learning network is mined. By fusing the local and global information representation, the recommendation system can more accurately identify the current learning state and learning requirement of learners, recommend questions with appropriate difficulty and in line with the learning rhythm at the right time, and improve the accuracy of personalized recommendation and learning effect.
[0092] For example, Figure 1The learning time requirement perception-based multi-head self-attention exercise recommendation method is shown in the framework diagram, and the application mainly includes four modules: a learning behavior sequence encoding module, a learner global representation network module, an exercise feature modeling module and an individualized exercise recommendation module. By fusing the learning behavior sequence, the answering time and the exercise difficulty information of the learner into the deep learning model, the recommendation system can recommend the exercises suitable for the cognitive level of the learner at the appropriate time, and improve the learning efficiency. The specific steps of the application are as follows:
[0093] Step 1, obtaining the learning behavior sequence, the answering time sequence and the exercise difficulty information of the learner;
[0094] Step 2, establishing a learning behavior sequence encoding module to extract learning behavior sequence features; the learning behavior sequence encoding module focuses on the interaction between the exercise sequence and the answering time, and the module models the behavior changes of the learner in the learning process. The learning behavior sequence encoding module mainly includes the following two parts:
[0095] Learner answering sequence modeling: through the learning behavior sequence, the deep learning model is used to capture the answering behavior and time interaction features of the learner, and the recommendation system can identify the individualized learning rhythm and time requirement of the learner, so as to more accurately recommend suitable exercises.
[0096] Learner time requirement modeling: the application particularly focuses on the learning task arrangement of the learner within a limited time, predicts the learning rhythm of the learner by combining the answering time of the learner, and then recommends exercises with appropriate difficulty for the learner. Unlike traditional recommendation models that only use exercise sequences, this module also adds the important feature of answering time to reflect the answering performance and rhythm changes of the learner facing exercises of different difficulties.
[0097] The learning behavior sequence encoding module includes an embedding layer and an MSA-LATM (multi-head self-attention mechanism-long short-term memory network) layer; the specific working process of the learning behavior sequence encoding module is as follows:
[0098] Step 2.1, the input of the learning behavior sequence encoding module includes two parts: an exercise sequence e=[e1,e2,…,e i ,…,e s ] and a corresponding answering time sequence t=[t1,t2,…,t i ,…,t s ], wherein s is the length of the learning behavior sequence of the current learner, i.e. the total number of time steps of the sequence, the length of the learning behavior sequence s is consistent with the time step number of the LSTM, and each time step corresponds to a learning behavior, e i represents the exercise answered at the i-th time step (since each time step corresponds to a learning behavior, e iIt can also be interpreted as the i-th exercise in the exercise sequence), t i is the answer time of the i-th time step exercise. First, e i With t i Perform combined encoding to form the joint input unit et of the i-th time step i =(e i ,t i ), the joint input units of all exercises in the current learner's learning behavior sequence constitute the learner's historical answer sequence; the joint input units of each time step are converted into a unified vector representation through the embedding layer. After embedding, the complete input sequence embedding matrix is formed:
[0099] x i =Embed et (et i );
[0100] X=[x1,x2,…,x i ,…,x s ];
[0101] Among them, x i Embed is the vector representation of the learner's answer to the exercise at the i-th time step; et (·) is the embedding layer of the learning behavior sequence encoding module; X is the input sequence embedding matrix;
[0102] Step 2.2: Input the input sequence embedding matrix into the MSA-LSTM layer to obtain the attention output representation; the specific process is as follows:
[0103] Step 2.2.1. Use a standard LSTM (Long Short-Term Memory) network to embed the input sequence into a matrix model, capturing the temporal relationship in the sequence and obtaining the hidden state at each time step. The hidden states of all time steps form the hidden state matrix. LSTM can stably transmit information over longer sequences, and its output is as follows:
[0104] H=LSTM(X)=[h1,h2,…,h i ,…,h s ];
[0105] Where H is the hidden state matrix; LSTM(·) is the long short-term memory network; h i represents the temporal representation of the i-th time step, reflecting the local learning state of the learner.
[0106] Step 2.2.2: Although LSTM can handle the order of answering behaviors, different time steps in the sequence have different importance for the recommendation results. To solve this problem, the present invention adds a multi-head self-attention mechanism (MSA) based on the LSTM output to capture the dependencies between time steps and dynamically allocate attention. The specific process is as follows:
[0107] First, the hidden state matrix is mapped into the query matrix Q, key matrix K and value matrix V:
[0108] Q=HW Q ;
[0109] K=HW K ;
[0110] V=HW V ;
[0111] Among them, W Q 、W K 、W V are different parameter matrices that can be learned.
[0112] Subsequently, the attention output is calculated based on the scaled dot product attention mechanism. The core calculation process is as follows:
[0113]
[0114] Among them, Attention(·) is the scaled dot product attention mechanism; softmax(·) is the softmax function; T is the transpose symbol; d k is the dimension of each attention head.
[0115] Finally, the results of multiple attention heads are concatenated and a unified attention output representation is obtained through linear transformation:
[0116]
[0117] v = MultiHead(Q,K,V);
[0118] in, For the The result of an attention head; Respectively The query matrix, key matrix, and value matrix of each attention head; MultiHead(·) is a multi-head self-attention mechanism; represents the number of attention heads, W O is the projection matrix; v is the attention output representation.
[0119] Step 2.3, To enhance the nonlinear representation ability of the model and stabilize the training, the present application introduces a feedforward network and a residual connection, converts and normalizes the above attention output representation, and obtains a final learner learning behavior sequence representation S:
[0120] S = LayerNorm(v + Dropout(ReLU(vW1 + b1)W2 + b2));
[0121] wherein LayerNorm(·) is a layer normalization; Dropout(·) is a random dropout operation for preventing model overfitting; ReLU(·) is a kind of nonlinear activation function; W1, W2 are different learnable parameter matrices; b1, b2 are different learnable bias terms.
[0122] Step 3, In order to capture the structural relationship and behavior similarity of learners in the whole learning network, the present application designs a learner global representation network module to extract the learner global representation. Based on the idea of graph neural network, the module models the learning behavior from the structural perspective, and then mines the behavior similarity between learners to capture the global information of learners in the learning process. The learner global representation network module mainly includes an improved SDNE layer and an MSA-LSTM layer, and the specific working process is as follows:
[0123] Step 3.1, The present application constructs the interaction behavior between learners and exercises as a learner-exercise heterogeneous graph For all learners and exercise nodes, ε is an edge set representing the interaction relationship between learners and exercises; the graph is a heterogeneous bipartite graph containing two types of nodes, namely learner nodes and exercise nodes. Each edge in the graph represents an interaction between a learner and an exercise, i.e. a learning behavior, which is used to characterize the relationship between the two types of nodes. In order to more effectively express the performance difference of learners in the learning process, a weight is assigned to each edge in the graph: if the learner correctly completes a question, the weight of the edge is the number of attempts required to complete the question, reflecting the effort; if the learner fails to answer correctly, the edge weight is set to 0 to represent the cognitive barriers that the question may cause. The above design makes the graph structure not only retain the information of the behavior occurrence, but also introduce the measurement of the behavior quality. By constructing a heterogeneous bipartite graph structure between learners and exercises, the number of attempts required to complete each question and the answer result are considered to set the edge weight, reflecting the preference of learners for exercises of different difficulties. By introducing the weight information, the graph neural network can more effectively extract the potential similarity between the learning behaviors of learners. Modeling the learning behavior of learners from a global perspective enables the recommendation system to accurately identify the learning state and learning needs of learners.
[0124] Step 3.2, constructing an improved structural deep network embedding method layer; specifically:
[0125] Firstly, the constructed learner-question heterogeneous graph G is represented as an adjacency matrix A. In order to extract structured semantic information from the graph, the present application improves the structural deep network embedding method (SDNE). In the original SDNE method, a deep autoencoder is used to perform nonlinear reconstruction on the adjacency matrix, so as to maintain the local structure consistency of the graph and capture the high-order structural relationship between nodes. In the present application, an innovative loss function design is introduced on the basis of this framework, further improving the quality of the embedding representation.
[0126] In the encoding stage, the model inputs the adjacency vector of each node into the deep autoencoder, and maps it into a low-dimensional embedding vector representation. On this basis, the first-order proximity loss of SDNE is improved, and the weighted cosine similarity is used as a constraint to measure the directional consistency of connected nodes in the embedding space. This improvement can better capture the behavior pattern similarity between learners, and avoid the sensitivity of the traditional Euclidean distance to the vector amplitude, and focus more on the behavior relevance between nodes. The improved first-order proximity loss function is as follows:
[0127]
[0128] wherein, is the index number of different nodes; are the i-th and j-th nodes, respectively; is the weight of the edge; are the low-dimensional embedding vector representations of and, respectively. The use of weighted cosine similarity can effectively strengthen the semantic association of learning behavior in the embedding space, so that similar learning behaviors can be closer in the embedding space.
[0129] At the same time, in order to capture the dynamic evolution characteristics of learning behavior, a time-aware second-order proximity loss is designed. The interaction behavior matrix between learners and questions is divided into multiple time slices according to the time window Each time slice A (t) represents the adjacency matrix in the t-th time slice, reflecting the interaction relationship between learners and questions in that time slice, and the reconstruction constraint of recent behavior is strengthened through exponential decay weighting. This mechanism enables the model to pay more attention to recent learning behavior when reconstructing the adjacency matrix, adapting to the dynamic changes of learning behavior. The improved time-aware second-order proximity loss function is as follows:
[0130]
[0131] where e is a natural constant; δ is an adjustable attenuation factor; is the total number of time slices of the time window; is the decoding output of the t-th time slice; A (t) is the adjacency matrix in the t-th time slice; ||·||F F denotes the Frobenius norm, denotes the square thereof, i.e., the sum of squares of the matrix element differences.
[0132] The final optimization objective is the weighted sum of the three losses:
[0133]
[0134] where, is the total loss function of the improved SDNE layer; α, β, λ are different hyperparameters for balancing the relative importance of the three losses; is an L2 norm regularization term for preventing overfitting.
[0135] Step 3.3. After inputting the learner-question heterogeneous graph into the improved SDNE layer, a preliminary learner embedding representation R is obtained, which mainly reflects the structural position of the learner in the learning community and the association strength and behavior similarity between other nodes. However, the embedding learned by SDNE is essentially optimized based on the adjacency matrix reconstruction task, mainly depicting the static connection pattern of the graph structure, lacking deep perception and dynamic modeling of learning behavior semantics. Therefore, to further enhance the expression ability of the embedding vector in the recommendation task, another MSA-LSTM layer is introduced to perform semantic enhancement on the preliminary learner embedding representation R, and finally generate a global learner representation R'. This process enables the model to more effectively learn the behavior rules and potential influence relationships between groups from structural information. Finally, the global learner representation is combined with the learner learning behavior sequence representation for the personalized question recommendation task.
[0136] Step 4. Construct a question feature modeling module to extract question feature representations; this module includes an embedding layer. This module divides the difficulty level of the question according to the overall correct answer rate of the question to capture the semantic differences of the learning resources. The specific working process of the question feature modeling module is as follows:
[0137] Step 4.1. Let the total number of answers of the question e j at the j-th time step be B j , where the number of correct answers of the question at the j-th time step is C j , then the answer correct rate r jDefined as:
[0138]
[0139] Step 4.2: To convert the continuous correct answer value r j ∈[0,1] is mapped to a discrete difficulty level, and the distribution of correct answers to all exercises is counted Where N is the total number of exercises, which are divided into three equal intervals after sorting. Specifically, if the exercise e answered in the jth time step is j The correct answer rate is in the range of one third of the smallest value in the set (i.e., r j ≤r (1 / 3) ), it is marked as “difficult”; if it is in the middle third (i.e. (1 / 3) <r j ≤r (2 / 3) ), it is marked as “medium”; if it is in the highest third (i.e. j >r (2 / 3) ), then it is marked as "easy". The following mapping function is used to represent the discrete difficulty level of the exercise:
[0140]
[0141] Among them, d j ∈{0,1,2} is the exercise e answered in the jth time step j Difficulty level label; r (1 / 3) and r (2 / 3) They represent the lower third and upper third quantiles of the correct answer set respectively.
[0142] Step 4.3. Finally, the difficulty level is mapped to the feature representation of the exercise through the embedding layer:
[0143] D j =Embed d (d j );
[0144] Among them, d j The feature representation of the exercise answered at the jth time step; Embed d (·) is the embedding layer of the question feature modeling module.
[0145] Step 5: Build a personalized exercise recommendation module that integrates the learning behavior sequence representation, the learner's global representation, and the exercise feature representation to recommend the next exercise and answer time for the learner. This module includes a fully connected layer and its specific working process is as follows:
[0146] Step 5.1: Concatenate the learning behavior sequence representation S, the learner global representation R′, and the problem feature representation D to form the fused feature Z:
[0147]
[0148] Step 5.2, after obtaining the fusion vector Z, a linear transformation layer is used for prediction, and a Softmax function is used to output the predicted probability distribution
[0149]
[0150] Wherein, Softmax(·) is a Softmax function; W z , b z Respectively, weight matrix, bias term, output result Indicates the probability distribution of all candidate exercise-answer time combination categories, which is used to depict the comprehensive prediction of the next learning behavior of the learner.
[0151] Step 5.3, loss function of the personalized exercise recommendation module The predicted probability distribution And the cross entropy between the real label is defined as:
[0152]
[0153] Wherein, M is the total number of all exercise-answer time combination categories; y m ∈{0,1} indicates the real label of the mth category; Indicates the predicted probability distribution of the mth category.
[0154] The application captures the dynamic behavior characteristics in the learning process of the learner by analyzing the answer sequence change of the learner, combines the structural relationship and behavior similarity of the learner in the whole learning network, and comprehensively depicts the current learning state of the learner; The method of the application introduces the difficulty characteristics of the exercises, ensures that the recommended content matches the cognitive level and ability state of the learner, and avoids the problem of recommended exercises being too difficult or too easy; The method of the application also integrates learning time requirements, realizes recommending exercises suitable for the cognitive level of the learner at the right time, optimizes the learning rhythm, and improves the learning efficiency.
[0155] The application has been verified by experiments, and the answer log records of two programming competitions from the Codeforces platform are crawled as experimental data, proving the feasibility and superiority of the application. The learning behavior sequence coding module, the learner global representation network module, the exercise feature modeling module and the personalized exercise recommendation module are combined to form the complete model of the application.
[0156] One of the experimental data is recorded as data set Codeforces 936, from which two representative real learners (numbered 527 and 13342) are selected, and the performance differences of the complete model (Ours) of the application, the variant model (Ours (w / o GR)) removing the global representation of the learner, and the GRU4Rec model in the personalized recommendation task are compared and analyzed. Among them, the exercises and answering time are represented as a combination, for example, (A, 1) represents that the learner answers the A exercise at the time slice with ID 1. The model case analysis is shown in Table 1.
[0157] Table 1 Model case analysis table
[0158]
[0159] Top-k recommendation refers to taking the top-k candidate items predicted by the model as the recommendation result. The complete model (Ours) of the application can more accurately hit the real next interaction in the Top-K recommendation of the two learners, among which the real interaction of the learner with ID 13342 hits at the Top-1 position, and the learner with ID 527 hits at the Top-2 position. This shows that the model of the application effectively learns the answering preferences and time requirements of the learners. In contrast, the model removing the global representation of the learner (Ours (w / o GR)) has a certain backward shift in the hit position of the two learners, respectively, to Top-5 and Top-4, which shows that the global representation can learn the potential association between the learners through the graph structure, so as to extract the structural relationship of the learners in the whole learning network and the behavior similarity features between other learners. Once this information is missing, the model becomes more dependent on local sequences to capture individual behavior, resulting in a decrease in recommendation accuracy. The GRU4Rec model performs the worst, and the real interactions of the two learners only hit at the Top-7 and Top-13 positions, respectively, and the recommendation result is scattered and multiple historical exercises are recommended. The visualization result is shown in Figures 2-3 , wherein Ground Truth refers to the next interaction actually occurred by the learner, and from the figure it can be seen that the recommendation result of the model proposed by the application is more concentrated. This shows that the traditional sequence model relying only on local behavior modeling is difficult to accurately capture the time requirements and answering preferences of the learners.
[0160] Of course, the above description is not a limitation of the application, and the application is also not limited to the above examples. Changes, modifications, additions or substitutions made by those skilled in the art within the essential scope of the application should also be within the protection scope of the application.
Claims
1. A multi-head self-attention exercise recommendation method based on learning time demand perception, characterized by: The steps include: Step 1: Obtain the learner's answer log record, which includes the exercise sequence, answer time sequence, and exercise difficulty information; Step 2: Establish a learning behavior sequence encoding module to extract learning behavior sequence representation; Step 3: Establish a learner global representation network module to extract the learner global representation; Step 4: Construct an exercise feature modeling module to extract exercise feature representations; Step 5: Build a personalized exercise recommendation module, integrate the learning behavior sequence representation, learner global representation, and exercise feature representation, and recommend the next exercise and answer time for learners.
2. The multi-head self-attention exercise recommendation method based on learning time demand perception according to claim 1 is characterized in that: In step 2, the specific working process of the learning behavior sequence encoding module is as follows: Step 2.1: The input of the learning behavior sequence encoding module consists of two parts: the exercise sequence e = [e1, e2, …, e i ,…,e s ] and the corresponding answer time series t=[t1,t2,…,t i ,…,t s ], where s is the length of the learning behavior sequence of the current learner, that is, the total number of time steps in the sequence, e i represents the exercise answered in the δth time step, t i is the answer time of the i-th time step exercise; first, e i With t i Perform combined encoding to form the joint input unit et of the i-th time step i =(e i ,t i ), the joint input unit of each time step is converted into a unified vector representation through the embedding layer. After embedding, the complete input sequence embedding matrix is formed: x i =Embed et (et i ); X=[x1,x2,…,x i ,…,x s ]: Among them, x i Embed is the vector representation of the learner's answer to the exercise at the i-th time step; et (·) is the embedding layer of the learning behavior sequence encoding module; X is the input sequence embedding matrix; Step 2.2: Input the input sequence embedding matrix into the multi-head self-attention mechanism-long short-term memory network layer to obtain the attention output representation; In step 2.3, a feedforward network and residual connection are introduced to transform and normalize the attention output representation to obtain the final learner's learning behavior sequence representation.
3. The multi-head self-attention exercise recommendation method based on learning time demand perception according to claim 2 is characterized in that: The specific process of step 2.2 is as follows: Step 2.2.
1. Use the long short-term memory network to model the input sequence embedding matrix and obtain the hidden state of each time step. The hidden states of all time steps constitute the hidden state matrix: H=LSTM(X)=[h1,h2,…,h i ,…,h s ]; Where H is the hidden state matrix; LSTM(·) is the long short-term memory network; h i represents the temporal representation of the i-th time step; Step 2.2.2: Add a multi-head self-attention mechanism based on the output of the long short-term memory network to capture the dependencies between time steps and dynamically allocate attention. The specific process is as follows: First, the hidden state matrix is mapped into the query matrix Q, key matrix K and value matrix V: Q=HW Q ; K=HW K ; V=HW V ; Among them, W Q 、W K 、W V is a matrix of different learnable parameters; Subsequently, the attention output is calculated based on the scaled dot product attention mechanism. The core calculation process is as follows: Among them, Attention(·) is the scaled dot product attention mechanism; softmax(·) is the softmax function; T is the transpose symbol; d k is the dimension of each attention head; Finally, the results of multiple attention heads are concatenated and a unified attention output representation is obtained through linear transformation: v = MultiHead(Q,K,V); in, For the The result of an attention head; Respectively The query matrix, key matrix, and value matrix of each attention head; MultiHead(·) is a multi-head self-attention mechanism; represents the number of attention heads, W O is the projection matrix; v is the attention output representation; The calculation formula of step 2.3 is: S=LayerNorm(v+Dropout(ReLU(vW1+b1)W2+b2)); Among them, S is the learning behavior sequence representation; LayerNorm(·) is layer normalization; Dropout(·) is a random dropout operation; ReLU(·) is a nonlinear activation function; W1 and W2 are different learnable parameter matrices; b1 and b2 are different learnable bias terms.
4. The multi-head self-attention exercise recommendation method based on learning time demand perception according to claim 3 is characterized in that: In step 3, the specific working process of the learner global representation network module is as follows: Step 3.1: Construct the interaction between learners and exercises into a learner-exercise heterogeneous graph For all learner and exercise nodes, ε is the edge set, which represents the interactive relationship between learners and exercises. A weight is assigned to each edge in the graph: if the learner completes a question correctly, the edge weight is the number of attempts required to complete the question; if the learner fails to answer correctly, the edge weight is set to 0. Step 3.2: Construct an improved structural deep network embedding method layer; specifically: First, the constructed learner-exercise heterogeneous graph G is represented as the adjacency matrix A; In the encoding stage of the original structure deep network embedding method, the model inputs the adjacency vector of each node into the deep autoencoder and maps it to a low-dimensional embedding vector representation; on this basis, the first-order neighbor loss of the original structure deep network embedding method is improved, and the weighted cosine similarity is used as a constraint to measure the directional consistency of the connected nodes in the embedding space; the improved first-order neighbor loss function for: in, is the index number of different nodes; Respectively , nodes; For the edge The weight of They are Low-dimensional embedding vector representation of ; Then, a time-aware second-order neighbor loss is designed; the interaction behavior matrix between the learner and the exercises is divided into multiple time slices according to the time window Each time slice A (t) Represents the adjacency matrix in the t-th time slice; improved time-aware second-order neighbor loss function for: Wherein, e is a natural constant; δ is an adjustable attenuation factor; is the total number of time slices in the time window; is the decoding output of the tth time slice; A (t) is the adjacency matrix in the t-th time slice; ||·|| F represents the Frobenius norm, represents its square; The final optimization target is the weighted sum of three losses: in, is the total loss function of the improved structural deep network embedding method layer; α, β, and λ are different hyperparameters used to balance the relative importance of the three losses; is an L2 norm regularization term; Step 3.3: After inputting the learner-exercise heterogeneous graph into the improved structured deep network embedding method layer, a preliminary learner embedding representation R is obtained; then another multi-head self-attention mechanism - long short-term memory network layer is introduced to semantically enhance the preliminary learner embedding representation R, and finally generate the learner global representation R ′ .
5. The multi-head self-attention exercise recommendation method based on learning time demand perception according to claim 4 is characterized in that: In step 4, the specific working process of the exercise feature modeling module is as follows: Step 4.1: Let the problem e to be answered at the jth time step be j The total number of answers is B j , where the number of correct answers to the exercises in the jth time step is C j , then the correct answer rate r for the exercise answered in the jth time step j Defined as: Step 4.2: To convert the continuous correct answer value r j ∈[0,1] is mapped to a discrete difficulty level, and the distribution of correct answers to all exercises is counted Where N is the total number of exercises, which are divided into three equal intervals after sorting; the discrete difficulty level of the exercises is represented by the following mapping function: Among them, d j ∈{0,1,2} is the exercise e answered in the jth time step j The difficulty level label, 0, 1, 2 represent the difficulty level easy, medium, and difficult respectively; (1 / 3) and r (2 / 3) Respectively represent the lower third and upper third quantiles of the correct answer set; Step 4.3: Map the difficulty level to the problem feature representation through the embedding layer: D j =Embed d (d j ); Among them, D j The feature representation of the exercise answered at the jth time step; Embed d (·) is the embedding layer of the question feature modeling module.
6. The multi-head self-attention exercise recommendation method based on learning time demand perception according to claim 5 is characterized in that: In step 5, the specific working process of the personalized exercise recommendation module is as follows: Step 5.1: Represent the learning behavior sequence S and the learner global representation R ′ And the feature representation D of the exercise is concatenated to form the fusion feature Z: Step 5.2: After obtaining the fusion vector Z, use the linear transformation layer to make predictions and output the predicted probability distribution through the Softmax function. Among them, Softmax(·) is the Softmax function; W z 、b z are weight matrix and bias term respectively; output results Represents the probability distribution of all candidate exercise-answer time combination categories, which is used to characterize the comprehensive prediction of the learner's next learning behavior; Step 5.
3. Loss function of the personalized exercise recommendation module for: Where M is the total number of all exercise-answer time combination categories; y m ∈{0,1} represents the true label of the mth category; Represents the probability distribution of the m-th category prediction.
Citation Information
Patent Citations
Learner cognitive diagnosis method based on multilayer attention mechanism
CN117056727A
Individualized exercise recommendation method and recommendation system integrating reinforcement and comparative learning
CN119089030A