EduFuncSum: a function-wise progressive transformer for code summarization in undergraduate programming education
摘要
Automatic code summarization holds significant promise for enhancing program comprehension in undergraduate programming education. Traditional end-to-end summarization models generate isolated descriptions for individual functions, but they often fail to convey how multiple functions interact, limiting their pedagogical value. Moreover, existing approaches rarely align summaries with educational objectives, such as guiding novice learners through code structure and logic. To address these gaps, we propose EduFuncSum, a novel Transformer-based approach to code summarization designed specifically for undergraduate programming courses. EduFuncSum decomposes a program into its constituent functions and then generates summaries in a progressive, function-wise manner: each function’s summary is conditioned on both its own code and the preceding summary, thereby building context step by step. This progressive summarization mirrors an instructional walkthrough-function by function-yielding cohesive, context-rich explanations of multi-function codebases. We integrate specialized cross-function attention and summary-integration mechanisms within a Transformer backbone to ensure both local accuracy and global coherence. Empirical evaluation on three public benchmarks demonstrates that EduFuncSum surpasses state-of-the-art models in BLEU-4, ROUGE-L, and METEOR, and ablation studies confirm the value of its progressive design. By producing sequential, context-aware summaries, EduFuncSum offers a powerful pedagogical tool for helping students grasp complex programs and for assisting educators in generating clear documentation and assessments.