Personalized programming question recommendation method fusing dynamic interaction information
By using a pre-trained large programming model and a long short-term memory network, combined with an attention mechanism, and integrating dynamic interactive information, personalized programming problem recommendations are made. This solves the problem of existing technologies failing to effectively utilize code and evaluation feedback information, and achieves more accurate programming problem recommendation results.
Patent Information
- Application Number
- CN202511415943.5
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-09-30
- Publication Date
- 2025-11-04
- Estimated Expiration
- 2045-09-30
AI Technical Summary
Existing personalized programming problem recommendation methods ignore the rich information in the code submitted by students and fail to effectively utilize the semantics of the problem text and the evaluation feedback score information, resulting in poor recommendation performance. The general programming model has not been optimized for the student-problem-feedback three-element interaction.
We use a pre-trained programming large model UniXcoder and a language model GPT2-encoder to generate code and question text vectors. We combine a long short-term memory network and an attention mechanism to model students' historical programming interaction sequences and integrate dynamic interaction information to recommend personalized programming questions.
By constructing a comprehensive code representation and modeling the evolution of students' abilities, the system can accurately predict the programming problems students currently need, thereby improving the accuracy of personalized recommendations and learning efficiency.
Smart Images

Figure CN120892633A_ABST
Abstract
Description
TECHNICAL FIELD
[0001] The present application relates to a recommendation method that fuses dynamic interaction information, in particular to a personalized programming question recommendation method that fuses dynamic interaction information. BACKGROUND
[0002] Personalized recommendation is a technology that automatically matches and pushes resources or services that best meet the needs of users based on their historical behavior and characteristics. As a specific application of personalized recommendation in the field of programming education, personalized programming question recommendation aims to estimate students' knowledge state by analyzing their programming behavior, and to recommend programming questions that match their ability level, so as to efficiently improve programming ability. In recent years, with the rapid development of online education platforms and the rise of artificial intelligence technology, personalized programming question recommendation has become a frontier research direction that has attracted much attention.
[0003] Current programming learning activities mainly rely on online programming evaluation platforms (Online Judge, OJ), such as LeetCode, Luogu, etc. In the process of learning programming skills, students write code based on their understanding of specific programming questions and submit it to the OJ system. The system evaluates the code through pre-set test cases and gives feedback, and the students record and continuously optimize the code based on the feedback and resubmit it until it passes all test cases or moves on to other questions. This dynamic interaction process generates rich data, including code submission records and evaluation feedback scores. Analyzing these dynamic interaction data can help more accurately estimate students' real programming ability, thereby improving the quality of personalized recommendation systems.
[0004] However, existing personalized programming question recommendation schemes have the following shortcomings: 1. Early programming question recommendation methods mainly use content or collaborative filtering methods, which usually use students' external characteristics, answer sequences or question similarity for recommendation, ignoring the rich information contained in students' submitted code, resulting in limited recommendation effect.
[0005] 2. Static code feature methods usually only make one-time encoding of abstract syntax tree (AST) or token sequence, without considering the dynamic association of question text semantics and evaluation feedback score information; 3. General programming large models (such as UniXcoder, CodeBERT) can extract code syntax and semantic information, but are not specifically optimized for "student-question-feedback" three-way interaction, and direct application is limited by recommendation accuracy.
[0006] To overcome the above-mentioned defects of the prior art, the embodiments of the present application propose a personalized programming question recommendation framework that fuses dynamic interaction information, so that the recommendation result is highly matched with the student's immediate ability. SUMMARY
[0007] To solve the above problems, the application provides a personalized programming question recommendation method fusing dynamic interaction information, which constructs code representation based on a pre-trained programming large model and a supervised learning network, uses a long short-term memory network to model a historical answer sequence, and uses an attention mechanism to recommend programming questions.
[0008] The technical scheme of the application is as follows: a personalized programming question recommendation method fusing dynamic interaction information, comprising the following steps: Step S1: obtaining an online evaluation platform dataset and preprocessing and dividing the online evaluation platform dataset; Step S2: based on the data of step S1, formalizing the historical programming interaction sequence of students and defining the task; Step S3: according to the task requirement of step S2, building an overall framework including a code representation module and a question recommendation module, and establishing a personalized programming question recommendation model; Step S4: implementing and training the code representation module in step S3, taking the online evaluation platform dataset obtained in step S1 as the input of the code representation module, using the programming large model UniXcoder and the language model GPT2-encoder to generate code and question text vectors, and fusing them into a comprehensive code representation through supervised learning; Step S5: implementing and training the question recommendation module in step S3, based on the comprehensive code representation of step S4, combining the historical programming interaction sequence of students, using a long short-term memory network and an attention mechanism to model the evolution of students' ability, and generating a probability distribution of the next moment recommendation.
[0009] Further, step S1: obtaining an online evaluation platform dataset and preprocessing and dividing the online evaluation platform dataset, specifically: Step S11, collecting an online evaluation platform dataset, which includes students' code submission records, students' code submission records, question identification, question text, students' submitted code text, and evaluation feedback score information; Step S12, preprocessing the online evaluation platform dataset, which includes score discretization processing, question identification remapping, and sorting of students' historical programming interaction sequences; The score discretization processing converts the evaluation feedback score information into three categories of students' evaluation feedback scores: error, partial correctness, and full correctness; the question identification remapping uniformly maps the non-continuous question numbers in the online evaluation platform dataset to continuous numbers; the sorting of students' historical programming interaction sequences is to arrange the code submission records of each student in ascending order according to the submission time to form the students' historical programming interaction sequences; Step S13: The preprocessed online evaluation platform dataset is randomly divided into groups based on students. Specifically, 80% of the students' submission records are randomly selected as the training set, and the remaining 20% of the students' submission records are selected as the test set.
[0010] Further, step S2: formally express and define the student's historical programming interaction sequence; specifically: Step S21, formally describe and define the personalized programming problem recommendation task: Let... Given a set of all different programming problems, where Indicates the first A programming problem, Let be the total number of programming problems, and let there be 4 student records in the training set. Step S22, let the historical programming interaction sequence of each student be... ,in Indicates the student's time step The question identifier for answering, Indicates the student's time step Question identifier for answering The corresponding question text, Indicates the student's time step Question identifier for answering The corresponding commit code, This indicates the student's assessment feedback score category, which is represented by three student assessment feedback score categories: incorrect, partially correct, and completely correct. Step S23, given the historical programming interaction sequence for each student in step S22. Based on this, study the random variables of candidate problems. The conditional distribution P( | ), and select As The system continuously recommends programming problems to students, enabling personalized problem recommendations. This indicates that the conditional distribution P( | The largest candidate random variable for learning problems The value of .
[0011] Further, in step S3, the overall framework including the code representation module and the question recommendation module is built, and a personalized programming question recommendation model is established. The specific process is as follows: Step S31, the code representation module extracts the semantic and structural features of the code and the semantic features of the question text using the pre-trained programming language model, generates the corresponding embedding vectors of the code and the question text, and fuses the code and the question text using supervised learning to obtain a comprehensive code representation vector; Step S32, the question recommendation module uses the comprehensive code representation vector and the student's historical programming interaction sequence to predict the probability distribution of the next time recommendation through the long short-term memory network and the attention mechanism.
[0012] Further, step S4, the code representation module in step S3 is implemented and trained, and the online evaluation platform dataset obtained in step S1 is input into the code representation module, the code and question text vectors are generated by using the programming large model UniXcoder and the language model GPT2-encoder, and the comprehensive code representation is fused through supervised learning; the specific process is as follows: Step S41, the code submission record of the student in the online evaluation platform dataset obtained in step S11 is input into the code representation module; Step S42, the student submission code text and the question text in the student's code submission record are input into the programming large model UniXcoder and the language model GPT2-encoder respectively; Step S43, in the preprocessing layer of the programming large model UniXcoder, the student submission code text is first segmented, and a sequence of length is obtained , wherein represents the first word element segmented from the student submission code text, represents the th word element segmented from the student submission code text, and then a special mark CLS is inserted at the most front end of the sequence of length , denoted as , to obtain a code text segmentation sequence of length ; Step S44, according to the programming language category to which the student submission code text belongs, a multi-language parsing framework Tree-sitter is called to load the corresponding syntax library to parse the student submission code text and generate a code abstract syntax tree AST node sequence of length , represents the first node label of the code abstract syntax tree AST node sequence, represents the second node label of the code abstract syntax tree AST node sequence, represents the th node label of the code abstract syntax tree AST node sequence; Step S45, the code text token sequence and the code abstract syntax tree AST node sequence are spliced to obtain a unified input sequence , as shown in the formula: ; In the formula, is a splicing operation, is the code text token sequence obtained in step S43, is the code abstract syntax tree AST node sequence obtained in step S44; Step S46, in the embedding layer of the programming large model UniXcoder, each token in the unified input sequence is mapped to a high-dimensional vector respectively, generating a high-dimensional vector matrix , wherein, represents a real number field; is the embedding layer output dimension of the programming large model UniXcoder; the vectors in the high-dimensional vector matrix correspond to the special token CLS, which is used to represent the overall semantic information of the code; the vectors respectively correspond to the token sequence in the code text; the vectors respectively correspond to the code abstract syntax tree AST node sequence ; that is, the high-dimensional vector matrix is the line-by-line splicing of the code text token matrix and the code abstract syntax tree AST node matrix ; Step S47, input the high-dimensional vector matrix generated in step S46 into the Transformer encoder of the programming large model UniXcoder, to generate a feature matrix that fuses the code semantics and the code abstract syntax tree AST node structure; ; In the formula, is the feature matrix that fuses the code semantics and the code abstract syntax tree AST node structure, represents the code semantics-code abstract syntax tree AST structure joint representation obtained after the global context is fused for the token; is the sequence length obtained by the programming large model UniXcoder cutting the student-submitted code text, is the length of the code abstract syntax tree AST node sequence; After the global context is fused, the feature matrix that fuses the code semantics and the code abstract syntax tree AST node structure Vector corresponding to the special marker CLS This is used to represent the comprehensive semantic information of the entire piece of code submitted by the student; the vector is used to represent the comprehensive semantic information of the entire piece of code submitted by the student. As the embedding vector of the code text submitted by the student, let it be denoted as ; Step S48, for students in the time step Question identifier for answering Corresponding question text The GPT2-encoder language model is used to segment students at each time step. Question identifier for answering Corresponding question text The sequence is segmented into word-tagged sequences, and the word embedding layer of the GPT2-encoder language model is used to map each word-tagged sequence to a high-dimensional embedding vector. ; in, It is the output dimension of the word embedding layer. For students in time steps Question identifier for answering Corresponding question text Segmentation token sequence length, Indicates the student's time step Question identifier for answering Corresponding question text The high-dimensional embedding vector mapped to the j-th word tag; Step S49, will Indicates the student's time step Question identifier for answering Corresponding question text The series of high-dimensional embedding vectors mapped to the j-th word tag The text of the question is fed into a multi-layer Transformer encoder of the GPT2-encoder language model to obtain the student's answer at time step i. Corresponding question text The final embedded representation; ; in, Indicates the student's time step Question identifier for answering Corresponding question text The final embedding representation, This represents the hidden state after context enhancement; Step S410, using a weight matrix as The bias vector is The activation function is the fully connected layer of the final embedding representation of the question text answered by the student at time step i the final embedding representation of the question text answered by the student at time step i the final embedding representation of the question text answered by the student at time step i the final embedding representation of the question text answered by the student at time step i , and the comprehensive code representation vector is constructed; the specific formula is: ; In the formula, is the comprehensive code representation vector; is a rectified linear unit activation function; Step S411, according to the score discretization processing in step S1, the evaluation feedback of the student is classified , and the code true class vector is converted through one-hot encoding , and the comprehensive code representation vector obtained in step S410 is input into a fully connected layer with a weight matrix , a bias vector , and an activation function , to obtain a predicted code class vector ; Step S412, for the student submitted code text in the training set, after step S411, the code true class vector and the predicted code class vector are obtained, and there are a total of 𝑈 students in the training set, and the 𝑢th student has code submissions; Let the true label and the predicted probability of the 𝑢th student at the 𝑖th time step on the code feedback class 𝑠 be calculated as a cross-entropy loss function : ; In the formula, is the code feedback class, and 𝑠∈{0,1,2}, is the true class label of the 𝑢th student at the 𝑖th time step belonging to the first class, is the probability predicted by the model that the 𝑢th student at the 𝑖th time step belongs to the first class; Step S413, the cross-entropy loss function calculated in step S412 is used to fine-tune the parameters of the programming large model UniXcoder, the parameters of the fully connected layer used for fusion in step S410, and the parameters of the fully connected layer used for classification in step S411 through the back propagation algorithm; the parameters of the language model GPT2-encoder are frozen and do not participate in parameter updating; Step S414: After completing the training in step S413, use the trained parameters to analyze all students at each time step. Question identifier for answering Corresponding commit code Each of these is converted into a comprehensive code representation vector. .
[0013] Further, in step S5, the question recommendation module from step S3 is implemented and trained. Based on the comprehensive code representation from step S4, and combined with the student's historical programming interaction sequence, a long short-term memory network and attention mechanism are used to model the student's ability evolution and generate the probability distribution for the next time step recommendation. The specific process is as follows: Step S51, construct the student response interaction vector; at time step Students using one-hot encoding at time step Question identifier for answering In the case of the above response, the interaction vector is obtained. ; If the student is in time step Answer correctly (i.e., submit code) If all test cases are passed, the evaluation feedback is correct. Interaction vectors The middle ( +M) positions have 1s, and the remaining positions have 0s; if the student answers incorrectly (i.e., submits incorrect code) If not all test cases pass, the evaluation feedback will be correct. Interaction vectors The Middle One position is 1, and the rest are 0; Step S52, the interaction vector Mapped to a low-dimensional embedding representation; utilizing a learnable weight matrix. , interaction vector Transform into a low-dimensional, dense question interaction embedding vector , It represents the dimension of the question's interactive embedding vector, where T denotes the matrix transpose; Step S53: Construct a comprehensive interactive embedding representation; combine this with the comprehensive code representation vector obtained in step S410. Interact with the question embedding vector in step S52 By concatenating the elements in sequence, a comprehensive interactive embedding is obtained; the formula is as follows: ; In the formula, This represents the student's integrated interaction embedding vector at time step i; Step S54, use a Long Short-Term Memory network to model the student's comprehensive interaction embedding sequence; the student's comprehensive interaction embedding sequence at each time step is { },in, This represents the student's integrated interaction embedding vector at the first time step. This represents the student's integrated interaction embedding vector at the second time step. This represents the student's integrated interaction embedding vector at time step t; Embed the student's comprehensive interactions at each time step into the sequence { Input a Long Short-Term Memory (LSTM) network, and let the initial hidden state of the LSTM network be... ,for arrive At each time step, the hidden state of the Long Short-Term Memory (LSTM) network is updated incrementally. , It is the hidden state dimension of the Long Short-Term Memory (LSTM) network; ; In the formula, Is Hidden states of a Long Short-Term Memory (LSTM) network at time steps; Step S55: Calculate the hidden state similarity; when recommending the next question, calculate the hidden state at time step t. Similarity score with the previous hidden state The similarity function is calculated as follows: ; in, It is the hidden state of a Long Short-Term Memory (LSTM) network from time step i=1 to t-1. The transpose of the spliced matrix, Indicates a fully connected layer; Step S56: Obtain the context vector representing the student's historical ability state; obtain the similarity function of the previously hidden state obtained in step S55. ,application The function obtains normalized attention weights : ; Then, by weighted summation, historical response information related to the current state is captured, resulting in a context vector representing the student's historical ability state. : ; Step S57: Predict the recommended question for the next moment; use the context vector representing the student's historical ability state. Hidden state at time step t After being spliced together, they are input to the fully connected layer (FC). Activation function, obtain Probability distribution of recommended questions at all times : ; Step S58: Construct the supervised loss and update the model parameters; for each sample in the training set, extract the sample time step. Title identifier And generate one-hot true class vectors. ; ; in, Represents the true class vector The kth component, Represents the true class vector The first component, Represents the true class vector The second component, Represents the true class vector The (M-1)th component; Step S59, calculate the cross-entropy loss, and record the total number of students in the training set for the i-th student. Each time step, from t=1 to t= At time t, step S58 generates the true class vector of the nth student at time t+1, denoted as [vector]. And the probability distribution of the predicted question for the nth student at time t+1 in step S57 is denoted as follows: ; Cross-entropy loss function here Defined as: ; in, Let n be the true class vector of student t+1 at time t. Belongs to the code feedback score category Category tags, Probability distribution of recommending a question for student number t+1 at time t Prediction code feedback score category The probability value; calculated by the cross-entropy loss function. And minimize the cross-entropy loss function To achieve this, we update all parameters in the Long Short-Term Memory (LSTM) network, the fully connected layers, and the embedding mapping matrix, up to the cross-entropy loss function. Until it stops falling; Step S510, after calculating the cross-entropy loss in step S59, the probability distribution of the question recommended at the moment is obtained Step S57 The question identifier corresponding to the maximum value in the distribution is taken as the next time step t+1 recommended to the student.
[0014] The advantages of the present application are: the present application combines the semantic features and structural features of code text, the semantic features of question text, and the real-time feedback score information of the online programming evaluation platform, and constructs a comprehensive code representation containing dynamic interaction information, thereby modeling the student's immediate programming ability more comprehensively. The present application effectively captures the changes in the student's answer sequence by using a long short-term memory network and an attention mechanism, thereby more accurately predicting the programming question required by the student at the moment, and further improving the effect of personalized question recommendation. The present application method has a wide range of applications and can be conveniently applied to various online programming education platforms to provide personalized question pushing services for programming teaching, realize individualized teaching, and improve the learning efficiency and learning experience of students. BRIEF DESCRIPTION OF DRAWINGS
[0015] Figure 1 The overall model structure flowchart of the present application. DETAILED DESCRIPTION
[0016] Figure 1 The complete process of the model from input to output is shown.
[0017] The specific process is as follows: using the self-built online evaluation platform dataset, the discrete question serial number is remapped to a continuous number after preprocessing; the feedback score corresponding to the student code is divided into three categories, and the submission records of each student are sorted in ascending order according to the submission time. Finally, all students in the dataset are divided into a training set and a test set, and all indicators are reported on the test set.
[0018] The student's historical programming learning behavior is expressed as a historical programming interaction sequence in the online programming evaluation platform.
[0019] The personalized programming question recommendation model is constructed, including a code representation module and a question recommendation module.
[0020] The classification information in step S1 is used as the target, the code text embedding generated by the fine-tuned UniXcoder model and the question text embedding generated by the GPT2-encoder model are used as the input, a supervised pre-training classification task is constructed, and a comprehensive code representation vector is constructed by using a full connection layer to fuse the two inputs during the training process.
[0021] In the long short-term memory network modeling student answer interaction sequence stage, the question interaction embedding vector is formed by fusing the programming question and student answer feedback information, and is further spliced with the comprehensive code representation obtained in step S4 to input into the long short-term memory network to obtain the hidden state representation of the student learning state. The current learning state is fused with the related historical answer information by using the attention mechanism, and the question conforming to the current programming ability of the student is predicted through the full connection network.
[0022] Embodiments of the present application: a personalized programming question recommendation method fusing dynamic interaction information, comprising the following steps: Step S1: obtaining an online evaluation platform dataset, and preprocessing and data dividing the online evaluation platform dataset; Step S2: based on the data of step S1, formalizing the historical programming interaction sequence of the student and defining the task; Step S3: according to the task requirement of step S2, building an overall framework including a code representation module and a question recommendation module, and establishing a personalized programming question recommendation model; Step S4: implementing and training the code representation module in step S3, taking the online evaluation platform dataset obtained in step S1 as the input of the code representation module, using the programming large model UniXcoder and the language model GPT2-encoder to generate code and question text vectors, and fusing them into a comprehensive code representation through supervised learning; Step S5: implementing and training the question recommendation module in step S3, based on the comprehensive code representation of step S4, combining the historical programming interaction sequence of the student, using long short-term memory network and attention mechanism to model the evolution of the student's ability, and generating the probability distribution of the next time recommendation.
[0023] Further, step S1: obtaining an online evaluation platform dataset, and preprocessing and data dividing the online evaluation platform dataset, specifically: Step S11, collecting an online evaluation platform dataset, the online evaluation platform dataset including student code submission records, the student code submission records having question identification, question text, student submitted code text and evaluation feedback score information; Step S12, preprocessing the online evaluation platform dataset, the preprocessing including score discretization processing, question identification remapping and sorting of the student's historical programming interaction sequence; The score discretization processing converts the evaluation feedback score information into three student evaluation feedback categories: error, partial correctness and full correctness. The question identification remapping uniformly maps the non-continuous question numbers in the online evaluation platform dataset to continuous numbers. The sorting of the student's historical programming interaction sequence is to arrange the code submission records of each student in ascending order according to the submission time to form the student's historical programming interaction sequence. Step S13, the pre-processed online evaluation platform dataset is randomly divided into student units, that is, randomly select 80% of the students' complete submission records as the training set, and the remaining 20% of the students' complete submission records as the test set.
[0024] Further, step S2: formalize the historical programming interaction sequence of the student and define the task; specifically: Step S21, formalize the personalized programming question recommendation task and define: let be the set of all different programming questions, where represents the th programming question, is the total number of programming questions, and let there be a total of 𝑈 students' records in the training set; Step S22, let the historical programming interaction sequence of each student be , where represents the question identifier answered by the student at time step , represents the question identifier answered by the student at time step , corresponding to the question text, represents the question identifier answered by the student at time step , corresponding to the submission code, represents the student's evaluation feedback classification, which is respectively represented as error, partial correctness, and full correctness. Step S23, based on the historical programming interaction sequence of each student given in step S22 , learn the conditional distribution P( | ) of the candidate question random variable , and select as the programming question to be recommended to the student at time , to achieve personalized question recommendation, where represents the value of the learning candidate question random variable that maximizes the conditional distribution P( | ).
[0025] Further, step S3, build the overall framework including the code representation module and the question recommendation module, and establish the personalized programming question recommendation model, the specific process is: Step S31, the code representation module extracts the semantic and structural features of the code and the semantic features of the question text using the pre-trained programming language model, generates the corresponding embedding vectors of the code and the question text, and fuses the code and the question text using supervised learning to obtain a comprehensive code representation vector; Step S32, the question recommendation module uses the comprehensive code representation vector and the student's historical programming interaction sequence to predict the probability distribution of the next time recommendation through the long short-term memory network and the attention mechanism.
[0026] Further, step S4, the code representation module in step S3 is implemented and trained, and the online evaluation platform dataset obtained in step S1 is input into the code representation module, the code and question text vectors are generated by using the programming large model UniXcoder and the language model GPT2-encoder, and the comprehensive code representation is fused through supervised learning; the specific process is as follows: Step S41, the code submission records of the students in the online evaluation platform dataset obtained in step S11 are input into the code representation module; Step S42, the student submission code text and the question text in the student's code submission record are input into the programming large model UniXcoder and the language model GPT2-encoder respectively; Step S43, in the preprocessing layer of the programming large model UniXcoder, the student submission code text is first segmented, and a sequence of length is obtained , wherein represents the first token of the student submission code text, represents the token of the student submission code text, and then a special mark CLS is inserted at the most front end of the sequence of length , denoted as , to obtain a code text segmentation sequence of length ; Step S44, according to the programming language category to which the student submission code text belongs, the multi-language parsing framework Tree-sitter is called to load the corresponding syntax library to parse the student submission code text and generate a code abstract syntax tree AST node sequence of length , wherein represents the first node label of the code abstract syntax tree AST node sequence, represents the second node label of the code abstract syntax tree AST node sequence, represents the node label of the code abstract syntax tree AST node sequence; Step S45, the code text token sequence and the code abstract syntax tree AST node sequence are spliced to obtain a unified input sequence , as shown in the formula: ; In the formula, is a splicing operation, is the code text token sequence obtained in step S43, is the code abstract syntax tree AST node sequence obtained in step S44; Step S46, in the embedding layer of the programming large model UniXcoder, each token in the unified input sequence is mapped to a high-dimensional vector respectively, generating a high-dimensional vector matrix , wherein, represents a real number field; is the embedding layer output dimension of the programming large model UniXcoder; the vectors in the high-dimensional vector matrix correspond to the special token CLS, which is used to represent the overall semantic information of the code; the vectors correspond to the token sequence in the code text respectively; correspond to the code abstract syntax tree AST node sequence respectively; that is, the high-dimensional vector matrix is the line-by-line splicing of the code text token matrix and the code abstract syntax tree AST node matrix ; Step S47, input the high-dimensional vector matrix generated in step S46 into the Transformer encoder of the programming large model UniXcoder, to generate a feature matrix that fuses the code semantics and the code abstract syntax tree AST node structure; ; In the formula, is the feature matrix that fuses the code semantics and the code abstract syntax tree AST node structure, represents the code semantics-code abstract syntax tree AST structure joint representation obtained after the global context is fused for the token; is the sequence length obtained by the programming large model UniXcoder splitting the student-submitted code text, is the length of the code abstract syntax tree AST node sequence; After the global context is fused, the feature matrix that fuses the code semantics and the code abstract syntax tree AST node structure Vectors corresponding to special mark CLS , for representing the comprehensive semantic information of the whole student submitted code; the vector is taken as the embedding vector of the student submitted code text, denoted as ; Step S48, for the question identification answered by the student at time step , the question text corresponding to the question identification answered by the student at time step is segmented into a word token sequence by using the tokenizer of the language model GPT2-encoder, and each word token sequence is mapped to a high-dimensional embedding vector by using the word embedding layer of the language model GPT2-encoder; ; ; wherein, is the output dimension of the word embedding layer, is the length of the segmented word token sequence of the question text corresponding to the question identification answered by the student at time step , represents the high-dimensional embedding vector mapped by the jth word token of the question text corresponding to the question identification answered by the student at time step ; Step S49, the series composed of the high-dimensional embedding vectors mapped by the jth word token of the question text corresponding to the question identification answered by the student at time step is input into the multi-layer Transformer encoder of the language model GPT2-encoder, so as to obtain the final embedding representation of the question text corresponding to the question identification answered by the student at time step i; ; ; wherein, represents the final embedding representation of the question text corresponding to the question identification answered by the student at time step , represents the context-enhanced hidden state; Step S410, a weight matrix , a bias vector , and an activation function A fully connected layer that integrates student-submitted code text embedding vectors. The text of the questions that students answer at time step i Corresponding question text The final embedding representation Construct a comprehensive code representation vector; the specific formula is: ; In the formula, It is a comprehensive code representation vector; It is a modified linear unit activation function; Step S411: Based on the score discretization process in step S1, classify the student's evaluation feedback score into categories. Converted into a code-based true class vector through one-hot encoding. Simultaneously, the comprehensive code representation vector obtained in step S410 is... Input a weight matrix as The bias vector is The activation function is The fully connected layer yields the predicted code category vector. ; Step S412: For the code text submitted by students in the training set, after step S411, the true class vector of the code is obtained. With the predicted code category vector Suppose there are a total of n students in the training group, and the nth student has a total of [number missing]. This code commit; Let the actual label and predicted probability of the code submitted by student number 'i' at time step 'i' in category 'k' of the code feedback score be used to calculate the cross-entropy loss function. : ; In the formula, It is the code feedback score category, 𝑠∈{0,1,2}, For student number n, step n belongs to the nth time step. The actual category label of the class, To predict whether the model will belong to the _th student at time step _i. The probability of a class; Step S413: Use the cross-entropy loss function calculated in step S412. The parameters of the UniXcoder programming model, the fully connected layer parameters used for fusion in training step S410, and the fully connected layer parameters used for classification in training step S411 are fine-tuned using the backpropagation algorithm; the parameters of the language model GPT2-encoder are frozen and do not participate in parameter updates. Step S414: After completing the training in step S413, use the trained parameters to analyze all students at each time step. Question identifier for answering Corresponding commit code Each of these is converted into a comprehensive code representation vector. .
[0027] Further, in step S5, the question recommendation module from step S3 is implemented and trained. Based on the comprehensive code representation from step S4, and combined with the student's historical programming interaction sequence, a long short-term memory network and attention mechanism are used to model the student's ability evolution and generate the probability distribution for the next time step recommendation. The specific process is as follows: Step S51, construct the student response interaction vector; at time step Students using one-hot encoding at time step Question identifier for answering In the case of the above responses, the interaction vector is obtained. ; If the student is in time step Answer correctly (i.e., submit code) If all test cases are passed, the evaluation feedback is correct. Interaction vectors The middle ( +M) positions have 1s, and the remaining positions have 0s; if the student answers incorrectly (i.e., submits incorrect code) If not all test cases pass, the evaluation feedback will be correct. Interaction vectors The Middle One position is 1, and the rest are 0; Step S52, the interaction vector Mapped to a low-dimensional embedding representation; utilizing a learnable weight matrix. , interaction vector Transform into a low-dimensional, dense question interaction embedding vector , It represents the dimension of the question's interactive embedding vector, where T denotes the matrix transpose; Step S53: Construct a comprehensive interactive embedding representation; combine this with the comprehensive code representation vector obtained in step S410. Interact with the question embedding vector in step S52 By concatenating the elements in sequence, a comprehensive interactive embedding is obtained; the formula is as follows: ; In the formula, This represents the student's integrated interaction embedding vector at time step i; Step S54, use a Long Short-Term Memory network to model the student's comprehensive interaction embedding sequence; the student's comprehensive interaction embedding sequence at each time step is { },in, This represents the student's integrated interaction embedding vector at the first time step. This represents the student's integrated interaction embedding vector at the second time step. This represents the student's integrated interaction embedding vector at time step t; Embed the student's comprehensive interactions at each time step into the sequence { Input a Long Short-Term Memory (LSTM) network, and let the initial hidden state of the LSTM network be... ,for arrive At each time step, the hidden state of the Long Short-Term Memory (LSTM) network is updated incrementally. , It is the hidden state dimension of the Long Short-Term Memory (LSTM) network; ; In the formula, Is Hidden states of a Long Short-Term Memory (LSTM) network at time steps; Step S55: Calculate the hidden state similarity; when recommending the next question, calculate the hidden state at time step t. Similarity score with the previous hidden state The similarity function is calculated as follows: ; in, It is the hidden state of a Long Short-Term Memory (LSTM) network from time step i=1 to t-1. The transpose of the spliced matrix, Indicates a fully connected layer; Step S56: Obtain the context vector representing the student's historical ability state; obtain the similarity function of the previously hidden state obtained in step S55. ,application The function obtains normalized attention weights : ; Then, by weighted summation, historical response information related to the current state is captured, resulting in a context vector representing the student's historical ability state. : ; Step S57: Predict the recommended question for the next moment; use the context vector representing the student's historical ability state. Hidden state at time step t After being spliced together, they are input to the fully connected layer (FC). Activation function, obtain Probability distribution of recommended questions at all times : ; Step S58: Construct the supervised loss and update the model parameters; for each sample in the training set, extract the sample time step. Title identifier And generate one-hot true class vectors. ; ; in, Represents the true class vector The kth component, Represents the true class vector The first component, Represents the true class vector The second component, Represents the true class vector The (M-1)th component; Step S59, calculate the cross-entropy loss, and record the total number of students in the training set for the i-th student. Each time step, from t=1 to t= At time t, step S58 generates the true class vector of the nth student at time t+1, denoted as [vector]. And the probability distribution of the predicted question for the nth student at time t+1 in step S57 is denoted as follows: ; Cross-entropy loss function here Defined as: ; in, Let n be the true class vector of student t+1 at time t. Belongs to the code feedback score category Category tags, Probability distribution of recommending a question for student number t+1 at time t Prediction code feedback score category The probability value; calculated by the cross-entropy loss function. And minimize the cross-entropy loss function To achieve this, we update all parameters in the Long Short-Term Memory (LSTM) network, the fully connected layers, and the embedding mapping matrix, up to the cross-entropy loss function. Until it stops falling; Step S510: After calculating the cross-entropy loss in step S59, for the students' historical programming interaction sequences... Obtained using step S57 Probability distribution of recommended questions at all times Take the question identifier corresponding to the maximum value in the distribution and recommend it to students as the next time step t+1.
Claims
1. A personalized programming problem recommendation method integrating dynamic interactive information, characterized in that: Includes the following steps: Step S1: Obtain the dataset from the online evaluation platform, and preprocess and partition the dataset. Step S2: Based on the data from Step S1, formalize and define the students' historical programming interaction sequences; Step S3: Based on the task requirements of step S2, build an overall framework including a code representation module and a question recommendation module, and establish a personalized programming question recommendation model; Step S4: Implement and train the code representation module in step S3. Use the online evaluation platform dataset obtained in step S1 as the input of the code representation module. Use the programming big model UniXcoder and the language model GPT2-encoder to generate code and question text vectors, and fuse them into a comprehensive code representation through supervised learning. Step S5: Implement and train the question recommendation module in step S3. Based on the comprehensive code representation in step S4, combine the student's historical programming interaction sequence, use a long short-term memory network and attention mechanism to model the student's ability evolution, and generate the probability distribution of the recommendation at the next moment.
2. The personalized programming problem recommendation method integrating dynamic interactive information according to claim 1, characterized in that: Step S1: Obtain the dataset from the online evaluation platform, and preprocess and partition the dataset, specifically as follows: Step S11: Collect the dataset from the online assessment platform. The dataset contains students' code submission records, which include question identifiers, question text, student submitted code text, and assessment feedback scores. Step S12: Preprocess the dataset from the online assessment platform. The preprocessing includes score discretization, question label remapping, and sorting of students' historical programming interaction sequences. The scoring discretization process transforms the evaluation feedback scores into three categories: incorrect, partially correct, and completely correct scores for each student. The question identifier remapping process maps the non-continuous question numbers in the online evaluation platform dataset to consecutive numbers. The sorting of students' historical programming interaction sequences involves arranging each student's code submission records in ascending order according to the submission time to form the students' historical programming interaction sequences. Step S13: The preprocessed online evaluation platform dataset is randomly divided into groups based on students. Specifically, 80% of the students' submission records are randomly selected as the training set, and the remaining 20% of the students' submission records are selected as the test set.
3. The personalized programming problem recommendation method integrating dynamic interactive information according to claim 2, characterized in that: Step S2: Formalize and define the students' historical programming interaction sequence; Specifically: Step S21, formally describe and define the personalized programming problem recommendation task: Let... Given a set of all different programming problems, where Indicates the first A programming problem, Let be the total number of programming problems, and let there be 4 student records in the training set. Step S22, let the historical programming interaction sequence of each student be... ,in Indicates the student's time step The question identifier for answering, Indicates the student's time step Question identifier for answering The corresponding question text, Indicates the student's time step Question identifier for answering The corresponding commit code, This indicates the student's assessment feedback score category, which is represented by three student assessment feedback score categories: incorrect, partially correct, and completely correct. Step S23, given the historical programming interaction sequence for each student in step S22. Based on this, study the random variables of candidate problems. The conditional distribution P( | ), and select As The system continuously recommends programming problems to students, enabling personalized problem recommendations. This indicates that the conditional distribution P( | The largest candidate random variable for learning problems The value of .
4. The personalized programming problem recommendation method integrating dynamic interactive information according to claim 3, characterized in that: Step S3: Build the overall framework including the code representation module and the question recommendation module, and establish a personalized programming question recommendation model. The specific process is as follows: Step S31: The code representation module uses a pre-trained programming language model to extract the semantic and structural features of the code and the semantic features of the question text, generates the corresponding embedding vectors of the code and the question text, and uses supervised learning to fuse the code and the question text to obtain a comprehensive code representation vector. In step S32, the question recommendation module uses a comprehensive code representation vector and the student's historical programming interaction sequence to predict the probability distribution of the next recommendation moment through a long short-term memory network and attention mechanism.
5. The personalized programming problem recommendation method integrating dynamic interactive information according to claim 4, characterized in that: Step S4: Implement and train the code representation module from step S3. Use the online evaluation platform dataset obtained in step S1 as input to the code representation module. Utilize the large-scale programming model UniXcoder and the language model GPT2-encoder to generate code and question text vectors, and fuse them into a comprehensive code representation through supervised learning. The specific process is as follows: Step S41: Using the student code submission records in the online assessment platform dataset obtained in step S11, input them into the code representation module; Step S42: Input the student's submitted code text and question text from the student's code submission record into the programming big model UniXcoder and the language model GPT2-encoder, respectively; Step S43: In the preprocessing layer of the UniXcoder programming model, the student-submitted code text is first segmented into words to obtain a length of... sequence ,in, This represents the first word segmented from the student's submitted code text. This indicates the first segment of the code text submitted by the student. 1 word element, then, in a length of sequence Insert a special marker CLS at the very beginning, denoted as The length is obtained as Code text segmentation sequence ; Step S44: Based on the programming language category of the student's submitted code text, call the multi-language parsing framework Tree-sitter to load the corresponding syntax library, parse the student's submitted code text, and generate a length of [length missing]. Code Abstract Syntax Tree (AST) Node Sequence , This represents the label of the first node in the sequence of nodes in the Abstract Syntax Tree (AST). This represents the label of the second node in the sequence of nodes in the Abstract Syntax Tree (AST). The first node of the sequence of nodes in the Abstract Syntax Tree (AST) Each node label; Step S45, segment the code text into word sequences and the sequence of nodes in the Abstract Syntax Tree (AST). The input sequence is obtained by concatenation. As shown in the formula: ; In the formula, It's a splicing operation. It is the code text segmentation sequence obtained in step S43. It is the sequence of AST nodes obtained in step S44; Step S46: In the embedding layer of the UniXcoder programming model, the unified input sequence is... Each marker in the matrix is mapped to a high-dimensional vector, generating a high-dimensional vector matrix. ,in, Represents the real number field; It is the output dimension of the embedding layer of the UniXcoder large-scale programming model; vectors in a high-dimensional vector matrix. The corresponding special marker CLS is used to represent the overall semantic information of the code; vector These correspond to the word segmentation sequences in the code text. ;vector These correspond to the sequence of nodes in the Abstract Syntax Tree (AST). That is, a high-dimensional vector matrix. For code text word segmentation matrix With the Abstract Syntax Tree (AST) node matrix Line-by-line concatenation; Step S47, the high-dimensional vector matrix generated in step S46 Input the Transformer encoder of the UniXcoder programming model to generate a feature matrix that integrates code semantics and the AST node structure of the code abstract syntax tree. ; in, To integrate the feature matrix of code semantics and the AST node structure, Indicates the first The joint representation of the code semantics and code abstract syntax tree (AST) structure obtained by fusing the global context; The sequence length obtained by segmenting the student-submitted code text for the large programming model UniXcoder. The length of the sequence of nodes in the Abstract Syntax Tree (AST). After fusing the global context, the feature matrix integrates code semantics and the AST node structure. Vector corresponding to the special marker CLS This is used to represent the comprehensive semantic information of the entire piece of code submitted by the student; the vector is used to represent the comprehensive semantic information of the entire piece of code submitted by the student. As the embedding vector of the code text submitted by the student, let it be denoted as ; Step S48, for students in the time step Question identifier for answering Corresponding question text The GPT2-encoder language model is used to segment students at each time step. Question identifier for answering Corresponding question text The sequence is segmented into word-tagged sequences, and the word embedding layer of the GPT2-encoder language model is used to map each word-tagged sequence to a high-dimensional embedding vector. ; in, It is the output dimension of the word embedding layer. For students in time steps Question identifier for answering Corresponding question text Segmentation token sequence length, Indicates the student's time step Question identifier for answering Corresponding question text The high-dimensional embedding vector mapped to the j-th word tag; Step S49, will Indicates the student's time step Question identifier for answering Corresponding question text The series of high-dimensional embedding vectors mapped to the j-th word tag The text of the question is fed into a multi-layer Transformer encoder of the GPT2-encoder language model to obtain the student's answer at time step i. Corresponding question text The final embedded representation; ; in, Indicates the student's time step Question identifier for answering Corresponding question text The final embedding representation, This represents the hidden state after context enhancement; Step S410, using a weight matrix as The bias vector is The activation function is A fully connected layer that integrates student-submitted code text embedding vectors. The text of the questions that students answer at time step i Corresponding question text The final embedding representation Construct a comprehensive code representation vector; the specific formula is: ; In the formula, It is a comprehensive code representation vector; It is a modified linear unit activation function; Step S411: Based on the score discretization process in step S1, classify the student's evaluation feedback score into categories. Converted into a code-based true class vector through one-hot encoding. Simultaneously, the comprehensive code representation vector obtained in step S410 is... Input a weight matrix as The bias vector is The activation function is The fully connected layer yields the predicted code category vector. ; Step S412: For the code text submitted by students in the training set, after step S411, the true class vector of the code is obtained. With the predicted code category vector Suppose there are a total of n students in the training group, and the nth student has a total of [number missing]. This code commit; Let the actual label and predicted probability of the code submitted by student number 'i' at time step 'i' in category 'k' of the code feedback score be used to calculate the cross-entropy loss function. : ; In the formula, It is the code feedback score category, 𝑠∈{0,1,2}, For student number n, step n belongs to the nth time step. The actual category label of the class, To predict whether the model will belong to the _th student at time step _i. The probability of a class; Step S413: Use the cross-entropy loss function calculated in step S412. The parameters of the UniXcoder programming model, the fully connected layer parameters used for fusion in training step S410, and the fully connected layer parameters used for classification in training step S411 are fine-tuned using the backpropagation algorithm; the parameters of the language model GPT2-encoder are frozen and do not participate in parameter updates. Step S414: After completing the training in step S413, use the trained parameters to analyze all students at each time step. Question identifier for answering Corresponding commit code Each of these is converted into a comprehensive code representation vector. .
6. The personalized programming problem recommendation method integrating dynamic interactive information according to claim 5, characterized in that: Step S5: Implement and train the question recommendation module from Step S3. Based on the comprehensive code representation from Step S4, and combined with the student's historical programming interaction sequence, use a long short-term memory network and attention mechanism to model the student's ability evolution and generate the probability distribution for the next time step recommendation; the specific process is as follows: Step S51, construct the student response interaction vector; at time step Students using one-hot encoding at time step Question identifier for answering In the case of the above response, the interaction vector is obtained. ; If the student is in time step If the answer is correct, the assessment feedback is correct. Interaction vectors The middle ( +M) positions are set to 1, and the remaining positions are set to 0; if a student answers incorrectly, the assessment will provide feedback on the correctness of the answer. Interaction vectors The Middle One position is 1, and the rest are 0; Step S52, the interaction vector Mapped to a low-dimensional embedding representation; utilizing a learnable weight matrix. , interaction vector Transform into a low-dimensional, dense question interaction embedding vector , It represents the dimension of the question's interactive embedding vector, where T denotes the matrix transpose; Step S53: Construct a comprehensive interactive embedding representation; combine this with the comprehensive code representation vector obtained in step S410. Interact with the question embedding vector in step S52 By concatenating the elements in sequence, a comprehensive interactive embedding is obtained; the formula is as follows: ; In the formula, This represents the student's integrated interaction embedding vector at time step i; Step S54, use a Long Short-Term Memory network to model the student's comprehensive interaction embedding sequence; the student's comprehensive interaction embedding sequence at each time step is { },in, This represents the student's integrated interaction embedding vector at the first time step. This represents the student's integrated interaction embedding vector at the second time step. This represents the student's integrated interaction embedding vector at time step t; Embed the student's comprehensive interactions at each time step into the sequence { Input a Long Short-Term Memory (LSTM) network, and let the initial hidden state of the LSTM network be... ,for arrive At each time step, the hidden state of the Long Short-Term Memory (LSTM) network is updated incrementally. , It is the hidden state dimension of the Long Short-Term Memory (LSTM) network; ; In the formula, Is Hidden states of a Long Short-Term Memory (LSTM) network at time steps; Step S55: Calculate the hidden state similarity; when recommending the next question, calculate the hidden state at time step t. Similarity score with the previous hidden state The similarity function is calculated as follows: ; in, It is the hidden state of a Long Short-Term Memory (LSTM) network from time step i=1 to t-1. The transpose of the spliced matrix, Indicates a fully connected layer; Step S56: Obtain the context vector representing the student's historical ability state; obtain the similarity function of the previously hidden state obtained in step S55. ,application The function obtains normalized attention weights : ; Then, by weighted summation, historical response information related to the current state is captured, resulting in a context vector representing the student's historical ability state. : ; Step S57: Predict the recommended question for the next moment; use the context vector representing the student's historical ability state. Hidden state at time step t After being spliced together, they are input to the fully connected layer (FC). Activation function, obtain Probability distribution of recommended questions at all times : ; Step S58: Construct the supervised loss and update the model parameters; for each sample in the training set, extract the sample time step. Title identifier And generate one-hot true class vectors. ; ; in, Represents the true class vector The kth component, Represents the true class vector The first component, Represents the true class vector The second component, Represents the true class vector The (M-1)th component; Step S59, calculate the cross-entropy loss, and record the total number of students in the training set for the i-th student. Each time step, from t=1 to t= At time t, step S58 generates the true class vector of the nth student at time t+1, denoted as [vector]. And the probability distribution of the predicted question for the nth student at time t+1 in step S57 is denoted as follows: ; Cross-entropy loss function here Defined as: ; in, Let n be the true class vector of student t+1 at time t. Belongs to the code feedback score category Category tags, Probability distribution of recommending a question for student number t+1 at time t Prediction code feedback score category The probability value; calculated by the cross-entropy loss function. And minimize the cross-entropy loss function To achieve this, we update all parameters in the Long Short-Term Memory (LSTM) network, the fully connected layers, and the embedding mapping matrix, up to the cross-entropy loss function. Until it stops falling; Step S510: After calculating the cross-entropy loss in step S59, for the students' historical programming interaction sequences... Obtained using step S57 Probability distribution of recommended questions at all times Take the question identifier corresponding to the maximum value in the distribution and recommend it to students as the next time step t+1.
Citation Information
Patent Citations
Dynamic perception test question recommendation method and system fused with deep knowledge tracking
CN114372137A
Programming knowledge tracking method and device fusing multi-dimensional attributes of questions and code representation
CN119026681A
Personalized programming question recommendation method based on knowledge tracking
CN119271873A
Artificial intelligence tutoring system that support diagnosis of learning proficiency and collaborative learning
KR102636582B1