Programming exercise recommendation method and system based on knowledge tracking and text matching
By using knowledge tracing and text matching methods, learners' programming abilities and knowledge levels are assessed, and a personalized list of recommended exercises is generated. This solves the problem of unsuitable exercises in existing systems, improves the accuracy of recommendations, and enhances learners' motivation.
Patent Information
- Application Number
- CN202411656169.2
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2024-11-19
- Publication Date
- 2025-11-11
- Estimated Expiration
- 2044-11-19
AI Technical Summary
Existing programming exercise recommendation systems cannot effectively measure learners' current abilities, which may result in unsuitable recommended exercises, affecting learners' emotional cognition and potentially leading to feelings of frustration.
Using a knowledge tracing and text matching approach, a programming ability assessment model is used to select exercises of appropriate difficulty. Combined with vector text matching and a knowledge tracing model, a personalized recommendation list is generated to ensure that the exercises match the learner's ability and knowledge level.
It improves the accuracy of programming exercise recommendations, stimulates learners' self-learning enthusiasm, and avoids the frustration caused by unsuitable exercises.
Smart Images

Figure CN119761361B_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of computer technology, and in particular to a method and system for recommending programming exercises based on knowledge tracing and text matching. Background Technology
[0002] With the rapid development of the internet and the increasing demand for programming talent, programming education has gradually become a basic and widespread form of education. Therefore, studying the learning behavior of programming learners, tracking their learning status, and recommending suitable learning materials has become a new area of research in recommendation systems, known as personalized programming recommendation. Currently, the mainstream recommendation method uses the POJ (Programming Online Judge) system. In an educational setting, learners practice programming, design algorithms, and submit them to the POJ system for evaluation within an integrated development environment (IDE) linked to POJ. The POJ system then provides real-time feedback and exercise recommendations based on case test analysis.
[0003] While the benefits of POJ in education are well-known, current systems may only recommend exercises that are suitable for learners in terms of content, without considering whether the exercises are appropriate for the learner's current abilities. This can negatively impact learners' emotional cognition, potentially leading to feelings of frustration and even thoughts of giving up learning. Therefore, a learner-specific recommendation model should be able to measure the learner's current learning status and problem-solving abilities, identifying exercises that can be completed with minimal effort, thereby motivating learners to engage in self-study.
[0004] Knowledge tracking appears to be a viable approach to tailoring programming exercises to students' abilities. Knowledge tracking is an application in educational systems that models students' knowledge status by capturing their interactions with exercises, thereby predicting their mastery of the next exercise. Current research on knowledge tracking is conducted across various disciplines. However, few studies explore how to apply knowledge tracking to provide recommendations in programming instruction. Summary of the Invention
[0005] The main objective of this invention is to propose a programming exercise recommendation method and system based on knowledge tracking and text matching, which can track learners' current programming ability and current knowledge stage, thereby improving the accuracy of the recommendation results.
[0006] To achieve the above objectives, one aspect of this invention proposes a programming exercise recommendation method based on knowledge tracing and text matching, comprising:
[0007] The relevant interaction information of learners when answering programming exercises and the information of the exercises themselves are input into the programming ability assessment model. Based on the learner's ability, exercises of appropriate difficulty are selected to obtain a first-level recommendation list.
[0008] The primary recommendation list and exercise library are input into the programming knowledge stage assessment module. The exercise text is matched using the vector text matching method. Exercises that match the learner's knowledge stage are selected to obtain the secondary candidate recommendation list.
[0009] The secondary candidate recommendation list is input into the knowledge tracking model, and a tertiary recommendation list is output. Based on the tertiary recommendation list, a personalized recommendation scheme for the programming learning environment that matches the learner's ability and knowledge stage is determined.
[0010] In some embodiments, the process of inputting relevant interaction information of learners answering programming exercises and information about the exercises themselves into a programming ability assessment model, and selecting exercises of appropriate difficulty based on the learner's ability to obtain a primary recommendation list, includes the following steps:
[0011] Graph convolution encoding is performed on the solution code text in the interactive information, and the exercise number and submission score are encoded.
[0012] The solution code text, exercise number, and submission score are embedded and then input into an interactive network for deep feature mining to obtain the embedded information.
[0013] The embedded information after interaction is input into a two-layer LSTM network for training to obtain the model output result;
[0014] The model output is matched with the exercise library to obtain a candidate first-level recommendation list;
[0015] The first-level recommendation list is obtained based on the candidate first-level recommendation list;
[0016] The solution code text, after being embedded, is split into learner's programming knowledge reserve CK and learner's programming iteration ability CA. Then, through the GraphCodeBert encoding layer, the graph embedding of learner's programming knowledge reserve CK is obtained. And graph embedding of learners' programming iteration ability CA The exercise number N and the submission score R are then mapped from discrete integer indices to a continuous vector space, forming the exercise number embedding e. id and submit score embedding e R Finally, e id and e R Separately and By combining the information, we can obtain the learner's programming knowledge base, including the question information. and learners' programming iteration ability The calculation formula for the embedding layer can be expressed as:
[0017]
[0018] in, W1 and W2 are learnable parameters; symbol This indicates a splicing operation, where i represents the i-th time step;
[0019] Specifically, for the embedded information, a hierarchical approach is used to extract the corresponding text features. The expression for the extraction process is as follows:
[0020] H A1 =Encoder l (e A1 )
[0021] H D =Encoder l (e D )
[0022] Among them, H A1 Text features representing text A1; H D The text features representing the exercise set D; Encoder l Represents the feature extraction function; e A1 The word embedding representation of text A1 representing exercise set D; e D The word embedding representation of exercise set D.
[0023] In some embodiments, obtaining the primary recommendation list based on the candidate primary recommendation list includes the following steps:
[0024] The vector representing the learner's programming ability from the output of the two-layer LSTM network and the numbers of each exercise in the programming exercise library are input together into the fully connected layer to obtain the learner's current predicted mastery level of each exercise.
[0025] The exercise numbers and corresponding scores are filtered to select exercise numbers in the range of 0.5-1 and combined to obtain the first-level recommendation list;
[0026] The calculation formula for the two-layer LSTM network is as follows:
[0027]
[0028] in, represent: represent: and Dual represents the state at each time step during a learner's programming history answering questions. LSTM()This represents a two-layer LSTM network.
[0029] In some embodiments, the step of inputting the primary recommendation list and the exercise library into the programming knowledge stage assessment module, using vector text matching to perform exercise text matching, learning exercises that match the learner's knowledge stage, and obtaining a secondary candidate recommendation list includes the following steps:
[0030] The IDs of the first-level recommendation list and the corresponding exercise text content are input into the Stella text matching network to obtain text feature vectors;
[0031] Calculate the similarity of text feature vectors;
[0032] The knowledge points in the first-level recommendation list and several similar exercises are combined to form the second-level candidate recommendation list.
[0033] In some embodiments, the expression for generating the primary recommendation list is:
[0034] A1=F(P(1|X h q t+1 )),
[0035] Where A1 represents a list containing k exercise numbers, P is a probability function, and X... h The information input to the input layer, q t+1 The exercise text is for the next time step; F(x) is the filter.
[0036] In some embodiments, the expression for generating the secondary candidate recommendation list A2 is:
[0037] A2 = A1 ∪ Top k (S),
[0038] Among them, Top k (S) represents the k exercises that are most relevant to the given text.
[0039] In some embodiments, the expression for generating the three-level recommendation list is:
[0040] A3=F(KT(A1, Stella(A1))),
[0041] Here, A3 refers to the final set of exercises recommended to learners, filter(x) is the filter, Stella(x) is the text encoding model, and KT(x) is the expression for F(P(1|X). h q t+1 The simplified version of )) outputs a list of candidate exercises from the knowledge tracing model, and the Top_k filtering method is used for the filtering rules.
[0042] Another aspect of this invention provides a programming exercise recommendation system based on knowledge tracing and text matching, comprising:
[0043] The first module is used to input relevant interaction information and information about the exercises themselves into the programming ability assessment model, select exercises of appropriate difficulty according to the learner's ability, and obtain a first-level recommendation list.
[0044] The second module is used to input the primary recommendation list and the exercise bank into the programming knowledge stage assessment module, use vector text matching method to match exercise text, learn exercises that match the learner's knowledge stage, and obtain a secondary candidate recommendation list;
[0045] The third module is used to input the secondary candidate recommendation list into the knowledge tracking model, output a tertiary recommendation list, and determine a personalized recommendation scheme for the programming learning environment that matches the learner's ability and knowledge stage based on the tertiary recommendation list.
[0046] To achieve the above objectives, another aspect of the present invention provides an electronic device, which includes a memory and a processor, wherein the memory stores a computer program, and the processor executes the computer program to implement the method described above.
[0047] To achieve the above objectives, another aspect of the present invention provides a computer-readable storage medium storing a computer program that, when executed by a processor, implements the methods described above.
[0048] This invention also discloses a computer program product or computer program, which includes computer instructions stored in a computer-readable storage medium. A processor of a computer device can read the computer instructions from the computer-readable storage medium and execute the computer instructions, causing the computer device to perform the aforementioned method.
[0049] The embodiments of this invention include at least the following beneficial effects: This invention provides a programming exercise recommendation method and system based on knowledge tracking and text matching. This scheme inputs relevant interaction information of learners answering programming exercises and information about the exercises themselves into a programming ability assessment model. Based on the learner's ability, exercises of appropriate difficulty are selected to obtain a first-level recommendation list. The first-level recommendation list and the exercise library are input into a programming knowledge stage assessment module, and vector text matching is used to perform exercise text matching to learn exercises that match the learner's knowledge stage, resulting in a second-level candidate recommendation list. The second-level candidate recommendation list is input into a knowledge tracking model, outputting a third-level recommendation list. Based on the third-level recommendation list, a personalized recommendation scheme for a programming learning environment that matches the learner's ability and knowledge stage is determined. The embodiments of this invention can track the learner's current programming ability and current knowledge stage, improving the accuracy of the recommendation results. Attached Figure Description
[0050] Figure 1 This is a schematic diagram of an implementation environment provided by an embodiment of the present invention;
[0051] Figure 2 This is a flowchart of the overall steps provided in the embodiments of the present invention;
[0052] Figure 3 This is a diagram of the programming knowledge tracking method for information interaction provided in this embodiment of the invention, used for a programming exercise recommendation function module.
[0053] Figure 4 This is a schematic diagram of the programming capability matching module inside the model provided in this embodiment of the invention;
[0054] Figure 5 This is a schematic diagram of the structure of the programming knowledge stage matching module within the model provided in this embodiment of the invention;
[0055] Figure 6 This is a schematic diagram of the overall framework provided in an embodiment of the present invention. Detailed Implementation
[0056] To make the objectives, technical solutions, and advantages of this invention clearer, the invention will be further described in detail below with reference to the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are merely illustrative of the invention and are not intended to limit the invention. In the following description, when referring to the accompanying drawings, unless otherwise indicated, the same numbers in different drawings represent the same or similar elements. The embodiments described in the following exemplary embodiments do not represent all embodiments consistent with the embodiments of this invention; they are merely examples of apparatuses and methods consistent with some aspects of the embodiments of this invention as detailed in the appended claims.
[0057] It is understood that the terms “first,” “second,” etc., used in this invention may be used herein to describe various concepts, but unless specifically stated otherwise, these concepts are not limited by these terms. These terms are used only to distinguish one concept from another. For example, first information may also be referred to as second information without departing from the scope of embodiments of the invention, and similarly, second information may also be referred to as first information. Depending on the context, the words “if,” “when,” or “in response to determination” as used herein may be interpreted as “when…” or “when…” or “in response to determination.”
[0058] The terms “at least one,” “multiple,” “each,” “any,” etc., used in this invention, “at least one” includes one, two, or more than two; “multiple” includes two or more than two; “each” refers to each of the corresponding multiple; and “any” refers to any one of the multiple.
[0059] Unless otherwise defined, all technical and scientific terms used herein have the same meaning as commonly understood by one of ordinary skill in the art to which this invention pertains. The terminology used herein is for the purpose of describing embodiments of the invention only and is not intended to limit the invention.
[0060] The programming exercise recommendation method and system based on knowledge tracing and text matching provided in this invention relates to the field of computer technology. The programming exercise recommendation method based on knowledge tracing and text matching provided in this invention can be applied to a terminal, a server, or software running on a terminal or server. In some embodiments, the terminal can be a smartphone, tablet, laptop, desktop computer, smart speaker, smartwatch, or in-vehicle terminal, but is not limited to these. The server can be configured as an independent physical server, a server cluster or distributed system composed of multiple physical servers, or a cloud server providing basic cloud computing services such as cloud services, cloud databases, cloud computing, cloud functions, cloud storage, network services, cloud communication, middleware services, domain name services, security services, CDN, and big data and artificial intelligence platforms. The server can also be a node server in a blockchain network. The software can be an application implementing the programming exercise recommendation method based on knowledge tracing and text matching, but is not limited to the above forms.
[0061] This invention can be used in a wide variety of general-purpose or special-purpose computer system environments or configurations. Examples include: personal computers, server computers, handheld or portable devices, tablet devices, multiprocessor systems, microprocessor-based systems, set-top boxes, programmable consumer electronics, network PCs, minicomputers, mainframe computers, and distributed computing environments including any of the above systems or devices. This invention can be described in the general context of computer-executable instructions, such as program modules, that are executed by a computer. Generally, program modules include routines, programs, objects, components, data structures, etc., that perform specific tasks or implement specific abstract data types. This invention can also be practiced in distributed computing environments where tasks are performed by remote processing devices connected via a communication network. In distributed computing environments, program modules can reside in local and remote computer storage media, including storage devices.
[0062] like Figure 1 The diagram shown is a schematic representation of an implementation environment provided by an embodiment of the present invention. (Refer to...) Figure 1 The implementation environment includes at least one terminal 102 and a server 101. The terminal 102 and the server 101 can be connected via a network, either wirelessly or via a wired connection, to complete data transmission and exchange.
[0063] Server 101 can be a standalone physical server, a server cluster or distributed system composed of multiple physical servers, or a cloud server that provides basic cloud computing services such as cloud services, cloud databases, cloud computing, cloud functions, cloud storage, network services, cloud communication, middleware services, domain name services, security services, CDN (Content Delivery Network), and big data and artificial intelligence platforms.
[0064] Additionally, server 101 can also be a node server in a blockchain network. Blockchain is a novel application model of computer technologies such as distributed data storage, peer-to-peer transmission, consensus mechanisms, and encryption algorithms.
[0065] Terminal 102 can be a smartphone, tablet, laptop, desktop computer, smart speaker, smartwatch, etc. It can also be a vehicle-mounted terminal of the various device types described above, but is not limited to these. Terminal 102 and server 101 can be directly or indirectly connected via wired or wireless communication, and this embodiment of the invention does not impose any limitations.
[0066] Exemplary based on Figure 1The implementation environment shown in this embodiment of the invention provides a programming exercise recommendation method based on knowledge tracing and text matching. The following description uses the application of this programming exercise recommendation method based on knowledge tracing and text matching in server 101 as an example. It can be understood that this method can also be applied in terminal 102.
[0067] Reference Figure 2 , Figure 2 The flowchart illustrates a programming exercise recommendation method based on knowledge tracing and text matching applied to a server, as provided in this embodiment of the invention. The execution entity of this method can be any of the aforementioned computer devices (including a server or a terminal). (Refer to...) Figure 2 The method may include the following steps:
[0068] The relevant interaction information of learners when answering programming exercises and the information of the exercises themselves are input into the programming ability assessment model. Based on the learner's ability, exercises of appropriate difficulty are selected to obtain a first-level recommendation list.
[0069] The primary recommendation list and exercise library are input into the programming knowledge stage assessment module. The exercise text is matched using the vector text matching method. Exercises that match the learner's knowledge stage are selected to obtain the secondary candidate recommendation list.
[0070] The secondary candidate recommendation list is input into the knowledge tracking model, and a tertiary recommendation list is output. Based on the tertiary recommendation list, a personalized recommendation scheme for the programming learning environment that matches the learner's ability and knowledge stage is determined.
[0071] In some embodiments, the process of inputting relevant interaction information of learners answering programming exercises and information about the exercises themselves into a programming ability assessment model, and selecting exercises of appropriate difficulty based on the learner's ability to obtain a primary recommendation list, includes the following steps:
[0072] Graph convolution encoding is performed on the solution code text in the interactive information, and the exercise number and submission score are encoded.
[0073] The solution code text, exercise number, and submission score are embedded and then input into an interactive network for deep feature mining to obtain the embedded information.
[0074] The embedded information after interaction is input into a two-layer LSTM network for training to obtain the model output result;
[0075] The model output is matched with the exercise library to obtain a candidate first-level recommendation list;
[0076] The first-level recommendation list is obtained based on the candidate first-level recommendation list;
[0077] The solution code text, after being embedded, is split into learner's programming knowledge reserve CK and learner's programming iteration ability CA. Then, through the GraphCodeBert encoding layer, the graph embedding of learner's programming knowledge reserve CK is obtained. And graph embedding of learners' programming iteration ability CA The exercise number N and the submission score R are then mapped from discrete integer indices to a continuous vector space, forming the exercise number embedding e. id and submit score embedding e R Finally, e id and e R Separately and By combining the information, we can obtain the learner's programming knowledge base, including the question information. and learners' programming iteration ability The calculation formula for the embedding layer can be expressed as:
[0078]
[0079] in, W1 and W2 are learnable parameters; symbol This indicates a splicing operation, where i represents the i-th time step;
[0080] Specifically, for the embedded information, a hierarchical approach is used to extract the corresponding text features. The expression for the extraction process is as follows:
[0081] H A1 =Encoder l (e A1 )
[0082] H D =Encoder l (e D )
[0083] Among them, H A1 Text features representing text A1; H D The text features representing the exercise set D; Encoder l Represents the feature extraction function; e A1 The word embedding representation of text A1 representing exercise set D; e D The word embedding representation of exercise set D.
[0084] In some embodiments, obtaining the primary recommendation list based on the candidate primary recommendation list includes the following steps:
[0085] The vector representing the learner's programming ability from the output of the two-layer LSTM network and the numbers of each exercise in the programming exercise library are input together into the fully connected layer to obtain the learner's current predicted mastery level of each exercise.
[0086] The exercise numbers and corresponding scores are filtered to select exercise numbers in the range of 0.5-1 and combined to obtain the first-level recommendation list;
[0087] The calculation formula for the two-layer LSTM network is as follows:
[0088]
[0089] in, represent; represent; and Dual represents the state at each time step during a learner's programming history answering questions; LSTM() This represents a two-layer LSTM network.
[0090] In some embodiments, the step of inputting the primary recommendation list and the exercise library into the programming knowledge stage assessment module, using vector text matching to perform exercise text matching, learning exercises that match the learner's knowledge stage, and obtaining a secondary candidate recommendation list includes the following steps:
[0091] The IDs of the first-level recommendation list and the corresponding exercise text content are input into the Stella text matching network to obtain text feature vectors;
[0092] Calculate the similarity of text feature vectors;
[0093] The knowledge points in the first-level recommendation list and several similar exercises are combined to form the second-level candidate recommendation list.
[0094] In some embodiments, the expression for generating the primary recommendation list is:
[0095] A1=F(P(1|X h q t+1 )),
[0096] Where A1 represents a list containing k exercise numbers, P is a probability function, and X... h The information input to the input layer, q t+1 The exercise text is for the next time step; F(x) is the filter.
[0097] In some embodiments, the expression for generating the secondary candidate recommendation list A2 is:
[0098] A2 = A1 ∪ Top k (S),
[0099] Among them, Top k (S) represents the k exercises that are most relevant to the given text.
[0100] In some embodiments, the expression for generating the three-level recommendation list is:
[0101] A3=F(KT(A1, Stella(A1))),
[0102] Here, A3 refers to the final set of exercises recommended to learners, filter(x) is the filter, Stella(x) is the text encoding model, and KT(x) is the expression for F(P(1|X). h q t+1 The simplified version of )) outputs a list of candidate exercises from the knowledge tracing model, and the Top_k filtering method is used for the filtering rules.
[0103] The implementation process of this invention will be described in detail below using specific application scenarios as examples:
[0104] This invention primarily addresses the problem of exercise recommendation in online programming learning. In this invention, the exercises recommended to learners possess both interpretability of the learner's programming ability and interpretability of their programming knowledge stage. Learner ability interpretability is reflected by the submitted code content and scores provided through interaction between the learner and the exercises, while learner knowledge stage interpretability is jointly reflected by the learner's historical learning question texts and the model's output of predicted solvable question texts. The submitted code text content is categorized into various programming languages, and the submission score is 1 for a correct answer and 0 for an incorrect answer. This feature information effectively represents the learner's mastery of different types of exercises and captures the learner's learning trajectory, thereby enabling better research on real-time exercise recommendation in online programming learning.
[0105] like Figure 3 As shown, a personalized programming recommendation system based on knowledge tracking and text matching includes the following modules: a programming ability assessment module, a programming knowledge stage assessment module, and an exercise recommendation module.
[0106] This invention provides a personalized recommendation method for programming based on knowledge tracing and text matching, which specifically includes the following steps:
[0107] Feature extraction is performed on the relevant interaction information of learners when answering programming exercises, as well as the information of the exercises themselves.
[0108] The processed features are input into the programming ability assessment model, which outputs the learner's ability representation against all matching exercises in the exercise bank, thus obtaining a list of exercises that the learner can solve, i.e., the first-level candidate recommendation list.
[0109] The primary candidate recommendation list and the exercise bank are input into the programming knowledge stage matching module. Vector text matching and similarity calculation methods are used to obtain the secondary candidate recommendation list that matches the learner's knowledge stage.
[0110] The secondary candidate recommendation list is then input into the knowledge tracking model, and the recommender provides learners with a personalized recommendation scheme that suits their programming learning environment.
[0111] Before being input into the knowledge tracing model, the learner's interaction information and the text information of the exercises themselves undergo feature extraction. Feature extraction of the learner's interaction information refers to obtaining all the solution code text and corresponding scores submitted by the learner when solving the same programming problem. Scores are only 0 and 1; to prevent gradient vanishing during the data cleaning phase, this embodiment encodes them as -1 and 1 values. To better refine the feature information contained in the learner's code, this embodiment decomposes the code submitted by the learner into two parts: one representing the learner's mastery of programming knowledge, and the other representing the learner's problem-solving ability.
[0112] In this embodiment, the GraphCodeBERT programming encoding module is used to vectorize the submitted code text. GraphCodeBERT is an encoding model specifically for programming languages, and compared to the traditional AST syntax tree model, GraphCodeBERT can represent code text more intuitively. When there are more than two code texts of solutions submitted for the same exercise, the steps for obtaining code text features in this embodiment include:
[0113] The first step is to take the solution code text submitted by the learner at time t as a representation of the learner's programming knowledge reserves (CK).
[0114] The second step is to take the difference between the solution code text submitted by the learner at time t-1 and the solution code text submitted by the learner at time t, and obtain the difference set code text, which serves as the representation of programming iteration ability (CA).
[0115] Finally, the learning knowledge reserve (CK) and programming iteration ability (CA) are input into the GraphCodeBERT code text representation model for graph construction and vectorization, ultimately obtaining the learner's programming knowledge reserve embedding (e). CK And the embedding of learners' programming iteration ability CA .
[0116] In the Knowledge Tracking (KT) part of this example, an Interactive Memory Network (IMN) is included. Compared to models like DKT, which are based on a single time sequence, IMN can learn the non-linear relationship between student and exercise interactions. IMN consists of two parts: the first part is an interaction network, and the second part is a two-layer LSTM network. The output of one layer serves as the input to the next layer.
[0117] First, the information from the lower input layer is fed into the embedding layer to obtain the features of the learner-exercise interaction information, which are the exercise text embeddings e. Q Embedding learners' programming knowledge reserves CK Embedding learners' programming iteration ability CA and submit answer code e R .
[0118] Furthermore, an Interactive Memory Network (IMN) is placed above the embedding layer. Through this layer, deep correlation information between the previous time-step latent vector and the learner's programming knowledge reserves, as well as the previous time-step latent vector and the learner's programming iteration ability, is obtained. These are then fed into a two-layer LSTM network to capture the contextual relationships between the learner's historical learning records and obtain the learner's global knowledge state h at the current time step.
[0119] Furthermore, the learner's global knowledge state and the exercise ID from the exercise bank are embedded into the output layer to obtain the learner's predicted score for that exercise.
[0120] Finally, based on filter F, the top k items with predicted scores between 0.7 and 0.8 are selected to form the first-level candidate recommendation list A1.
[0121] In summary, the calculation for the knowledge tracing part can be expressed as:
[0122] A1=F(P(1|X h q t+1 ))
[0123] Where A1 represents a list containing k exercise IDs, P is a probability function, and X... h The information input to the input layer, q t+1 The exercise text for the next time step. F(x) is the filter.
[0124] The recommendation section of this embodiment includes a text matching model, which consists of two parts: the first part is a Stella encoding model based on hierarchical granularity, and the second part is a cosine similarity calculation method. The steps of the recommendation section are as follows:
[0125] First, several semantically similar exercises are matched from the exercise bank. The module input consists of the exercise IDs of the filtered first-level candidate recommendation list A1 and the exercise text, where the text content can be in various natural languages. In this example, the text language is uniformly translated into Chinese.
[0126] In some embodiments, the exercise text is encoded as an embedding vector.
[0127] In some embodiments, cosine similarity is used to calculate the candidate recommendation list embedding e. A1 Exercise bank text embedding e D The similarity score is obtained by measuring the distance between the texts. The score ranges from 0 to 1, with a score of 1 for completely identical texts, and the score decreases accordingly as the texts differ.
[0128] In some embodiments, exercise IDs containing similarity values are input into a filter. The filter uses the Top_k method to select the top k exercise IDs with the highest similarity scores, which, together with the first-level candidate recommendation list A1, form the second-level candidate list A2.
[0129] In this example, the recommended candidate list A2 is fed back into the KT model to filter out a list of exercises that match the learner's knowledge level and abilities. Within the KT model, the learner's previously learned global programming ability state h and the secondary candidate list A2 are fed back into the fully connected layer, and the corresponding predicted score is output based on the exercise ID.
[0130] In some embodiments, the exercise ID containing the predicted score is input into the filter. The top m exercises with predicted scores in the range of 0.8-0.9 are selected to form a three-level candidate recommendation list A3, which is then input into the recommender. For learners, exercises with predicted scores close to 0 may be completely impossible for them to solve, while exercises with predicted scores close to 1 may be too easy for them. Neither of these is conducive to stimulating learners' learning motivation. Through experiments, the score selection standard in this embodiment of the invention is set in the range of 0.7-0.8.
[0131] In summary, the calculation of the recommendation portion can be expressed as:
[0132] A3 = F(KT(A1, Stella(A1)))
[0133] Here, A3 refers to the final set of exercises recommended to learners, filter(x) is the filter, Stella(x) is the text encoding model, and KT(x) is F(P(1|X)). h q t+1 The simplified version of )) outputs a list of candidate exercises from the knowledge tracing model, and the Top_k filtering method is used for the filtering rules.
[0134] Therefore, the recommendation task is complete.
[0135] like Figure 4 As shown, in a personalized recommendation system based on knowledge tracing and text matching, the internal structure of the capability matching module includes:
[0136] Input Layer. The input layer will receive a series of historical data from the learner's interaction with the exercises. This includes three categories: exercise number N, learner-submitted solution text C, and submitted score R.
[0137] Embedding layer. In the embedding layer, the learner's solution text C is split into two parts: the learner's programming knowledge reserve CK and the learner's programming iteration ability CA, and the corresponding graph embedding is obtained through the GraphCodeBert encoding layer. The exercise number N and the submission score R are then mapped from discrete integer indices to a continuous vector space, forming the exercise number embedding e. id and submit score embedding e R Finally, e id and e R Separately and By combining the information, we can obtain the learner's programming knowledge base, including the question information. and learners' programming iteration ability The calculation formula for the embedding layer can be expressed as:
[0138]
[0139] in, These are learnable parameters. (Symbol) This indicates a splicing operation, where i represents the i-th time step.
[0140] Interactive memory network. It is then input into the interactive memory network, first of which... The latent vector h retained from the previous time step of the model is input into the interaction network for interaction. This module can be regarded as enriching the addition of the recursive transformation, incorporating additional information while maintaining the same range as the original input. Note that the interaction network module is skipped during the first input because there is no information from the previous time step.
[0141] In some embodiments, the latent vector h passed through the interactive network and the embedding e of the learner's programming knowledge reserve are used in this invention. CK Embedding learners' programming iteration ability CA With the submitted answer code e R The data is then fed into a two-layer LSTM network. As a time-based model with memory, the LSTM network can store the state of each time step in the learner's programming answer history. and Furthermore, it retains the learned knowledge at the next time step, thus predicting the learner's knowledge state from both macro and micro perspectives. At the same time, LSTM avoids the gradient explosion problem compared to RNN models. A two-layer LSTM network is constructed by connecting two single-layer LSTMs in parallel, with the aim of learning e separately. CK and e CA The feature information is used to ensure the consistency of feature information partitioning. The computation of a two-layer LSTM network can be represented as:
[0142]
[0143] Finally, the outputs of the two layers are unified into a single vector, representing the learner's global knowledge state h′. i h′ i The calculation formula can be expressed as:
[0144]
[0145] like Figure 5 As shown, in a personalized recommendation system based on knowledge tracing and text matching, the internal structure of the knowledge stage matching module includes the following:
[0146] Input layer. Through a knowledge tracing model, embodiments of the present invention can obtain deep connections between learners' learning states and exercises, thereby inferring connections between new exercises and learning states. Embodiments of the present invention will obtain the learner's global knowledge state h′. i The predicted scores for all exercises are concatenated with the embedded question IDs of exercise database D, input into a fully connected layer, and output as predicted scores for all exercises. Finally, based on filter F, the top k exercise IDs with predicted scores between 0.7 and 0.8 are selected to form the first-level candidate recommendation list A1.
[0147] The calculation of the first-level candidate recommendation list A1 can be represented as:
[0148]
[0149] in ReLU is an activation function. Let A1 be a list containing k exercise IDs, where a = 0.7 and b = 0.8. (These are learnable parameters.)
[0150] Embedding layer. Based on a hierarchical granular encoding model. When training such representations, the computational constraints of each exercise text are often unknown. In this case, rigid, fixed-length representations may be too long or too short, failing to adapt to all exercise texts. Therefore, this embodiment uses the Stella text encoding model to represent text content as vectors. Stella has flexible embedding encoding capabilities, enabling selective encoding of a text from coarse to fine granular, and achieving nearly the same effect as independently trained single-dimensional vector representations. First, the exercise texts Q from the candidate recommendation list A1 are... A1 The exercise text Q of the exercise bank D D The input is fed into the embedding layer and transformed into exercise text e A1 Exercise text e from exercise bank D D .
[0151] e A1 =Embed(A1)
[0152] e D =Embed(D)
[0153] in, , respectively, are the word embedding representations of text A1 and exercise set D, m1 and m2 are the number of words in text A1 and D, respectively, and d is the embedding dimension.
[0154] In some embodiments, text features are extracted hierarchically. For text embedding e A1 e D In this embodiment of the invention, Matrioushka representation learning is used to obtain feature representations H at different levels. A1 H D The calculation formula can be expressed as:
[0155] H A1 =Encoder l (e A1 )
[0156] H D =Encoder l (e D )
[0157] Encoder l It is a feature extraction function for a specific layer, where l represents the layer number.
[0158] Context-aware module. In some embodiments, the text feature representation is input into the context-aware module. In this module, the word embedding matrix is first mapped to query vectors, key vectors, and value vectors. The query vectors and key vectors are used to calculate the attention score matrix, and the value vectors are weighted and summed. This embodiment of the invention obtains a context-aware word representation. This mechanism effectively captures the dependencies between words, enhancing the model's ability to understand semantic information. Subsequently, after processing through a multi-layer self-attention mechanism and a feedforward neural network, this embodiment of the invention can generate a context-aware representation of the text. Through the self-attention mechanism, the model can flexibly focus on the importance of different parts of the sentence, thereby adaptively adjusting the representation of each word. Finally, the vectors are normalized and residually connected to update the feature representation H. A1 H D The output H after passing through the context-aware module A1 H D The calculation can be expressed as:
[0159]
[0160] in Aggregate(x) is the feature aggregation layer. This represents the corresponding context words.
[0161] In some embodiments, an average pooling layer is used to transform the word embeddings of each text into a fixed-dimensional vector representation, e A1 e D These are the first-level recommendation list A1 and the final encoded result of the exercise bank text, respectively. The calculation formula can be expressed as:
[0162]
[0163] Similarity calculation. e A1 e D Perform similarity calculation and select
[0164]
[0165] In some embodiments, the present invention employs a Top-k method to select the top k exercise IDs with the highest similarity scores from the similarity score set S. Specifically, the present invention sorts the similarity scores and selects the top k exercise IDs, denoted as...
[0166] Top k (S) = {id1, id2, ..., id} k}
[0167] In some embodiments, this invention combines the primary candidate recommendation list A1 with the exercise IDs obtained through the Top-k method to form a secondary candidate list A2. At this point, the secondary candidate list A2 contains all exercises from the primary candidate list plus the k exercises most relevant to the given text. This method not only enriches the content of the candidate list but also improves the targeting and effectiveness of the recommendations, thereby better meeting the learner's needs. Through this comprehensive strategy, learners can obtain more relevant and challenging exercises, promoting their learning and improving their programming skills. The calculation of the secondary recommendation list can be expressed as:
[0168] A2 = A1 ∪ Top k (S)
[0169] Finally, a recommended list of exercises is constructed based on the predicted probabilities. This secondary recommendation list is then re-input into the knowledge tracing model KT, and the predicted scores of the exercises in the list are calculated. The top m exercise IDs with scores between a and b are selected from the predicted scores and denoted as A3, representing exercises that the learner can appropriately challenge. The calculation of A3 can be expressed as:
[0170]
[0171] Loss function. To achieve more accurate predictions, the knowledge tracking model is trained using a loss function (Loss). In this embodiment of the invention, cross-entropy log loss is used to train the model.
[0172] In conclusion, this concludes the recommendations section.
[0173] Compared with existing technologies, the embodiments of this invention have the following advantages and beneficial effects: They employ a knowledge tracking model with programming feature learning capabilities, encoding the unique code-based question-answering text features specific to programming and inputting them into a time-aware sequence model to assess the learner's current programming ability; they use a text similarity matching model that allows variable vector lengths, employing a Stella model to match exercises with similar knowledge points for the current learner; and they use multiple metrics to evaluate the model results and optimize the model. This method effectively considers the characteristics of the programming domain in knowledge tracking and models the learning model of programming learners. It solves problems such as gradient vanishing and coarse feature partitioning granularity, greatly improving the accuracy of programming exercise recommendations.
[0174] refer to Figure 6 In the overall system framework of this invention embodiment, another aspect of this invention embodiment also provides a programming exercise recommendation system based on knowledge tracing and text matching, including:
[0175] The first module is used to input relevant interaction information and information about the exercises themselves into the programming ability assessment model, select exercises of appropriate difficulty according to the learner's ability, and obtain a first-level recommendation list.
[0176] The second module is used to input the primary recommendation list and the exercise bank into the programming knowledge stage assessment module, use vector text matching method to match exercise text, learn exercises that match the learner's knowledge stage, and obtain a secondary candidate recommendation list;
[0177] The third module is used to input the secondary candidate recommendation list into the knowledge tracking model, output a tertiary recommendation list, and determine a personalized recommendation scheme for the programming learning environment that matches the learner's ability and knowledge stage based on the tertiary recommendation list.
[0178] It is understood that the content of the above method embodiments is applicable to this system embodiment. The specific functions implemented in this system embodiment are the same as those in the above method embodiments, and the beneficial effects achieved are also the same as those achieved in the above method embodiments.
[0179] This invention also provides an electronic device, which includes a memory and a processor. The memory stores a computer program, and the processor executes the computer program to implement the aforementioned programming exercise recommendation method based on knowledge tracing and text matching. This electronic device can be any smart terminal, including tablet computers, in-vehicle computers, etc.
[0180] It is understood that the content of the above method embodiments is applicable to this device embodiment. The specific functions implemented by this device embodiment are the same as those of the above method embodiments, and the beneficial effects achieved are also the same as those achieved by the above method embodiments.
[0181] This invention also provides a computer-readable storage medium storing a computer program that, when executed by a processor, implements the aforementioned programming exercise recommendation method based on knowledge tracing and text matching.
[0182] It is understood that the content of the above method embodiments is applicable to this storage medium embodiment. The specific functions implemented in this storage medium embodiment are the same as those in the above method embodiments, and the beneficial effects achieved are also the same as those achieved in the above method embodiments.
[0183] Memory, as a non-transitory computer-readable storage medium, can be used to store non-transitory software programs and non-transitory computer-executable programs. Furthermore, memory may include high-speed random access memory, and may also include non-transitory memory, such as at least one disk storage device, flash memory device, or other non-transitory solid-state storage device. In some embodiments, memory may optionally include memory remotely located relative to the processor, and these remote memories can be connected to the processor via a network. Examples of such networks include, but are not limited to, the Internet, intranets, local area networks, mobile communication networks, and combinations thereof.
[0184] It should be noted that in various specific embodiments of the present invention, when processing data related to user identity or characteristics, such as user information, user behavior data, user historical data, and user location information, user permission or consent is obtained first. Furthermore, the collection, use, and processing of this data comply with relevant laws, regulations, and standards. In addition, when embodiments of the present invention require access to sensitive personal information of users, separate permission or consent from the user is obtained through pop-ups or redirection to a confirmation page. Only after obtaining the user's separate permission or consent is the necessary user-related data for the normal operation of the embodiments of the present invention acquired.
[0185] The embodiments described in this invention are for the purpose of more clearly illustrating the technical solutions of the embodiments of this invention, and do not constitute a limitation on the technical solutions provided by the embodiments of this invention. As those skilled in the art will know, with the evolution of technology and the emergence of new application scenarios, the technical solutions provided by the embodiments of this invention are also applicable to similar technical problems.
[0186] Those skilled in the art will understand that the technical solutions shown in the figures do not constitute a limitation on the embodiments of the present invention, and may include more or fewer steps than shown, or combine certain steps, or different steps.
[0187] The device embodiments described above are merely illustrative. The units described as separate components may or may not be physically separate; that is, they may be located in one place or distributed across multiple network units. Some or all of the modules can be selected to achieve the purpose of this embodiment according to actual needs.
[0188] Those skilled in the art will understand that all or some of the steps in the methods disclosed above, as well as the functional modules / units in the systems and devices, can be implemented as software, firmware, hardware, or suitable combinations thereof.
[0189] The terms "first," "second," "third," "fourth," etc. (if present) in the specification and accompanying drawings of this invention are used to distinguish similar objects and are not necessarily used to describe a specific order or sequence. It should be understood that such data can be interchanged where appropriate so that embodiments of the invention described herein can be implemented in orders other than those illustrated or described herein. Furthermore, the terms "comprising" and "having," and any variations thereof, are intended to cover a non-exclusive inclusion; for example, a process, method, system, product, or apparatus that comprises a series of steps or units is not necessarily limited to those steps or units explicitly listed, but may include other steps or units not explicitly listed or inherent to such processes, methods, products, or apparatus.
[0190] It should be understood that in this invention, "at least one (item)" refers to one or more, and "more than one" refers to two or more. "And / or" describes the relationship between related objects, indicating that three relationships can exist. For example, "A and / or B" can represent three cases: only A exists, only B exists, and both A and B exist simultaneously, where A and B can be singular or plural. The character " / " generally indicates that the preceding and following related objects are in an "or" relationship. "At least one (item) of the following" or similar expressions refer to any combination of these items, including any combination of single or plural items. For example, at least one (item) of a, b, or c can represent: a, b, c, "a and b", "a and c", "b and c", or "a and b and c", where a, b, and c can be single or multiple.
[0191] In the several embodiments provided by this invention, it should be understood that the disclosed apparatus and methods can be implemented in other ways. For example, the apparatus embodiments described above are merely illustrative; for instance, the division of the units described above is only a logical functional division, and in actual implementation, there may be other division methods. For example, multiple units or components may be combined or integrated into another system, or some features may be ignored or not executed. Furthermore, the coupling or direct coupling or communication connection shown or discussed may be through some interfaces; the indirect coupling or communication connection between devices or units may be electrical, mechanical, or other forms.
[0192] The units described above as separate components may or may not be physically separate. The components shown as units may or may not be physical units; that is, they may be located in one place or distributed across multiple network units. Some or all of the units can be selected to achieve the purpose of this embodiment according to actual needs.
[0193] Furthermore, the functional units in the various embodiments of the present invention can be integrated into one processing unit, or each unit can exist physically separately, or two or more units can be integrated into one unit. The integrated unit can be implemented in hardware or as a software functional unit.
[0194] If the integrated unit is implemented as a software functional unit and sold or used as an independent product, it can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of the present invention, in essence, or the part that contributes to the prior art, or all or part of the technical solution, can be embodied in the form of a software product. This computer software product is stored in a storage medium and includes multiple instructions to cause a computer device (which may be a personal computer, server, or network device, etc.) to execute all or part of the steps of the methods of the various embodiments of the present invention. The aforementioned storage medium includes various media capable of storing programs, such as USB flash drives, portable hard drives, read-only memory (ROM), random access memory (RAM), magnetic disks, or optical disks.
[0195] The preferred embodiments of the present invention have been described above with reference to the accompanying drawings, but this does not limit the scope of the claims of the present invention. Any modifications, equivalent substitutions, and improvements made by those skilled in the art without departing from the scope and spirit of the present invention should be within the scope of the claims of the present invention.
Claims
1. A programming exercise recommendation method based on knowledge tracing and text matching, characterized in that, Includes the following steps: The relevant interaction information of learners when answering programming exercises and the information of the exercises themselves are input into the programming ability assessment model. Based on the learner's ability, exercises of appropriate difficulty are selected to obtain a first-level recommendation list. The primary recommendation list and exercise library are input into the programming knowledge stage assessment module. The exercise text is matched using the vector text matching method. Exercises that match the learner's knowledge stage are selected to obtain the secondary candidate recommendation list. The secondary candidate recommendation list is input into the knowledge tracing model, and a tertiary recommendation list is output. Based on the tertiary recommendation list, a personalized recommendation scheme for the programming learning environment that matches the learner's ability and knowledge stage is determined. The process of inputting relevant interaction information and information about the exercises themselves into the programming ability assessment model, selecting exercises of appropriate difficulty based on the learner's ability, and obtaining a primary recommendation list includes the following steps: Graph convolution encoding is performed on the solution code text in the interactive information, and the exercise number and submission score are encoded. The solution code text, exercise number, and submission score are embedded and then input into an interactive network for deep feature mining to obtain the embedded information. The embedded information after interaction is input into a two-layer LSTM network for training to obtain the model output result; The model output is matched with the exercise library to obtain a candidate first-level recommendation list; The first-level recommendation list is obtained based on the candidate first-level recommendation list; The solution code text, after being embedded, is split into learner's programming knowledge reserve CK and learner's programming iteration ability CA. Then, through the GraphCodeBert encoding layer, the graph embedding of learner's programming knowledge reserve CK is obtained. And graph embedding of learners' programming iteration ability CA Exercise number and Submit Score The discrete integer indices are then mapped to a continuous vector space, forming an embedded exercise number. and submission score embedding Finally, and Separately and , By combining the information, we can obtain the learner's programming knowledge base, including the question information. and learners' programming iteration ability The calculation formula for the embedding layer can be expressed as: in, , For learnable parameters; symbol This indicates a splicing operation. Indicates the first At that moment; Specifically, for the embedded information, a hierarchical approach is used to extract the corresponding text features. The expression for the extraction process is as follows: in, Text features representing text A1; Textual features representing exercise bank D; Represents the feature extraction function; Word embedding representation of text A1 representing exercise set D; The word embedding representation of exercise set D.
2. The programming exercise recommendation method based on knowledge tracing and text matching according to claim 1, characterized in that, The process of obtaining the primary recommendation list based on the candidate primary recommendation list includes the following steps: The vector representing the learner's programming ability from the output of the two-layer LSTM network and the numbers of each exercise in the programming exercise library are input together into the fully connected layer to obtain the learner's current predicted mastery level of each exercise. The exercise numbers and corresponding scores are filtered to select exercise numbers in the range of 0.5-1 and combined to obtain the first-level recommendation list; The calculation formula for the two-layer LSTM network is as follows: in, This represents the learner's current knowledge level at the programming syntax level. This represents the learner's current knowledge level at the programming debugging stage. and This represents the learner's knowledge status in terms of syntax and debugging at the previous time step; This represents a two-layer LSTM network.
3. The programming exercise recommendation method based on knowledge tracing and text matching according to claim 1, characterized in that, The process of inputting the primary recommendation list and exercise library into the programming knowledge stage assessment module, using vector text matching to match exercise texts, learning exercises that match the learner's knowledge stage, and obtaining a secondary candidate recommendation list includes the following steps: The IDs of the first-level recommendation list and the corresponding exercise text content are input into the Stella text matching network to obtain text feature vectors; Calculate the similarity of text feature vectors; The knowledge points in the first-level recommendation list and several similar exercises are combined to form the second-level candidate recommendation list.
4. The programming exercise recommendation method based on knowledge tracing and text matching according to claim 1, characterized in that, The expression for the generation process of the first-level recommendation list is: , in, Let P represent a list containing k exercise numbers, where P is a probability function. The information input to the input layer, The exercise text for the next time step; For filters.
5. The programming exercise recommendation method based on knowledge tracing and text matching according to claim 4, characterized in that, The secondary candidate recommendation list The expression for the generation process is: , in, Represent the k exercises that are most relevant to the given text.
6. The programming exercise recommendation method based on knowledge tracing and text matching according to claim 5, characterized in that, The expression for the generation process of the three-level recommendation list is: , in, This refers to the final set of exercises recommended to learners. For filters, For text encoding models, yes The simplified version outputs a list of candidate exercises from the knowledge tracing model, using the Top_k filtering method.
7. A system for implementing the programming exercise recommendation method based on knowledge tracing and text matching as described in any one of claims 1-6, characterized in that, include: The first module is used to input relevant interaction information and information about the exercises themselves into the programming ability assessment model, select exercises of appropriate difficulty according to the learner's ability, and obtain a first-level recommendation list. The second module is used to input the primary recommendation list and the exercise bank into the programming knowledge stage assessment module, use vector text matching method to match exercise text, learn exercises that match the learner's knowledge stage, and obtain a secondary candidate recommendation list; The third module is used to input the secondary candidate recommendation list into the knowledge tracking model, output a tertiary recommendation list, and determine a personalized recommendation scheme for the programming learning environment that matches the learner's ability and knowledge stage based on the tertiary recommendation list.
8. An electronic device, characterized in that, Including the processor and memory; The memory is used to store programs; The processor executes the program to implement the method as described in any one of claims 1 to 6.
9. A computer-readable storage medium, characterized in that, The storage medium stores a program that is executed by a processor to implement the method as described in any one of claims 1 to 6.
Citation Information
Patent Citations
Test question recommendation method and device, electronic equipment and storage medium
CN113837910A
Personalized exercise recommendation method and system based on knowledge tracking
CN118277663A