Knowledge tracking method integrating graph embedding and attention

By constructing a correlation structure diagram between questions and skill points, combining the multi-head attention mechanism and the Sigmoid module, the accuracy and computational consumption problems of existing knowledge tracking methods in complex knowledge systems are solved, and efficient and low-power cognitive state prediction is achieved.

CN116611517BActive Publication Date: 2025-09-26ZHUO SHI TECH (HAINAN) CO LTD
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202310481693.X
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2023-04-27
Publication Date
2025-09-26
Estimated Expiration
2043-04-27

AI Technical Summary

Technical Problem

Existing knowledge tracking methods have difficulty in accurately predicting learners' mastery of skill points when dealing with complex knowledge systems, and they have high computational consumption and high training costs.

Method used

By integrating graph embedding and attention mechanisms, we construct a correlation structure diagram between questions and skill points. We use a multi-head attention module and a sigmoid module to predict cognitive states. We combine the correlation, similarity, and difficulty loss functions between questions and skill points to reduce computational complexity.

Benefits of technology

It improves the accuracy of knowledge tracking, reduces computing energy consumption, shortens training time, and achieves low-power and efficient cognitive state prediction.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN116611517B_ABST
    Figure CN116611517B_ABST
Patent Text Reader

Abstract

The present invention discloses a knowledge tracking method that integrates graph embedding and attention. The method obtains several answer records through the background of an online learning system, constructs a correlation structure diagram of questions and skill points, performs graph embedding to obtain the embedding vector of each question node and skill point node, constructs a cognitive state prediction model including a multi-head attention module, a dot product module and a sigmoid module, obtains several answer records of different learners through the background of the online learning system, trains the cognitive state prediction model, and inputs the information of the historical answer records of learners who need to track knowledge into the trained cognitive state prediction model to obtain the predicted probability of the learner answering the next question correctly. The method uses a graph structure to express the correlation relationship between each question and skill point, and encodes the difficulty of the question as attribute information as the basis for cognitive state prediction. Cognitive state prediction is performed based on the self-attention mechanism, thereby improving the accuracy of knowledge tracking.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention belongs to the field of educational data mining technology, and more specifically, relates to a knowledge tracking method that integrates graph embedding and attention. Background Art

[0002] The widespread adoption of large-scale online learning platforms and the application of intelligent teaching data analysis have provided favorable guarantees for personalized and precise teaching. Online learning platforms can store learners' detailed interactions and historical behavior trajectories. Leveraging this data, adaptive learning paths can be generated for individual learners and personalized learning resources can be delivered, achieving personalized teaching tailored to each individual. Knowledge tracing uses the correct and incorrect answers a learner gives to a set of exercises to estimate their mastery of skill points and predict the probability of their correct answer to the next question. However, due to the diversity of learning activities and the complexity of knowledge systems, accurate cognitive status diagnosis remains a challenging task at this stage.

[0003] According to different modeling methods, existing knowledge tracing methods can be divided into three categories: Bayesian Knowledge Tracing (BKT), Additive Factor Model (AFM) based on logistic regression model, and Deep Knowledge Tracing (DKT) based on recurrent neural network.

[0004] The BKT method treats the underlying knowledge state as a binary variable. After each round of learning interaction, a hidden Markov model is used to update the value of the binary variable based on whether the learner has mastered a skill point. However, because the correspondence between skill points and variables in reality is fuzzy, BKT cannot capture the relationship between different skill points and, therefore, loses its ability to model complex knowledge. The AFM method assumes that learning is a gradual process of change rather than a discrete transition. This method incorporates two variables, the number of practice sessions and the learning rate, to express the impact of the learner's knowledge state, transitioning from static assessment to dynamic analysis of knowledge state. However, the AFM method relies heavily on expert experience to annotate domain knowledge, resulting in high labor costs. The DKT method uses a recurrent neural network to predict knowledge state. It converts the input learning state data into a vector representation using one-hot encoding or compressed sensing algorithms. After feature extraction in the input and hidden layers, the output layer predicts the learner's next performance on the test. Compared to traditional machine learning models, recurrent neural networks have the advantages of high-dimensionality and continuous representation of temporal states, making them more suitable for modeling complex knowledge systems. DKT outperforms traditional machine learning methods in predictive performance, but its hidden layer parameters lack interpretability for teaching purposes. For example, questions with the same skill points can vary in difficulty. In recent years, the attention-based Transformer has been widely introduced into deep learning models, effectively improving predictive accuracy. However, its high training cost and computational overhead significantly restrict its application in knowledge tracking tasks. Summary of the Invention

[0005] The purpose of the present invention is to overcome the shortcomings of the existing technology and provide a knowledge tracking method that integrates graph embedding and attention. It uses graph structure to express the relationship between each question and skill point, and encodes the difficulty of the question as attribute information as the basis for cognitive state prediction. It performs cognitive state prediction based on the self-attention mechanism to improve the accuracy of knowledge tracking.

[0006] To achieve the above-mentioned object of the invention, the knowledge tracking method of the present invention integrating graph embedding and attention includes the following steps:

[0007] S1: Obtain several answer records through the online learning system background and extract the question information set from them Skill point information collection Let the number of questions be N X 、N number of skill points S, encode each question and skill point to obtain an M-1 dimensional encoding vector, where the value of M is determined according to actual needs; extract the information of each answer record, including the question code, skill point code, learner number, and learner answer identifier indicating whether the learner answered the question correctly. When the learner answers correctly, the learner answer identifier is 1, otherwise it is 0; generate a historical behavior record set for each learner based on the answer record, where each record contains the question number answered by the learner, the answer identifier, and the skill number set corresponding to the question;

[0008] S2: N X Questions and N S Skill points are taken as nodes. When a question and a skill point appear in the same answer record, an edge is generated at the corresponding node, thereby generating a correlation structure graph G of the question and skill point. An initial vector is generated for each node, and then graph embedding is performed to obtain the embedding vector of each question node and skill point node. The dimension of the embedding vector is M, thus obtaining the question feature matrix and skill point feature matrix

[0009] S3: Build a cognitive state prediction model, including a multi-head attention module, a dot product module, and a Sigmoid module, where:

[0010] The multi-head attention module is used to extract the knowledge state matrix W of size M×M from the learner's D historical answer records using the multi-head attention mechanism and send it to the dot product module, where the query in the multi-head attention mechanism is is the embedding vector x for the question in the dth historical answer record among the learner’s D historical answer records d ,key is the embedding vector s of the skill point in the dth historical answer record among the learner's D historical answer records d , s d Represents the average vector of the skill point embedding vectors involved in the d-th historical answer record, value The answer vector e in the dth historical answer record among the D historical answer records d , e d The answer vector is the concatenation of the encoding vector of the question in the d-th historical answer record and the learner's answer identifier;

[0011] The dot product module is used to embed the vector of the next question to be predicted And the knowledge state matrix W enters the dot product calculation to obtain the feature matrix And sent to the Sigmoid module.

[0012] The Sigmoid module is used to use the Sigmoid nonlinear activation function to activate the feature matrix Processing is performed to obtain the probability that the learner will answer the predicted question

[0013] S4: Obtain several answer records of different learners through the background of the online learning system, and then divide them into answer record sequences of length D+1; for each answer record sequence, obtain the embedding vector x of the question in each answer record d and learner answer mark y d , embed D+1 into the embedding vector and the correct identification y of the first D learners’ answers d As input, the D+1th answer label is used as the expected output to train the cognitive state prediction model;

[0014] S5: For learners who need to track knowledge, obtain their answer records for the most recent D questions and record the embedding vector of each question in the answer record as x′ d , whether the learner answers the question correctly or not is marked as y′ d , the embedding vector of the next question to be answered is recorded as The above information is input into the cognitive state prediction model trained in step S4 to obtain the predicted probability of the learner answering the next question correctly.

[0015] Furthermore, the calculation formula of the loss function Loss used in the graph embedding in step S2 is as follows:

[0016] Loss=(1-α)*(L1(X,S)+L2(X)+L3(S))+(α)*L4(X,S,θ)

[0017] Among them, L1(X,S) represents the correlation loss function between questions and skill points, and the calculation method is as follows:

[0018] For the i-th question and j-th skill point, i∈{1,2,…,N X}, j∈{1,2,…,N S}, let the current eigenvector of the i-th question be x i , let the current eigenvector of the j-th question be s j ,j=1,2,…,N S If there is a connection edge between the i-th question and the j-th skill point in the graph G, let the correlation coefficient r ij =1, otherwise let the correlation coefficient r ij =0; the local proximity between the i-th question and the j-th skill point is calculated using the following formula

[0019]

[0020] Among them, σ() represents the sigmoid nonlinear activation function;

[0021] Then, the following formula is used to calculate the correlation loss function L1(X,S) between the question and the skill point:

[0022]

[0023] L2(X) represents the cross entropy loss function of question similarity, which is calculated as follows:

[0024]

[0025] Among them, r ii′ X Represents the true association between the i-th question and the i'th question. If the i-th question and the i'th question are both neighbor nodes of the same skill point node, then r ii′ X =1, otherwise r ii′ X =0, represents the estimated correlation between the i-th question and the i′-th question,

[0026] L3(S) represents the cross entropy loss function of skill point similarity, which is calculated as follows:

[0027]

[0028] Among them, r jj′ S Represents the true association between the jth skill point and the j′th skill point. If the jth skill point and the j′th skill point are both neighbor nodes of the same question node, then r jj′ S =1, otherwise r jj′ S =0, represents the estimated correlation between skill points,

[0029] L4(Q,S) represents the question difficulty loss function, which is calculated as follows:

[0030] For the i-th question, the correct rate U of the question is obtained based on the answer records collected in step S1. i , and then use the preset nonlinear activation function to map the accuracy rate to the difficulty attribute feature C i =w T U i +b, w, b represent the weight and bias of the nonlinear activation function respectively; LeakyReLu is used as the activation function Ci Processing to obtain the accuracy estimate

[0031]

[0032] Among them, Leak is a constant term;

[0033] Then use the following formula to calculate the difficulty loss function L4(Q,S) of the question:

[0034]

[0035] in, represents the vector consisting of the weight w and bias term b of the nonlinear activation layer, || ||2 represents the calculation of the two-norm, and λ is the coefficient used to control the relationship between the empirical error term and the regularization term.

[0036] Furthermore, the multi-head attention module in step S3 includes a linear transformation module, an attention calculation layer, a splicing layer and a fully connected layer, wherein:

[0037] The linear transformation module includes H groups of linear layers. The value of H should be determined according to actual needs. Each group of linear layers includes the first linear layer, the second linear layer and the third linear layer, which are used to transform the query Q respectively. d , key K d , value V d Perform linear transformation, and then send the query matrix, key matrix, and value matrix after linear transformation to the attention calculation layer. In the h-th group of linear layers:

[0038] The first linear layer is used to process the input query Q d Perform linear calculation to obtain the query matrix Q d,h =Linear(Q d )=Q d W Q,h And sent to the attention calculation layer, where represents the h-th weight matrix of the query;

[0039] The second linear layer is used to transform the input key K d Perform linear calculations to obtain the key matrix K d,h =Linear(K d )=K d W K,h And sent to the attention calculation layer, where represents the h-th weight matrix of the key;

[0040] The third linear layer is used to transform the input value V d Perform linear calculations to obtain the value matrix V d,h =Linear(K d )=Kd W K,h And sent to the attention calculation layer, where represents the h-th weight matrix of the key;

[0041] The attention calculation layer is used to use the attention mechanism to receive the H groups of query matrices Q d,h , key matrix K d,h Sum matrix V d,h Calculate and get the corresponding attention matrix Head h =Attention(Q d,h ,K d,h ,V d,h ), and then sent to the splicing layer;

[0042] The concatenation layer is used to concatenate H attention matrices Head h Splicing, get the multi-head attention matrix Multi_Head(Q,K,V)=Concat(Head1,...,Head H )W O , where W O It is the parameter matrix to be trained, and then the multi-head attention matrix Multi_Head(Q,K,V) is sent to the fully connected layer;

[0043] The fully connected layer is used to reduce the dimensionality of the multi-head attention matrix Multi_Head(Q,K,V) to obtain a knowledge state matrix W of size K×K.

[0044] Furthermore, the calculation method of the attention calculation layer is as follows:

[0045] First, query Q d,h and key K d,h Perform binary quantization operation. The specific method is:

[0046] Let the matrix to be quantized be F, and randomly extract M sub-matrices from the matrix F. As a support sample, γ represents the preset submatrix size, and the submatrices are arbitrarily combined to obtain M×(M-1) submatrix pairs (f m ,f m′ ), m,m′=1,2,…,M and m≠m′; then use the kernel function κ(f m ,f m′ ): Learn a set of hash function mappings H: λ represents the number of hash functions; then the hash function mapping is obtained:

[0047]

[0048] In the above formula, κ() represents the hash kernel function, represents the weight matrix, Used to normalize the kernel function, and the mean of the normalized kernel function is 0, g: is The defined mapping, H(f m ) is the submatrix f m The vector after mapping by the hash function;

[0049] Note query Q d,h The extracted sub-matrix is ​​(q d,h ) m , the vector after hash function mapping is H((q d,h ) m ), key K d,h The obtained sub-matrix is ​​(k d,h ) m , the vector after hash function mapping is H((k d,h ) m ); for the submatrix pair (q d,h ) m ,(k d,h ) m′ ), m, m′=1,2,…,M, and the corresponding vector H((q d,h ) m ) and H((k d,h ) m′ ) as the similarity, and select the first β sub-matrix pairs with the largest similarity to form a set Select the first β pairs of submatrices with the smallest similarity to form a set The value of β is set according to actual needs; then the corresponding attention decay label Y is calculated using the following formula d,h ((q d,h ) m ,(k d,h ) m′ )):

[0050]

[0051] Thus we get the attention decay label matrix Y of size M×M d,h ;

[0052] The attention matrix Head is calculated using the following formula h :

[0053]

[0054] Furthermore, the loss function for cognitive state prediction model training in step S4 adopts a cross entropy loss function.

[0055] The present invention integrates graph embedding and attention knowledge tracking method, obtains several answer records through the background of the online learning system, constructs the association structure diagram of questions and skill points, performs graph embedding to obtain the embedding vector of each question node and skill point node, constructs a cognitive state prediction model including a multi-head attention module, a dot product module and a Sigmoid module, obtains several answer records of different learners through the background of the online learning system, trains the cognitive state prediction model, and for learners who need to track knowledge, inputs their historical answer records into the trained cognitive state prediction model to obtain the predicted probability of the learner answering the next question correctly.

[0056] The present invention has the following beneficial effects:

[0057] 1) The present invention constructs a correlation structure diagram between questions and skill points, and records the learner's interaction with the questions associated with the skill points to realistically simulate the changes in the learner's mastery of the skill points;

[0058] 2) In the process of knowledge state extraction, the present invention combines the attention mechanism to assign differentiated weights to the interaction records of different questions, timely updating the learner's knowledge state characteristics, thereby more accurately predicting the probability of answering the next question correctly;

[0059] 3) The present invention can significantly reduce computing energy consumption and shorten the training time of the cognitive state prediction model through a low-power attention mechanism. BRIEF DESCRIPTION OF THE DRAWINGS

[0060] Figure 1 This is a structural diagram of a specific implementation of the knowledge tracking method that integrates graph embedding and attention in the present invention;

[0061] Figure 2 Schematic diagram of the embedding process in the figure in this embodiment;

[0062] Figure 3 is a structural diagram of the cognitive state prediction model in the present invention;

[0063] Figure 4 This is a structural diagram of the multi-head attention module of this embodiment;

[0064] Figure 5 This is a comparison chart of the knowledge tracking performance of the present invention and the comparative method in this embodiment;

[0065] Figure 6 3 is a comparison chart of the training time of the present invention and the comparative method on the ASSIS09 data set in this embodiment. DETAILED DESCRIPTION

[0066] The following describes the specific embodiments of the present invention in conjunction with the accompanying drawings so that those skilled in the art can better understand the present invention. It should be noted that in the following description, when detailed descriptions of known functions and designs may dilute the main content of the present invention, such descriptions will be omitted here.

[0067] Example

[0068] Figure 1 This is a structural diagram of a specific implementation of the knowledge tracking method of integrating graph embedding and attention in the present invention. Figure 1 As shown in FIG, the specific steps of the knowledge tracking method of integrating graph embedding and attention of the present invention include:

[0069] S101: Obtain knowledge tracking training data:

[0070] Obtain several answer records through the background of the online learning system and extract the question information set from them Skill point information collection Let the number of questions be N X 、N number of skill points S , encode each question and skill point to obtain an M-1 dimensional encoding vector, where the value of M is determined based on actual needs. Extract information from each answer record, including the question code, skill point code, learner ID, and a learner answer identifier indicating whether the learner answered the question correctly. If the learner answers correctly, the learner answer identifier is 1, otherwise it is 0. Based on the answer record, a historical behavior record set is generated for each learner. Each record contains the question number answered by the learner, the answer identifier, and the set of skill numbers corresponding to the question.

[0071] S102: Embedding representation based on graph structure:

[0072] N X Questions and N S Skill points are taken as nodes. When a question and a skill point appear in the same answer record, an edge is generated at the corresponding node, thereby generating a correlation structure graph G of the question and skill point. An initial vector is generated for each node, and then graph embedding is performed to obtain the embedding vector of each question node and skill point node. The dimension of the embedding vector is M, thus obtaining the question feature matrix and skill point feature matrix

[0073] Figure 2 FIG is a schematic diagram of the embedding process in this embodiment. Figure 2As shown, each node in the association structure graph G of questions and skill points is associated with node attributes, node connection edges and relationship attributes. In the graph embedding process, the neighbor sampling of each node in the graph is obtained through aggregation operation, and the node information is updated using the neighbor sampling results to obtain a low-dimensional embedding vector for each node. In order to improve the accuracy of the embedding vector, the present invention takes into account the local dependency between "question-skill point", the similarity between "question-question" and the similarity between "skill point-skill point" in the design of the loss function of graph embedding. At the same time, in order to effectively extract the knowledge contained in the graph structure, the correct answer rate of all learners on the current question node is also converted into attribute features and embedded in the graph structure, so that the question difficulty information is retained in the learned graph embedding vector. The calculation formula of the graph embedding loss function Loss in this embodiment is as follows:

[0074] Loss=(1-α)*(L1(X,S)+L2(X)+L3(S))+(α)*L4(X,S,θ)

[0075] Among them, L1(X,S) represents the correlation loss function between questions and skill points, and the calculation method is as follows:

[0076] For the i-th question and j-th skill point, i∈{1,2,…,N X}, j∈{1,2,…,N S}, let the current eigenvector of the i-th question be x i , let the current eigenvector of the j-th question be s j ,j=1,2,…,N S If there is a connection edge between the i-th question and the j-th skill point in the graph G, let the correlation coefficient r ij =1, otherwise let the correlation coefficient r ij = 0. The local proximity between the i-th question and the j-th skill point is calculated using the following formula:

[0077]

[0078] Here, σ() represents the sigmoid nonlinear activation function. The sigmoid function normalizes the relationship value to the interval [0, 1], thereby converting the relationship value into a probability, which represents the local proximity between the question and the skill. The superscript T indicates transposition.

[0079] Then, the following formula is used to calculate the correlation loss function L1(X,S) between the question and the skill point:

[0080]

[0081] L2(X) represents the cross entropy loss function of question similarity, which is calculated as follows:

[0082] According to the association structure graph G of questions and skill points, if two question nodes have a common neighbor skill point node, the neighbor relationship information can be aggregated as the similarity between the questions. Therefore, the cross entropy loss function L2(X) of the question similarity is calculated using the following formula:

[0083]

[0084] Among them, r ii′ X Represents the true association between the i-th question and the i'th question. If the i-th question and the i'th question are both neighbor nodes of the same skill point node, then r ii′ X =1, otherwise r ii′ X =0, represents the estimated correlation between the i-th question and the i′-th question,

[0085] L3(S) represents the cross entropy loss function of skill point similarity, which is calculated as follows:

[0086] Similar to the question, if two skill point nodes have a few nodes in common neighbors, the relationship information of the neighbors can be aggregated as the similarity between the skill points. Therefore, the cross entropy loss function L3(S) of the question similarity is calculated using the following formula:

[0087]

[0088] Among them, r jj′ S Represents the true association between the jth skill point and the j′th skill point. If the jth skill point and the j′th skill point are both neighbor nodes of the same question node, then r jj′ S =1, otherwise represents the estimated correlation between skill points,

[0089] L4(Q,S) represents the question difficulty loss function, which is calculated as follows:

[0090] The correct rate of all learners on the current question node can be extracted from the answer record. Therefore, in the graph embedding stage, this information is mapped into difficulty attributes and embedded into the graph model as an auxiliary feature for predicting the learner's knowledge status. For the i-th question, the correct rate U of the question is obtained based on the answer records collected in step S101. i , and then use the preset nonlinear activation function to map the accuracy rate to the difficulty attribute feature C i =w T U i +b, w, b represent the weight and bias of the nonlinear activation function respectively. The traditional sigmoid nonlinear activation function is prone to gradient vanishing problem during the model training stage. Therefore, in this embodiment, Leaky Rectified Linear Unit (LeakyReLu) is selected as the activation function for the difficulty attribute feature C. i Processing to obtain the accuracy estimate

[0091]

[0092] Among them, Leak is a constant term used to retain the negative information in the gradient value.

[0093] According to the above formula, when w i T U i +b i When it is less than or equal to 0, the output is forced to be equal to 0. Using the LeakyReLu activation function can make the output have a certain sparsity, thereby speeding up the convergence of the model.

[0094] Then use the following formula to calculate the difficulty loss function L4(Q,S) of the question:

[0095]

[0096] in, represents the vector consisting of the weight w and the bias term b of the nonlinear activation layer, ||||2 represents the calculation of the two-norm, and λ is the coefficient used to control the relationship between the empirical error term and the regularization term, so that the model has better generalization performance.

[0097] In summary, this embodiment adopts joint training in the graph embedding process and uses the gradient descent algorithm for optimization until the loss function no longer decreases, thereby obtaining the trained graph structure embedding information and the embedding vectors of each question node and skill point node.

[0098] S103: Constructing a cognitive status prediction model:

[0099] In order to predict the cognitive state of learners, the present invention constructs a cognitive state prediction model based on the multi-head attention mechanism. Figure 3 This is a structural diagram of the cognitive state prediction model in the present invention. Figure 3 As shown, the cognitive state prediction model in the present invention includes a multi-head attention module, a dot product module and a Sigmoid module, wherein:

[0100] The multi-head attention module is used to extract the knowledge state matrix W of size M×M from the learner's D historical answer records using the multi-head attention mechanism and send it to the dot product module, where the query in the multi-head attention mechanism is is the embedding vector x for the question in the dth historical answer record among the learner’s D historical answer records d ,key is the embedding vector s of the skill point in the dth historical answer record among the learner's D historical answer records d , s d Represents the average vector of the skill point embedding vectors involved in the d-th historical answer record, value The answer vector e in the dth historical answer record among the D historical answer records d , e d Represents the answer vector obtained by concatenating the encoding vector of the question in the d-th historical answer record and the learner's answer identifier.

[0101] Figure 4 This is the structural diagram of the multi-head attention module in this embodiment. Figure 4 As shown, the multi-head attention module in this embodiment includes a linear transformation module, an attention calculation layer, a splicing layer, and a fully connected layer, where:

[0102] The linear transformation module includes H groups of linear layers. The value of H should be determined according to actual needs. Each group of linear layers includes the first linear layer, the second linear layer and the third linear layer, which are used to transform the query Q respectively. d , key K d , value V d Perform linear transformation, and then send the query matrix, key matrix, and value matrix after linear transformation to the attention calculation layer. In the h-th group of linear layers:

[0103] The first linear layer is used to process the input query Q d Perform linear calculation to obtain the query matrix Q d,h =Linear(Q d )=Q d W Q,h And sent to the attention calculation layer, where represents the h-th weight matrix of the query.

[0104] The second linear layer is used to transform the input key Kd Perform linear calculations to obtain the key matrix K d,h =Linear(K d )=K d W K,h And sent to the attention calculation layer, where Represents the h-th weight matrix of a key.

[0105] The third linear layer is used to transform the input value V d Perform linear calculations to obtain the value matrix V d,h =Linear(K d )=K d W K,h And sent to the attention calculation layer, where Represents the h-th weight matrix of a key.

[0106] The attention calculation layer is used to use the attention mechanism to receive the H groups of query matrices Q d,h , key matrix K d,h Sum matrix V d,h Calculate and get the corresponding attention matrix Head h =Attention(Q d,h ,K d,h ,V d,h ), and then sent to the splicing layer.

[0107] Based on the conventional attention calculation method, the attention matrix in this embodiment can be calculated using the following formula:

[0108]

[0109] In order to improve the computational efficiency of the multi-head attention module and reduce computational overhead, a low-power attention mechanism is adopted in this embodiment. The specific method is as follows: Assume that the query Q d and key K d They are all unit vectors, which can be quantized using binarization. The attention mechanism calculation is approximately:

[0110]

[0111] In the above formula, In order to avoid the denominator value being 0, a bias term c is introduced after each inner product operation so that H(Q d,h )H(K d,h ) T +c≥0; H() represents a hash function.

[0112] Although the above formula reduces the complexity of the attention mechanism to linear operations, there are still many floating-point multiplication operations in the formula, which needs further improvement. The specific method is as follows:

[0113] First, query Q d,h and key K d,h Perform binary quantization operation. The specific method is:

[0114] Let the matrix to be quantized be F, and randomly extract M sub-matrices from the matrix F. As a support sample, γ represents the preset submatrix size, and the submatrices are arbitrarily combined to obtain M×(M-1) submatrix pairs (f m ,f m′ ), m,m′=1,2,…,M and m≠m′. Then use the kernel function κ(f m ,f m′ ): Learn a set of hash function mappings H: λ represents the number of hash functions. The multiplication operation between the binary value and the precise floating point value in the above formula is replaced by a simple addition operation, thereby reducing computational energy consumption. At this point, the hash function mapping can be obtained:

[0115]

[0116] In the above formula, κ() represents the hash kernel function, represents the weight matrix, Used to normalize the kernel function, and the mean of the normalized kernel function is 0, g: is The defined mapping, H(f m ) is the submatrix f m The vector after mapping by the hash function.

[0117] Through the above binary quantization, the original high-dimensional query Q d,h and key K d,h Mapping to a low-dimensional space that maintains similarity reduces computational complexity. d,h The extracted sub-matrix is ​​(q d,h ) m , the vector after hash function mapping is H((q d,h ) m ), key K d,h The obtained sub-matrix is ​​(k d,h ) m , the vector after hash function mapping is H((k d,h ) m ). For the submatrix pair (q d,h ) m ,(k d,h ) m′ ), m, m′=1,2,…,M, and the corresponding vector H((qd,h ) m ) and H((k d,h ) m′ ) as the similarity, and select the first β sub-matrix pairs with the largest similarity to form a set Select the first β pairs of submatrices with the smallest similarity to form a set The value of β is set according to actual needs. Then the corresponding attention decay label Y is calculated using the following formula d,h ((q d,h ) m ,(k d,h ) m′ )):

[0118]

[0119] Thus we get the attention decay label matrix Y of size M×M d,h . Attention Matrix Head h By value V d,h With attention decay label Y d,h The specific calculation expression is:

[0120]

[0121] In the above formula, the knowledge state is obtained by linearly transforming the historical problem-solving records and the processing results of all subspaces. It reflects the contribution of different problems to the update of the learner's knowledge state. Therefore, lightweight bit-by-bit operations are used to replace inefficient floating-point multiplication operations, quantifying the learner's mastery of different knowledge points.

[0122] The concatenation layer is used to concatenate H attention matrices Head h Splicing, get the multi-head attention matrix Multi_Head(Q,K,V)=Concat(Head1,...,Head H )W O , where W O It is the parameter matrix to be trained, and then the multi-head attention matrix Multi_Head(Q,K,V) is sent to the fully connected layer.

[0123] The fully connected layer is used to reduce the dimensionality of the multi-head attention matrix Multi_Head(Q,K,V) to obtain a knowledge state matrix W of size M×M.

[0124] The dot product module is used to embed the vector of the question to be predicted And the knowledge state matrix W enters the dot product calculation to obtain the matrix And send it to the Sigmoid module.

[0125] The Sigmoid module is used to use the Sigmoid nonlinear activation function to activate the matrix Processing is performed to obtain the probability that the learner will answer the predicted question

[0126] S104: Training cognitive state prediction model:

[0127] Obtain several answer records of different learners through the background of the online learning system, and then divide them into answer record sequences of length D+1. For each answer record sequence, obtain the embedding vector x of the question in each answer record d and learner answer mark y d , D+1 embedding vectors and the first D learners’ correct answers are identified as y d As input, the D+1th answer label is taken as the expected output to train the cognitive state prediction model.

[0128] In this embodiment, the loss function used in cognitive state prediction model training is a cross entropy loss function, and its calculation formula is as follows:

[0129]

[0130] in, Indicates the real answer mark, p t+1 Represents the answer label predicted based on the learner's current cognitive state. By training the model parameters, the cross entropy value is reduced to ensure that the model's prediction effect gradually approximates the true label.

[0131] S105: Cognitive status prediction:

[0132] For learners who need to track knowledge, obtain their answer records for the most recent D questions and record the embedding vector of each question in the answer record as x′ d , whether the learner answers the question correctly or not is marked as y′ d , the embedding vector of the next question to be answered is recorded as The above information is input into the cognitive state prediction model trained in step S104 to obtain the predicted probability of the learner answering the next question correctly.

[0133] In order to better illustrate the technical effects of the present invention, specific examples are used to experimentally verify the present invention. The present invention adopts three public data sets: ASSISTments2009, ASSISTments2012 and EdNet, and selects the deep knowledge tracking (DKT) model as the comparison method, and uses accuracy (ACC) and area under the curve (AUC) as evaluation indicators to evaluate the technical effects. In this experimental verification, the present invention is divided into two implementation methods: conventional attention mechanism and low-power attention mechanism. Table 1 is a comparison table of evaluation indicators of the present invention and the two comparison methods on three public data sets.

[0134]

[0135] Table 1

[0136] Figure 5 3 is a comparison chart of the knowledge tracking performance of the present invention and the comparative method in this embodiment. Figure 5 In the example, “Normal” indicates that the conventional attention mechanism is used, and “Lite” indicates that the low-power attention mechanism is used. The AUC curves of “Normal” and “Lite” are almost overlapping. As shown in Table 1 and Figure 5 As shown in the figure, the performance of the present invention on three public datasets is significantly better than that of the DKT model in terms of AUC and ACC values ​​on the three datasets, especially on the ASSISTments2009 dataset, where the improvement is the largest, with the AUC value increased to 0.855 and the ACC value increased to 0.831 compared with the DKT method.

[0137] Figure 6 : is a comparison chart of the training time of the present invention and the comparative method on the ASSIS09 data set in this embodiment. Figure 6 As shown in the figure, under the same data set, the training time of the DKT method is 29.83 seconds / round, the conventional attention mechanism used in the present invention is 75.36 seconds / round, and the low-power attention mechanism is reduced to 33.91 seconds / round. Therefore, when the low-power attention mechanism is used in the present invention, the training time is close to that of the classic DKT method, and compared with the conventional attention mechanism, the computational overhead is significantly reduced while maintaining the prediction accuracy.

[0138] Although the above describes the illustrative specific embodiments of the present invention to facilitate understanding of the present invention by those skilled in the art, it should be clear that the present invention is not limited to the scope of the specific embodiments. For those skilled in the art, as long as various changes are within the spirit and scope of the present invention as defined and determined by the appended claims, these changes are obvious, and all inventions and creations using the concepts of the present invention are protected.

Claims

1. A knowledge tracking method that integrates graph embedding and attention mechanism, characterized by: The steps include: S1: Obtain several answer records through the online learning system background and extract the question information set from them Skill point information collection Let the number of questions be N X 、N number of skill points S , encode each question and skill point to obtain an M-1 dimensional encoding vector, where the value of M is determined according to actual needs; extract the information of each answer record, including the question code, skill point code, learner number, and learner answer identifier indicating whether the learner answered the question correctly. When the learner answers correctly, the learner answer identifier is 1, otherwise it is 0; generate a historical behavior record set for each learner based on the answer record, where each record contains the question number answered by the learner, the answer identifier, and the skill number set corresponding to the question; S2: N X Questions and N S Skill points are taken as nodes. When a question and a skill point appear in the same answer record, an edge is generated at the corresponding node, thereby generating a correlation structure graph G of the question and skill point. An initial vector is generated for each node, and then graph embedding is performed to obtain the embedding vector of each question node and skill point node. The dimension of the embedding vector is M, thus obtaining the question feature matrix and skill point feature matrix The calculation formula of the loss function Loss used in graph embedding is as follows: Loss=(1-α)*(L1(X,S)+L2(X)+L3(S))+(α)*L4(X,S,θ) Among them, L1(X,S) represents the correlation loss function between questions and skill points, and the calculation method is as follows: For the i-th question and j-th skill point, i∈{1,2,…,N X }, j∈{1,2,…,N S }, let the current eigenvector of the i-th question be x i , let the current eigenvector of the j-th question be s j ,j=1,2,…,N S If there is a connection edge between the i-th question and the j-th skill point in the graph G, let the correlation coefficient r ij =1, otherwise let the correlation coefficient r ij =0; the local proximity between the i-th question and the j-th skill point is calculated using the following formula Among them, σ() represents the sigmoid nonlinear activation function; Then, the following formula is used to calculate the correlation loss function L1(X,S) between the question and the skill point: L2(X) represents the cross entropy loss function of question similarity, which is calculated as follows: Among them, r ii′ X Represents the true association between the i-th question and the i'th question. If the i-th question and the i'th question are both neighbor nodes of the same skill point node, then r ii′ X =1, otherwise r ii′ X =0, represents the estimated correlation between the i-th question and the i′-th question, L3(S) represents the cross entropy loss function of skill point similarity, which is calculated as follows: Among them, r jj′ S Represents the true association between the jth skill point and the j′th skill point. If the jth skill point and the j′th skill point are both neighbor nodes of the same question node, then r jj′ S =1, otherwise r jj′ S =0, represents the estimated correlation between skill points, L4(Q,S) represents the question difficulty loss function, which is calculated as follows: For the i-th question, the correct rate U of the question is obtained based on the answer records collected in step S1. i , and then use the preset nonlinear activation function to map the accuracy rate to the difficulty attribute feature C i =w T U i +b, w, b represent the weight and bias of the nonlinear activation function respectively; LeakyReLu is used as the activation function C i Processing to obtain the accuracy estimate Among them, Leak is a constant term; Then use the following formula to calculate the difficulty loss function L4(Q,S) of the question: in, represents the vector consisting of the weight w and bias term b of the nonlinear activation layer, || ||2 represents the calculation of the two-norm, and λ is the coefficient used to control the relationship between the empirical error term and the regularization term; S3: Build a cognitive state prediction model, including a multi-head attention module, a dot product module, and a Sigmoid module, where: The multi-head attention module is used to extract the knowledge state matrix W of size M×M from the learner's D historical answer records using the multi-head attention mechanism and send it to the dot product module, where the query in the multi-head attention mechanism is is the embedding vector x for the question in the dth historical answer record among the learner’s D historical answer records d ,key is the embedding vector s of the skill point in the dth historical answer record among the learner's D historical answer records d , s d Represents the average vector of the skill point embedding vectors involved in the d-th historical answer record, value The answer vector e in the dth historical answer record among the D historical answer records d , e d The answer vector is the concatenation of the encoding vector of the question in the d-th historical answer record and the learner's answer identifier; The dot product module is used to embed the vector of the next question to be predicted And the knowledge state matrix W enters the dot product calculation to obtain the feature matrix And send it to the Sigmoid module; The Sigmoid module is used to use the Sigmoid nonlinear activation function to activate the feature matrix Processing is performed to obtain the probability that the learner will answer the predicted question S4: Obtain several answer records of different learners through the background of the online learning system, and then divide them into answer record sequences of length D+1; for each answer record sequence, obtain the embedding vector x of the question in each answer record d and learner answer mark y d , D+1 embedding vectors and the first D learners’ correct answers are identified as y d As input, the D+1th answer label is used as the expected output to train the cognitive state prediction model; S5: For learners who need to track knowledge, obtain their answer records for the most recent D questions and record the embedding vector of each question in the answer record as x′ d , whether the learner answers the question correctly or not is marked as y′ d , the embedding vector of the next question to be answered is recorded as The above information is input into the cognitive state prediction model trained in step S4 to obtain the predicted probability of the learner answering the next question correctly.

2. The knowledge tracking method according to claim 1, characterized in that: The multi-head attention module in step S3 includes a linear transformation module, an attention calculation layer, a splicing layer and a fully connected layer, wherein: The linear transformation module includes H groups of linear layers. The value of H should be determined according to actual needs. Each group of linear layers includes the first linear layer, the second linear layer and the third linear layer, which are used to transform the query Q respectively. d , key K d , value V d Perform linear transformation, and then send the query matrix, key matrix, and value matrix after linear transformation to the attention calculation layer. In the h-th group of linear layers: The first linear layer is used to process the input query Q d Perform linear calculation to obtain the query matrix Q d,h =Linear(Q d )=Q d W Q,h And sent to the attention calculation layer, where represents the h-th weight matrix of the query; The second linear layer is used to transform the input key K d Perform linear calculations to obtain the key matrix K d,h =Linear(K d )=K d W K,h And sent to the attention calculation layer, where represents the h-th weight matrix of the key; The third linear layer is used to transform the input value V d Perform linear calculations to obtain the value matrix V d,h =Linear(K d )=K d W K,h And sent to the attention calculation layer, where represents the h-th weight matrix of the key; The attention calculation layer is used to use the attention mechanism to receive the H groups of query matrices Q d,h , key matrix K d,h Sum matrix V d,h Calculate and get the corresponding attention matrix Head h =Attention(Q d,h ,K d,h ,V d,h ), and then sent to the splicing layer; The concatenation layer is used to concatenate H attention matrices Head h Splicing, get the multi-head attention matrix Multi_Head(Q,K,V)=Concat(Head1,...,Head H )W O , where W O It is the parameter matrix to be trained, and then the multi-head attention matrix Multi_Head(Q,K,V) is sent to the fully connected layer; The fully connected layer is used to reduce the dimensionality of the multi-head attention matrix Multi_Head(Q,K,V) to obtain a knowledge state matrix W of size K×K.

3. The knowledge tracking method according to claim 2, characterized in that: The calculation method of the attention calculation layer is as follows: First, query Q d,h and key K d,h Perform binary quantization operation. The specific method is: Let the matrix to be quantized be F, and randomly extract M sub-matrices from the matrix F. As a support sample, γ represents the preset submatrix size, and the submatrices are arbitrarily combined to obtain M×(M-1) submatrix pairs (f m ,f m′ ), m,m′=1,2,…,M and m≠m′; then use the kernel function Learn a set of hash function mappings H: λ represents the number of hash functions; then the hash function mapping is obtained: In the above formula, κ() represents the hash kernel function, represents the weight matrix, Used to normalize the kernel function, and the mean of the normalized kernel function is 0, g: is The defined mapping, H(f m ) is the submatrix f m The vector after mapping by the hash function; Note query Q d,h The extracted sub-matrix is ​​(q d,h ) m , the vector after hash function mapping is H((q d,h ) m ), key K d,h The obtained sub-matrix is ​​(k d,h ) m , the vector after hash function mapping is H((k d,h ) m ); for the submatrix pair (q d,h ) m ,(k d,h ) m′ ), m, m′=1,2,…,M, and the corresponding vector H((q d,h ) m ) and H((k d,h ) m′ ) as the similarity, and select the first β sub-matrix pairs with the largest similarity to form a set Select the first β pairs of submatrices with the smallest similarity to form a set The value of β is set according to actual needs; then the corresponding attention decay label Y is calculated using the following formula d,h ((q d,h ) m ,(k d,h ) m′ )): Thus we get the attention decay label matrix Y of size M×M d,h ; The attention matrix Head is calculated using the following formula h :

4. The knowledge tracking method according to claim 1, characterized in that: The loss function for cognitive state prediction model training in step S4 adopts the cross entropy loss function.

Citation Information

Patent Citations

  • Knowledge tracking method and system based on self-attention mechanism

    CN113283585A

  • Knowledge tracking method based on graph attention network

    CN114911975A