How a pre-trained transformer is trained is associated with measurable differences in JavaScript code summarization alongside model architecture, according to an empirical comparative study published in Discover Computing. Archana Praveen Kumar and colleagues evaluated four fine-tunable transformer models—GPT-2, T5, CodeT5, and CodeBERT—under incremental fine-tuning and exhaustive prompt-based training. Across all five reported automated metrics, CodeBERT consistently scored higher under exhaustive prompt-based training than under incremental fine-tuning, whereas GPT-2 posted nearly identical ROUGE scores under both regimes. Among eight tested configurations, CodeT5 fine-tuned with a prompt template reached the highest ROUGE-1 score at 31.78 percent, ROUGE-L at 28.69 percent, and corpus-level BLEU at 15.29, while a static-prompt CodeT5 variant led on METEOR at 29.63 and mean sentence-level BLEU at 0.0411. Because every experiment used JavaScript snippets from CodeSearchNet, generalization to other programming languages remains untested.
Automatic code summarization translates source code snippets into concise natural language descriptions that help developers understand and maintain evolving software without writing every comment manually. Earlier neural approaches frequently relied on graph neural networks, graph attention networks, multi-modal feature fusion, or Abstract Syntax Trees to capture structural relationships, but those methods carried high computational costs or struggled to generalize across coding styles and languages. Prior research also concentrated heavily on Java and Python, leaving JavaScript comparatively under-examined despite its prevalence in web and server-side development. JavaScript poses distinct summarization challenges, including dynamic typing, callback-oriented control flow, frequent anonymous functions, flexible syntax, and no static type annotations. Because earlier studies typically varied training strategies or prompt designs individually, the authors formulated three research questions: how incremental fine-tuning versus exhaustive prompt-based training affects performance, how model architecture shapes that relationship, and how static, template, and context-based prompts affect code-specific models.
Rather than benchmarking large instruction-tuned language models such as LLaMA 2 or GPT-3.5—excluded because their scale and often closed-source availability hinder reproducible, controlled fine-tuning on modest hardware—the researchers chose four fine-tunable pre-trained architectures. GPT-2, loaded from the gpt2 checkpoint, is a decoder-only autoregressive transformer described as having 1.5 billion parameters and pre-trained on 8 million web pages to predict next words using masked multi-head attention and positional encoding. T5, initialized from t5-small, is a general-purpose encoder-decoder pre-trained on the Common Crawl-derived C4 corpus through masked language modeling within a unified text-to-text framework. CodeT5, using Salesforce/codet5-base-multi-sum, is a 220-million-parameter code-aware encoder-decoder sharing T5’s architecture and pre-trained on code-comment pairs. CodeBERT, based on microsoft/codebert-base, is a 125-million-parameter RoBERTa-base model with 12 layers, 768-dimensional hidden states, and 12 attention heads pre-trained on 2.1 million bimodal and 6.4 million unimodal CodeSearchNet records via masked language modeling and replaced token detection; both its encoder and decoder were initialized from that checkpoint.
All experiments used the JavaScript split of the filtered CodeSearchNet dataset from the CodeXGLUE code-to-text benchmark, containing 58,025 training, 3,885 validation, and 3,291 test examples. Inputs were assembled by joining tokenized code fields and targets by joining docstring tokens, with inputs truncated to 512 tokens and targets to 128 tokens during tokenization, or 150 output tokens in selected runs. The authors distinguish between truncation at tokenization, applied across all models, and filtering against the 512-token limit, applied only to some models. Because each architecture was trained and evaluated on a differently sized subset and subset selection procedures were not uniformly documented, the four models were not evaluated on a shared test set. Specifically, GPT-2 used 20,000 training examples, exhaustive CodeBERT used 50,024 examples, and the original CodeT5 runs used 54,770 training, 3,669 validation, and 3,110 test examples.
The experimental matrix was not fully crossed across training regimes. GPT-2 and CodeBERT were evaluated under both incremental fine-tuning and exhaustive training, whereas T5 received only incremental training and CodeT5 received only exhaustive training across three prompt designs. In incremental, or progressive, fine-tuning, models trained on expanding subsets to stabilize updates, starting at 10,000 examples for GPT-2 and 1,000 for CodeBERT before scaling to the full assigned split. In exhaustive training, models processed the full assigned dataset, with CodeBERT trained on 50,024 examples more than three times and GPT-2’s exhaustive model further refined incrementally. All runs used fp16 mixed precision and the AdamW optimizer on Google Colab NVIDIA T4 and A100 GPUs with CUDA 12.1. Hyperparameter searches tested learning rates of 1e-5 to 5e-5, batch sizes of 16 to 40 (8 to 64 for GPT-2), 5 to 12 epochs, weight decay up to 0.02, and gradient accumulation of 1 to 3 steps; CodeT5 used validation-loss early stopping with a patience of 5 or 10 epochs.
For exhaustive CodeT5 training, the team tested three prompt designs: a static prompt appending a fixed instruction, a template prompt wrapping code in literal bracketed tags reading “The <language> JavaScript </language>code <code> {} </code> comment is <comment> </comment>” with an empty comment span, and a context-aware prompt intended to supply encoder-derived representations. For decoder-only GPT-2, the prompt omitted the language name and appended a “Summary:” cue to trigger generation. However, the authors disclose in an appendix that the context-aware prompt did not operate as intended: a frozen CodeBERT encoder mean-pooled final hidden states and took an argmax over the hidden dimension rather than the vocabulary, sending non-vocabulary indices to the tokenizer and yielding uninterpretable strings. Accordingly, the paper states that context-prompt results describe that implementation as executed rather than contextual prompting as a technique, and notes that alternative prompt wordings and selection criteria were not systematically recorded.
Evaluation relied on five reference-based automated metrics: mean sentence-level BLEU on a zero-to-one scale, alongside corpus-level BLEU, ROUGE-1, ROUGE-L, and METEOR reported as percentages. Overall, code-specific models outperformed general-purpose ones: four of five code-specific configurations surpassed incrementally trained T5 on every metric and outperformed GPT-2 on ROUGE. The sole exception was incrementally trained CodeBERT, which recorded lower ROUGE-1 (28.58 percent) and ROUGE-L (25.27 percent) than T5 (30.31 percent and 26.17 percent), while leading T5 on the remaining three metrics. Under exhaustive prompting, CodeBERT surpassed T5 on every metric and placed near CodeT5, with exhaustive CodeBERT, static CodeT5, and context CodeT5 clustering between 30.83 and 31.04 percent on ROUGE-1. GPT-2 scored much lower on ROUGE under both regimes, and its BLEU and METEOR entries were replaced with dashes because wrongly duplicated values could not be recovered after the models ceased to exist. Because T5 and CodeT5 each ran under one regime, isolated training-strategy comparisons rest solely on CodeBERT and GPT-2.
Comparing CodeT5’s three prompt designs revealed narrow, metric-dependent margins rather than a uniform ranking. The template prompt led on corpus-level BLEU (15.29 versus 13.60 for static and 14.91 for context), ROUGE-1 (31.78 percent), and ROUGE-L (28.69 percent), whereas the static prompt led on METEOR (29.63) and mean sentence-level BLEU (0.0411 versus 0.0390 for template and 0.0373 for context); context prompts scored lowest on four of five metrics. All three variants fell within 0.78 ROUGE-1 points. Because the main experiments were single runs without global Python, NumPy, or PyTorch seeds or significance tests, the authors retrained the CodeT5 template model from scratch across three seeds (42, 43, and 44) on one T4 GPU using fixed decoding (beam width 5, length penalty 1.0, maximum length 128) and a 512-token-filtered split of 57,871 training, 3,876 validation, and 3,286 test examples. ROUGE-1 ranged from 34.3218 to 35.0321 (standard deviation 0.3781), while BERTScore had a 0.0896 standard deviation. That dispersion implies a two-run standard deviation near 0.53 ROUGE-1 points, making the 0.78-point main-table gap roughly 1.5 times run-to-run variability—too small for a reliable ranking.
The authors also noted clear metric divergences. Models such as T5 posted relatively strong ROUGE-1 and ROUGE-L scores alongside low BLEU scores because BLEU relies on exact n-gram overlap and penalizes valid paraphrases. Manual inspection of generated summaries identified four recurring errors: missing key functionality, incorrect interpretation of variables or functions, over-generalization, and hallucinated details absent from the code. Qualitative samples showed that every architecture except GPT-2 routinely generated structured documentation tags such as @param and @return, and the team integrated the trained models into a Gradio web interface for interactive JavaScript summarization. Still, the paper stresses that BLEU, ROUGE, and METEOR measure lexical overlap rather than semantic accuracy or developer utility. Apart from BERTScore in the confirmatory run, main configurations lacked learned semantic metrics or human evaluation—the study’s most significant evaluation limitation.
Additional confounders further bound interpretation. In the three-seed confirmatory runs, absolute scores shifted relative to the main table—reaching a mean ROUGE-1 of 34.75 percent but a corpus-level BLEU of 4.51—because those runs used roughly 3,100 additional training examples, uniform metric software, and fixed decoding that produced shorter summaries averaging 7.1 tokens versus 12.8 in references. In the original experiments, beam widths ranged from 4 to 64, length penalties from 1 to 10, and maximum generation lengths from 50 to 512 tokens, while exact per-run decoding settings, GPU assignments, and METEOR software implementations (HuggingFace evaluate versus NLTK) were not uniformly recorded. Consequently, reported differences reflect training strategy, decoding settings, data volume, and metric implementation jointly, requiring controlled re-decoding to isolate training effects. The authors archived notebooks and confirmatory outputs on Zenodo, with weights available on request, and prioritized matched instruction-tuned baselines, human evaluation, semantic metrics, and multi-language testing.
Subject of Research: Comparative evaluation of incremental fine-tuning and prompt-based training across four pre-trained transformer architectures for JavaScript automatic code summarization
Article Title: A comparative study of incremental vs prompt-based training for code summarization across transformer architectures
Article References: Kumar, A. P., Namratha, M., Pratheeksha, S., Bangera, R. R., Krishna, R., Ashwini, B., & Reza, S. M. (2026). A comparative study of incremental vs prompt-based training for code summarization across transformer architectures. Discover Computing, 29(1), Article 969. https://doi.org/10.1007/s10791-026-10860-0
Image Credits: AI Generated
DOI: 10.1007/s10791-026-10860-0
Keywords: automatic code summarization, JavaScript, transformer architectures, incremental fine-tuning, prompt-based training, CodeT5, CodeBERT, GPT-2, T5, CodeSearchNet, CodeXGLUE, ROUGE metrics, BLEU score, METEOR metric, prompt engineering, BERTScore, Gradio interface
News Source: Denise Maddox. (December 6, 2026). CodeBERT Scored Higher Under Prompt-Based Training in JavaScript Code Summarization Study. Scienmag.



