Abstract
Personalizing computer science education requires identifying Knowledge Components (KCs)—discrete units of skill—within student code. Traditional manual tagging is unscalable and subjective. This paper introduces a framework that automatically extracts pattern-based KCs by combining attention-based neural networks with variational autoencoders (VAEs). By analyzing Abstract Syntax Trees (ASTs) and identifying influential subtrees, the system discovers recurring structural patterns representing meaningful programming strategies. Evaluation on a large-scale Java dataset shows that these KCs improve student success prediction by 13% (AUC 74.8%) and exhibit clear learning trajectories, validating their educational significance.
Introduction
In computer science education, tracking student progress relies on identifying Knowledge Components (KCs) like "nested loops" or "array indexing." However, the open-ended nature of programming makes manual identification difficult. Previous automated methods often lacked depth or acted as "black boxes." This research addresses these gaps by proposing a pipeline to discover "pattern-based KCs" that are both mathematically robust and educationally meaningful, bridging the gap between raw code analysis and cognitive modeling.
Methodology
The proposed framework utilizes a multi-stage pipeline to transform raw code into abstract knowledge:
- Subtree-based Attention Neural Network (SANN): Code is parsed into Abstract Syntax Trees (ASTs). SANN predicts submission correctness and uses an attention mechanism to highlight influential subtrees.
- Normalization: Variable names and literals are replaced with generic placeholders (e.g.,
int x = 5becomesint VAR = LITERAL) to focus on logic rather than naming conventions. - Variational Autoencoder (VAE): Highlighted, normalized subtrees are processed by a VAE to map structurally similar patterns into a shared latent space.
- Clustering: K-means clustering on the latent space defines 50 distinct pattern-based KCs, each representing a recurring structural strategy.
Experimental Setup
The study utilized a publicly available dataset from CodeWorkout, an online platform for introductory Java programming. The dataset included 47,764 code submissions from 407 students across 50 programming problems. Submissions were binarized into "correct" or "incorrect" based on passing all test cases.
Results and Discussion
The effectiveness of the extracted KCs was evaluated through predictive modeling and learning curve analysis.
- Predictive Power: Integrating the KCs into a Deep Knowledge Tracing (DKT) model resulted in an AUC of 74.8%, a significant improvement over the standard DKT baseline of 65.9%. This ~13% improvement demonstrates the superior descriptive power of pattern-based KCs.
- Educational Validity: Learning Curve Analysis was performed to ensure the KCs were educationally valid. For 70% of the discovered KCs (35 out of 50), student error rates followed a "power law of practice," steadily declining as students encountered the patterns more often.
Conclusion
This framework provides a transparent and scalable way for instructors to monitor student progress by identifying structural patterns that correlate with learning. While currently limited to compilable code and short snippets, future work will explore scaling to larger projects and using Large Language Models (LLMs) to generate natural language descriptions for the discovered KCs, making them even more accessible to educators.
Summary updated