A multi-head self-attention exercise recommendation method based on learning time requirement perception
By learning a time-aware multi-head self-attention exercise recommendation method, which combines learning behavior sequences and global representations, the problem of unconsidered learning time requirements in existing technologies is solved. This enables the recommendation of exercises of appropriate difficulty to learners at the right time, improving learning efficiency and the accuracy of personalized recommendations.
Patent Information
- Application Number
- CN202510884500.4
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2025-06-30
- Publication Date
- 2026-01-20
- Estimated Expiration
- 2045-06-30
AI Technical Summary
Existing personalized exercise recommendation methods fail to fully consider learners' learning pace and time management needs within a limited time, neglecting to answer appropriately difficult questions at the right time. As a result, the recommendation system cannot recommend exercises that match learners' cognitive level and difficulty preferences at the right time, affecting learning efficiency and learning experience.
We employ a multi-head self-attention exercise recommendation method based on learning time requirement awareness. By integrating learner answer logs, answer time, and exercise difficulty information through a learning behavior sequence encoding module, a learner global representation network module, and an exercise feature modeling module, we construct a personalized exercise recommendation system. This system comprehensively considers learner time requirements, exercise difficulty characteristics, and global behavior similarity to recommend exercises that match learners' cognitive level and difficulty preferences.
It enables the recommendation of exercises that match learners' cognitive level and difficulty at the right time, improving learning efficiency and experience. Through deep learning models, it accurately reflects learners' behavioral dynamics and learning pace, captures individual dynamic changes and group structure information, and improves the accuracy of personalized recommendations.
Smart Images

Figure CN120804168B_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. Collaborative filtering methods are based on the historical answer records of learners, and recommend exercises by mining the similarity between learners or exercises. Such methods are highly dependent on historical interaction data, are easily affected by data sparsity and cold start problems, and lead to unstable recommendation results. Matrix decomposition methods extract latent feature vectors by decomposing the learner-exercise interaction matrix for matching recommendation. However, matrix decomposition methods are essentially static modeling, and are difficult to capture dynamic behavior changes of learners in the learning process. Sequence modeling methods can better reflect the behavior changes of learners, and sequence modeling methods mainly based on recurrent neural networks are gradually used for learning resource recommendation. Sequence modeling methods can more accurately depict the dynamic behavior patterns of learners by analyzing the evolution of the answer sequences of learners. However, such methods mainly focus on the local behavior sequence of learners, and fail 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 mainly focus on meeting the knowledge needs of learners. They include knowledge-based exercise recommendation, cognitive diagnosis-based exercise recommendation, and deep knowledge tracking-based exercise recommendation. In content-based exercise recommendation, the similarity between knowledge points and the similarity of exercise texts are analyzed to identify similar sentences related to a certain knowledge point, thereby improving the accuracy of recommendation. Some methods build a knowledge structure graph containing the relationships between knowledge points, calculate the weights of these relationships, and recommend exercises with high error rates based on the learners' performance in the knowledge point error rate matrix. Some methods analyze learners' historical answer data to assess their cognitive level on specific test items and recommend exercises that meet learners' cognitive level and learning objectives by combining the association between exercise resources and knowledge points. Cognitive diagnosis model-based exercise recommendation methods first assess learners using cognitive diagnosis to determine their mastery of each knowledge point, then predict their performance on educational resources based on the assessment results, and finally recommend exercises that meet the requirements based on the predicted scores. Since the knowledge point mastery level obtained by traditional cognitive diagnosis models is usually discrete, it needs to be further processed to be continuous. Some methods use probability matrix decomposition techniques to predict learners' exercise answer scores after diagnosing their mastery level. Some research has improved traditional collaborative filtering algorithms by considering learners' knowledge point mastery and the answer history of similar learners, and recommending exercises for target learners through collaborative filtering algorithms. Deep knowledge tracking methods use neural network models to track learners' learning processes and predict their answers based on their historical answer sequences, improving the accuracy of answer prediction. Dynamic key-value memory network models can automatically establish relationships between exercises and implicit knowledge points, solving the problem of manually labeling Q matrices in traditional cognitive diagnosis models. Some methods based on improved graph structure deep knowledge tracking models can better identify the causal relationships between knowledge points and dynamically track learners' knowledge states using knowledge point network structures.
[0005] Existing technologies fail to jointly model local behavior dynamics and global structure representation, making it difficult to fully reflect the interaction between individual behavior and group behavior of learners.
[0006] In terms of learning needs, the key factor of learning time is ignored, and only the knowledge needs of learners are met, improving learning effectiveness, but not fully considering the needs of efficient learning within a limited time, that is, recommending appropriate difficulty exercises that meet the cognitive level of 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 a long short-term memory network; g i This represents the timing representation of the i-th time step;
[0028] Step 2.2.2: Based on the output of the Long Short-Term Memory (LSTM) network, a multi-head self-attention mechanism is added to capture the dependencies between time steps and dynamically allocate attention; the specific process is as follows:
[0029] First, map the hidden state matrix to a query matrix Q, a key matrix L, and a value matrix V:
[0030] Q = HW Q ;
[0031] =GW K ;
[0032] V = HW V ;
[0033] Among them, W Q W K W V Different parameter matrices can be learned;
[0034] Subsequently, the attention output is calculated based on the scaled dot product attention mechanism, and its core calculation process is as follows:
[0035]
[0036] Where Attention(·) is the scaled dot product attention mechanism; softmax(·) is the softmax function; T is the transpose sign; d k Dimensions for each attention head;
[0037] Finally, the results from multiple attention heads are concatenated and a unified attention output representation is obtained through a linear transformation:
[0038]
[0039] v = MultiHead(Q,K,V);
[0040] in, For the first The result of individual attention; The first The query matrix, key matrix, and value matrix of each attention head; MultiHead(·) is the multi-head self-attention mechanism; W represents the number of attention heads. O v 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 sequence of exercises, t i Let e be the answering time for the exercise at the i-th time step. i With t i Perform combined encoding to form the joint input unit et at the i-th time step. i =(e i ,t i The joint input units of all questions in the current learner's learning behavior sequence constitute the learner's historical answer sequence; the joint input units at each time step are converted into a unified vector representation through an embedding layer, and after embedding, a complete input sequence embedding matrix is formed:
[0099] x i =Embed et (et i );
[0100] X = [x1, x2, ..., x i ,…,x s ];
[0101] Where, x i The vector representation of the learner's answer to the exercise at the i-th time step; Embed et (·) represents 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 model the embedding matrix of the input sequence, capturing the temporal relationships in the sequence and obtaining the hidden state at each time step. The hidden states at all time steps constitute the hidden state matrix. LSTM can stably transmit information in relatively long 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 a long short-term memory network; h i The temporal representation of the i-th time step reflects the learner's local learning state.
[0106] Step 2.2.2: Although LSTM can handle the sequential relationship of answering behaviors, the importance of different time steps in the sequence to the recommendation result is not the same. To solve this problem, this invention adds a multi-head self-attention mechanism (MSA) to the LSTM output to capture the dependencies between time steps and dynamically allocate attention. The specific process is as follows:
[0107] First, map the hidden state matrix to a query matrix Q, a key matrix K, and a value matrix V:
[0108] Q = HW Q ;
[0109] K = HW K ;
[0110] V = HW V ;
[0111] Among them, W Q W K W V These are different parameter matrices that can be learned.
[0112] Subsequently, the attention output is calculated based on the scaled dot product attention mechanism, and its core calculation process is as follows:
[0113]
[0114] Where Attention(·) is the scaled dot product attention mechanism; softmax(·) is the softmax function; T is the transpose sign; d k Dimensions for each attention head.
[0115] Finally, the results from multiple attention heads are concatenated and a unified attention output representation is obtained through a linear transformation:
[0116]
[0117] v = MultiHead(Q,K,V);
[0118] in, For the first The result of individual attention; The first The query matrix, key matrix, and value matrix of each attention head; MultiHead(·) is the multi-head self-attention mechanism; W represents the number of attention heads. 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 layer normalization; Dropout(·) is a random dropout operation for preventing model overfitting; ReLU(·) is a 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 global representation of learners. Based on the idea of graph neural network, this 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 the edge set, representing the interaction relationship between learners and exercises; the graph is a heterogeneous bipartite graph, which contains 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 describe 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 learner's preference for different difficulty exercises. 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 answer accuracy value r... j The coordinates ∈[0,1] are mapped to discrete difficulty levels. The distribution of the correct answer rate for all exercises is statistically analyzed. Where N is the total number of exercises, and the intervals are divided into three equal parts according to the sorted order. Specifically, if the exercise e answered in the j-th time step... j The accuracy rate of the answers falls within one-third of the minimum value in the set (i.e., r). j ≤r (1 / 3) If it is located in the middle third of the interval (i.e., r), it is marked as "difficult"; if it is located in the middle third of the interval (i.e., r), it is marked as "difficult". (1 / 3) <r j ≤r (2 / 3) If it is in the highest third of the range (i.e., r), it is marked as "medium"; if it is in the highest third of the range (i.e., r), it is marked as "medium". j >r (2 / 3) If the difficulty level is 0, it is marked as "easy". The discrete difficulty level of the exercise is represented by the following mapping function:
[0140]
[0141] Where, d j Exercise e for answering at the j-th time step ∈{0,1,2} j Difficulty level label; r (1 / 3) and r (2 / 3) These represent the lower third and upper third quantiles of the set of correct answer rates, respectively.
[0142] Step 4.3: Finally, the difficulty level is mapped to the exercise feature representation through the embedding layer:
[0143] D j =Embed d (d j );
[0144] Where, d j The problem feature representation for the problem answered at the j-th time step; Embed d (·) represents the embedding layer of the exercise feature modeling module.
[0145] Step 5: Construct a personalized exercise recommendation module, which integrates learning behavior sequence representation, learner global representation, and exercise feature representation to recommend the next exercise and answering time to 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 exercise 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 results are 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 problem recommendation method based on learning time requirement perception, characterized in that, Comprising the following steps: Step 1, obtaining a learner answer log record, the log record comprising a problem sequence, an answer time sequence, and problem difficulty information; Step 2, establishing a learning behavior sequence encoding module to extract learning behavior sequence representation; Step 3, establishing a learner global representation network module to extract learner global representation; Step 4, constructing a problem feature modeling module to extract problem feature representation; The specific working process of the problem feature modeling module is as follows: Step 4.1, let the first... Exercises that require answering at each time step The total number of responses is , of which The number of correct answers to the questions at each time step is Then the first The accuracy rate of answering questions at each time step Defined as: ; Step 4.2, for the continuous answer accuracy value mapping to discrete difficulty levels, the distribution of the answer accuracy of all exercises is counted wherein is the total number of exercises, and is divided according to the sorted three equal intervals; the discrete difficulty level of the exercise is represented by the following mapping function: ; wherein, is the difficulty level label of the exercise answered by the user at the time step, 0, 1, 2 representing easy, medium, and hard difficulty levels, respectively; and represent the lower and upper tercile points of the set of correct answer rates, respectively. Step 4.3, mapping the difficulty level to the problem feature representation through an embedding layer: ; wherein, is a first is a problem feature representation of a problem solved by the agent at a time step; is an embedding layer of the problem feature modeling module; Step 5, constructing a personalized problem recommendation module to fuse the learning behavior sequence representation, the learner global representation, and the problem feature representation to recommend the next problem and the answer time for the learner; The specific working process of the personalized problem recommendation module is as follows: Step 5.1, learning behavior sequence representation , learner global representation and problem feature representation fusion feature after splicing : ; Step 5.2, obtaining fusion vector After that, the prediction is made using a linear transformation layer and the predicted probability distribution is output by a Softmax function : ; wherein, is a Softmax function; , are weight matrix, bias term respectively; output result denotes the probability distribution over all candidate problem-answer time combination classes, which is used to depict the comprehensive prediction of the learner's next learning behavior; Step 5.3, Loss function of the personalized exercise recommendation module is: ; wherein, is the total number of all question-answer time combination classes; denotes the true label of the th class; denotes the predicted probability distribution of the th class.
2. The method of claim 1, wherein the method is based on a learning time requirement-aware multi-head self-attention problem recommendation method. In the 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 contains two parts, the problem sequence and the corresponding answer time sequence wherein, is the length of the learning behavior sequence of the current learner, that is, the total number of time steps of the sequence, represents the problem answered at the time step, is the answer time of the problem at the time step; first, is combined with to form the joint input unit of the time step, and the joint input unit of each time step is converted into a unified vector representation through an embedding layer. After embedding, a complete input sequence embedding matrix is formed: ; ; wherein, a vector representation of the learner's answer to the exercise at the time step; an embedding layer of the learning behavior sequence encoding module; an input sequence embedding matrix; Step 2.2, inputting the input sequence embedding matrix into the multi-head self-attention mechanism-long short-term memory network layer to obtain attention output representation; Step 2.3, introducing a feedforward network and a residual connection to convert and normalize the attention output representation to obtain the final learning behavior sequence representation of the learner. 3.The method of claim 2, wherein, The specific process of step 2.2 is as follows: Step 2.2.1, modeling the input sequence embedding matrix using a long short-term memory network to obtain the hidden state of each time step, and the hidden state matrix of all time steps: ; wherein, is a hidden state matrix; is a long short-term memory network; denotes a time step; a time series representation. Step 2.2.2, adding a multi-head self-attention mechanism to the output of the long short-term memory network to capture the dependency between time steps and dynamically allocate attention; the specific process is as follows: First, the hidden state matrix is mapped to a query matrix , a key matrix , and a value matrix : ; ; ; wherein, , , are different learnable parameter matrices; Subsequently, the attention output is calculated based on the scaled dot-product attention mechanism, and the core calculation process is as follows: ; wherein, is a scaled dot-product attention mechanism; is a function; is a transpose symbol; 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: ; ; ; wherein, is the result of the th attention head; , , are the query matrix, key matrix and value matrix of the th attention head, respectively; is the multi-head self-attention mechanism; denotes the number of attention heads, is the projection matrix; is the attention output representation; The calculation formula of step 2.3 is as follows: ; wherein, is a learning behavior sequence representation; is a layer normalization; is a random drop operation; is a nonlinear activation function; , are different learnable parameter matrices; , are different learnable bias terms.
4. The method of claim 3, wherein the method further comprises: In the step 3, the specific working process of the learner global representation network module is as follows: Step 3.1, the interaction behavior between learners and exercises is constructed as a learner-exercise heterogeneous graph , for all learner and exercise nodes, for the edge set, representing the interaction relationship between learners and exercises; each edge in the graph is assigned a weight: if the learner correctly completes an exercise, the weight of the edge is the number of attempts required to complete the exercise; if the learner fails to answer correctly, the edge weight is set to 0; Step 3.2, constructing an improved structural deep network embedding method layer; specifically: First, the constructed learner-item heterogeneous graph after learning is as follows is expressed as an adjacency matrix ; In the encoding stage of the original structure deep network embedding method, the model inputs the adjacency vector of each node into a deep autoencoder to map it into 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 direction consistency of connected nodes in the embedding space; the improved first-order neighbor loss function is f(x) = -log(1+exp(-x)) ; wherein, , are index numbers of different nodes; , are the first , the first nodes, respectively; is a weight of an edge ; , are low-dimensional embedding vector representations of , , respectively; Then, a time-aware second-order proximal loss is designed; the interaction behavior matrix between learners and exercises is cut into multiple time slices according to a time window , each time slice represents the proximal matrix in the first time slice; and the improved time-aware second-order proximal loss function is: ; wherein, is a natural constant; is an adjustable attenuation factor; is the total number of time slices of the time window; is the decoded output of the time slice; represents the adjacency matrix within the time slice; denotes the Frobenius norm, denotes its square; The final optimization objective is the weighted sum of the three losses: ; wherein, is the total loss function for the improved structural deep network embedding method layer; , , are different hyperparameters for balancing the relative importance of the three loss terms; is an L2 norm regularization term; Step 3.3, after inputting the learner-exercise heterogeneous graph into the improved structure deep network embedding method layer, the preliminary learner embedding representation is obtained ; then another multi-head self-attention mechanism-long short-term memory network layer is introduced to the preliminary learner embedding representation for semantic enhancement, and finally the learner global representation is generated .
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