A multi-modal code search method based on fine-grained attention alignment

By employing a fine-grained attention-aligned multimodal code search method, leveraging multi-head attention mechanisms and cross-entropy optimization, the heterogeneity problem between code and query is addressed. This enables efficient and accurate feature extraction and matching in large code databases, thereby improving the quality of code search.

CN118673091BActive Publication Date: 2026-07-24HOHAI UNIV
0 Cites 0 Cited by

Patent Information

Application Number
CN202410630129.4
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2024-05-21
Publication Date
2026-07-24
Estimated Expiration
2044-05-21

AI Technical Summary

Technical Problem

Existing code search methods suffer from incomplete information extraction and utilization and insufficient consideration of feature dimensions when dealing with the heterogeneity of code and queries, the unified representation of embedded spaces, and the explosive growth of code databases, resulting in inaccurate search results.

Method used

A multimodal code search method based on fine-grained attention alignment is adopted. The method uses a fine-grained network to represent the text and structural features of the code and the query in different ways, and uses a fine-grained alignment mechanism to fuse the features of different modalities, including multi-head attention mechanism, bidirectional gated graph neural network and cross-entropy optimization, to improve the accuracy of feature representation and matching effect.

Benefits of technology

It improves the matching accuracy of code and query in large code databases, solves the problem of insufficient information feature extraction in code search, reduces the error caused by feature misalignment, and improves search quality.

✦ Generated by Eureka AI based on patent content.
Patent Text Reader

Abstract

The application discloses a multimodal code search method based on fine-grained attention alignment, constructs a new mechanism to learn the rich semantics of source code and natural language queries from two modalities of text and structure, uses a multimodal feature network to construct a code search model, adopts different construction methods for different modal features, and fully expresses different features of corresponding codes and texts; meanwhile, a fine-grained alignment mechanism is adopted in the model training process, and the same modal features are aligned respectively, thereby facilitating the matching of code entities and text entities; after the construction of all features is completed, a cosine similarity function is used to calculate the similarity between a given query and code samples in all code libraries, so that the code samples are ranked according to the similarity. The application gets rid of the insufficiency of code representation and feature extraction in the existing code search field, can more completely utilize the information contained in different modal features for code representation and matching, and has higher recognition accuracy and better convergence performance.
Need to check novelty before this filing date? Find Prior Art