# C2B: A Semantic Source Code Retrieval Model Using CodeT5 and Bi-LSTM  
[PERSON]  
Department of Computer Software Engineering, National University of Sciences and Technology, Islamabad 44000, Pakistan; [EMAIL_ADDRESS] (N.B. ); [EMAIL_ADDRESS] (A.M.); [EMAIL_ADDRESS] (F.A. ); [EMAIL_ADDRESS] (A-A.K.) [PERSON]  
Correspondence: [EMAIL_ADDRESS]. techniques (e.g., [10; 11; 12; 13; 14]) show significant improvement over traditional keyword-based search methods, they are not without limitations [12; 15]. Existing techniques significantly face two main challenges: (i) Inability to effectively understand the context within which code operates. This includes not just the broader application context but also the specific syntax and structure of programming languages. Traditional techniques fail to grasp the intricate dependencies and nuances within code structures, which can lead to irrelevant or incorrect search results [16]. (ii) Struggles in interpreting the semantics of both the natural language used in queries and the programming languages used in code. Effective code search requires a deep understanding of the intent behind a user's query, which can be complex and nuanced. Current techniques lack the sophistication to accurately match these queries with appropriate code snippets, particularly when dealing with abstract concepts or less explicitly defined problems [10; 11; 12; 13; 14]. Deep learning techniques for code search, as discussed in [16], tend to overlook the knowledge gap existing between code snippets and user queries. Instead, they prioritize learning pattern matching based on the semantic relationship between the code and its corresponding description. Recently, a lot of academics have been working in this field to identify new ways to overcome the gaps in existing work [17]. To address the above-stated limitations of existing approaches, this research aims to propose a hybrid neural code search approach that leverages CodeT5 [18] (a pretrained transformer-based model; transformer-based models in deep learning revolutionized natural language processing. These models rely on self-attention mechanisms to capture contextual relationships between words in a sequence without relying on recurrent or convolutional structures) and Bi-LSTM. The proposed model is named \"CodeT5 and Bi-LSTM hybrid model\" (C2B). The Bi-LSTM processes sequential data, capturing contextual information in both forward and backward directions. This capability is essential for accurately parsing complex, context-rich queries. The C2B model employs CodeT5 [18], a specialized version of the T5 [19] model tailored for code, to comprehend the semantics of both natural language and code. The CodeT5 adaptability across various programming languages and frameworks significantly enhances the model's generalization. By combining these strengths, the C2B model offers a comprehensive approach that addresses the challenges of existing code search systems, providing developers with enhanced productivity and reduced development time and ultimately leading to higher-quality software development. This synergistic approach enhances the accuracy of code search, improves comprehension of complex queries, and facilitates code reuse, addressing key limitations in existing systems. In this research, our main contributions can be outlined as follows:  
* A robust C2B model is proposed that efficiently integrates CodeT5 and Bi-LSTM, allowing seamless interaction between natural language and code representations. * Extensive assessments are conducted using the CodeSearchNet benchmark dataset to indicate that our C2B hybrid model performs better when compared with previous alternatives. * An attention mechanism is incorporated to enhance the model's ability to focus on relevant parts of the code and queries, further improving search accuracy. The rest of this paper is organized as follows: Section 2 presents a comprehensive analysis of existing studies, methodologies, and findings related to the research themes. Section 3 details the research methodology.