A knowledge tracking method based on collaborative attention and contrastive learning
By employing collaborative attention and contrastive learning methods, this study simulates the mutual influence between learning ability and knowledge acquisition. It designs a knowledge internalization encoder and performs constrained data augmentation, addressing the issue that the mutual influence between learning ability and knowledge acquisition has not been considered in existing technologies, thereby improving the reliability and accuracy of knowledge tracking.
Patent Information
- Application Number
- CN202410491954.0
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2024-04-23
- Publication Date
- 2025-12-09
- Estimated Expiration
- 2044-04-23
AI Technical Summary
Existing knowledge tracing methods fail to effectively consider the interrelationship between learning ability and knowledge acquisition, neglect the knowledge internalization process, and fail to maintain semantic consistency during data augmentation, resulting in insufficient reliability of decision-making results.
We employ a collaborative attention mechanism to simulate the mutual influence between learning ability and knowledge acquisition. We design a knowledge internalization encoder and utilize top-down attentional priors. Combined with a contrastive learning algorithm, we improve the reliability of the model through constrained data augmentation methods.
It achieves more reliable knowledge tracking, enhances the model's generalization ability and decision accuracy, and is able to better predict learners' knowledge status and answer probability at different points in time.
Smart Images

Figure CN118379166B_ABST
Abstract
Description
TECHNICAL FIELD
[0001] The present application relates to a knowledge tracking method based on collaborative attention and contrast learning, and belongs to the technical field of knowledge tracking. BACKGROUND
[0002] As the core of online learning platforms, intelligent education systems need to achieve two functions: one is to visualize learners' knowledge states, helping them understand their current learning status and adjust their learning strategies; the other is to provide personalized learning services such as recommending appropriate exercises and courses based on predicted knowledge states. The implementation of these functions relies on knowledge tracking, which tracks learners' dynamic knowledge states using their interaction history records. Existing knowledge tracking research mainly includes probabilistic-based and deep learning-based knowledge tracking models.
[0003] According to educational psychology theory, knowledge acquisition is a complex cognitive process mainly influenced by two main factors: learning ability and knowledge mastery. Learning ability determines the strategy and efficiency of acquiring knowledge, while knowledge mastery is the basis for acquiring new knowledge. The two factors influence each other and develop together.
[0004] Therefore, considering the mutual influence between learning ability and knowledge mastery is crucial for knowledge tracking research. Existing models either do not model learning ability or only consider learning ability as an influencing factor of IRT (Item Response Theory) model, which violates the teaching principle that learning ability and knowledge mastery influence each other and develop together, ultimately leading to insufficient reliability of decision results.
[0005] In addition, existing models mainly focus on the answering pattern during the learning process, only capturing superficial knowledge mastery, and do not cover the process of internalizing knowledge into personal cognitive structure. Effective knowledge mastery should reach the application level to flexibly and creatively solve problems, so the key step of internalizing knowledge during the learning process should not be ignored.
[0006] Knowledge tracing is to model the knowledge state of a learner during learning. However, it is challenging to model this process due to the different learning priors and paths of learners. Initially, this problem was solved by traditional methods such as Bayesian knowledge tracing. Later, inspired by psychology and education, researchers proposed IRT-based models that consider learning ability and problem difficulty as influencing factors. However, these factors are artificially extracted and remain the same for each student throughout the learning process. However, the actual learning process is long-term and dynamic, so it is more reasonable to design a dynamic modeling process. With the development of deep learning technology, its powerful feature extraction capability has been applied to the field of knowledge tracing to accurately capture the dynamic knowledge state of learners. DKT is the first knowledge tracing model that uses deep learning technology. It introduces RNN and achieves good results, but it has a long-term dependency problem. DKVMN is more interpretable than DKT because it uses dynamic matrices and static matrices to store knowledge states and knowledge concepts, respectively, unlike DKT, which uses a hidden high-dimensional vector to represent knowledge states. Inspired by the application of Transformer in natural language processing, SAKT and AKT use attention mechanisms to effectively capture the representation of the learning sequence of learners, avoiding the long-term dependency problem. In addition, some researchers combine probabilistic models with deep neural network models, such as Deep-IR, which combines DKVMN and IRT, where learning ability is an influencing factor of the IRT model. Although it has a certain degree of interpretability, it fails to fully consider the complex interaction between learning ability and knowledge state in the refinement of cognitive processes.
[0007] Contrastive learning is an unsupervised learning method that learns high-quality data representations by maximizing the similarity between relevant samples and minimizing the similarity between irrelevant samples. This method usually relies on highly customized rules to generate positive and negative samples and has achieved significant success in computer vision and natural language processing.
[0008] Recently, contrastive learning has also been introduced into the field of knowledge tracing to improve data representation quality and enhance the performance of downstream tasks. Song et al. used node-level and graph-level contrastive learning based on subgraphs of relationships between exercises to obtain high-level semantic representations of exercises and concepts. Lee et al. explored the relationship between semantically similar or dissimilar examples in the learning history to reveal the complexity of the knowledge acquisition process. However, these methods use random node dropping, edge dropping, or random cropping for data augmentation, which can easily cause semantic drift and fail to fully consider the semantic consistency and reliability between augmented samples and original samples.
[0009] Existing knowledge tracing methods still have some shortcomings:
[0010] 1) When modeling the learning process, the mutual influence between learning ability and knowledge acquisition was not considered;
[0011] 2) The process of knowledge internalization was not considered;
[0012] 3) The semantic shift issue was not considered during data augmentation. Summary of the Invention
[0013] To address the above problems, the purpose of this invention is to provide a knowledge tracking method based on collaborative attention and contrastive learning. This method refines the modeling of the cognitive process, uses collaborative attention to simulate the mutual influence between learning ability and knowledge acquisition, then utilizes a top-down attention-guided knowledge internalization process, and finally combines a contrastive learning training algorithm to achieve more reliable knowledge tracking.
[0014] The technical solution adopted in this invention is as follows:
[0015] A knowledge tracking method based on collaborative attention and contrastive learning includes the following steps:
[0016] 1) Constructing learning activity representations: The learner's learning interaction sequence is discrete, that is, the record consisting of question-concept-answer pairs is used as a basic interaction. The original record of the answer is input into the embedding layer to generate the input representation of the model.
[0017] 2) Construct a collaborative attention layer for ability and knowledge to simulate the mutual influence between learning ability and knowledge acquisition, so as to achieve collaborative attention to learning ability and knowledge acquisition during the learning process and acquire knowledge at the comprehension level;
[0018] 3) Construct a knowledge internalization encoder and use top-down attentional priors to guide the knowledge internalization and updating process in order to acquire knowledge mastery at the application level;
[0019] 4) Design contrastive learning algorithms to enrich the representation of learning data, cope with complex situations that arise during the learning process, and improve the reliability of knowledge tracking;
[0020] 5) Extract the knowledge mastery level of the corresponding question at the current moment from the learned knowledge state, and then use it to predict the probability of answering the question correctly at the current moment.
[0021] Furthermore, step 1) specifically involves:
[0022] The learner's learning interaction sequence is discrete, meaning that the record consisting of question-concept-answer pairs is used as a basic interaction. Therefore, the learning record at time t can be represented as x. t =(q t ,c t ,r tTherefore, the learner's interaction sequence can be represented as: X={(q1,c1,r1),…,(q t ,c t ,r t Considering the correlation between different questions containing the same concept, this invention uses a Rasch model-based approach to construct the embedding of questions and concepts, thereby improving the flexibility of the knowledge tracing method. Specifically, it uses the concept c at time t... t To construct the problem embedding q at time t t :
[0023]
[0024] in, It is concept c t Embedded vector, This summarizes question q. t The included concept c t Changes, The question is q. t A scalar difficulty parameter used to control the difficulty deviation between a problem and the concepts it contains.
[0025] Concept c t and answer r t When embedding is used as the embedding of learning activities, since the learner's knowledge state changes steadily over time, there should not be large jumps in their knowledge state at a specific time. Therefore, positional embedding is incorporated into the learning activities to address this situation. Finally, the learning activity embedding i at time t is... t for:
[0026]
[0027] in, Is the answer r? t Embedded vector, This summarizes the concept of inclusion c. t Changes in learning activities This indicates the position of the learning activity at time t.
[0028] Furthermore, step 2) specifically involves:
[0029] 1) Constructing an attention-based capability and knowledge encoder
[0030] Considering forgetting and accumulated learning gains during the learning process, the calculation uses weighted exponential decay to represent the impact of forgetting behavior, and uses max pooling (MaxOut) to expand the attention score to reflect accumulated learning gains. The specific attention calculation method is as follows:
[0031]
[0032]
[0033] where Q, K, V are the query, key and value in the attention network input, respectively, θ is the parameter to control the influence of the forgetting effect on the final weight, d h is the column number of Q, K matrix, i.e., the dimension of the vector, d(Δ t ) is a distance function to measure the distance between the current t time learning and the previous learning, softmax(·) is a normalization function, the output range is (0, 1), and the attention is extended to multiple heads, which is convenient to pay attention to the data from multiple aspects and enhance the representation ability:
[0034] MultiHead(Q,K,V)=concat(h1,h2,…,h n )W o ;
[0035]
[0036] where h i is the i-th attention head, is a learnable parameter matrix, and Q, K, V projection parameter matrices, respectively, and then using residual connection and layer normalization (LayerNorm), the entire encoder is defined as:
[0037] Encoder(Q,K,V)=LayerNorm(MultiHead(Q,K,V)+Q);
[0038] Finally, the learning ability at time t and the knowledge mastery at the memory level are represented as:
[0039]
[0040]
[0041] where,
[0042] 2) Building a collaborative attention module
[0043] The traditional attention mechanism is improved to a collaborative attention mechanism to simulate the mutual attention between learning ability and knowledge mastery. The learning ability and memory level knowledge mastery encoding are sent into the collaborative attention module at the same time, so that the learning ability encoding and knowledge mastery encoding at time t can be obtained as:
[0044]
[0045]
[0046] where, Then the learning ability and knowledge mastery fusion encoding at time t is obtained by two independent feedforward networks FFN, residual connection and normalization:
[0047]
[0048]
[0049] where
[0050] 3) Knowledge mastery at the understanding level
[0051] Strong learning ability and good knowledge mastery of learners usually mean higher problem solving ability, while weak learning ability and knowledge mastery are on the contrary, which shows that learning ability and knowledge mastery enhance each other. Therefore, by combining the two factors, LSTM is used to propagate and fuse the mutual attention information in learning ability encoding and knowledge mastery encoding, so as to obtain the knowledge mastery at the understanding level at time t
[0052]
[0053] Further, step 3) is specifically:
[0054] Knowledge mastery at the understanding level should be internalized into knowledge mastery at the application level to better apply to problem solving, so a knowledge internalization encoder is designed to model this process, and not all knowledge needs to be internalized and updated when updating knowledge internalization. Only the knowledge whose knowledge mastery changes needs to be internalized, so a top-down attention cue prior is designed to guide this process, and the specific design process is as follows:
[0055] ① Initialize a set of knowledge parameters C = (C1, …, C N ) as the knowledge to be internalized, which is taken as the query object in the knowledge internalization encoder;
[0056] ② Sparse reconstruction is performed on the initialized knowledge parameters, and sparse reconstruction depends on prior knowledge. Only those that meet the prior conditions will be selected. Therefore, initialize a prior vector W = (w1, …, w N );
[0057] ③ Use the knowledge mastery at the understanding level to generate specific top-down attention guidance signals:
[0058]
[0059]
[0060] where, is the top-down attention cue prior at time t, is a learnable parameter matrix.
[0061] ④According to the analogy between attention and sparse reconstruction, a top-down version of the attention mechanism is constructed by adding a top-down attention cue signal to the value V while keeping Q and K unchanged, so that the knowledge mastery of the nth knowledge concept at time t is obtained after knowledge internalization encoding:
[0062]
[0063] ⑤Finally, the knowledge state z t is fused by the knowledge mastery of the n knowledge concepts:
[0064] z t ={z t,n n=1,…,N}.
[0065] Further, step 4) is specifically:
[0066] 1) According to previous contrastive learning work, designing a contrastive learning algorithm requires data augmentation of the learning sequence. Given the inherent prerequisite relationship between knowledge concepts, two data augmentation methods are proposed to minimize the semantic deviation between the augmented learning sequence and the original learning sequence.
[0067] ①Record exchange: Considering the inherent relationship between knowledge points, the order of answering questions has a significant impact on the knowledge state, but changing the order of the learning sequence within a small window should not affect the overall knowledge state. To maintain the original semantics as much as possible, two records are randomly exchanged within a small window M.
[0068] ②Noise disturbance: During the answering process, the learner may make mistakes or guess correctly. To offset this situation, random noise is added to the answer sequence at random positions, i.e., adding noise to randomly selected positions and keeping the original state for unselected positions. The addition method is as follows:
[0069] r=r+Δ;
[0070]
[0071] where, r is the embedding of the answer sequence, Δ is the noise vector, ε is the hyperparameter used to control the size of the noise, is a set of noise vectors following uniform distribution, d is the dimension of the noise vector.
[0072] 2) After data augmentation, the embedding of the positive sample question at time t is And interactive embedding Input model, get positive sample knowledge state at t time Finally, the contrastive loss of learner i at t time is calculated as follows:
[0073]
[0074] Where tau is the temperature parameter of contrastive learning, and sim(·) is the cosine similarity function.
[0075] Further, step 5) is specifically:
[0076] 1) Extract the problem q at t+1 time t+1 Knowledge state Used to predict the probability of answering q t+1 , and calculate the prediction loss at t+1 time:
[0077]
[0078]
[0079]
[0080]
[0081] Where alpha i is the attention score of the i-th knowledge concept, delta represents the sigmoid activation function, and the output range is (0, 1), is a learnable parameter matrix, is the probability of answering q t+1 , and is the prediction loss at t+1 time.
[0082] 2) Solve the objective function, considering the contrastive learning process, the final objective function is the fusion of contrastive loss and prediction loss, that is, the loss at the final t time is:
[0083]
[0084] Where lambda is a hyperparameter that controls the contrastive learning signal.
[0085] 3) Finally, use the Adam optimizer to optimize the objective function and update the model parameters.
[0086] By the above technical solution, the present application has the following advantages and beneficial technical effects:
[0087] 1) The knowledge tracking method based on collaborative attention and contrastive learning disclosed in the present application uses collaborative attention to simulate the mutual influence relationship between learning ability and knowledge mastery in the learning process, and realizes collaborative attention between the two.
[0088] 2) The knowledge tracking method based on collaborative attention and contrastive learning disclosed in the application promotes the internalization of knowledge mastery at the understanding level into knowledge mastery at the application level through the designed knowledge internalization encoder, and further designs a top-down attention prompt prior to guide the knowledge internalization process;
[0089] 3) The knowledge tracking method based on collaborative attention and contrastive learning disclosed in the application designs a training algorithm for contrastive learning, and through a limited data enhancement method, complex situations occurring in the learning process are coped with, the reliability of the knowledge tracking result is realized, and the generalization ability of the model is enhanced. BRIEF DESCRIPTION OF DRAWINGS
[0090] Figure 1 is a model mechanism diagram of the method (CCKT) of the application;
[0091] Figure 2 is a collaborative attention structure diagram used in the application;
[0092] Figure 3 is a knowledge internalization encoder structure diagram used in the application;
[0093] Figure 4 is a performance comparison diagram of different variants of the method of the application on four different data sets. DETAILED DESCRIPTION
[0094] In the following description, many specific details are set forth in order to provide a thorough understanding of the present application. However, the present application is not limited to the embodiments described and shown herein, but can be practiced with alternatives within the scope of the present application, which will be apparent to those skilled in the art. Therefore, the present application is not limited to the specific embodiments disclosed below, and the present application is not limited to the specific embodiments disclosed below.
[0095] The application discloses a knowledge tracking method based on collaborative attention and contrastive learning. The method includes three main parts: ability and knowledge collaborative attention layer, knowledge internalization encoder and contrastive learning module. The ability and knowledge collaborative attention layer is used to simulate the mutual influence between learning ability and knowledge mastery in the learning process, and to realize the collaborative attention of learning ability and knowledge mastery in the learning process; the knowledge internalization encoder is used to internalize the knowledge mastery at the understanding level into the knowledge mastery at the application level, and then used for the prediction of future learning performance, to realize the acquisition process of more detailed and complete modeling knowledge; the contrastive learning module is used to deal with complex situations occurring in the learning process, to realize more reliable knowledge tracking.
[0096] The application realizes reliable knowledge tracking by refining the modeling of cognitive processes, considering the mutual influence of learning ability and knowledge mastery in the learning process and the internalization process of knowledge, and designing a training algorithm for contrastive learning.
[0097] The technical solutions of the present application will be described clearly and completely in combination with specific embodiments and the drawings.
[0098] A knowledge tracking method based on collaborative attention and contrast learning includes the following steps:
[0099] Step 1, constructing learning activity representation, the learning interaction sequence of a learner is discrete, that is, the record composed of a problem-concept-answer pair is taken as a basic interaction, the original record of answering a question is input into an embedding layer to generate input representation of a model;
[0100] Step 2, constructing a collaborative attention layer of ability and knowledge, simulating the mutual influence relationship between learning ability and knowledge mastery, realizing collaborative attention of learning ability and knowledge mastery in a learning process, and acquiring knowledge mastery at an understanding level;
[0101] Step 3, constructing a knowledge internalization encoder, and using top-down attention to guide the prior of the internalization updating process of knowledge to acquire knowledge mastery at an application level;
[0102] Step 4, designing a contrast learning algorithm, enriching the representation of learning data, coping with complex situations in a learning process, and improving the reliability of knowledge tracking;
[0103] Step 5, extracting the knowledge mastery level of a corresponding question at a current moment from the learned knowledge state, and then using the knowledge mastery level to predict the probability of answering the question correctly at the current moment.
[0104] The above process can be represented as follows: Figure 1 In the above steps, step 1 corresponds to the embedding layer in the figure, step 2 corresponds to the ability and knowledge encoder layer, step 3 corresponds to the knowledge internalization encoder, the contrast learning in step 4 runs through the whole modeling process, and step 5 corresponds to the prediction layer.
[0105] The present application provides a knowledge tracking method based on collaborative attention and contrast learning, which refines the modeling of a cognitive process, first designs a collaborative attention layer of ability and knowledge to simulate the mutual influence relationship between learning ability and knowledge mastery, then designs a knowledge internalization encoder and uses top-down attention to guide the prior of the internalization process of knowledge, and finally combines a training algorithm of contrast learning to realize more reliable knowledge tracking.
[0106] Example 1
[0107] A knowledge tracking method based on collaborative attention and contrast learning includes the following steps:
[0108] Before model training, the implemented dataset needs to be selected. The implemented dataset of the model is four real public education datasets. The specific statistical information is shown in Table 1. Assist09 and Assist17 are collected from the ASSISTment online learning platform. Statics is collected from the engineering mechanics course of a university. Algebra05 is provided by KDDcup2010 education data mining challenge.
[0109] Table 1 Basic information of dataset
[0110] Dataset Learner Question Concept Interaction record Learner average answer Assist09 4217 26688 123 346860 82.25 Assist17 1709 3162 102 942816 551.68 Statics 333 - 1223 189297 568.46 Algebra05 574 1084 138 809694 1410.62
[0111] In the embodiment, 80% of learners in each dataset are taken as the training set, and 20% of learners are taken as the test set. The input sequence length is fixed to 200. If the learning sequence length of a learner exceeds 200, the entire learning sequence is truncated into multiple input sequences. If the length is not enough, it is filled to 200. All model methods are implemented using the PyTorch framework, and offline area under curve (AUC), accuracy (ACC) and root mean square error (RMSE) are used as evaluation indexes to measure the performance of the method.
[0112] The specific implementation steps are as follows:
[0113] Step 1): The learning interaction sequence of the learner is discrete, that is, the record composed of problem-concept-answer pair is taken as a basic interaction, and the learning record at time t can be expressed as x t t t t Therefore, the interaction sequence of the learner can be expressed as: X={(q1,c1,r1),…,(q t t t Considering the relevance between different problems containing the same concept, the present application uses the Rasch model to construct the embedding of the problem and the concept to improve the flexibility of the knowledge tracking method, that is, the problem embedding q t at time t is constructed by the concept c t at time t:
[0114]
[0115] wherein, is the embedding vector of the concept c t , summarizes the change of the concept c t contained in the problem q t , is the problem q t a scalar difficulty parameter to control the difficulty bias between the problem and the concepts it contains.
[0116] The embedding of the concept c t and the answer r y is fused as the embedding of the learning activity at time t, because the knowledge state of the learner is changing stably over time, the knowledge state at a specific time should not have too much fluctuation, therefore, the position embedding is fused in the learning activity to deal with this situation, and the learning activity embedding i t at the final time t is:
[0117]
[0118] where, is the embedding vector of the answer r t , and summarizes the changes of the learning activity containing the concept c t , and represents the position of the learning activity at time t.
[0119] Step 2): Construct the ability and knowledge collaborative attention layer, which mainly includes three parts, namely the ability and knowledge encoder, the collaborative attention module and the LSTM module;
[0120] ① Construct the ability and knowledge encoder based on attention mechanism
[0121] Considering the forgetting and accumulated learning gains in the learning process, the weight exponential decay is used in the calculation to represent the influence of forgetting behavior, and the MaxOut operation is used to expand the attention score to reflect the accumulated learning gains, and the specific attention calculation method is:
[0122]
[0123]
[0124] where Q, K, V correspond to the query, key value, value in the input of the attention network, θ is the parameter to control the influence of the forgetting effect on the maximum weight, d h is the column number of Q, K matrix, that is, the dimension of the vector, d(Δ t ) is the distance function to measure the distance between the current learning and the previous learning, softmax(·) is the normalization function, the output range is (0, 1), and the attention is expanded to multiple heads, which is convenient to pay attention to the data from multiple aspects and enhance the representation ability:
[0125] MultiHead(Q,K,V)=concat(h1,h2,…,h n )W O ;
[0126]
[0127] where h i is the i-th attention head, is a learnable parameter matrix, and are the projection parameter matrices of Q, K, V, respectively, and residual connection and layer normalization (LayerNorm) are used, and the whole encoder is defined as:
[0128] Encoder(Q, K, V) = LayerNorm(MultiHead(Q, K, V) + Q);
[0129] Finally, the learning ability and the knowledge mastery at the memory level at time t are represented as:
[0130]
[0131]
[0132] where,
[0133] ② Building a collaborative attention module
[0134] There is a complex mutual influence relationship between learning ability and knowledge mastery during the learning process. In order to capture this mutual influence, the learning ability and knowledge mastery state are considered to be mutually concerned in the model, so the traditional attention mechanism is improved to a collaborative attention mechanism, and then the learning ability and the knowledge mastery at the memory level are encoded and sent into the collaborative attention module, as shown in Figure 2 So the learning ability encoding participated by the knowledge mastery at time t and the knowledge mastery encoding participated by the learning ability are obtained as:
[0135]
[0136]
[0137] where, Then the learning ability and knowledge mastery fusion encoding at time t is obtained through two independent feedforward networks FFN, residual connection and normalization:
[0138]
[0139]
[0140] where
[0141] ③ Understanding level knowledge mastery
[0142] The strong learning ability and good knowledge mastery of learners usually means higher problem-solving ability, while the weak learning ability and knowledge mastery are on the contrary, which shows that learning ability and knowledge mastery enhance each other. Therefore, by combining the two factors, LSTM is used to propagate and fuse the mutual attention information in learning ability encoding and knowledge mastery encoding, so as to obtain the knowledge mastery at the understanding level at t time
[0143]
[0144] Step 3): The knowledge mastery at the understanding level should be internalized into the knowledge mastery at the application level to better apply to the problem solving, so a knowledge internalization encoder is designed to model this process. However, not all knowledge needs to be internalized and updated when the knowledge internalization is updated, only the knowledge whose knowledge mastery changes needs to be internalized. Therefore, a top-down attention cue prior is designed to guide this process, and the specific design process is as follows:
[0145] ①Initialize a set of knowledge parameters C=(C1,…,C N ) as the knowledge to be internalized, which is used as the query object in the knowledge internalization encoder;
[0146] ②Sparse reconstruction is performed on the initialized knowledge parameters, and sparse reconstruction depends on prior knowledge. Only those that meet the prior conditions will be selected. Therefore, initialize a prior vector W=(w1,…,w N );
[0147] ③Use the knowledge mastery at the understanding level to generate a specific top-down attention guidance signal:
[0148]
[0149]
[0150] Where is the top-down attention cue prior at t time, is a learnable parameter matrix.
[0151] ④According to the analogy between self-attention and sparse reconstruction, a top-down version of self-attention mechanism is constructed, as shown in Figure 3 , only need to add a top-down attention cue signal to V value, while keeping Q and K unchanged, so the knowledge mastery of the nth knowledge concept at t time is obtained through the knowledge internalization encoder:
[0152]
[0153] ⑤Finally, the knowledge state z t at t time is fused by the knowledge mastery of n knowledge concepts:
[0154] z t = {z t,n : n = 1, …, N};
[0155] Step 4) Designing a contrastive learning training algorithm
[0156] 1) According to previous contrastive learning work, designing a contrastive learning algorithm requires data augmentation of the learning sequence. Given the inherent prerequisite relationship between knowledge concepts, two data augmentation methods are proposed here to minimize the semantic deviation between the augmented learning sequence and the original learning sequence.
[0157] ① Record exchange: Considering the inherent relationship between knowledge points, the order of answering questions has a significant impact on the knowledge state, but changing the order of the learning sequence in a small range should not affect the overall knowledge state. To maintain the original semantics as much as possible, the order of two records is randomly exchanged within a small window range M.
[0158] ② Noise disturbance: Learners may make mistakes or guess correctly during the answering process. To offset this situation, random noise is added to the answer sequence at random positions. The selected positions are added with noise, and the unselected positions remain unchanged. The addition method is as follows:
[0159] r = r + Δ;
[0160]
[0161] where r is the embedding of the answer sequence, Δ is the noise vector, ε is the hyperparameter used to control the size of the noise, is a set of noise vectors following uniform distribution, and d is the dimension of the noise vector.
[0162] 2) After data augmentation, the problem embedding of the positive sample at time t and the interaction embedding are input into the model to obtain the knowledge state of the positive sample at time t Finally, the contrastive loss of learner i at time t is calculated as follows:
[0163]
[0164] where τ is the temperature parameter of contrastive learning, and sim(·) is the cosine similarity function.
[0165] Step 5) Extract the knowledge mastery level of the corresponding problem at the current time from the learned knowledge state, and then use it to predict the probability of answering the problem correctly at the next time. The specific process is as follows:
[0166] 1) Extract the problem q t+1knowledge state for predicting q t+1 The probability of answering correctly, and the prediction loss at time t+1 is calculated:
[0167]
[0168]
[0169]
[0170]
[0171] where α i is the attention score of the ith knowledge concept, and δ represents the sigmoid activation function, with an output range of (0, 1), is a learnable parameter matrix, is the probability of answering correctly for predicting q t+1 , is the prediction loss at time t+1.
[0172] 2) The objective function is obtained, considering the contrast learning process. The final objective function is the fusion of the contrast loss and the prediction loss, i.e. the loss at time t is:
[0173]
[0174] where λ is a hyperparameter that controls the contrast learning signal.
[0175] 3) Finally, the Adam optimizer is used to optimize the objective function and update the model parameters.
[0176] In this embodiment, after designing the model, the specific implementation steps of model training are as follows:
[0177] 1) Model training
[0178] ① First, input the training set into the model in batches, each batch containing a certain number of samples;
[0179] ② On each batch, forward propagation is performed to calculate the model output and loss value;
[0180] ③ According to the loss value, the gradient is calculated by backpropagation, and the model parameters are updated;
[0181] ④ Repeat steps ①-③ until the stopping condition is reached;
[0182] 2) Model saving
[0183] After training is completed, save the weights and parameters of the model;
[0184] 3) Model evaluation
[0185] ① Load the saved model;
[0186] ② Evaluate the performance of the model using the test dataset;
[0187] ③ Similarly, input the test dataset into the model by batch;
[0188] ④ Calculate the performance indicators of the model on the test dataset.
[0189] The parameter settings in the implementation process are as shown in Table 2:
[0190] Table 2 Model parameter configuration
[0191] Model parameter Value Training data proportion 0.8 Batch size 64 Optimizer Adam Loss function Cross-entropy loss function Dropout 0.2 Learning rate 0.001 Embedding dimension d h ]]> 128 Hyperparameter λ 0.01 Noise perturbation control parameter ε 0.5 Record interaction window value M 3 Knowledge parameter N 16
[0192] In addition to using the method of the present application (CCKT) for knowledge tracking tasks, the same data is used for several classic knowledge tracking methods for performance comparison, including the DKT model based on RNN, the DKVMN model based on dynamic key-value network, the AKT and SAKT models based on attention mechanism, and the CL4KT and DTransformer models based on attention mechanism and contrast learning. In order to compare fairly, the best result of the model performance prediction is taken as the comparison result.
[0193] The test results of different methods are shown in Table 3, and the best results are shown in bold.
[0194] Table 3 Overall performance comparison of different methods on four datasets
[0195]
[0196] As can be seen from Table 3, on all four datasets, the performance of the method of the present application (CCKT) is more superior than that of other classic knowledge tracking methods, which shows the effectiveness of the method of the present application. In addition, CCKT, like CL4KT and DTransformer, although all use the way based on attention mechanism and contrast learning, the performance of CCKT method is more superior, which further verifies that mining the relationship between learning ability and knowledge mastery can achieve better knowledge state tracking.
[0197] In order to evaluate the influence of different parts of the method of the present application on performance, several variants of the method of the present application are tested on the dataset:
[0198] (1) CCKT-CL: excluding contrast learning;
[0199] (2) CCKT-Prompt: does not contain top-down attention prompt prior;
[0200] (3) CCKT-CL-Prompt: neither consider contrastive learning nor consider top-down attention prompt prior.
[0201] Results are shown in Table 2. Figure 4 It is shown that the lack of any one part will affect the model performance to varying degrees, indicating the effectiveness of each component. The performance decline of CCKT-Prompt shows that the introduction of top-down attention prompt prior helps to guide the internalization update of knowledge; the significant performance decline of CCKT-CL highlights the important role of contrastive learning in obtaining rich data representation.
[0202] The above is only the preferred embodiment of the present application, and does not limit the present application in any form. Any simple modification, equivalent change and modification of the above embodiment without departing from the technical solution content of the present application, according to the technical essence of the present application, all still belong to the scope of the technical solution of the present application.
Claims
1. A knowledge tracing method based on co-attention and contrastive learning, characterized in that, Comprising the following steps: 1) Constructing a learning activity representation, the learning interaction sequence of a learner is discrete, that is, the record composed of question-concept-answer pairs as a basic interaction, input the original record of answering into the embedding layer, and generate the input representation of the model; 2) Constructing a collaborative attention layer of ability and knowledge, simulating the mutual influence relationship between learning ability and knowledge mastery, realizing the collaborative attention of learning ability and knowledge mastery in the learning process, and obtaining the knowledge mastery at the understanding level; 3) Constructing a knowledge internalization encoder, which is based on attention mechanism and uses top-down attention prompt prior to guide the internalization update process of knowledge, so as to internalize the knowledge mastery at the understanding level to obtain the knowledge mastery at the application level; The knowledge mastery at the understanding level should be internalized to the knowledge mastery at the application level to better apply to problem solving, so a knowledge internalization encoder is designed to model this process, and not all knowledge needs to be internalized during the knowledge internalization update, only the knowledge whose mastery changes needs to be internalized, so a top-down attention prompt prior is designed to guide this process, the specific design process is as follows: ① Initialize a set of knowledge parameters C = (C1, ..., C N As the knowledge to be internalized, it is used as the query object in the knowledge internalization encoder, where N is the number of initialized knowledge parameters; ②The initialized knowledge parameters are sparsely reconstructed, and the sparse reconstruction depends on prior knowledge, only those meeting the prior conditions will be selected; therefore, the prior vector W=(w1,...,wn) is reinitialized N , and N is the number of initialized prior vectors. ③ Use the knowledge mastery at the understanding level to generate specific top-down attention guidance signals: where is element-wise multiplication, cosine_sim(,) denotes cosine similarity calculation, is the top-down attention cue prior at time t, W1, W2, are learnable parameter matrices, b1, b2 are bias terms, is the knowledge mastery representation at the understanding level at time t, is the knowledge mastery representation at the understanding level at time t with the prior knowledge mastery representation w t the similarity vector calculated ③ According to the analogy between attention and sparse reconstruction, a top-down version of attention mechanism is constructed, which only adds a top-down attention prompt signal to the V value in attention calculation, while keeping Q and K unchanged, so as to obtain the knowledge mastery representation of the nth knowledge concept at time t through the knowledge internalization encoder is: wherein C n is the nth knowledge concept to be internalized, q j is the jth question embedding vector, is the jth question corresponding understanding level knowledge mastery representation, is the jth question attention guidance signal; (4) Finally, the learner's knowledge state z at time t t is composed of the joint knowledge mastery of all N knowledge concepts: 4) Designing a contrastive learning algorithm to enrich the representation of learning data, dealing with complex situations in the learning process, and improving the reliability of knowledge tracking; 5) Extract the knowledge mastery level of the corresponding question at the current time from the learned knowledge state, and then use it to predict the probability of answering the question correctly at the current time.
2. The knowledge tracing method of claim 1, wherein, Step 1) is specifically: The learning interaction sequence of the learner is discrete, that is, the record composed of the question-concept-answer pair is taken as a basic interaction, and the learning record at a certain t time can be expressed as x t =(q t ,c t ,r t ) ; therefore, the interaction sequence of the learner can be expressed as: X={(q1,c1,r1),…,(q t ,c t ,r t )}; Considering the relevance between different problems containing the same concept, the flexibility of the knowledge tracking method is improved by constructing the embedding of problems and concepts based on the Rasch model, i.e. by constructing the embedding of problems at time t q t at time t using the concepts c t : wherein, is a concept c t embedding vector, is a vector of the same dimension as the embedding vector that summarizes the variation of the concept c t contained in the question q t , is a scalar difficulty parameter of the question q t that controls the difficulty bias between the question and the concept it contains. Concept c t and answer r t When embedding is used as the embedding of learning activities, since the learner's knowledge state changes steadily over time, there should not be large jumps in their knowledge state at a specific time. Therefore, positional embedding is incorporated into the learning activities to address this situation. Finally, the learning activity embedding i at time t is... t for: wherein, is an embedding vector answering r t , is a vector of the same dimension as the embedding vector summarizing the changes in the learning activity containing the concept c t , t denotes the position embedding vector of the corresponding learning activity at time t.
3. The knowledge tracing method of claim 1, wherein, Step 2) is specifically: 1) Constructing an ability and knowledge encoder based on attention mechanism Considering the forgetting and cumulative learning gains in the learning process, the weight exponential decay is used in the calculation to represent the influence of forgetting behavior, and the MaxOut operation is used to expand the attention score to reflect the cumulative learning gains, and the specific attention calculation method is as follows: Wherein Q, K, V correspond to the query, key value, value in the attention network input respectively, θ is the parameter for controlling the influence of the forgetting effect on the maximum weight, d h is the column number of Q, K matrix, that is, the dimension of the vector, d(Δ t ) is the distance function between the current t moment learning and the previous learning, softmax(·) is the normalization function, the output range is (0, 1), and the attention is extended to n heads, wherein n is a positive integer, the multiple head design of attention is convenient to pay attention to the data from multiple aspects, and the representation ability is enhanced, and the multiple head design process can be represented as: MultiHead(Q, K, V) = concat(h1, h2,..., hn, V) Wn n )W O ; where h i = Attention(QW i Q ,KW i K ,VW i V ); where h i is the i-th attention head, W O is a learnable parameter matrix, and W i Q ,W i K ,W i V are the projection parameter matrices for Q, K, V, respectively, and residual connections and layer normalization (LayerNorm) are used, and the entire encoder is defined as: Encoder(Q,K,V)=LayerNorm(MultiHead(Q,K,V)+Q); Finally, the learning ability encoding at time t and the knowledge mastery encoding at the memory level is represented as: where I 1:t = {i1, i2, …, it} represents the sequence of learning activity embedding vectors for consecutive 1 to t time instants. t-1 , t 2) Constructing a collaborative attention module The traditional attention mechanism is improved into a collaborative attention mechanism, mutual attention between simulation learning ability and knowledge mastery is realized, learning ability and knowledge mastery at the memory level are encoded, and the encoded learning ability and knowledge mastery at the memory level are simultaneously sent into the collaborative attention module, so that learning ability coding of knowledge mastery at time t is obtained and learning ability coding of knowledge mastery Then, the learning ability fusion encoding at time t is obtained through two independent feedforward neural networks FFN, a residual connection, and normalization and knowledge mastery fusion encoding is: 3) Knowledge mastery at the understanding level Strong learning ability and good knowledge mastery of learners usually means higher problem-solving ability, while weak learning ability and knowledge mastery are on the contrary, which shows that learning ability and knowledge mastery enhance each other; therefore, by combining the two factors, the mutual attention information in the learning ability encoding and the knowledge mastery encoding is propagated and fused using the LSTM, so as to obtain the knowledge mastery at the understanding level at t time 4. The knowledge tracing method of claim 1, wherein, Step 4) is specifically: 1) According to the previous contrastive learning work, the contrastive learning algorithm needs to be designed first, and the learning sequence needs to be augmented, considering the inherent prerequisite relationship between knowledge concepts, this paper proposes two data augmentation methods to minimize the semantic deviation between the augmented learning sequence and the original learning sequence; ① Record exchange: Considering the inherent relationship between knowledge points, the order of answering has a significant impact on the knowledge state, but the change of the order of the learning sequence in a small window range M should not affect the overall knowledge state; In order to maintain the original semantics as much as possible, this paper adopts the method of randomly exchanging the order of two records within a small window range M; ② Noise disturbance: During the answering process, the learner may make mistakes or guess correctly, in order to offset this situation, random noise is added to the answer sequence at a random position, that is, noise is added to the randomly selected position, and the original state is retained at the position not selected, the addition method is as follows: r=r+Δ; ‖Δ‖2= ε, where r is the embedding of the answer sequence, Δ is a noise vector, and ε is a hyperparameter that controls the magnitude of the noise, is a set of noise vectors that follow a uniform distribution, denoted by U(0, 1). 2) After data augmentation, the positive sample problem embedding at time t and interaction embedding Input model, get the knowledge state of the positive sample at time t Finally, calculate the contrastive loss of learner i at time t As follows: where τ is a temperature parameter for contrastive learning, used to adjust the similarity distribution between samples, denotes the knowledge state of learner i at time t, is the positive sample representation after data augmentation, denotes the knowledge state of learner j at time t, is the positive sample representation after data augmentation, sim(·) is the cosine similarity function, e () denotes the natural exponential function, log() denotes the logarithmic function.
5. The knowledge tracing method of claim 1, wherein, Step 5) is specifically: 1) Extract the knowledge state of question q at time t+1 t+1 for predicting q t+1 the probability of answering correctly, and compute the prediction loss at time t+1: where, a i is the attention score of the i-th knowledge concept, z t,i is the mastery level of the i-th knowledge concept at time t, z t,j is the mastery level of the j-th knowledge concept at time t, denotes the transpose of the question vector q t+1 , N is a positive integer, indicating that there are N knowledge concepts, δ represents the sigmoid activation function, the output range is (0, 1), W h is a learnable parameter matrix, b h is a bias term, y t+1 is the real answer situation of the learner, is the probability of predicting q t+1 to be correct, is the predicted loss at time t+1; 2) Obtain the objective function, taking into account the contrast learning process, the final objective function is the fusion of the contrast loss and the prediction loss, that is, the loss at the final t time is: wherein λ is a hyperparameter controlling the contrastive learning signal, is the contrastive learning loss computed at time t; 3) Finally, the objective function is optimized using the Adam optimizer, updating the model parameters.
Citation Information
Patent Citations
Knowledge and capability binary tracking method based on continuous matrix decomposition
CN112528221A
Cognitive description fused attention knowledge tracking method
CN114021722A