Abstract
PyEvalAI is an open-source, privacy-preserving system designed to automate the grading of Jupyter Notebooks. By integrating unit tests with locally hosted Large Language Models (LLMs), it provides students with immediate, personalized feedback on both code and mathematical derivations. This hybrid approach significantly reduces manual grading workloads for teaching assistants while enabling students to iterate on their assignments in real-time.
Introduction
In STEM education, Jupyter Notebooks have become the standard for assignments due to their ability to integrate code, LaTeX, and explanatory text. However, the manual grading of these notebooks is a resource-intensive process, often resulting in feedback delays of a week or more. While automated tools like Otter-Grader and NBgrader effectively handle code via unit tests, they struggle with mathematical derivations and qualitative text. Furthermore, the use of cloud-based LLMs for grading raises significant concerns regarding student data privacy and institutional compliance. PyEvalAI addresses these challenges by providing a "human-in-the-loop" system that evaluates both code and text within a secure, local environment.
Methods
The PyEvalAI architecture is built around a Tornado-based server that coordinates several key components to ensure both performance and privacy.
Local LLM Hosting
To maintain data privacy, the system hosts an AWQ-quantized version of Mistral Large on an in-house NVIDIA A100 GPU. This setup ensures that sensitive student data never leaves the university's infrastructure, a critical requirement for academic compliance.
Hybrid Evaluation Framework
The system employs a hybrid approach to assist the LLM in grading:
- Text Tests: These are structured as yes/no questions (e.g., "Did the student use the required library?") that provide the LLM with explicit grading criteria.
- Code Tests: Functional tests execute student code in a secure environment, passing the execution results back to the LLM for final evaluation.
The LLM is then prompted with the task description, a sample solution, the student’s submission, and the test results. It generates a score and constructive feedback using greedy sampling to ensure deterministic and consistent outputs.
Evaluation
The system was validated through a case study in a university-level Numerics course involving 20 Bachelor of Science students. The study covered 19 distinct practice tasks, resulting in 277 solutions that were graded by both the AI and human tutors to establish a performance baseline.
Key Results
The implementation of PyEvalAI demonstrated significant improvements in both grading efficiency and student learning outcomes.
- Grading Accuracy: Approximately 65.7% of AI-generated grades were identical to those provided by human tutors. While the mean difference was a negligible -0.14%, a standard deviation of 20.73% indicates that human oversight remains necessary for outlier cases.
- Student Performance: Students who utilized multiple attempts saw score increases of 25%–30% between their penultimate and final submissions, suggesting that the AI's immediate feedback effectively guided them toward correct solutions.
- Efficiency: The average turnaround time for feedback was reduced to 88.2 seconds, a massive improvement over traditional manual grading cycles.
- Student Sentiment: Surveys indicated that students found the system fair and motivating, particularly when working independently.
Discussion and Conclusion
PyEvalAI demonstrates that privacy-preserving, AI-assisted grading is viable in university settings. By hosting quantized open-weight models locally, departments can provide high-quality feedback without relying on external APIs. The system also introduces a "drafting" effect, where AI-generated feedback serves as a useful starting point for tutors, who agreed with the AI in nearly 60% of cases.
Future work will focus on reducing hardware requirements by fine-tuning smaller, more efficient models on collected student solutions. Additionally, the researchers plan to expand the system's deployment to other STEM fields to further evaluate its versatility and scalability.
Summary updated