A Three-Phases SFT Hybrid Model Integrated Strong Prior Module and Data Overlap Estimation in the Eduation Context

Zhangquan Chen, Chunjiang Liu, Haobin DuanarXiv 2024 · arXiv · OpenReview

Abstract: In this paper, we introduce CodingTeachLLM, a large language model (LLM) designed for coding teaching. Specially, we aim to enhance the coding ability of LLM and lead it to better teaching mode in education context. Thus, we propose an end-to-end prior-based three-phases supervised fine-tuned model, which is proved more competitive than traditional fine-tuning method. More specifically, our model realizes the structural disassembly and incremental guided output of educational knowledge. To this end, we robustify data classification of three types via a sampler and overlap estimation neural network, and inject the preprocessing datasets into pre-trained model in three batches for LORA fine-tuning. Then, we design a prior module couples system prompt, vector databases, and abstract syntax tree task segmentation. Finally, the compression method and regularization constraint are applied to the prior-based fine-tuned model, followed by text filter at the output end to obtain incremental guided results. Our model represents the first research effort to truly embody the tutor role with the features of abundant educational knowledge, step-by-step incremental guided outputs and non-disclosure of answers. Extensive experiments report that our model also achieves state-of-the-art in code abilities compared to open-source models, reaching an impressive 75.10% on the HumanEval (@pass 1) benchmark. Additionally, our model maintains strong conversational capabilities, with the 13B quantized version achieving scores of 56.34, 50.60, and 45.27 respectively on the MMLU, C-Eval, and AGIEval (5 shot) dialogue evaluation benchmarks.

Introduction

Large Language Models (LLMs) like GPT-4 have revolutionized code generation. However, their utility in educational contexts is limited by a "full throughput" approach—providing complete solutions immediately. This bypasses the critical learning process where students struggle with sub-problems. A human tutor breaks down complex tasks into logical steps. CodingTeachLLM addresses this by enforcing pedagogical restraint and structural disassembly of content, acting as a tutor that guides rather than just solves.

Methods

The CodingTeachLLM pipeline moves beyond traditional one-shot fine-tuning through a three-phase approach and a specialized prior module.

System architecture of CodingTeachLLM, illustrating the three-phase SFT process and the Prior Module integration.

Three-Phase SFT Strategy

The model utilizes Low-Rank Adaptation (LoRA) in three distinct stages to progressively build its persona:

  1. Foundational Logic: Training on general textbooks and code data to build base capabilities.
  2. Educational Persona: Injecting educational instruction data to instill a "teacher" identity.
  3. Incremental Guidance: Training on multi-round dialogue data to master the art of step-by-step prompting.

The Prior Module and AST Segmentation

The "Prior Module" is central to the tutoring logic. It integrates vector databases (Faiss) for context retrieval and Abstract Syntax Tree (AST) task segmentation. By using ASTs, the model decomposes coding tasks into structural components (e.g., loops, conditionals), allowing it to provide guidance on one block at a time. To maintain this persona, the authors implemented structured pruning and an output filter to suppress the "leakage" of final answers during long conversations.

Datasets and Evaluation

The model was trained on a comprehensive four-part dataset including textbooks, educational instructions, multi-language code, and multi-round guidance dialogues. Performance was evaluated using HumanEval for coding and MMLU, C-Eval, and AGIEval for general reasoning and chat capabilities.

Results

CodingTeachLLM achieves state-of-the-art performance in both raw coding ability and pedagogical adherence.

Comparison of CodingTeachLLM against other models across tutoring-specific metrics.

Quantitative Performance

The 34B version achieved a 75.10% pass@1 on HumanEval, significantly outperforming open-source models like CodeFuse-CodeLlama and even GPT-4's zero-shot performance by over 12%. The 13B quantized version also showed strong general capabilities, scoring 56.34 on MMLU and 50.60 on C-Eval.

Qualitative Tutoring Capabilities

As shown in the comparison table, CodingTeachLLM is unique in its ability to consistently maintain a "tutor style" while providing "guided output" without prematurely revealing the answer. Most other models, including GPT-4 and Claude-2, often fail to withhold the final solution or provide structured guidance consistently.

Conclusion

CodingTeachLLM represents a significant step toward AI-driven education. By combining structural code analysis with a phased training approach, it successfully mimics the behavior of a human tutor. Future work will explore transferring this methodology to other domains such as law or medicine and further optimizing for lower-resource hardware.

Summary updated

Abstract

In this paper, we introduce CodingTeachLLM, a large language model (LLM) designed for coding teaching. Specially, we aim to enhance the coding ability of LLM and lead it to better teaching mode in education context. Thus, we propose an end-to-end prior-based three-phases supervised fine-tuned model, which is proved more competitive than traditional fine-tuning method. More specifically, our model realizes the structural disassembly and incremental guided output of educational knowledge. To this end, we robustify data classification of three types via a sampler and overlap estimation neural network, and inject the preprocessing datasets into pre-trained model in three batches for LORA fine-tuning. Then, we design a prior module couples system prompt, vector databases, and abstract syntax tree task segmentation. Finally, the compression method and regularization constraint are applied to the prior-based fine-tuned model, followed by text filter at the output end to obtain incremental guided results. Our model represents the first research effort to truly embody the tutor role with the features of abundant educational knowledge, step-by-step incremental guided outputs and non-disclosure of answers. Extensive experiments report that our model also achieves state-of-the-art in code abilities compared to open-source models, reaching an impressive 75.10% on the HumanEval (@pass 1) benchmark. Additionally, our model maintains strong conversational capabilities, with the 13B quantized version achieving scores of 56.34, 50.60, and 45.27 respectively on the MMLU, C-Eval, and AGIEval (5 shot) dialogue evaluation benchmarks.
BibTeX
@misc{chen2024three,
  author = {Zhangquan Chen and Chunjiang Liu and Haobin Duan},
  title = {{A Three-Phases SFT Hybrid Model Integrated Strong Prior Module and Data Overlap Estimation in the Eduation Context}},
  year = {2024},
  eprint = {2403.15426},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/2403.15426},
}
Figure