NeurIPS 2026Coming to NeurIPS?Explore papers, orals & directions

Data-Driven Feedback Generation for Introductory Programming Exercises

Ke Wang, Rishabh Singh, Zhendong Su

Introduction

In Massive Open Online Courses (MOOCs) and large-scale university programming classes, providing personalized feedback is a significant challenge. While automated grading can determine if a solution is correct, it often fails to explain why it failed or how to fix it. Manual intervention by instructors is unscalable for thousands of students. Existing automated tools often require labor-intensive error models or suggest "heavy" repairs that rewrite a student's entire logic, which can be detrimental to the learning process.

The Sarfgen Framework

The authors introduce Sarfgen, a data-driven system designed to provide instant, minimal, and automated feedback. Sarfgen leverages the "power of the crowd," operating on the principle that most student errors have been previously encountered and corrected by others in the same course.

The Sarfgen pipeline: Search, Align, and Repair.

The system operates through a three-stage pipeline:

  1. Search: Using a novel Position-Aware Characteristic Vector, Sarfgen embeds Abstract Syntax Trees (ASTs) into numerical vectors. This allows for rapid identification of the most similar correct programs in a database using Euclidean distance, bypassing the computational expense of traditional Tree Edit Distance (TED) calculations.
  2. Align: To handle variations in variable naming across different student submissions, the system employs usage-based $\alpha$-conversion. It profiles variable usage to map a student's variables to those in the reference program (e.g., mapping a student's i to a reference's counter).
  3. Repair: The system generates potential edits and uses dynamic analysis—running the code against test cases—to find the smallest subset of changes that results in a passing program. This ensures the feedback is concise and preserves the student's original algorithmic intent.

Evaluation and Results

Sarfgen was evaluated using over 4,800 incorrect submissions from 17 programming exercises in real-world courses, including a C# course on edX and Microsoft Code Hunt. The evaluation demonstrated that Sarfgen is both effective and efficient, outperforming existing state-of-the-art tools like CLARA.

Examples of minimal code repairs generated by Sarfgen for various programming tasks.

Key results from the study include:

  • High Coverage: It successfully generated useful feedback for 89.7% of incorrect submissions.
  • Real-time Performance: Feedback generation averaged under two seconds, making it suitable for live, interactive learning environments.
  • Minimal Repairs: Sarfgen consistently found smaller, more relevant fixes that respect the student's unique approach rather than forcing a single "official" solution.

Conclusion

Sarfgen represents a significant step forward in automated programming education. By treating code as data and utilizing efficient search and alignment techniques, it provides scalable, high-quality feedback without requiring manual instructor effort. While it depends on a large pool of existing solutions, its success in production environments like edX highlights its potential for transforming large-scale computer science education.

Summary updated

BibTeX
@inproceedings{wang2018data,
  author = {Ke Wang and Rishabh Singh and Zhendong Su},
  title = {{Data-Driven Feedback Generation for Introductory Programming Exercises}},
  booktitle = {Pldi},
  year = {2018},
  doi = {10.1145/3192366.3192384},
}
Figure