arrow
Return

AdaptGen: A Problem-Adaptive Solution Template Generation Technique for Online Programming Platforms

delete2026-05-12
delete0
PRE
AI
G
Guowei Zhang
W
Weiqin Zou
X
Xiaowei Zhang
J
Jingxuan Zhang
J
Jifeng Xuan
DOI:10.1109/tse.2026.3692192delete
deleteOriginal
deleteOriginal request for help
deleteShare
deleteSave
Abstract

Abstract

En 中文
Online programming platforms that offer various programming tasks play a crucial role in helping programmers enhance their coding skills. Programming tasks posted for different application scenarios may follow the same or similar programming patterns in their solutions. This leads programmers to repeatedly write not just the core code of problem-solving, but also the same basic framework and some peripheral code (such as variable declarations and input/output handling) that are needed to make their solutions executable. Repeatedly writing boilerplate or well-mastered algorithmic frameworks wastes time and adds little value for programmers focused on skill-specific practice. Toward this, we propose to develop AdaptGen, a problem-adaptive code template generation method for online programming platforms. AdaptGen analyzes and extracts solution patterns from various programming problem solutions (i.e., code accepted by online programming platforms) and generates templates tailored to each problem. More specifically, AdaptGen is built on genetic programming and uses a linear hashing sequence encoding strategy to represent solutions. It incorporates selection, crossover, and de-duplication operators to maintain diversity in the evolution process, and a fitness function tailored to generate solution templates. These templates are then abstracted and structured with a flexible core-code-hiding mechanism, enabling programmers of different experience levels to practice efficiently. We evaluated AdaptGen using two datasets from LeetCode and NowCoder, containing a total of 997 tasks and over 3,200 solution categories. Results show that AdaptGen successfully generates usable templates for 77%-84% of solution categories, with 80% of the templates performing well in manual evaluations. It also outperforms seven advanced representative large language models (LLMs), achieving the best overall performance in template quality, consistency, and generation efficiency. To validate AdaptGen’s effectiveness in real-world programming environments, we further conduct a user study involving live coding practice by programmers in online programming platforms, which effectively demonstrated its utility in practical application scenarios.
Keywords:
Online programming platforms
solution template
adaptive generation
genetic algorithm

Journal

IEEE Transactions on Software Engineering cover
IEEE Transactions on Software Engineering
IF:
5.6
Papers:
2.9K
Citations:
1.1W

Organization

J
jinan inspur data technology co., ltd.
Scholars:
8
Papers: 5
Citations: 0
N
nanjing university of aeronautics and astronautics
Scholars:
3.7K
Papers: 1.2K
Citations: 1
W
wuhan university
Scholars:
8.1W
Papers: 5.8W
Citations: 70
researcher View more organizations
Cited Papers

Cited Papers

On the Naturalness of Software
err2016-04-26
err164
PREAI
errHindle, Abram; Barr, Earl T.; Gabel, Mark; Su, Zhendong; Devanbu, Premkumar
errShare
errSave
Competition-level code generation with AlphaCode
err2022-12-09
err0
errOAAI
errYujia Li; David Choi; Junyoung Chung; Nate Kushman; Julian Schrittwieser; Rémi Leblond; Tom Eccles; James Keeling; Felix Gimeno; Agustin Dal Lago; Thomas Hubert; Peter Choy; Cyprien de Masson d’Autume; Igor Babuschkin; Xinyun Chen; Po-Sen Huang; Johannes Welbl; Sven Gowal; Alexey Cherepanov; James Molloy; Daniel J. Mankowitz; Esme Sutherland Robson; Pushmeet Kohli; Nando de Freitas; Koray Kavukcuoglu; Oriol Vinyals
errShare
errSave
errShare
errSave
Improved Crossover Operators for Genetic Programming for Program Repair
err2016-09-24
err0
PREAI
errVinicius Paulo L. Oliveira; Eduardo F. D. Souza; Claire Le Goues; Celso G. Camilo-Junior
errShare
errSave
StepCoder: Improving Code Generation with Reinforcement Learning from Compiler Feedback
err2024-01-01
err0
PREAI
errShihan Dou; Yan Liu; Haoxiang Jia; Enyu Zhou; Limao Xiong; Junjie Shan; Caishuang Huang; Xiao Wang; Xiaoran Fan; Zhiheng Xi; Yuhao Zhou; Tao Ji; Rui Zheng; Qi Zhang; Tao Gui; Xuanjing Huang
errShare
errSave
researcher View more