TL;DR
EduFuncSum is a novel Transformer-based model designed to summarize multi-function codebases by mimicking an instructional walkthrough. Unlike traditional models that summarize functions in isolation, EduFuncSum generates summaries progressively, conditioning each new description on the summary of the previous function to ensure global coherence and pedagogical value for students.
The Challenge: Bridging the "Big Picture" Gap
In undergraduate programming education, students often struggle to see the "big picture." While they might understand what a single line or a single function does, they often fail to grasp how multiple functions interact to achieve a larger goal.
Current state-of-the-art (SOTA) code summarization tools typically operate at the single-function level. They produce isolated "docstrings" that ignore the broader context of the program. For a novice learner, reading five disconnected summaries of five interacting functions is far less helpful than a cohesive narrative that explains how data flows from one part of the program to the next.
The EduFuncSum Architecture
The authors propose EduFuncSum, a "function-wise progressive transformer." Its architecture is built on a standard Transformer encoder-decoder backbone but introduces specialized modifications to handle multi-function context.
As shown in the architecture diagram above, the model utilizes three key innovations:
- Progressive Summarization: The model processes a program function-by-function. When generating a summary for function $F_i$, the decoder doesn't just look at the code for $F_i$; it also "listens" to the summary it just wrote for function $F_{i-1}$ via a Previous Summary Encoder.
- Cross-Function Attention & Gating: To manage these two different inputs (the current code and the previous summary), the authors implemented a specialized gating mechanism. This sigmoid-based gate dynamically weights the two contexts. If the current code is self-explanatory, the gate relies on the code; if the function relies heavily on a previously established object or variable, the gate allows more information from the prior summary to flow through.
- Summary Integration: Finally, the model concatenates these context-aware snippets into a single, cohesive multi-sentence description of the entire program.
This approach effectively turns the summarization process into a "storytelling" task, where each chapter (function) builds upon the last.
Key Insights and Results
The model was evaluated on three major public benchmarks: CodeSearchNet (CSN), FUNCOM, and CodeXGLUE. Because these datasets are typically structured as single (code, summary) pairs, the authors simulated multi-function scenarios by concatenating related functions during testing.
Quantitative Performance
EduFuncSum consistently outperformed ten SOTA baselines, including heavyweights like CodeT5 and OpenAI Codex. On the CodeSearchNet Python dataset, EduFuncSum achieved a BLEU-4 score of 22.45, surpassing OpenAI Codex (20.98) and CodeT5 (20.53). Similar gains were observed in ROUGE-L and METEOR metrics across all datasets.
Pedagogical Impact
In a human study involving undergraduate CS students, EduFuncSum scored significantly higher in "Learning Support" (4.28/5) compared to CodeT5 (3.61/5). Students noted that the summaries felt like a "coherent explanation" rather than a disjointed list of facts. The researchers found that providing the previous summary didn't just make the overall program description better; it actually improved the accuracy of the individual function summaries by allowing the model to use more precise, context-aware terminology.
Limitations and Future Work
While powerful, the authors acknowledge a few hurdles:
- Logic Blindness: Like most LLM-based tools, EduFuncSum can sometimes miss deep semantic errors, such as an infinite loop, if the function name and structure look "normal."
- Scaling to Large Systems: The current model relies on a linear sequence of functions. Future versions may need to incorporate static analysis to determine the best "narrative order" for complex, non-linear call graphs.
- Exposure Bias: There is a risk that a small error in an early summary could "snowball" into later ones, though the Transformer decoder remained remarkably stable in initial experiments.
Summary updated