Optimizing Function-Level Source Code Classification Using Meta-Trained CodeBERT in Low-Resource Settings

This study investigates the effectiveness of a meta-trained transformer-based model, CodeBERT, for classifying source code functions in environments with limited labeled data.The primary objective is to improve the accuracy and generalizability of function-level code classification using few-shot learning, a strategy where the model learns from only a few labeled examples per category.We introduce a meta-learning framework designed to enable CodeBERT to adapt to new function types with minimal supervision, addressing a common limitation in traditional code classification methods that require extensive labeled datasets and manual feature engineering.The methodology involves episodic few-shot classification, where each episode simulates a low-resource task using five labeled and five unlabeled samples per function class.A balanced subset of Python functions was sampled from the CodeXGLUE benchmark, consisting of ten function categories with equal representation.The source code was preprocessed by removing comments and docstrings, then tokenized into a fixed length of 128 tokens to fit the model input format.The meta-trained CodeBERT was evaluated across 10 episodes, each representing a different task composition.Results show that the model achieves an average classification accuracy of 73.0%, with high accuracy on function categories characterized by unique syntax patterns, and lower performance on categories with overlapping logic or naming structures.Despite this variability, the model-maintained accuracy above 60% in all episodes.These findings suggest that meta-learning significantly enhances the adaptability of CodeBERT to unseen tasks under dataconstrained conditions.This research demonstrates that meta-trained transformer models can serve as practical tools for real-time code analysis, particularly in integrated development environments and continuous integration pipelines.Future work may include extending the framework to other programming languages and incorporating semantic code representations to further reduce classification ambiguity.

Authors

Institutions

Publication Details

Journal
Journal of Applied Data Sciences
Published
2025-08-27
DOI
https://doi.org/10.47738/jads.v6i3.902
Citations
1
Primary Topic
Speech Recognition and Synthesis
Type
article
Field-Weighted Citation Impact
2.48
Controls
|||
ALL TIME
JAN
FEB
MAR
APR
MAY
JUN
JUL
AUG
SEP
OCT
article

Optimizing Function-Level Source Code Classification Using Meta-Trained CodeBERT in Low-Resource Settings

Abednego Dwi Septiadi
1 citations
Journal of Applied Data Sciences
Speech Recognition and Synthesis
2.48
article

Optimizing Function-Level Source Code Classification Using Meta-Trained CodeBERT in Low-Resource Settings

Abednego Dwi Septiadi
article en
1 citations

Abstract

This study investigates the effectiveness of a meta-trained transformer-based model, CodeBERT, for classifying source code functions in environments with limited labeled data.The primary objective is to improve the accuracy and generalizability of function-level code classification using few-shot learning, a strategy where the model learns from only a few labeled examples per category.We introduce a meta-learning framework designed to enable CodeBERT to adapt to new function types with minimal supervision, addressing a common limitation in traditional code classification methods that require extensive labeled datasets and manual feature engineering.The methodology involves episodic few-shot classification, where each episode simulates a low-resource task using five labeled and five unlabeled samples per function class.A balanced subset of Python functions was sampled from the CodeXGLUE benchmark, consisting of ten function categories with equal representation.The source code was preprocessed by removing comments and docstrings, then tokenized into a fixed length of 128 tokens to fit the model input format.The meta-trained CodeBERT was evaluated across 10 episodes, each representing a different task composition.Results show that the model achieves an average classification accuracy of 73.0%, with high accuracy on function categories characterized by unique syntax patterns, and lower performance on categories with overlapping logic or naming structures.Despite this variability, the model-maintained accuracy above 60% in all episodes.These findings suggest that meta-learning significantly enhances the adaptability of CodeBERT to unseen tasks under dataconstrained conditions.This research demonstrates that meta-trained transformer models can serve as practical tools for real-time code analysis, particularly in integrated development environments and continuous integration pipelines.Future work may include extending the framework to other programming languages and incorporating semantic code representations to further reduce classification ambiguity.

Journal of Applied Data SciencesVol. 6(3)
Telkom University (ID)
Decent work and economic growth
Openalex Percentile: Top 9%
Speech Recognition and Synthesis
2.48
AI Navigator

Ask Laika to Summarize, Analyze, and Connect papers live on the map.

Summarize Papers & Methodologies

Extract key findings, datasets, and comparative methods across publications.

Benchmark Rankings & Visual Analytics

Rank top research institutions, authors, funders, topics, and journals by Field-Weighted Citation Impact (FWCI) and paper volume with instant charts.

Connect Distant Disciplines

Bridge topological clusters on the map to find hidden collaborative intersections.

Optimizing Function-Level Source Code Classification Using Meta-Trained CodeBERT in Low-Resource Settings — Abednego Dwi Septiadi · Journal of Applied Data Sciences (2025) | TGRS Research Map | TGRS