On the Effectiveness of Zero-Shot and Few-Shot Pretrained Language Models for Software Requirement Classification

Accurate classification of software requirements, particularly distinguishing between fun- ctional and non-functional requirements, is essential for enabling traceability, guiding system design, and ensuring project success. Traditional supervised machine learning methods have shown promise in this domain but suffer from limited generalizability, high labeling costs, and overfitting. Recent advances in pretrained language models (PLMs) offer new opportunities for effective requirement classification through zero-shot (ZS) and few-shot (FS) learning. This study investigates the effectiveness of ZS and FS PLMs, including prompt-based generative large language models (e.g., <monospace xmlns:mml="http://www.w3.org/1998/Math/MathML" xmlns:xlink="http://www.w3.org/1999/xlink">GPT-4o</monospace> and <monospace xmlns:mml="http://www.w3.org/1998/Math/MathML" xmlns:xlink="http://www.w3.org/1999/xlink">Llama3</monospace>), in classifying functional vs. non-functional requirements and non-functional subtypes, such as usability, security, operational, and performance requirements. We conduct a comprehensive empirical evaluation across five classification tasks using two widely adopted datasets: PROMISE and SecReq. The study compares six PLMs, including two ZS, two FS transformer models, and two generative Large Language Models under both ZS and FS settings. We benchmark these models against state-of-the-art and domain-specific baselines, and complement the quantitative analysis with a detailed qualitative error analysis. FS models, such as <monospace xmlns:mml="http://www.w3.org/1998/Math/MathML" xmlns:xlink="http://www.w3.org/1999/xlink">All-MPNET</monospace>, <monospace xmlns:mml="http://www.w3.org/1998/Math/MathML" xmlns:xlink="http://www.w3.org/1999/xlink">All-DistilRoBERTa</monospace>, and <monospace xmlns:mml="http://www.w3.org/1998/Math/MathML" xmlns:xlink="http://www.w3.org/1999/xlink">GPT-4o</monospace> in the FS setting, consistently outperform ZS models across all tasks, achieving superior performance in multi-class NFR and security requirement classification. While <monospace xmlns:mml="http://www.w3.org/1998/Math/MathML" xmlns:xlink="http://www.w3.org/1999/xlink">NoRBERT</monospace> remains superior in binary FR/NFR classification, our FS models outperform or match its performance in other scenarios. ZS models, such as <monospace xmlns:mml="http://www.w3.org/1998/Math/MathML" xmlns:xlink="http://www.w3.org/1999/xlink">GPT-4o</monospace>, also demonstrate strong results without requiring training data, highlighting their practical utility. Error analysis reveals that annotation issues and lack of context are major sources of misclassification. Our findings establish that ZS and FS PLMs, especially prompt-based generative large language models, offer viable and scalable alternatives to traditional supervised approaches. This study lays the foundation for the broader adoption of prompt-based PLMs in requirement engineering.

Authors

Institutions

Publication Details

Journal
IEEE Access
Published
2025-01-01
DOI
https://doi.org/10.1109/access.2025.3607813
Citations
1
Primary Topic
Software Engineering Research
Type
article
Field-Weighted Citation Impact
3.25
Controls
|||
ALL TIME
JAN
FEB
MAR
APR
MAY
JUN
JUL
AUG
SEP
OCT
article

On the Effectiveness of Zero-Shot and Few-Shot Pretrained Language Models for Software Requirement Classification

Anwarul Islam Sifat, Shahid Uz Zaman, Andrew Ma, Md Rakibul Islam et al.
1 citations
IEEE Access
Software Engineering Research
3.25
article

On the Effectiveness of Zero-Shot and Few-Shot Pretrained Language Models for Software Requirement Classification

Anwarul Islam Sifat, Shahid Uz Zaman, Andrew Ma, Md Rakibul Islam, Md Shafikuzzaman
article en
1 citations

Abstract

Accurate classification of software requirements, particularly distinguishing between fun- ctional and non-functional requirements, is essential for enabling traceability, guiding system design, and ensuring project success. Traditional supervised machine learning methods have shown promise in this domain but suffer from limited generalizability, high labeling costs, and overfitting. Recent advances in pretrained language models (PLMs) offer new opportunities for effective requirement classification through zero-shot (ZS) and few-shot (FS) learning. This study investigates the effectiveness of ZS and FS PLMs, including prompt-based generative large language models (e.g., <monospace xmlns:mml="http://www.w3.org/1998/Math/MathML" xmlns:xlink="http://www.w3.org/1999/xlink">GPT-4o</monospace> and <monospace xmlns:mml="http://www.w3.org/1998/Math/MathML" xmlns:xlink="http://www.w3.org/1999/xlink">Llama3</monospace>), in classifying functional vs. non-functional requirements and non-functional subtypes, such as usability, security, operational, and performance requirements. We conduct a comprehensive empirical evaluation across five classification tasks using two widely adopted datasets: PROMISE and SecReq. The study compares six PLMs, including two ZS, two FS transformer models, and two generative Large Language Models under both ZS and FS settings. We benchmark these models against state-of-the-art and domain-specific baselines, and complement the quantitative analysis with a detailed qualitative error analysis. FS models, such as <monospace xmlns:mml="http://www.w3.org/1998/Math/MathML" xmlns:xlink="http://www.w3.org/1999/xlink">All-MPNET</monospace>, <monospace xmlns:mml="http://www.w3.org/1998/Math/MathML" xmlns:xlink="http://www.w3.org/1999/xlink">All-DistilRoBERTa</monospace>, and <monospace xmlns:mml="http://www.w3.org/1998/Math/MathML" xmlns:xlink="http://www.w3.org/1999/xlink">GPT-4o</monospace> in the FS setting, consistently outperform ZS models across all tasks, achieving superior performance in multi-class NFR and security requirement classification. While <monospace xmlns:mml="http://www.w3.org/1998/Math/MathML" xmlns:xlink="http://www.w3.org/1999/xlink">NoRBERT</monospace> remains superior in binary FR/NFR classification, our FS models outperform or match its performance in other scenarios. ZS models, such as <monospace xmlns:mml="http://www.w3.org/1998/Math/MathML" xmlns:xlink="http://www.w3.org/1999/xlink">GPT-4o</monospace>, also demonstrate strong results without requiring training data, highlighting their practical utility. Error analysis reveals that annotation issues and lack of context are major sources of misclassification. Our findings establish that ZS and FS PLMs, especially prompt-based generative large language models, offer viable and scalable alternatives to traditional supervised approaches. This study lays the foundation for the broader adoption of prompt-based PLMs in requirement engineering.

IEEE AccessVol. 13
Lamar University (US), California State University Los Angeles (US), Fairmont Senior High School (US)
Openalex Percentile: Top 6%
Software Engineering Research
3.25
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.