Applied Sciences (Jul 2024)

C2B: A Semantic Source Code Retrieval Model Using CodeT5 and Bi-LSTM

  • Nazia Bibi,
  • Ayesha Maqbool,
  • Tauseef Rana,
  • Farkhanda Afzal,
  • Adnan Ahmed Khan

DOI
https://doi.org/10.3390/app14135795
Journal volume & issue
Vol. 14, no. 13
p. 5795

Abstract

Read online

To enhance the software implementation process, developers frequently leverage preexisting code snippets by exploring an extensive codebase. Existing code search tools often rely on keyword- or syntactic-based methods and struggle to fully grasp the semantics and intent behind code snippets. In this paper, we propose a novel hybrid C2B model that combines CodeT5 and bidirectional long short-term memory (Bi-LSTM) for source code search and recommendation. Our proposed C2B hybrid model leverages CodeT5’s domain-specific pretraining and Bi-LSTM’s contextual understanding to improve code representation and capture sequential dependencies. As a proof-of-concept application, we implemented the proposed C2B hybrid model as a deep neural code search tool and empirically evaluated the model on the large-scale dataset of CodeSearchNet. The experimental findings showcase that our methodology proficiently retrieves pertinent code snippets and surpasses the performance of prior state-of-the-art techniques.

Keywords