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

Institutions

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
Controls
|||
ALL TIME
JAN
FEB
MAR
APR
MAY
JUN
JUL
AUG
SEP
OCT
article

LLAMA-Augmented Hierarchical Transformer for Fine-Grained Code Search

Jiayun Zheng, Y. X. Zhao, Tiantian Huang, Yu-Cheng Yang et al.
Educational Technology and Assessment
article

LLAMA-Augmented Hierarchical Transformer for Fine-Grained Code Search

Jiayun Zheng, Y. X. Zhao, Tiantian Huang, Yu-Cheng Yang, A. Y. Sun
article en

Abstract

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.

Northeastern University (US), Washington University in St. Louis (US), Rolta (United States) (US), Bellevue University (US), Seattle University (US)
Openalex Percentile: Top 59%
Educational Technology and Assessment
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.