LLAMA-Augmented Hierarchical Transformer for Fine-Grained Code Search
Code retrieval plays a pivotal role in intelligent software engineering by enabling accurate matching between natural language queries and relevant source code. However, existing retrieval models often struggle with preserving long-range context, effectively capturing multi-granular semantics, and integrating global knowledge from large-scale language models. To overcome these limitations, this work proposes HiTR-LLaMA, a hierarchical Transformer-based retrieval framework enhanced with LLaMA-based contextual augmentation. By incorporating hierarchical encoding with cross-layer feature aggregation, LLMguided semantic enrichment, and a multi-view residual reranking mechanism, the proposed model achieves fine-grained query-code semantic alignment in a unified architecture. The retrieval and reranking modules are optimized through a two-stage training strategy, supported by hard-negative mining and task-specific prompt engineering. Extensive experiments demonstrate that HiTR-LLaMA substantially improves retrieval quality and offers a scalable, adaptable solution for real-world code search tasks.
Authors
- Jiayun Zheng (ORCID: https://orcid.org/0009-0005-5838-796X)
- Y. X. Zhao
- Tiantian Huang (ORCID: https://orcid.org/0000-0002-9088-6313)
- Yu-Cheng Yang (ORCID: https://orcid.org/0009-0005-7088-4627)
- A. Y. Sun (ORCID: https://orcid.org/0009-0007-5784-8167)
Institutions
- Northeastern University (US)
- Washington University in St. Louis (US)
- Rolta (United States) (US)
- Bellevue University (US)
- Seattle University (US)
Publication Details
- Published
- 2025-06-20
- DOI
- https://doi.org/10.1109/caibda65784.2025.11183055
- Primary Topic
- Educational Technology and Assessment
- Type
- article
- Field-Weighted Citation Impact
- 0.00