A programming knowledge tracking method integrating code and score information

By constructing a programming knowledge tracking model that integrates code and score information, and using PEBG, CodeBERT and GRU models, the problem of failing to effectively utilize score information in the existing technology is solved, and the accuracy and performance of knowledge tracking in programming learning tasks are improved.

CN118569447BActive Publication Date: 2024-10-29JIANGXI NORMAL UNIV
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202411038874.6
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2024-07-31
Publication Date
2024-10-29
Estimated Expiration
2044-07-31

AI Technical Summary

Technical Problem

Existing programming knowledge tracking models fail to effectively utilize the code score information submitted by students in programming learning tasks, resulting in inaccurate predictions of students' knowledge status, especially when most questions in programming exercises do not have a unique standard answer.

Method used

A programming knowledge tracking method that integrates code and score information is adopted. By constructing a programming knowledge tracking model including a problem representation module, a code representation module and a dual sequence modeling module, the PEBG model, CodeBERT model and GRU model are used, combined with the product layer and Exponentially decaying attention mechanism to generate enhanced code representation and make final correctness prediction.

Benefits of technology

The performance of the knowledge tracking model on programming learning tasks is improved. By fusing score information and question-related information, the code representation ability is enhanced, and the prediction accuracy of students' programming ability and knowledge mastery is improved.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN118569447B_ABST
    Figure CN118569447B_ABST
Patent Text Reader

Abstract

The invention discloses a programming knowledge tracking method integrating code and score information, comprising the following steps: expressing the historical programming behavior of college students as historical coding events in an online question judging system OJ; inputting each programming problem in a student programming behavior data set into a problem representation module, and uniformly generating a problem representation containing knowledge points and difficulty information for each programming problem; the code representation module uses a pre-training technology to construct a supervised pre-training task to train itself, and during the training process, the code submitted by the college students, the programming problem and the problem representation of the programming problem are integrated to generate an enhanced code representation; the problem representation and the enhanced code representation of the programming problem are input into a dual sequence modeling module to perform a final correctness prediction; the invention constructs a supervised pre-training task by using the pre-training technology, further integrates the score information and the problem-related information, and enhances the representation ability of the code.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the field of computer technology, and in particular to a programming knowledge tracking method that integrates code and score information. Background Art

[0002] Knowledge tracking is one of the key research areas for personalized education empowerment, which aims to predict students' future problem-solving performance based on changes in their knowledge status. In programming learning, since most problems have non-unique solutions, the task of programming knowledge tracking is challenging. Existing work has shown that considering code information can effectively improve the performance of knowledge tracking models in programming learning tasks. However, the way existing programming knowledge tracking models consider code information is still relatively simple, and fail to take into account the score information corresponding to the code.

[0003] The study of analyzing the changes in students' knowledge status is called knowledge tracking, which has been one of the hot topics of interest to both researchers and educators in recent years. Knowledge tracking captures the changes in students' knowledge status through their historical answer records and predicts their future performance in solving problems, so as to provide personalized suggestions.

[0004] The general form of knowledge tracing questions uses only two sequences, which are which questions the students have tried and whether each attempt is correct, which makes the knowledge tracing model widely applicable in different fields. With the rise of online programming education, more and more beginners choose to learn programming through online platforms. Therefore, how to help students learn programming through knowledge tracing technology is a current research hotspot. Unlike exercises in traditional fields, most questions in programming exercises do not have a unique standard answer. Students can write code based on their knowledge to answer open questions, which brings challenges to the programming knowledge tracing task. Specifically, when students answer programming exercises, they write code based on their understanding of the problem. After submission, the OJ (online evaluation) system determines whether the code is correct, that is, whether it passes all test cases, and gives corresponding scores based on the number of test cases passed by the code. The goal of programming knowledge tracing is to predict whether students can write corresponding correct code for specified problems in the future based on their historical programming sequences. The knowledge tracing model in traditional fields only considers the correctness of students' answers and ignores the specific content of their answers, so it is not completely applicable to the teaching scenario of students' programming learning.

[0005] In order to improve the performance of knowledge tracking models in programming learning tasks, some studies have tried to introduce the code information submitted by students into the model. However, the existing programming knowledge tracking model considers code information in a relatively simple way, ignoring the score information corresponding to the code submitted by students. In fact, when the OJ system determines that the code is wrong, the situation of passing the test case can be divided into two types: all failed and partially passed. The former scores 0, and the latter scores between 0 and 1. Although the submissions in these two cases are both error codes, the student knowledge status reflected in them is different. In comparison, passing some test cases should be regarded as having a better knowledge status. Summary of the invention

[0006] In view of the deficiencies in the prior art, the present invention provides a programming knowledge tracking method that integrates code and score information, which aims to solve the problems mentioned in the background technology.

[0007] To achieve the above object, the present invention provides the following technical solution: a programming knowledge tracking method integrating code and score information, comprising the following steps:

[0008] Step S1: Construct a student programming behavior dataset, which includes several complete code submissions of several college students for multiple programming problems; code submissions that pass the test case are considered correct submissions, otherwise they are considered incorrect submissions;

[0009] Step S2: taking the historical programming lines of college students as historical coding events in the online question-judging system OJ;

[0010] Step S3: construct a programming knowledge tracking model PKT-ICS, which consists of a problem representation module, a code representation module and a dual sequence modeling module; the problem representation module adopts the PEBG model, the code representation module adopts the CodeBERT model and the GPT-2 encoder; the dual sequence modeling module adopts two independent GRU models;

[0011] Step S4: input each programming problem in the student programming behavior dataset into the problem representation module, and output the problem representation of each programming problem, where the problem representation of each programming problem includes the knowledge points and difficulty information of the programming problem;

[0012] Step S5: The score information corresponding to the code submitted by the college students is used as the target of the code representation module, and the code, programming problems and problem representations of the programming problems submitted by the college students are used as the input of the code representation module. A supervised pre-training task is constructed to train the code representation module. During the training process, the code, programming problems and problem representations of the programming problems submitted by the college students are fused using a product layer to generate an enhanced code representation; wherein the score information corresponding to the code submitted by the college students is divided into three categories: all failed, represented by 0; partially passed, represented by 0~1; all passed, represented by 1;

[0013] Step S6: Input the problem representation and enhanced code representation of the programming problem into the dual sequence modeling module, use two independent GRU models to model the problem representation and enhanced code representation of the programming problem respectively, and add an exponential decay attention mechanism to perform weighted summation on the modeled problem representation and enhanced code representation of the programming problem respectively, and finally fuse them for the final correctness prediction.

[0014] Furthermore, the historical encoding event at each time step t in step S2 is represented by a four-tuple p t ,s t ,c t ,r t Indicates that, p t represents the programming problem at the tth time step, s t Indicates that p t The corresponding knowledge concept set; c t The code submitted by the college students at the tth time step; r t is the response of the online judging system OJ to the code submitted by the college student at the tth time step, indicating whether the student has solved the problem correctly, that is, the college student's code has passed the test after submission; the sequence of historical coding events is set to {(p1, s1, c1, r1), ..., (p t-1 ,s t-1 ,c t-1 ,r t-1 )}, the tracking target is the predicted input p t ,s t Time t The value of t-1 represents the programming problem at the t-1th time step; s t-1 Indicates that p t-1 The corresponding knowledge concept set; c t-1 Code submitted by college students at the t-1th time step; r t-1 is the response of the online judging system OJ to the code submitted by the college students at the t-1th time step.

[0015] Furthermore, for each programming problem and knowledge point in the student programming behavior dataset, the PEBG model is used to calculate the neighborhood set of programming problems, the neighborhood set of knowledge points, and the difficulty information of programming problems. At the same time, the initialized programming problem embedding and knowledge point embedding ,in, represents the set of real numbers; Represents the spatial dimensions of programming problems and knowledge points in the input PEBG model;

[0016] The correlation between each programming problem and the knowledge point, the neighborhood set of the programming problem, the neighborhood set of the knowledge point and the difficulty information of the programming problem are used as constraints to optimize the embedding of programming problems. and knowledge point embedding ;

[0017] Embed optimized programming problems into And knowledge point embedding The difficulty information of the programming problem is fused using a product layer to obtain the embedding vector of the programming problem. , that is, the problem representation of the programming problem.

[0018] Furthermore, in step S5, the CodeBERT model consists of an input layer, an embedding layer, and a bidirectional Transformer encoder layer, and the CodeBERT model is fine-tuned before use.

[0019] Furthermore, the specific process of step S5 is: using the input layer to process the code word segmentation submitted by college students into the original code text sequence, and adding a mark at the beginning of the original code text sequence , get the original code text word sequence , Indicates the first word in the original code text segmentation sequence word, will Input to the embedding layer to get the embedding vector of the code text , Indicates The embedding vector of the code text corresponding to the word, and then the embedding vector of the code text is Contextual semantic encoding, and finally output the semantic features of the code text , Indicates The final output code text semantic features corresponding to the words are shown in the formula:

[0020] (1);

[0021] In the formula, n is the number of participles; ; is the output dimension of the bidirectional Transformer encoder layer; represents the CodeBERT model;

[0022] Select the output vector of the last layer of the bidirectional Transformer encoder layer , as a sequence representation of code text ;

[0023] Use the GPT-2 encoder to obtain the question text representation; specifically, set the question text to , the GPT-2 encoder first converts the question text Decomposed into word tokens, in the word embedding layer of the GPT-2 encoder, each word token corresponds to an embedding vector ,in, Represents the dimension of the embedding vector space. The question text is processed by the word embedding layer of the GPT-2 encoder to generate a set of word embeddings , Indicates The vector representation corresponding to the word embedding is calculated, and the average value of the word embedding is obtained to obtain the question text representation ;

[0024] Learning with product layers , and The high-order mutual relationship between , and Mapped to the same low-dimensional feature space, expressed as:

[0025] (2);

[0026] In the formula, express , and The Class representation, and are the weight matrix and bias term of the corresponding linear layer respectively; After dimensionality reduction , and No. Class representation;

[0027] Then, capture the reduced dimension , and The linear relationship matrix between With the binary relationship matrix , expressed as:

[0028] (3);

[0029] (4);

[0030] In the formula, represents binary feature interactions, After dimensionality reduction , and No. Class representation; Indicates a congruence relationship;

[0031] Will Defined as the vector inner product: Next, we introduce a product layer to transform the linear relationship matrix With the binary relationship matrix Convert to linear relationship vectors respectively With the binary relationship vector , expressed as:

[0032] (5);

[0033] (6);

[0034] In the formula, and are all weights in the product layer; represents element-by-element multiplication; d is and The transformation dimension, and The dimensions after transformation are the same; express The d-th scalar value in ; express The d-th scalar value in ; express The nth scalar value in ; express The nth scalar value in ; and Represents the linear relationship matrix The number of rows and columns; and Represents the binary relationship matrix The number of rows and columns;

[0035] Finally, the enhanced code is calculated :

[0036] (7);

[0037] In the formula, represents the activation function; , and the bias vector ;

[0038] In the enhanced code representation After that, a fully connected layer is used to enhance the code representation Processing to get the predicted code category , and finally the predicted code category The corresponding score information is used as the target to calculate the cross entropy loss function between the predicted code category and the actual code category. , the formula is as follows:

[0039] (8);

[0040] In the formula, is the number of codes; is the code submission category; It is Code belongs to The actual label of the class, represented by one-hot encoding; It is The code is predicted to be The probability of the class.

[0041] Furthermore, the specific process of step S6 is: the problem representation sequence of the programming problem and the enhanced code represents the sequence They are input into two independent GRU models respectively. Each time step of the GRU model represents each cycle. Each cycle has corresponding input and output. Each GRU model has two inputs. The input of the GRU model that receives the problem representation sequence is the output of the previous cycle. And the input of this loop ; The input of the GRU model that receives the enhanced code representation sequence is the output of the previous cycle And the input required for this loop ; For the GRU model arrive At each time step, Equation (9) is applied to update the hidden state vector in the problem representation sequence of the programming problem and the enhanced code represents the hidden state vector in the sequence :

[0042] (9);

[0043] In the formula, and The weight coefficients in the problem representation sequence for programming problems; and is the weight coefficient in the enhanced code representation sequence; and They are the bias terms of the problem representation sequence and the enhanced code representation sequence of the programming problem; represents the hyperbolic tangent activation function; Problem representation of programming problems at k time steps; Represents the enhanced code representation at k time steps;

[0044] Use the attention mechanism to predict college students at time step The performance of the current programming problem The similarity is calculated between the hidden state vector in the problem representation sequence of the programming problem at the previous time step and the hidden state vector in the enhanced code representation sequence, and weights are assigned according to the size of the similarity. The similarity is calculated as follows:

[0045] (10);

[0046] In the formula, and Respectively represent the time step arrive of and The transpose of the concatenation matrix; represents a fully connected layer; a similarity vector representing a problem representation of a programming problem and a hidden state in a sequence of problem representations of the programming problem; Similarity vectors between hidden states in a sequence of problem representations and augmented code representations representing a programming problem;

[0047] Before applying the softmax function, an exponential decay is added to the similarity matrix to obtain the normalized attention mechanism weights:

[0048] (11);

[0049] (12);

[0050] In the formula, represents the normalized attention mechanism weight vector in the question sequence; represents the normalized attention mechanism weight vector in the code sequence; is the exponential decay hyperparameter; is the time step vector; represents the exponential function;

[0051] Through arrive of and Weighted summation is used to obtain the college students’ Programming knowledge level at that time and coding skills :

[0052] (13);

[0053] (14);

[0054] Finally, and Concatenate and input into the fully connected layer to get the final prediction probability ;

[0055] (15);

[0056] In the formula, represents the sigmoid function, Indicates splicing;

[0057] Get the prediction result based on the prediction probability , calculate the prediction results The binary cross entropy loss between the actual result and the actual result is used to update the parameters of the GRU model and the fully connected layer. , expressed as:

[0058] (16);

[0059] In the formula, represents the binary cross entropy loss function; represents the true value at time k; Represents the predicted value at time k.

[0060] Furthermore, in the problem representation module, the dimensions of programming problem embedding and problem representation of programming problems are set to 64 and 128 respectively, the batch size is set to 8, the learning rate is set to 1e-3, the Adam optimizer is used, the Dropout regularization technique is adopted, and the probability value is set to 0.5; in the code representation module, the dimensions of code text, the dimensions of problem text representation, and the dimensions of enhanced code representation are all set to 768, and the batch size is set to 32; when fine-tuning the CodeBERT model, the learning rate is set to 1e-5, and the learning rates of the product layer and the fully connected layer in the CodeBERT model are set to 1e-4, Adam is used as the optimizer, and the Dropout regularization technique with a probability value of 0.5 is adopted.

[0061] Compared with the existing technology, the present invention has the following beneficial effects: the present invention constructs a supervised pre-training task by using pre-training technology, taking score information as the target, and taking code text, question text and question representation containing knowledge points and difficulty information as input. During the training process, the three inputs are fused using a product layer to generate a more effective code representation, and based on this, a new programming knowledge tracking model is proposed. Different from the existing programming knowledge tracking model, the programming knowledge tracking model of the present invention further integrates score information and problem-related information on the basis of considering code information, thereby enhancing the representation ability of the code and improving the performance of the knowledge tracking model in programming learning tasks. BRIEF DESCRIPTION OF THE DRAWINGS

[0062] Figure 1 The present invention is a flow chart of the method. DETAILED DESCRIPTION

[0063] like Figure 1 As shown, the present invention provides a technical solution: a programming knowledge tracking method integrating code and score information, comprising the following steps:

[0064] Step S1: Construct a student programming behavior dataset; the student programming behavior dataset uses the CodeWorkoutdataSpring2019 dataset publicly released by the CSEDM data challenge, hereinafter referred to as the CSEDM dataset. Before use, the CSEDM dataset is preprocessed; the CSEDM dataset contains 46,825 complete code submissions for 50 programming problems by 246 college students throughout the semester, covering rich text information about programming problem prompts and college students' code submissions, as well as other related metadata, such as the programming concepts involved in each programming problem and the scores of each college student's code submission after passing the test case.

[0065] The college students' code submissions that pass the test cases are considered correct submissions, otherwise they are considered incorrect submissions.

[0066] In the data preprocessing part, invalid codes submitted by college students in the CSEDM dataset that cannot be converted into an abstract syntax tree (AST) are deleted; overall, about 85% of the codes submitted by college students can be converted into AST format, which means that this data preprocessing step does not cause significant data loss; the maximum code submission sequence length of all college students is set to 200; the code submissions of college students with more than 200 code submissions are split into two separate sequences.

[0067] Finally, all college students in the CSEDM dataset after data preprocessing are divided into training set, validation set and test set in a ratio of 8:1:1, and all indicators are reported on the test set.

[0068] Step S2: The historical programming behavior of college students is expressed as a series of historical coding events in the online question-judging system (OJ); the coding event at each time step t is represented by a four-tuple (p t ,s t ,c t ,r t ) indicates that, among which, p t represents the programming problem at the tth time step, s t Indicates that p t A collection of related knowledge concepts; c t The code submitted by the college students at the tth time step; r t is the response of the online judging system (OJ) to the code submitted by the college students at the tth time step, indicating whether the students have solved the problem correctly (the college students’ code has passed the test after submission); set the sequence of historical coding events {(p1, s1, c1, r1), ..., (p t-1 ,s t-1 ,c t-1 ,r t-1 )}, the tracking target is the predicted input (p t ,s t ) t The value of t-1 represents the programming problem at the t-1th time step; s t-1 Indicates that p t-1 The corresponding knowledge concept set; c t-1 Code submitted by college students at the t-1th time step; r t-1 is the response of the online judging system OJ to the code submitted by the college students at the t-1th time step.

[0069] Step S3: Construct a programming knowledge tracing model (PKT-ICS), which consists of a problem representation module, a code representation module and a dual-sequence modeling module; the problem representation module adopts the PEBG model, the code representation module adopts the CodeBERT model and the GPT-2 encoder; the dual-sequence modeling module consists of two independent GRU models.

[0070] Step S4: Input each programming problem in the student programming behavior dataset into the problem representation module, and generate a problem representation containing knowledge points and difficulty information for each programming problem.

[0071] Specifically, for each programming problem and knowledge point in the student programming behavior dataset, the neighborhood set of the programming problem, the neighborhood set of the knowledge point and the difficulty information of the programming problem are calculated according to the rules given by the PEBG model. At the same time, the initialized programming problem embedding is randomly generated. and knowledge point embedding ,in, represents the set of real numbers; Represents the spatial dimensions of programming problems and knowledge points in the input PEBG model.

[0072] The correlation between each programming problem and the knowledge point, the neighborhood set of programming problems, the neighborhood set of knowledge points and the difficulty information of programming problems are used as constraints to optimize the embedding of programming problems. and knowledge point embedding .

[0073] Embed optimized programming problems into And knowledge point embedding The difficulty information of the programming problem is input into the product layer of the PEBG model for fusion to obtain the embedding vector containing various related information of the programming problem. , that is, the problem representation of the programming problem.

[0074] Step S5: The score information corresponding to the code submitted by the college students is divided into three categories: all failed, represented by 0, partially passed, represented by 0-1, and all passed, represented by 1. Then the code representation module uses pre-training technology, with the score information corresponding to the code submitted by the college students as the target, and the code submitted by the college students, programming problems, and problem representations of programming problems as inputs, to construct a supervised pre-training task to train itself. During the training process, the product layer in the code representation module is used to fuse the three inputs (code submitted by college students, programming problems, and problem representations of programming problems) to generate enhanced code representation.

[0075] Specifically, the CodeBERT model is a bidirectional encoding model for code language representation, which consists of an input layer, an embedding layer, and a bidirectional Transformer encoder layer. The CodeBERT model is fine-tuned before use; the input layer is used to process the code submitted by college students into raw code text sequences, and an additional marker is added at the beginning of the raw code text sequence. After that, we get the original code text word sequence , Indicates the first word in the original code text segmentation sequence word; Input to the embedding layer to get the embedding vector of the code text , Indicates The embedding vector of the code text corresponding to the word, and then the embedding vector of the code text is Contextual semantic encoding, and finally output the semantic features of the code text , Indicates The final output code text semantic features corresponding to the words are shown in the formula:

[0076] (1);

[0077] In the formula, n is the number of participles, ; is the output dimension of the bidirectional Transformer encoder layer; Represents the CodeBERT model.

[0078] Given the mark The corresponding vector representation can contain the semantic information of the entire code text, and the output vector of the last layer of the bidirectional Transformer encoder layer is selected , as a sequence representation of the entire code text .

[0079] In order to extract the textual semantic information of programming problems, researchers usually convert the text into vector representation so as to merge it with other information in the CodeBERT model. The widely used GPT-2 encoder is selected to obtain the problem text representation. Specifically, the problem text is set to , the GPT-2 encoder first converts the question text Decomposed into a series of word tokens, each of which corresponds to an embedding vector in the word embedding layer of the GPT-2 encoder ,in, Represents the dimension of the embedding vector space. Therefore, the question text is processed to generate a set of token embeddings , Indicates The vector representation corresponding to the word embedding is calculated, and the average value of the word embedding is obtained to obtain the question text representation .

[0080] When there are multiple types of information available, high-quality embedded representations can usually be obtained by learning the interactions between these information. Inspired by product neural networks, product layers are used to learn high-order relationships between information. , and Three types of information, first use the linear layer to , and Mapped to the same low-dimensional feature space, it can be expressed as:

[0081] (2);

[0082] In the formula, express , and The Class representation, and are the weight matrix and bias term of the corresponding linear layer respectively; After dimensionality reduction , and No. Class representation.

[0083] Then, capture the reduced dimension , and The linear relationship matrix between With the binary relationship matrix , which can be expressed as:

[0084] (3);

[0085] (4);

[0086] In the formula, represents binary feature interactions, After dimensionality reduction , and No. Class representation; Indicates a congruence relationship; There are different ways to implement this. Defined as the vector inner product: Next, we introduce a product layer to transform the linear relationship matrix With the binary relationship matrix Convert to linear relationship vectors respectively With the binary relationship vector , which can be expressed as:

[0087] (5);

[0088] (6);

[0089] In the formula, and are the weights in the product layer, and their shapes are respectively and Sure, For linear relationship matrix Multiply to get scalar value, For binary relationship matrices Multiply to get scalar value; represents element-by-element multiplication; d is and The transformed dimensions of , the transformed dimensions of the two are the same; express The d-th scalar value in ; express The d-th scalar value in ; express The nth scalar value in ; express The nth scalar value in ; and Represents the linear relationship matrix The number of rows and columns; and Represents the binary relationship matrix The number of rows and columns.

[0090] Finally, the enhanced code is calculated :

[0091] (7);

[0092] In the formula, , and the bias vector ; Represents the activation function.

[0093] In the enhanced code representation After that, a fully connected layer is used to enhance the code representation After processing, the code category predicted by the code representation module can be obtained , and finally the predicted code category The corresponding score information is used as the target to calculate the cross entropy loss function between the predicted code category and the actual code category. , the formula is as follows:

[0094] (8);

[0095] In the formula, is the number of codes, is the code submission category, It is Code belongs to The actual label of the class (represented using one-hot encoding), It is The code is predicted to be The probability of the class.

[0096] Step S6: Input the problem representation and enhanced code representation of the programming problem into the dual-sequence modeling module. The dual-sequence modeling module uses two independent GRU models to model the problem representation and enhanced code representation of the programming problem respectively, and adds an exponential decay attention mechanism to weighted sum the problem representation and enhanced code representation of the modeled programming problem respectively, and finally fuses them for the final correctness prediction.

[0097] Specifically, the problem representation sequence of the programming problem and the enhanced code represents the sequence The GRU model is a recurrent neural network. Each time step represents each cycle. Each cycle has corresponding input and output. Each GRU model has two inputs. The input of the GRU model that receives the problem representation sequence is the output of the previous cycle. And the input required for this loop ; The input of the GRU model that receives the enhanced code representation sequence is the output of the previous cycle And the input required for this loop , for the GRU model arrive At each time step, the following equation is applied to update the hidden state vector in the sequence of problem representations of the programming problem and the enhanced code represents the hidden state vector in the sequence :

[0098] (9);

[0099] In the formula, and The weight coefficients in the sequence of problem representations for programming problems, It is used to multiply the hidden state vector in the sequence of problem representations of the programming problem with k-1 time steps, Used to multiply with the problem representation of the programming problem of k time steps; and is the weight coefficient in the enhanced code representation sequence; and They are the bias terms of the problem representation sequence and the enhanced code representation sequence of the programming problem; represents the hyperbolic tangent activation function; Problem representation of programming problems at k time steps; Representation of the enhanced code at k time steps.

[0100] In order to predict the college students at time step When the performance is, use the attention mechanism to represent the problem of the current programming problem The similarity is calculated between the hidden state vector in the problem representation sequence of the programming problem at the previous time step and the hidden state vector in the enhanced code representation sequence, and weights are assigned according to the magnitude of the similarity; the similarity function is calculated as follows:

[0101] (10);

[0102] In the formula, and Respectively represent the time step arrive of and The transpose of the concatenation matrix, represents a fully connected layer; a similarity vector between a problem representation of a programming problem and a hidden state in the problem representation of the programming problem; Similarity vectors between hidden states in a sequence of problem representations and augmented code representations representing a programming problem.

[0103] Inspired by the Ebbinghaus forgetting curve, an exponential decay is added to the similarity matrix before applying the softmax function to obtain the normalized attention mechanism weights:

[0104] (11);

[0105] (12);

[0106] In the formula, represents the normalized attention mechanism weight vector in the question sequence; represents the normalized attention mechanism weight vector in the code sequence; is the exponential decay hyperparameter; is the time step vector; represents an exponential function; the basic motivation for applying exponentially decaying attention is that the most recent programming events are more important for measuring the current learning status of college students.

[0107] Through arrive of and Weighted summation is performed to obtain the college students’ Programming knowledge level at that time and coding skills :

[0108] (13);

[0109] (14);

[0110] Finally, and Concatenate and input into the fully connected layer to get the final prediction probability ;

[0111] (15);

[0112] In the formula, represents the sigmoid function, Indicates splicing.

[0113] is a vector with the same length as the number of questions, in which each value represents the probability of the college student answering the question correctly. Therefore, it can be obtained from Corresponding to Read the prediction result at the location ; Calculate the binary cross entropy loss between the predicted results and the true results to update the parameters of the GRU model and the fully connected layer :

[0114] (16);

[0115] In the formula, represents the binary cross entropy loss function; represents the true value at time k; Represents the predicted value at time k.

[0116] In the problem representation module, the dimensions of programming problem embedding and problem representation of programming problems are set to 64 and 128 respectively, the batch size is set to 8, the learning rate is set to 1e-3, and the Adam optimizer is used; to prevent the problem representation module from overfitting, the Dropout regularization technique is used, and the probability value is set to 0.5; in the code representation module, the dimensions of the code text, the dimensions of the problem text representation, and the dimensions of the enhanced code representation are all set to 768, and the batch size is set to 32; when fine-tuning the CodeBERT model, the learning rate is set to 1e-5, the learning rates of the product layer and the fully connected layer in the CodeBERT model are set to 1e-4, and Adam is used as the optimizer; to prevent the code representation module from overfitting, the Dropout regularization technique with a probability value of 0.5 is used; in the dual sequence modeling module, the batch size, learning rate, and exponential decay attention coefficient λ are set to 64, 1e-3, and 0.4 respectively, the hidden state dimension of the GRU model and the output dimension of the fully connected layer are both set to 50, the random seed is set to 1, and Adam is used as the optimizer.

[0117] Although embodiments of the present invention have been shown and described, it will be appreciated by those skilled in the art that various changes, modifications, substitutions and variations may be made to the embodiments without departing from the principles and spirit of the present invention, and that the scope of the present invention is defined by the appended claims and their equivalents.

Claims

1. A programming knowledge tracking method integrating code and score information, characterized in that: The steps include: Step S1: Construct a student programming behavior dataset, which includes several complete code submissions of several college students for multiple programming problems; code submissions that pass the test case are considered correct submissions, otherwise they are considered incorrect submissions; Step S2: taking the historical programming behaviors of college students as historical coding events in the online question-judging system OJ; Step S3: construct a programming knowledge tracking model PKT-ICS, which consists of a problem representation module, a code representation module and a dual sequence modeling module; the problem representation module adopts the PEBG model, the code representation module adopts the CodeBERT model and the GPT-2 encoder; the dual sequence modeling module adopts two independent GRU models; Step S4: input each programming problem in the student programming behavior dataset into the problem representation module, and output the problem representation of each programming problem, where the problem representation of each programming problem includes the knowledge points and difficulty information of the programming problem; Step S5: The score information corresponding to the code submitted by the college students is used as the target of the code representation module, and the code, programming problems and problem representations of the programming problems submitted by the college students are used as the input of the code representation module. A supervised pre-training task is constructed to train the code representation module. During the training process, the code, programming problems and problem representations of the programming problems submitted by the college students are fused using a product layer to generate an enhanced code representation; wherein the score information corresponding to the code submitted by the college students is divided into three categories: all failed, represented by 0; partially passed, represented by 0~1; all passed, represented by 1; Step S6: Input the problem representation and enhanced code representation of the programming problem into the dual sequence modeling module, use two independent GRU models to model the problem representation and enhanced code representation of the programming problem respectively, and add an exponential decay attention mechanism to weighted sum the modeled problem representation and enhanced code representation of the programming problem respectively, and finally fuse them for the final correctness prediction; The specific process of step S6 is: the problem representation sequence of the programming problem and the enhanced code represents the sequence They are input into two independent GRU models respectively. Each time step of the GRU model represents each cycle. Each cycle has corresponding input and output. Each GRU model has two inputs. The input of the GRU model that receives the problem representation sequence is the output of the previous cycle. And the input of this loop ; The input of the GRU model that receives the enhanced code representation sequence is the output of the previous cycle And the input required for this loop ; For the GRU model arrive At each time step, Equation (9) is applied to update the hidden state vector in the problem representation sequence of the programming problem and the enhanced code represents the hidden state vector in the sequence , expressed as: (9); In the formula, and The weight coefficients in the problem representation sequence for programming problems; and is the weight coefficient in the enhanced code representation sequence; and They are the bias terms of the problem representation sequence and the enhanced code representation sequence of the programming problem; represents the hyperbolic tangent activation function; Problem representation of programming problems at k time steps; Represents the enhanced code representation at k time steps; Use the attention mechanism to predict college students at time step The performance of the current programming problem The similarity is calculated between the hidden state vector in the problem representation sequence of the programming problem at the previous time step and the hidden state vector in the enhanced code representation sequence, and weights are assigned according to the size of the similarity. The similarity is calculated as follows: (10); In the formula, and Respectively represent the time step arrive of and The transpose of the concatenation matrix; represents a fully connected layer; a similarity vector representing a problem representation of a programming problem and a hidden state in a sequence of problem representations of the programming problem; Similarity vectors between hidden states in a sequence of problem representations and augmented code representations representing a programming problem; Before applying the softmax function, an exponential decay is added to the similarity matrix to obtain the normalized attention mechanism weights: (11); (12); In the formula, represents the normalized attention mechanism weight vector in the question sequence; represents the normalized attention mechanism weight vector in the code sequence; is the exponential decay hyperparameter; is the time step vector; represents the exponential function; Through arrive of and Weighted summation is performed to obtain the college students’ Programming knowledge level at that time and coding skills : (13); (14); Finally, and Concatenate and input into the fully connected layer to get the final prediction probability ; (15); In the formula, represents the sigmoid function, Indicates splicing; Get the prediction result based on the prediction probability , calculate the prediction results The binary cross entropy loss between the actual result and the actual result is used to update the parameters of the GRU model and the fully connected layer. , expressed as: (16); In the formula, represents the binary cross entropy loss function; represents the true value at time k; Represents the predicted value at time k.

2. A programming knowledge tracking method integrating code and score information according to claim 1, characterized in that: In step S2, the historical encoding event of each time step t is represented by a four-tuple p t ,s t ,c t ,r t Indicates that, p t represents the programming problem at the tth time step, s t Indicates that p t The corresponding knowledge concept set; c t The code submitted by the college students at the tth time step; r t is the response of the online judging system OJ to the code submitted by the college student at the tth time step, indicating whether the student has solved the problem correctly, that is, the college student's code has passed the test after submission; the sequence of historical coding events is set to {(p1, s1, c1, r1), ..., (p t-1 ,s t-1 ,c t-1 ,r t-1 )}, the tracking target is the predicted input p t ,s t Time t The value of t-1 represents the programming problem at the t-1th time step; s t-1 Indicates that p t-1 The corresponding knowledge concept set; c t-1 Code submitted by college students at the t-1th time step; r t-1 is the response of the online judging system OJ to the code submitted by the college students at the t-1th time step.

3. A programming knowledge tracking method integrating code and score information according to claim 2, characterized in that: The specific process of step S4 is as follows: for each programming problem and knowledge point in the student programming behavior dataset, the PEBG model is used to calculate the neighborhood set of the programming problem, the neighborhood set of the knowledge point and the difficulty information of the programming problem respectively. At the same time, the initialized programming problem embedding and knowledge point embedding ,in, represents the set of real numbers; Represents the spatial dimensions of programming problems and knowledge points in the input PEBG model; The correlation between each programming problem and the knowledge point, the neighborhood set of the programming problem, the neighborhood set of the knowledge point and the difficulty information of the programming problem are used as constraints to optimize the embedding of programming problems. and knowledge point embedding ; Embed optimized programming problems into And knowledge point embedding The difficulty information of the programming problem is fused using a product layer to obtain the embedding vector of the programming problem. , that is, the problem representation of the programming problem.

4. A programming knowledge tracking method integrating code and score information according to claim 3, characterized in that: The CodeBERT model in step S5 consists of an input layer, an embedding layer, and a bidirectional Transformer encoder layer. The CodeBERT model is fine-tuned before use.

5. A programming knowledge tracking method integrating code and score information according to claim 4, characterized in that: The specific process of step S5 is: using the input layer to process the code submitted by college students into the original code text sequence, and adding a mark at the beginning of the original code text sequence , get the original code text word sequence , Indicates the first word in the original code text segmentation sequence word, will Input to the embedding layer to get the embedding vector of the code text , Indicates The embedding vector of the code text corresponding to the word, and then the embedding vector of the code text is Contextual semantic encoding, and finally output the semantic features of the code text , Indicates The final output code text semantic features corresponding to the words are shown in the formula: (1); In the formula, n is the number of participles; ; is the output dimension of the bidirectional Transformer encoder layer; represents the CodeBERT model; Select the output vector of the last layer of the bidirectional Transformer encoder layer , as a sequence representation of code text ; Use the GPT-2 encoder to obtain the question text representation; specifically, set the question text to , the GPT-2 encoder first converts the question text Decomposed into word tokens, in the word embedding layer of the GPT-2 encoder, each word token corresponds to an embedding vector ,in, Represents the dimension of the embedding vector space. The question text is processed by the word embedding layer of the GPT-2 encoder to generate a set of word embeddings , Indicates The vector representation corresponding to the word embedding is calculated, and the average value of the word embedding is obtained to obtain the question text representation ; Learning with product layers , and The high-order mutual relationship between , and Mapped to the same low-dimensional feature space, expressed as: (2); In the formula, express , and The Class representation, and are the weight matrix and bias term of the corresponding linear layer respectively; After dimensionality reduction , and No. Class representation; Then, capture the reduced dimension , and The linear relationship matrix between With the binary relationship matrix , expressed as: (3); (4); In the formula, represents binary feature interactions, After dimensionality reduction , and No. Class representation; Indicates a congruence relationship; Will Defined as the vector inner product: Next, we introduce a product layer to transform the linear relationship matrix With the binary relationship matrix Convert to linear relationship vectors respectively With the binary relationship vector , expressed as: (5); (6); In the formula, and are all weights in the product layer; represents element-by-element multiplication; d is and The transformation dimension, and The dimensions after transformation are the same; express The d-th scalar value in ; express The d-th scalar value in ; express The nth scalar value in ; express The nth scalar value in ; and Represents the linear relationship matrix The number of rows and columns; and Represents the binary relationship matrix The number of rows and columns; Finally, the enhanced code is calculated : (7); In the formula, represents the activation function; , and the bias vector ; In the enhanced code representation After that, a fully connected layer is used to enhance the code representation Processing to get the predicted code category , and finally the predicted code category The corresponding score information is used as the target to calculate the cross entropy loss function between the predicted code category and the actual code category. , the formula is as follows: (8); In the formula, is the number of codes; is the code submission category; It is Code belongs to The actual label of the class, represented by one-hot encoding; It is The code is predicted to be The probability of the class.

6. A programming knowledge tracking method integrating code and score information according to claim 5, characterized in that: In the question representation module, the dimensions of programming problem embedding and problem representation of programming problems are set to 64 and 128 respectively, the batch size is set to 8, the learning rate is set to 1e-3, the Adam optimizer is used, the Dropout regularization technique is adopted, and the probability value is set to 0.5; in the code representation module, the dimensions of code text, question text representation, and enhanced code representation are all set to 768, and the batch size is set to 32; when fine-tuning the CodeBERT model, the learning rate is set to 1e-5, and the learning rates of the product layer and the fully connected layer in the CodeBERT model are set to 1e-4. Adam is used as the optimizer, and the Dropout regularization technique with a probability value of 0.5 is adopted.

Citation Information

Patent Citations

  • Programming teaching system and method integrated with intelligent education

    CN112596731A

  • A code query model generation method and computer equipment

    CN113204679A