EULER: Fine-Tuning a Large Language Model for Socratic Interactions

Giulia Bonino, Gabriele Sanmartino, Giovanni Gatti Pinheiro, Paolo Papotti, Raphaël Troncy, Pietro MichiardiAIxEDU@AI*IA 2024

Abstract

While Large Language Models (LLMs) excel at direct question answering, their tendency to provide immediate solutions is often counterproductive in educational settings. This paper presents EULER, a framework that fine-tunes the Phi-3-Mini model to act as a Socratic tutor. By leveraging Direct Preference Optimization (DPO) and an "LLM-as-a-judge" data pipeline, EULER successfully shifts model behavior from "direct answerer" to "pedagogical guide," fostering critical thinking through discovery-based dialogue.

Introduction: The Challenge of the "Too Helpful" Assistant

In classroom environments, the Socratic Method—a dialogue-based approach where tutors ask probing questions—is a gold standard for encouraging students to uncover truths independently. However, standard LLMs are typically fine-tuned for helpfulness and directness, leading them to provide "spoiler" answers that stifle student engagement. The EULER framework addresses this by systematically steering models toward Socratic principles, ensuring they guide students toward solutions without revealing them prematurely.

Methodology

The researchers developed a multi-stage pipeline to instill Socratic behavior in the Phi-3-Mini-4k-Instruct (3.8B parameters) model.

Data Generation and Preference Ranking

The core of the approach is a sophisticated data generation pipeline. For various educational prompts, the system generates five candidate responses. These candidates are then ranked by GPT-4o, acting as a judge, based on four specific Socratic criteria: questioning, topicality, helpfulness, and answer concealment.

Figure 3: The EULER data generation and fine-tuning pipeline, illustrating the transition from raw training data to a Socratic LLM via DPO.

Direct Preference Optimization (DPO)

Following ranking, the model is fine-tuned using Direct Preference Optimization (DPO). Unlike traditional Reinforcement Learning from Human Feedback (RLHF), DPO optimizes the model directly by comparing "chosen" (high-scoring Socratic) and "rejected" (direct answer) pairs. This method proved both stable and computationally efficient for small-parameter models.

Datasets and Generalization

The study utilized three diverse datasets to evaluate cross-domain performance:

  • TutorChat: 80,000 synthetic dialogues based on science textbooks.
  • MathDial: 3,000 math-focused interactions involving student errors.
  • Debugging: Socratic dialogues centered on identifying and fixing code bugs.

A key finding was the versatility of the TutorChat dataset. Models trained on these science-based dialogues outperformed those trained on domain-specific math or coding sets, suggesting that the "Socratic style" generalizes effectively across disciplines.

Results and Validation

The EULER models demonstrated significant behavioral shifts. On the MathDial test set, the base Phi-3 model's Socratic score rose from 0.82 to 0.99 after fine-tuning. The most notable improvements occurred in "questioning" and "not revealing the answer," where EULER consistently outperformed its base counterpart.

Validating the Automated Judge

To ensure the reliability of the GPT-4o ranking system, the researchers compared its scores against human annotators. The analysis revealed a strong Pearson correlation of 0.78, confirming that advanced LLMs can effectively automate the evaluation of complex pedagogical traits.

Figure 6: Correlation between human scores and GPT-4o scores, validating the use of LLM-as-a-judge for Socratic evaluation.

Discussion and Future Directions

EULER proves that even small models (3.8B parameters) can master complex conversational styles previously reserved for much larger systems. However, two primary challenges remain. First, conversational drift occurs when models occasionally lose focus over long, multi-turn dialogues. Second, endless loops can occur because the current DPO optimization focuses on single-turn interactions, causing the model to sometimes fail to recognize when a student has reached the solution.

Future research will focus on multi-turn optimization to improve long-term dialogue planning and integrating deeper reasoning capabilities to enhance the precision of Socratic questioning.

Summary updated

BibTeX
@inproceedings{bonino2024euler,
  author = {Giulia Bonino and Gabriele Sanmartino and Giovanni Gatti Pinheiro and Paolo Papotti and Raphaël Troncy and Pietro Michiardi},
  title = {{EULER: Fine-Tuning a Large Language Model for Socratic Interactions}},
  booktitle = {AIxEDU@AI*IA},
  year = {2024},
}
Figure