Skip to main content
QUICK REVIEW

[Paper Review] Automated Correction for Syntax Errors in Programming Assignments using Recurrent Neural Networks

Sahil Bhatia, Rishabh Singh|arXiv (Cornell University)|Mar 19, 2016
Software Engineering ResearchComputer Science19 references71 citations
TL;DR

This paper proposes a recurrent neural network (RNN)-based method to automatically generate repair suggestions for syntax errors in student programming assignments by learning valid token sequences from correct student submissions. The approach achieves a 31.69% complete repair rate and 6.39% partial repair rate on over 14,000 erroneous submissions from an edX MOOC, demonstrating the feasibility of using deep learning to address a previously overlooked class of errors in automated feedback systems.

ABSTRACT

We present a method for automatically generating repair feedback for syntax errors for introductory programming problems. Syntax errors constitute one of the largest classes of errors (34%) in our dataset of student submissions obtained from a MOOC course on edX. The previous techniques for generating automated feed- back on programming assignments have focused on functional correctness and style considerations of student programs. These techniques analyze the program AST of the program and then perform some dynamic and symbolic analyses to compute repair feedback. Unfortunately, it is not possible to generate ASTs for student pro- grams with syntax errors and therefore the previous feedback techniques are not applicable in repairing syntax errors. We present a technique for providing feedback on syntax errors that uses Recurrent neural networks (RNNs) to model syntactically valid token sequences. Our approach is inspired from the recent work on learning language models from Big Code (large code corpus). For a given programming assignment, we first learn an RNN to model all valid token sequences using the set of syntactically correct student submissions. Then, for a student submission with syntax errors, we query the learnt RNN model with the prefix to- ken sequence to predict token sequences that can fix the error by either replacing or inserting the predicted token sequence at the error location. We evaluate our technique on over 14, 000 student submissions with syntax errors. Our technique can completely re- pair 31.69% (4501/14203) of submissions with syntax errors and in addition partially correct 6.39% (908/14203) of the submissions.

Motivation & Objective

  • To address the lack of automated feedback for syntax errors in large-scale online programming courses, where such errors constitute 34% of student submissions.
  • To develop a technique that can generate repair suggestions for syntax errors without relying on ASTs, which are unavailable for malformed programs.
  • To leverage large-scale correct student submissions to train a sequence model that predicts syntactically valid token sequences for fixing errors.
  • To improve accessibility and scalability of programming education by enabling automated, real-time feedback on syntax errors.
  • To explore the potential of RNNs in modeling code structure for pedagogical feedback beyond functional correctness.

Proposed method

  • Train a recurrent neural network (RNN) on all syntactically correct student submissions for a given programming assignment to learn a language model of valid token sequences.
  • For a student submission with a syntax error, use the prefix of the token sequence up to the error location as input to the RNN to predict corrective token sequences.
  • Generate candidate repairs by replacing or inserting the predicted token sequence at the error location, then validate using a compiler to ensure syntactic correctness.
  • Select only repairs that result in a compilable program, returning them as suggested fixes to the student.
  • Use a beam search strategy to explore multiple high-probability token sequence predictions for improved fix coverage.
  • Integrate the model into a feedback pipeline that can scale to thousands of student submissions in online education platforms.

Experimental results

Research questions

  • RQ1Can a sequence model trained on correct student code effectively predict syntactically valid repairs for syntax errors in erroneous student submissions?
  • RQ2To what extent can RNN-based language models learn the syntactic patterns of valid code sequences from real student implementations?
  • RQ3How effective is the proposed method in repairing syntax errors compared to traditional compiler error messages or AST-based feedback systems?
  • RQ4Can the model generalize across diverse student coding styles and error patterns in introductory programming assignments?
  • RQ5What are the limitations of using only prefix context for repair prediction, and how can future models incorporate future context for better accuracy?

Key findings

  • The proposed RNN-based method successfully repaired 31.69% (4,501 out of 14,203) of student submissions with syntax errors, demonstrating high practical utility.
  • An additional 6.39% (908 out of 14,203) of submissions were partially corrected, indicating the method can handle complex or multi-part errors.
  • The model’s performance is significantly limited by its reliance on prefix-only context, as it fails to consider future tokens that could improve fix accuracy.
  • The system cannot currently handle multiple syntax errors in a single submission, as fixing one error may leave others unresolved, requiring recursive application.
  • There is a risk of generating semantically incorrect fixes even when syntax is valid, highlighting the need for additional semantic validation in future extensions.
  • The method shows strong potential for integration into MOOC platforms like edX, Coursera, and Udacity to scale automated feedback for introductory programming courses.

Read this paper

Open the full text in the Nubint reader and ask about any passage as you read.

Read this paper on Nubint

This review was generated by AI from the original paper. Please check the paper before citing it.