Intelligent Question-Answering and Knowledge Transfer in Computer Programming Courses Based on ChatGPT and Knowledge Distillation
Main Article Content
Abstract
Current intelligent question-answering and knowledge transfer in programming courses suffer from low efficiency, insufficient model lightweighting, and semantic consistency deviations, limiting the practical deployment of large language models in specialized engineering education. As semantic reasoning and hierarchical information representation become increasingly important for intelligent information processing and knowledge interaction in advanced engineering systems, this paper proposes a ChatGPT semantic transfer optimization method based on hierarchical knowledge distillation. By constructing a multi-level semantic knowledge graph covering programming concepts, syntax, and task logic, the proposed framework performs hierarchical semantic modeling and introduces a multi-layer semantic alignment loss to achieve precise knowledge transfer. Parameter pruning constraints and a dynamic temperature adjustment strategy are further incorporated to improve model lightweighting and training stability, while a semantic consistency judgment mechanism supports intelligent question-answering in programming teaching scenarios. Experimental results demonstrate significant reductions in concept-, syntax-, and task-level distillation losses, together with substantial parameter compression and inference acceleration while maintaining high semantic consistency and answer accuracy. The convergence of semantic alignment corresponds to measurable improvements in practical question-answering performance. The proposed approach provides an effective technical pathway for intelligent programming education and offers methodological references for hierarchical knowledge transfer and semantic information processing in advanced engineering and electromagnetic information systems.
Downloads
Article Details

This work is licensed under a Creative Commons Attribution 4.0 International License.
Authors who publish with this journal agree to the following terms:
- Authors retain copyright and grant the journal right of first publication with the work simultaneously licensed under a Creative Commons Attribution License that allows others to share the work with an acknowledgement of the work's authorship and initial publication in this journal.
- Authors are able to enter into separate, additional contractual arrangements for the non-exclusive distribution of the journal's published version of the work (e.g., post it to an institutional repository or publish it in a book), with an acknowledgement of its initial publication in this journal.
- Authors are permitted and encouraged to post their work online (e.g., in institutional repositories or on their website) prior to and during the submission process, as it can lead to productive exchanges, as well as earlier and greater citation of published work (See The Effect of Open Access).
References
A. Keune, “Material syntonicity: Examining computational performance and its materiality through weaving and sewing crafts,” Journal of the Learning Sciences, vol. 31, no. 4-5, pp. 477-508, 2022, doi: 10.1080/10508406.2022.2100704.
J. Kärnä-Behm and E. Harjuniemi, “Interactive textiles: Learning e-textiles with higher education art and design students,” FormAcademisk, vol. 16, no. 1, pp. 1-15, 2023, doi: 10.7577/formakademisk.5017.
J. Jin and M. Kim, “GPT-empowered personalized eLearning system for programming languages,” Applied Sciences, vol. 13, no. 23, Art. no. 12773, 2023, doi: 10.3390/app132312773.
M. Dabingaya, “Analyzing the effectiveness of AI-powered adaptive learning platforms in mathematics education,” Interdisciplinary Journal Papier Human Review, vol. 3, no. 1, pp. 1-7, 2022, doi: 10.47667/ijphr.v3i1.226.
S. Al Faraby, A. Adiwijaya, and A. Romadhony, “Review on neural question generation for education purposes,” International Journal of Artificial Intelligence in Education, vol. 34, no. 3, pp. 1008-1045, 2024, doi: 10.1007/s40593-023-00374-x.
C. R. Navas Bonilla, L. M. Viñan Carrasco, J. C. Gaibor Pupiales, and D. E. Murillo Noriega, “The Future of Education: A Systematic Literature Review of Self-Directed Learning with AI,” Future Internet, vol. 17, no. 8, pp. 366, 2025, doi: 10.3390/fi17080366.
Y. Fan, H. Zhang, R. Li, Y. Wang, G. Zhang, H. Tan, et al., “Weakly-supervised explainable question answering via question aware contrastive learning and adaptive gate mechanism,” Information Sciences, vol. 697, Art. no. 121763, 2025, doi: 10.1016/j.ins.2024.121763.
H. Yang, L. Xu, C. Liu, and L. Huangfu, “Query-oriented two-stage attention-based model for code search,” Journal of Systems and Software, vol. 210, Art. no. 111948, 2024, doi: 10.1016/j.jss.2023.111948.
J. Liu, C. Zhang, J. Guo, Y. Zhang, H. Que, K. Deng, et al., “Ddk: Distilling domain knowledge for efficient large language models,” Advances in Neural Information Processing Systems, vol. 37, pp. 98297-98319, 2024, doi: 10.52202/079017-3119.
K. Huang, X. Guo, and M. Wang, “Towards efficient pre-trained language model via feature correlation distillation,” Advances in Neural Information Processing Systems, vol. 36, pp. 16114-16128, 2023.
Z. Jiang, J. Araki, H. Ding, and G. Neubig, “How can we know when language models know? On the calibration of language models for question answering,” Transactions of the Association for Computational Linguistics, vol. 9, pp. 962-977, 2021, doi: 10.1162/tacl_a_00407.
D. Wang, Q. Huang, M. Jackson, and J. Gao, “Retrieve what you need: A mutual learning framework for opendomain question answering,” Transactions of the Association for Computational Linguistics, vol. 12, pp. 247-263, 2024, doi: 10.1162/tacl_a_00646.
I. H. Hsiao and C. Y. Chung, “AI-infused semantic model to enrich and expand programming question generation,” Journal of Artificial Intelligence and Technology, vol. 2, no. 2, pp. 47-54, 2022, doi: 10.37965/jait.2022.0090.
M. Yousef, K. Mohamed, W. Medhat, E. H. Mohamed, G. Khoriba, and T. Arafa, “BeGrading: Large language models for enhanced feedback in programming education,” Neural Computing and Applications, vol. 37, no. 2, pp. 1027-1040, 2025, doi: 10.1007/s00521-024-10449-y.
Y. Wu, H. Zhu, C. Wang, F. Song, H. Zhu, Y. Chen, et al., “Programming knowledge tracing based on heterogeneous graph representation,” Knowledge-Based Systems, vol. 300, Art. no. 112161, 2024, doi: 10.1016/j.knosys.2024.112161.
N. Li, Q. Shen, R. Song, Y. Chi, and H. Xu, “MEduKG: A deep-learning-based approach for multi-modal educational knowledge graph construction,” Information, vol. 13, no. 2, pp. 91, 2022, doi: 10.3390/info13020091.
R. Cantini, A. Orsino, and D. Talia, “Xai-driven knowledge distillation of large language models for efficient deployment on low-resource devices,” Journal of Big Data, vol. 11, no. 1, pp. 63, 2024, doi: 10.1186/s40537-024-00928-3.
C. Jia, “Adversarial moment-matching distillation of large language models,” Advances in Neural Information Processing Systems, vol. 37, pp. 112184-112216, 2024, doi: 10.52202/079017-3562.
K. He, N. Pu, M. Lao, E. M. Bakker, and M. S. K. Lew, “Dual selective knowledge transfer for few-shot classification,” Appl. Intell, vol. 53, no. 22, pp. 27779-27789, 2023, doi: 10.1007/s10489-023-04994-7.
P. Khodaee, H. L. Viktor, and W. Michalowski, “Knowledge transfer in lifelong machine learning: A systematic literature review,” Artificial Intelligence Review, vol. 57, no. 8, pp. 217, 2024, doi: 10.1007/s10462-024-10853-9.
B. Liu, W. Guan, C. Yang, Z. Fang, and Z. Lu, “Transformer and graph convolutional network for text classification,” International Journal of Computational Intelligence Systems, vol. 16, no. 1, pp. 161, 2023, doi: 10.1007/s44196-023-00337-z.
Y. YaPing, Z. U. Abideen, A. Ali, T. Aoun, T. Mazhar, and T. Shahzad, “A hybrid model combining GCN transformer and Word2Vec for Chinese sequence labeling with deep linguistic knowledge,” International Journal of Speech Technology, vol. 28, no. 3, pp. 729-743, 2025, doi: 10.1007/s10772-025-10209-w.
Y. Zhao, H. Zhou, A. Zhang, R. Xie, Q. Li, and F. Zhuang, “Connecting embeddings based on multiplex relational graph attention networks for knowledge graph entity typing,” IEEE Transactions on Knowledge and Data Engineering, vol. 35, no. 5, pp. 4608-4620, 2022, doi: 10.1109/TKDE.2022.3142056.
H. Zhu, D. Xu, Y. Huang, Z. Jin, W. Ding, and J. Tong, “Graph structure enhanced pre-training language model for knowledge graph completion,” IEEE Transactions on Emerging Topics in Computational Intelligence, vol. 8, no. 4, pp. 2697-2708, 2024, doi: 10.1109/TETCI.2024.3372442.
G. Yang, S. Yu, Y. Sheng, and H. Yang, “Attention and feature transfer based knowledge distillation,” Scientific Reports, vol. 13, no. 1, Art. no. 18369, 2023, doi: 10.1038/s41598-023-43986-y.
W. Jooste, R. Haque, and A. Way, “Knowledge distillation: A method for making neural machine translation more efficient,” Information, vol. 13, no. 2, pp. 88, 2022, doi: 10.3390/info13020088.
G. Guo, L. Han, L. Wang, D. Zhang, and J. Han, “Semantic-aware knowledge distillation with parameter-free feature uniformization,” Visual Intelligence, vol. 1, no. 1, pp. 6, 2023, doi: 10.1007/s44267-023-00003-0.
X. Liang, L. Wu, J. Li, T. Qin, M. Zhang, and T. Y. Liu, “Multi-teacher distillation with single model for neural machine translation,” IEEE/ACM Transactions on Audio, Speech, and Language Processing, vol. 30, pp. 992-1002, 2022, doi: 10.1109/TASLP.2022.3153264.
Z. Yang, Y. Zhang, D. Sui, Y. Ju, J. Zhao, and K. Liu, “Explanation guided knowledge distillation for pre-trained language model compression,” ACM Transactions on Asian and Low-Resource Language Information Processing, vol. 23, no. 2, pp. 1-19, 2024, doi: 10.1145/3639364.
H. Li, J. Zhang, H. Shen, K. Cheng, and X. Huang, “KEFT: Knowledge-Enhanced Fine-Tuning for Large Language Models in Domain-Specific Question Answering,” Transactions of the Association for Computational Linguistics, vol. 13, pp. 1056-1067, 2025, doi: 10.1162/TACL.a.31.
Y. Lin, S. Yin, Y. Ding, and X. Liang, “ATMKD: Adaptive temperature guided multi-teacher knowledge distillation,” Multimedia Systems, vol. 30, no. 5, pp. 292, 2024, doi: 10.1007/s00530-024-01483-w.
Q. Zhong, L. Ding, J. Liu, B. Du, and D. Tao, “Panda: Prompt transfer meets knowledge distillation for efficient model adaptation,” IEEE Transactions on Knowledge and Data Engineering, vol. 36, no. 9, pp. 4835-4848.https://doi.org/10.1109/TKDE.2024.3376453, 2024.
W. Li, J. Xu, and Q. Chen, “Knowledge distillation-based multilingual fusion code retrieval,” Algorithms, vol. 15, no. 1, pp. 25, 2022, doi: 10.3390/a15010025.
J. Roh, M. Kim, and K. Bae, “Towards a small language model powered chain-of-reasoning for open-domain question answering,” ETRI Journal, vol. 46, no. 1, pp. 11-21, 2024, doi: 10.4218/etrij.2023-0355.
S. Liu, X. Guo, X. Hu, and X. Zhao, “Advancing generative intelligent tutoring systems with GPT-4: Design, evaluation, and a modular framework for future learning platforms,” Electronics, vol. 13, no. 24, pp. 4876, 2024, doi: 10.3390/electronics13244876.
J. Wang, Y. Zhang, and W. Liu, “Question answering system based on the combination of large language model and knowledge graph,” Applied Intelligence, vol. 55, no. 15, pp. 1000, 2025, doi: 10.1007/s10489-025-06828-0.