DOI: 10.3390/electronics15184299 ISSN: 2079-9292

Context-Aware Non-Functional Requirement Classification Using Functional Requirement Guidance and Domain-Specialized Representations

Ashwag Almohammady, Reem Alnanih, Nahed Alowidi

Existing Non-Functional Requirement (NFR) classification approaches typically classify NFR statements independently, overlooking the semantic information provided by their associated Functional Requirements (FRs). Moreover, most existing models rely on general-purpose language representations and sentence-level evaluation protocols that may overestimate model generalization. This paper proposes a context-aware NFR classification framework that integrates FR context with the domain-specialized representations learned by the domain-specialized Stage-3 Re-Distill encoder. The proposed framework is evaluated under a strict project-level protocol designed to assess generalization across previously unseen software projects, together with a supplementary sentence-level 10-fold cross-validation experiment for comparison with existing studies. Experimental results demonstrate that the proposed framework achieves 0.86 Accuracy and 0.80 Macro-F1 under the project-level evaluation protocol while consistently outperforming generic pretrained transformer encoders. The experiments further reveal that the contribution of FR context is category-dependent, substantially improving Security and Usability classification while providing little or even negative benefit for Availability. Under sentence-level cross-validation, the same framework achieves a Macro-F1 score of 0.97, highlighting the strong influence of evaluation protocols on reported performance. These findings demonstrate that domain-specialized representations and FR context provide complementary benefits for NFR classification while highlighting the importance of realistic evaluation protocols for assessing model generalization.