ACE-RLHF: Automated Code Evaluation and Socratic Feedback Generation Tool using Large Language Models and Reinforcement Learning with Human Feedback

Tasnia Rahman, Sathish A. P. Kumar, Sumit Kumar Jha, Arvind RamanathanarXiv 2025 · DOI

Introduction

In computer science education, students often struggle with debugging code. Traditional feedback mechanisms typically fall into two unhelpful categories: cryptic compiler errors that provide little guidance, or modern Large Language Models (LLMs) that provide the full solution immediately. The latter, known as the "spoiler effect," prevents students from developing critical problem-solving and logic skills. Furthermore, standard LLMs are prone to hallucinations, offering confidently incorrect advice.

To bridge this gap, we introduce ACE-RLHF (Automated Code Evaluation with Reinforcement Learning from Human Feedback). This framework fine-tunes LLMs to act as Socratic tutors. Instead of providing direct answers, the system generates concise hints and leading questions, guiding students toward self-correction while maintaining pedagogical integrity.

Methodology

The ACE-RLHF framework utilizes a multi-stage pipeline to align LLM behavior with Socratic teaching principles. The process begins with base models such as Llama-3-8B and GPT-3.5-turbo, which undergo the following transformations:

  1. Socratic Instruction Tuning: Models are fine-tuned using Chain-of-Thought (CoT) reasoning to prioritize pedagogical guidance over direct code repair.
  2. Reward Model Training: A separate reward model is trained on a preference dataset to distinguish between helpful Socratic responses and invalid ones (e.g., responses that are too direct, irrelevant, or repetitive).
  3. Reinforcement Learning Optimization: Two primary techniques are used to align the model with the reward model: Proximal Policy Optimization (PPO), which iteratively updates the model policy, and Best-of-n, where the system generates multiple candidates and selects the one with the highest reward score.
Figure 1: The ACE-RLHF system architecture illustrating the Socratic feedback loop.

Datasets and Experimental Setup

The study utilized three distinct datasets to train and evaluate the models:

  • Basic Programming Benchmark: 38 fundamental problems with 151 dialogue threads.
  • Competition-Level Benchmark: A new dataset featuring complex problems from CodeForces and ICPC to test Socratic feedback on intricate logic.
  • Socratic Preference Dataset: A collection of 2,500 tuples of valid/invalid Socratic responses, extended with 90 additional pairs for high-level competitive programming.

Results and Discussion

Experimental results indicate that ACE-RLHF significantly outperforms non-RLHF baselines. In manual evaluations with students, the GPT-3.5 model using "Best-of-n" optimization achieved an accuracy of 81.2%, representing a 40% improvement over previous state-of-the-art techniques.

Figure 3: Comparison of overall performance across different model configurations and RL strategies.

Key insights from the evaluation include:

  • Pedagogy over Proximity: By focusing on student understanding rather than just code distance, the model effectively enforces a specific teaching style.
  • The Best-of-n Advantage: For nuanced tutoring tasks, generating multiple candidates and reranking them proved more effective than standard iterative updates for GPT-based models.
  • Fluency vs. Informativeness: Qualitative analysis revealed a trade-off between models; Llama-3-PPO was rated as the most "fluent," while GPT-based models were preferred for their "informativeness."

Conclusion and Future Work

ACE-RLHF demonstrates that Reinforcement Learning from Human Feedback can successfully transform LLMs into effective pedagogical tools. While the framework shows substantial gains, challenges remain regarding the Expected Calibration Error (ECE) of reward models and the computational overhead for simpler tasks. Future research will explore ensemble reward models to reduce bias and the integration of larger baseline models to further mitigate hallucinations in complex debugging scenarios.

Summary updated

BibTeX
@misc{rahman2025ace,
  author = {Tasnia Rahman and Sathish A. P. Kumar and Sumit Kumar Jha and Arvind Ramanathan},
  title = {{ACE-RLHF: Automated Code Evaluation and Socratic Feedback Generation Tool using Large Language Models and Reinforcement Learning with Human Feedback}},
  year = {2025},
  eprint = {2504.04657},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/2504.04657},
}
Figure