Function entry feature recognition method, device and equipment based on deep learning

Through the deep learning-based Transformer model, the function entry features in codes in different programming languages ​​and styles are trained to identify functions, which solves the problems of weak generalization ability and low recognition accuracy in the existing technology, and achieves efficient and automated recognition.

CN119557643APending Publication Date: 2025-03-04JIANGXI SMART CLOUD TEST SAFETY TESTING CENT CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202411610246.0
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-11-12
Publication Date
2025-03-04

AI Technical Summary

Technical Problem

In the prior art, the function entry feature recognition method has problems with weak generalization ability and low recognition accuracy, and is particularly difficult to adapt to complex control flows and jump codes, as well as different parameter transfer methods and register usage patterns.

Method used

Using the Transformer model based on deep learning, we train the recognition model to identify the function entry feature vector by obtaining code data sets of different programming languages ​​and styles, and realize automatic recognition.

Benefits of technology

It significantly improves the accuracy and recall of function entry feature recognition, realizes automatic identification of codes of different programming languages ​​and styles, has strong generalization capabilities, and reduces the workload of manual annotation and inspection.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119557643A_ABST
    Figure CN119557643A_ABST
Patent Text Reader

Abstract

The invention is suitable for the technical field of code analysis, and particularly relates to a function entry feature recognition method, device and equipment based on deep learning, and the method comprises the steps: obtaining test set data; wherein the test set data comprises codes of different programming languages and codes of different styles; identifying a function entry of the test set data by using an identification model to obtain an identification result; wherein the identification model is a deep learning model, the identification model is used for identifying a function entry, and the identification result comprises a function entry feature vector of the test set data; and determining a function entry code of the test set data according to the identification result. According to the method, the accuracy of the function entry feature recognition method is improved, function entries in codes of different programming languages and different styles can be recognized, and the generalization ability is high.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application belongs to the field of code analysis technology, and in particular, relates to a method, device and equipment for identifying function entry features based on deep learning. Background Art

[0002] Function entry feature recognition is a very important task in the fields of program analysis, reverse engineering, and vulnerability detection. Identifying function entry helps to understand the code structure, optimize the compiler, or debug the program. The process of identifying function entry features is to identify the function entry point in the code by analyzing the structure and behavior of the code. Function entry feature recognition methods include static analysis tools, dynamic analysis tools, etc.

[0003] In the prior art, the function entry feature recognition method requires manual feature extraction, and the predefined features and rules cannot cover all function entry situations, and have poor adaptability to code obfuscation, variants, and new patterns. For codes containing complex control flows and jumps, the existing function entry feature recognition method is difficult to accurately identify the function entry. The existing function entry feature recognition method is not sufficiently adaptable to different parameter passing methods and register usage patterns.

[0004] In summary, the traditional function entry feature recognition method has the problems of weak generalization ability and low recognition accuracy. Summary of the invention

[0005] The embodiments of the present application provide a method, device and equipment for identifying function entry features based on deep learning, which can solve the problems of weak generalization ability and low recognition accuracy in the function entry feature recognition method in the related art.

[0006] In a first aspect, an embodiment of the present application provides a method for identifying function entry features based on deep learning, comprising:

[0007] Acquire test set data; wherein the test set data includes codes in different programming languages ​​and codes in different styles;

[0008] Using a recognition model to identify the function entry of the test set data, and obtaining a recognition result; wherein the recognition model is a deep learning Transformer model, the recognition model is used to identify the function entry, and the recognition result includes a function entry feature vector of the test set data;

[0009] According to the recognition result, the function entry code of the test set data is determined.

[0010] The above technical solutions in the embodiments of the present application have at least the following technical effects:

[0011] The function entry feature recognition method based on deep learning provided by the present application first obtains the test set data, which can be codes of different programming languages ​​and codes of different styles, and then uses the recognition model (deep learning Transformer model) to identify the function entry of the test set data, obtains the recognition result, and is conducive to knowing the function entry feature vector of the test set data, and finally determines the function entry code of the test set data according to the recognition result. The accuracy and recall rate of the traditional function entry feature recognition model and the function entry feature recognition model based on deep learning are compared by experiment, and it is verified that the method can significantly improve the accuracy and recall rate of the function entry feature recognition method. The method can realize the automation of function entry feature recognition, and through the trained model, the function entry can be automatically identified in a large-scale code base, reducing the workload of manual annotation and inspection, and improving efficiency. The method can identify function entry in codes of different programming languages ​​and different styles, and has strong generalization ability.

[0012] In a second aspect, an embodiment of the present application provides a function entry feature recognition device based on deep learning, comprising:

[0013] An acquisition unit, used to acquire test set data; wherein the test set data includes codes in different programming languages ​​and codes in different styles;

[0014] An identification unit, used to identify the function entry of the test set data using a recognition model to obtain a recognition result; wherein the recognition model is a deep learning Transformer model, the recognition model is used to identify the function entry, and the recognition result includes a function entry feature vector of the test set data;

[0015] The function entry code obtaining unit is used to determine the function entry code of the test set data according to the recognition result.

[0016] In the third aspect, an embodiment of the present application provides a function entry feature recognition device based on deep learning, comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor implements the method described in any one of the embodiments of the first aspect when executing the computer program.

[0017] It can be understood that the beneficial effects of the second to third aspects mentioned above can be found in the relevant description of the first aspect mentioned above, and will not be repeated here. BRIEF DESCRIPTION OF THE DRAWINGS

[0018] In order to more clearly illustrate the technical solutions in the embodiments of the present application, the drawings required for use in the embodiments or the description of the prior art will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the present application. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying any creative work.

[0019] Figure 1 It is a flowchart of a method for identifying function entry features based on deep learning provided by an embodiment of the present application;

[0020] Figure 2 It is a structural schematic diagram of a conversion model in a function entry feature recognition method based on deep learning provided in an embodiment of the present application;

[0021] Figure 3 It is a flowchart of the recognition model training process in the function entry feature recognition method based on deep learning provided in an embodiment of the present application;

[0022] Figure 4 It is a schematic diagram of the overall process of the function entry feature recognition method based on deep learning based on the clustering model provided in the embodiment of the present application;

[0023] Figure 5 It is a schematic diagram of the overall process of the function entry feature recognition method based on deep learning based on a graph neural network provided in an embodiment of the present application;

[0024] Figure 6 It is a structural diagram of a function entry feature recognition device based on deep learning provided in an embodiment of the present application;

[0025] Figure 7 It is a structural diagram of a function entry feature recognition device based on deep learning provided in an embodiment of the present application. DETAILED DESCRIPTION

[0026] In the following description, specific details such as specific system structures, technologies, etc. are provided for the purpose of illustration rather than limitation, so as to provide a thorough understanding of the embodiments of the present application. However, it should be clear to those skilled in the art that the present application may also be implemented in other embodiments without these specific details. In other cases, detailed descriptions of well-known systems, devices, circuits, and methods are omitted to prevent unnecessary details from obstructing the description of the present application.

[0027] It should be understood that when used in the present specification and the appended claims, the term "comprising" indicates the presence of described features, wholes, steps, operations, elements and / or components, but does not exclude the presence or addition of one or more other features, wholes, steps, operations, elements, components and / or combinations thereof.

[0028] It should also be understood that the term “and / or” used in the specification and appended claims refers to any and all possible combinations of one or more of the associated listed items, and includes these combinations.

[0029] As used in the specification and appended claims of this application, the term "if" can be interpreted as "when" or "uponce" or "in response to determining" or "in response to detecting", depending on the context. Similarly, the phrase "if it is determined" or "if [described condition or event] is detected" can be interpreted as meaning "uponce it is determined" or "in response to determining" or "uponce [described condition or event] is detected" or "in response to detecting [described condition or event]", depending on the context.

[0030] In addition, in the description of the present application specification and the appended claims, the terms "first", "second", "third", etc. are only used to distinguish the descriptions and cannot be understood as indicating or implying relative importance.

[0031] References to "one embodiment" or "some embodiments" etc. described in the specification of this application mean that one or more embodiments of the present application include specific features, structures or characteristics described in conjunction with the embodiment. Therefore, the statements "in one embodiment", "in some embodiments", "in some other embodiments", "in some other embodiments", etc. that appear in different places in this specification do not necessarily refer to the same embodiment, but mean "one or more but not all embodiments", unless otherwise specifically emphasized in other ways. The terms "including", "comprising", "having" and their variations all mean "including but not limited to", unless otherwise specifically emphasized in other ways.

[0032] In the related art, the method of identifying function entry features includes static analysis tools, dynamic analysis tools, and code analysis based on machine learning. Static analysis tools use predefined rules and features to identify function entry through static code analysis. They can perform analysis without executing code and are applicable to source code and binary code. For code obfuscation and complex control flow graphs, the accuracy of static analysis tools is low. Using static analysis tools to identify function entry depends on rules and features, and it is difficult to deal with new and mutated code structures. Dynamic analysis tools identify function entry and other key features by executing code and monitoring its behavior. Dynamic analysis tools can capture the behavior of runtime code and analyze the actual execution path of the code in combination with specific inputs. However, dynamic analysis tools need to execute code, and for test inputs with limited coverage, all function entries may not be fully identified. The use of traditional machine learning algorithms (decision trees, random forests, SVMs, etc.) for function entry identification uses historical data for training to improve the degree of intelligent recognition, but the code feature extraction process is complex and relies on domain knowledge, and the recognition effect of complex code patterns is limited.

[0033] To solve the above problems, the embodiment of the present application provides a method, device and equipment for identifying function entry features based on deep learning. In this method, the test set data is first obtained, and the test set data can be codes in different programming languages ​​and codes of different styles. Then, the recognition model (deep learning Transformer model) is used to identify the function entry of the test set data, and the recognition result is obtained, which is conducive to knowing the function entry feature vector of the test set data. Finally, according to the recognition result, the function entry code of the test set data is determined. By comparing the accuracy and recall rate of the traditional function entry feature recognition model and the function entry feature recognition model based on deep learning through experiments, it is verified that this method can significantly improve the accuracy and recall rate of the function entry feature recognition method. This method can realize the automation of function entry feature recognition. Through the trained model, the function entry can be automatically identified in a large-scale code base, reducing the workload of manual annotation and inspection, and improving efficiency. This method can identify function entry in codes of different programming languages ​​and different styles, and has strong generalization ability. .

[0034] The deep learning-based function entry feature recognition method provided in the embodiment of the present application can be applied to a deep learning-based function entry feature recognition device. At this time, the deep learning-based function entry feature recognition device is the executor of the deep learning-based function entry feature recognition method provided in the embodiment of the present application. The embodiment of the present application does not impose any restrictions on the specific type of the deep learning-based function entry feature recognition device.

[0035] For example, the deep learning-based function entry feature recognition device can be a tablet computer, a laptop computer, an ultra-mobile personal computer (UMPC), a netbook, a personal digital assistant (PDA), a desktop computer, a computing device or other processing device connected to a wireless modem, a computer, a laptop computer, a handheld computing device, a customer premises equipment (CPE) and / or other devices used to communicate on a wireless system and a next-generation communication system, such as a mobile terminal in a 5G network or a mobile terminal in a future evolved public land mobile network (PLMN), etc.

[0036] The deep learning-based function entry feature recognition method provided in the embodiment of the present application can help automatically identify function entries in the code and can be widely used in software security, code auditing, software engineering and other fields. For example, by automatically identifying function entries, the functions and behaviors of malware can be quickly analyzed to assist in the reverse engineering of malware; during the code submission and integration process, the function definitions and entries in the code can be automatically reviewed to facilitate code standardization and consistency; during the code refactoring process, different functions can be identified and separated to improve the readability and maintainability of the code. The deep learning-based function entry feature recognition method can be applied to actual scenarios in the following ways:

[0037] Integrated Development Environment (IDE) plug-in: Integrate the function entry feature recognition model into IDEs such as VSCode and IntelliJ, recognize and annotate function entries in the code in real time, and provide automatic completion and code navigation functions.

[0038] Automated code review platform: Deploy the function entry feature recognition model on an automated code review platform, such as GitHub Actions, GitLab CI, etc. When the code is submitted and merged, the function entry feature recognition model is automatically run to review the function definition and structure of the code.

[0039] Security analysis platform: Integrate the function entry feature recognition model into the security analysis platform, such as Fortify, Checkmarx, etc., to automatically identify and analyze the function entry in the code, and assist in security vulnerability detection and malicious code analysis.

[0040] Static code analysis tools: Embed the function entry feature recognition model into static code analysis tools, such as SonarQube and Pylint, to automatically analyze the function entry in the code and detect potential code problems and security vulnerabilities.

[0041] In order to better understand the function entry feature recognition method based on deep learning provided in the embodiment of the present application, the specific implementation process of the function entry feature recognition method based on deep learning provided in the embodiment of the present application is exemplarily introduced below.

[0042] Figure 1 A schematic flow chart of a method for identifying function entry features based on deep learning provided in an embodiment of the present application is shown. The method for identifying function entry features based on deep learning includes:

[0043] S10, obtaining test set data, wherein the test set data includes codes in different programming languages ​​and codes in different styles.

[0044] It can be understood that programming languages ​​can include statically typed languages ​​(C, C++, Java, C#), dynamically typed languages ​​(Python, JavaScript, Ruby), scripting languages ​​(Bash, PHP, Perl), functional languages ​​(Haskell, Scala, Lisp), object-oriented languages ​​(Java, C#, Smalltalk), and declarative languages ​​(SQL, Prolog).

[0045] The code style can include: naming conventions, using different variable and function naming conventions (such as camel case naming and underline naming); comment style, detailed comments, brief comments or no comments in the code; code format, different indentation styles (such as using spaces, tabs), different code block formats (such as K&R style, Allman style, etc.); code quality: including optimized code, complex code, readable code, etc.

[0046] Exemplarily, code can be extracted from a large open source code repository, which can be GitHub, GitLab, Bitbucket, etc. For example, code repositories from different programming languages ​​are obtained from GitHub through an API interface, such as by searching for tags of a specific language (such as language: Python) or tags of a specific project style (such as good-first-issue).

[0047] You can get code from code snippet websites. For example, LeetCode and HackerRank platforms provide code examples in different styles, including solutions to algorithmic problems. The Rosetta Code website includes code that implements the same algorithms and tasks in different programming languages, which is very suitable for obtaining multi-language and multi-style code.

[0048] You can get code from open source datasets. For example, Google CodeSearchNet Dataset contains code in 6 mainstream programming languages ​​(Python, Java, Go, JavaScript, PHP, Ruby). The Pile Dataset contains a large number of code snippets from multiple languages ​​and open source platforms, including GitHub code repositories. BigCode Project is an open source dataset released by academic institutions that provides code samples in multiple programming languages.

[0049] You can use the GitHub API to search for projects using language tags and keywords and extract code snippets. You can use Scrapy (Python crawler framework) to crawl code from different code snippet websites. You can use CLoc (Count Lines of Code) to analyze code collected from GitHub or other sources and count information such as the number of code lines and language.

[0050] You can use language filtering to ensure that each language has enough code samples (for example, each language has at least thousands of function definition code snippets). You can use style filtering to detect different code styles using formatting tools (such as black for Python and clang-format for C++) and select code that conforms to a specific style. You can use static analysis tools (such as Pylint and ESLint) to check the quality of the code and remove duplicate or invalid code snippets. The quality and diversity of the code is ensured by filtering and processing the acquired code with language filtering, style filtering, and static analysis tools. The filtered and processed code is divided into a test set and a training set.

[0051] The above method can be used to obtain high-quality and diverse codes, providing a basis for subsequent model training and testing.

[0052] In a possible implementation, the function entry feature recognition method based on deep learning also includes:

[0053] S100, obtaining sample data, wherein the sample data includes a function entry code.

[0054] Exemplarily, the method for acquiring sample data is consistent with the method for acquiring the code in step S10, and will not be described in detail here.

[0055] Optionally, S100, obtaining sample data, includes:

[0056] S110, obtaining initial data, wherein the initial data is obtained based on data collected from an open source code library.

[0057] Exemplarily, the method for acquiring code in step S10 may be used to acquire initial data from an open source code library.

[0058] S120, using an automatic marking tool to identify and mark the function entry of the initial data to obtain a first marking result. The automatic marking tool is used to identify the function entry of the initial data and mark the function entry of the initial data in the initial data.

[0059] It is understood that the automated annotation tool can be based on a syntax parser, a deep learning model (such as CodeBERT or other Transformer models), or a programming language analysis tool (such as clang or pycparser) to identify function entries in the code. For example, by analyzing the abstract syntax tree (AST) of the code, the automated tool can find the entry location of each function. A deep learning model, such as CodeBERT, can be used to analyze code snippets based on a pre-trained model and automatically annotate function entries.

[0060] Exemplarily, the automated annotation tool extracts the function definition or function entry in each file by parsing the code file, and the automated tool generates annotations for each function entry in the code. The annotation information may include the function entry name, function entry location (line number), function entry parameters, etc. The output of the automated annotation tool may be a function entry annotation file (or result file) of the initial data, which records all identified function entries. The output format of the automated annotation tool is a certain annotation format, such as JSON, CSV, or comments directly embedded in the code. S130, obtain a second annotation result. The second annotation result is obtained based on manually annotating the function entry of the initial data.

[0061] Exemplarily, a manual annotator can read the code, determine the definition of the function entry, and compare it with the automatic annotation results, manually annotate the location of each function entry, including the function entry name, parameters, return value, etc. The output format of the manual annotation can be consistent with the format of the automatic annotation tool for subsequent merging. Manual annotation can follow consistent rules. For example, the definition of the function entry can include information such as the return value type and parameter type of the function. Manual annotation can also include special functions in the code, such as constructors, destructors, anonymous functions, etc., which is conducive to the correct annotation of function definitions in each language.

[0062] S140: Merge the first annotation result and the second annotation result to obtain sample data.

[0063] Exemplarily, the results of automatic annotation and manual annotation can be checked, and if the annotations of the two are consistent, the results can be directly merged. If there is a conflict between automatic annotation and manual annotation (such as inconsistent annotation positions, missing function entries), manual annotation is preferred because manual annotation is more accurate. The differences between the two can be detected by an automated script, and a conflict report can be generated for further manual inspection and correction. If some function entries are missed by automatic annotation, they can be supplemented by manual annotation, which is conducive to all function definitions being correctly marked. The merged sample data can be saved in a structured format for subsequent model training. For example, the final output annotation file can be a JSON or CSV file, containing a list of function entries for each code file, recording information such as the function name, start and end lines.

[0064] Through the above steps, high-quality and accurate function entry annotations can be provided for the training of the recognition model.

[0065] S200, preprocessing the sample data to obtain a sample feature vector, wherein the sample feature vector is used to train a recognition model, and the sample feature vector is obtained based on extracting vocabulary features of the sample data, extracting grammatical features of the sample data, or extracting context features of the sample data.

[0066] Exemplarily, extracting the vocabulary features of sample data can tokenize the code snippet (sample data) and convert elements such as keywords, symbols, variable names, function names, etc. into discrete tokens. For example, def function_name(): may be segmented into [def, function_name, ()]. ​​Mapping the tokenized tokens to a high-dimensional space, Word2Vec, GloVe, or a specialized code embedding model (such as CodeBERT) can be used for vocabulary vectorization. Through the above method, the vocabulary feature vector of each sample can be obtained.

[0067] To extract the grammatical features of sample data, we can use the abstract syntax tree (AST) to perform syntax parsing and extract the features of the tree structure. By parsing the code into AST, each node represents a grammatical unit (such as function definition, variable, expression, etc.), which can capture the grammatical hierarchy of the code. By converting the nodes of AST into vector form, we can use the type of the node as a feature, or further combine the context information of the node to extract deeper grammatical features. The grammatical features can help the model understand the structure and grammatical patterns of the code.

[0068] It can be understood that context features refer to the position and relationship of the code in the context of code files, classes, modules, etc., and are the dependency information that may be included before and after the function definition.

[0069] For example, extracting context features of sample data can extract the calling relationship between function entry and other functions, which helps the model understand the context of the function. Context features such as module information, class information, and file information of the code can be extracted, and these context information can be encoded to generate vectors.

[0070] Optionally, S200, performing data preprocessing on the sample data to obtain a sample feature vector includes:

[0071] S210, code cleaning is performed on the sample data to obtain first data, wherein the code cleaning is used to remove irrelevant comments and blank lines in the sample data.

[0072] It can be understood that the purpose of cleaning sample data is to remove irrelevant comments and blank lines, making the functional part of the code clearer and making the retained code useful for recognition model training. Blank lines do not have any code content, just to improve code readability. In order to reduce useless data, you can simply remove all blank lines in the sample. Blank lines are lines composed entirely of spaces or tabs, or lines without any characters.

[0073] Exemplarily, the language type and comment rules of the code in the sample data can be determined. For example, Python, single-line comment (#), multi-line comment (using triple quotes """ or '); C / C++ / Java, single-line comment ( / / ), multi-line comment ( / ** / ); JavaScript, single-line comment ( / / ), multi-line comment ( / ** / ). Different languages ​​have different comment styles, and corresponding rules can be used to remove comments for specific languages. Single-line comment removal can remove the content of each line starting with a comment symbol (such as / / or #); multi-line comment removal can remove multi-line comment paragraphs in the code (such as / *...* / or """..."""").

[0074] In order to clean data efficiently, you can use regular expressions or specific code parsing libraries to process comments and blank lines according to the language. You can use regular expressions, which can quickly remove comments and blank lines, match single-line comments (such as # or / / ), match multi-line comments (such as / *...* / or """..."""), and match blank lines (match lines containing only spaces or Tabs). You can use parsing tools. Some programming languages ​​have special syntax parsing tools or libraries. For example, Python can use the ast library to parse Python code and extract functional code; C / C++ can use the clang parser to analyze comments in the code; JavaScript can use the Esprima parser to remove comments. The cleaned data will retain the valid parts of the code, while irrelevant comments and blank lines will be removed, and the output result is the first data. The cleaned code will be more concise and clean, retaining the most functional parts for subsequent processing.

[0075] S220, code segmentation is performed on the first data to obtain second data, and structural feature information corresponding to each segmentation unit in the second data is captured to obtain structural information. The code segmentation is used to segment the first data into a plurality of basic blocks or code lines, the segmentation unit is used to characterize the basic blocks or code lines, and the structural information includes structural feature information corresponding to each segmentation unit in the second data.

[0076] It can be understood that the purpose of code segmentation is to segment the cleaned code (i.e., the first data) into multiple basic blocks or code lines. The segmented code fragments can be more convenient for feature extraction and model training.

[0077] Exemplarily, line segmentation is to treat each line of code as a segmentation unit. The line segmentation method is suitable for processing relatively simple code structures. Each line may represent an instruction, declaration, function call, etc. Basic block segmentation is to divide the code into multiple basic blocks according to the logic block or control flow structure. The basic block refers to a section of code that is executed continuously and is used for control flow analysis. Each basic block contains a sequence of statements without jumps or branches. The basis for segmentation by basic block can include: function level, each function as a basic block; loop and conditional blocks, such as for, while, if and other control flow structures can be used as a basic block; variable declaration block, variable declaration, assignment operation as a separate block; function call block, independent function call as a basic block. Through code segmentation, the second data is generated, which contains multiple segmentation units (basic blocks or code lines), and each segmentation unit will be used as an independent part of subsequent processing.

[0078] It can be understood that structural features are used to describe the syntax and logical structure of the code, which can help the recognition model understand the role and context of each segmentation unit. The structural features may include the syntax type, control flow information, function call information, etc. of each segmentation unit.

[0079] Exemplarily, for each segmentation unit (code block or code line), the captured structural features may include: whether the segmentation unit belongs to a certain control flow structure (such as if, else, while, for, etc.); if it belongs to the control flow structure, it can be marked which part of the branch the segmentation unit is in (such as the conditional part of the if block, the else branch, the main part of the loop).

[0080] The syntax type of the segmentation unit, such as function definition, variable declaration, function call, assignment statement, expression, conditional statement, etc. The syntax type of each statement can be extracted through syntax analysis tools (such as Abstract Syntax Tree (AST)). For example, function definition, def (Python) or function (JavaScript); loop statement, for, while, etc.; function call, such as print(), foo().

[0081] Whether the split unit is in the function body, global scope, or local scope. If the split unit belongs to a function, capture the function's name, parameter list, etc.

[0082] Whether the split unit contains function calls, if so, record the target function name and call location of the function call. Capture function dependencies, such as whether the current code block depends on the output of other blocks.

[0083] It can capture the complexity information of code blocks, such as nesting levels (multiple conditions, nested loops), conditional complexity, etc.

[0084] The structural features of each segmentation unit are saved as structural information, which can be saved in a structured format, such as JSON or a dictionary, for subsequent integration with word vectors.

[0085] S230, word vectorization is performed on the second data to obtain third data, wherein the word vectorization is used to convert each segmentation unit in the second data into a word vector, and the third data includes the word vector corresponding to each segmentation unit.

[0086] Exemplarily, each segmentation unit (basic block or code line) in the code can be tokenized. Tokenization is to split the keywords, variables, operators, etc. in the code into a series of tokens. Each token can be converted into a vector representation using embedding technology (such as CodeBERT or Word2Vec), and the token sequence of each code snippet generates a fixed-length word vector through embedding technology (for example, the vector of the token sequence is reduced to a fixed length through average pooling or maximum pooling). The word vector corresponding to each segmentation unit forms the third data, which is a set of numerical feature vectors that represent the semantic and grammatical information of the code.

[0087] Exemplarily, S230, performing word vectorization on the second data to obtain third data includes:

[0088] S231, extracting code elements in each segmentation unit in the second data to obtain a set of code elements corresponding to each segmentation unit, wherein the code elements in each segmentation unit are used to represent each code line in each basic block or each word in each code line.

[0089] Exemplarily, each segmentation unit (such as a line of code or a basic block) can be tokenized to decompose keywords, variables, operators, etc. in the code into independent code elements. For example, the Python code line return x+1 is decomposed into ['return', 'x', '+', '1']. For some tasks, it may be necessary to view the entire line of code as a whole, rather than decomposing the line of code into more fine-grained words, which can be used in specific task scenarios, such as keeping complex expressions or function calls as they are. The code elements extracted by each segmentation unit are represented as sets or lists.

[0090] S232, combining each code element in the code element set corresponding to each segmentation unit according to the combination rule information corresponding to each segmentation unit to obtain combination data corresponding to each segmentation unit. The combination rule information corresponding to each segmentation unit is used to represent the order of each code line in each basic block or the order of each word in each code line.

[0091] Exemplarily, the code element set in each segmentation unit maintains the word order of the code elements in the code line. For example, if x>0, the combined data after maintaining the order is ['if', 'x', '>', '0']. If segmented by code block (multiple code lines), the order of each code line in the segmentation unit should also be maintained. The combined data generated by each segmentation unit is an ordered sequence of code elements, which is used for the next word vectorization.

[0092] S233, obtaining parameter information of a conversion model, wherein the conversion model is used to convert code lines or basic blocks into word vectors, and the conversion model is a Skip Gram model in Word2Vec.

[0093] It can be understood that the Skip Gram model in Word2Vec trains the model by predicting the context words around the target word. Its core idea is to predict the central word based on the context, which is suitable for processing large-scale corpora. The Skip Gram model is essentially a neural network, which includes an input layer, an input embedding layer, a hidden layer, an output embedding layer, and an output layer. The input embedding layer and the output embedding layer are used to map the input word vector (representation of the central word) and the output word vector (representation of the context word) to a low-dimensional vector space, so that the representation of the vocabulary in the low-dimensional space can capture the semantic and grammatical relevance, and the output layer predicts the probability of other words that may appear around it through the softmax function.

[0094] The parameters of the conversion model may include dimension, the dimension of the word vector (such as 100 dimensions, 200 dimensions, etc.), which indicates the length of the vector of each word after conversion; window size (such as the window size is 5), the window size of the model to capture the context, indicating the surrounding context range of each word; negative sampling number (such as the negative sampling number is 5) during model training. In order to avoid calculating too many irrelevant words, the model will use negative sampling technology to randomly select some non-appearing words as negative samples to enhance training efficiency.

[0095] Exemplarily, the user may input parameter settings of the conversion model through the human-computer interaction window.

[0096] S234, according to the parameter information of the conversion model, the combined data corresponding to each segmentation unit is input into the conversion model, so that the conversion model calculates the word vector corresponding to each code element in the combined data corresponding to each segmentation unit.

[0097] For example, assume that the parameters of the conversion model are that the word vector dimension is 100, the window size is 5, the number of negative samples is 5, and the word sequence is ['if', 'x', '>', '0']. For the combined data in each segmentation unit (such as the word sequence of a code line or a basic block), these word sequences can be input into the Skip Gram model for training. Each word will be used as the input of the model, and the model will generate a word vector based on the word and its context information.

[0098] For each central word (such as if), the model adjusts its vector according to its context words (such as x,>,0) so that in the high-dimensional space, the vectors of the central word and its context words are close. Context prediction and vector adjustment will continue until the model generates a word vector for each word. Through repeated training, the model outputs a high-dimensional vector representation of each word. For example, 'if':[0.21,-0.34,...], 'x':[0.12,0.45,...], '>':[0.98,-0.25,...], '0':[0.67,0.15,...]. The word vector retains the semantic relationship between code elements, and each dimension of the word vector representation represents a certain semantic feature of the word.

[0099] Each word in the combined data corresponding to each segmentation unit is input into the Skip Gram model, and the model generates the corresponding word vector based on the context information of each word. For all words in each segmentation unit, the model will output the corresponding word vector, and the size of the word vector is determined by the vector dimension of the model (such as 100 dimensions). The word vectors of all segmentation units will be output for subsequent integration processing or further analysis.

[0100] S235, integrating the word vectors corresponding to each code element in the combined data corresponding to each segmentation unit to obtain third data.

[0101] For example, different integration methods can be selected according to task requirements. The word vectors of all code elements in each segmentation unit can be averaged using vector averaging to obtain the overall vector representation of the segmentation unit. The word vectors of all code elements in each segmentation unit can be spliced ​​together using vector concatenation to form a high-dimensional vector representation. The final word vector representation of each segmentation unit, the integrated data is the third data, which can be used for subsequent model training or analysis.

[0102] S240: Integrate the third data and the structural information to obtain a sample feature vector.

[0103] For example, the word vector (third data) and the corresponding structural information feature can be spliced ​​into an overall feature vector. The structural information can be directly added to the word vector to form a high-dimensional vector representation. For example, the word vector may be 768-dimensional, the structural information may be 10-dimensional, and the spliced ​​vector will be 778-dimensional.

[0104] Different weights can be assigned to different features according to task requirements. For example, the control flow features in the structural information may be more important for certain tasks (such as function entry identification), so they can be assigned higher weights.

[0105] The integrated vector will be richer, not only containing the syntax and vocabulary information of the code, but also combining the structural features of the code, thus more comprehensively describing each code unit. The final output is a sample feature vector, which can be used to train the recognition model. Each sample feature vector represents a code segmentation unit, combining semantic (word vector) and structural features.

[0106] Through the above steps, high-quality sample feature vectors can be obtained, which can well describe the structure and semantic characteristics of the code and provide strong support for the training of the recognition model.

[0107] S300, obtaining a recognition model based on the sample feature vector; wherein the recognition model is a deep learning Transformer model.

[0108] As you can understand, Transformer is a neural network architecture that is widely used in Natural Language Processing (NLP) tasks. For example, translation, text classification, and question answering. One of the core concepts of Transformer is the self-attention mechanism, which enables the model to consider all positions in the input sequence at the same time, rather than processing them step by step like recurrent neural networks (RNNs) or convolutional neural networks (CNNs). The self-attention mechanism in Transformer is extended to multiple attention heads, each of which can learn different attention weights to better capture different types of relationships. Transformer is composed of multiple identical encoder and decoder layers stacked together. Since Transformer does not have built-in sequence position information, Transformer requires additional position encoding to express the position order of words in the input sequence.

[0109] Exemplarily, the preprocessed sample feature vectors can be input into the recognition model, and the feature vector of each sample represents the vocabulary, syntax or context information of the code snippet. The recognition model parameters are optimized through back propagation and gradient descent algorithms. According to the dimension of the sample feature vector and the data scale, the hyperparameters such as learning rate and batch size are adjusted to gradually let the recognition model learn to identify function entries from the sample feature vector. Use the validation set to evaluate the model performance, adjust the structure and hyperparameters of the model, and evaluate the effect of the model in identifying function entries through indicators such as confusion matrix, accuracy, and recall rate. After training, the recognition model can input new data and accurately identify which code snippets are function entries.

[0110] Optionally, S300, obtaining a recognition model based on the sample feature vector, includes:

[0111] S310, obtaining network parameter information, wherein the network parameter information includes the learning rate of the model, the optimizer of the model, the weight and threshold of the model, and the structural parameters of the model.

[0112] For example, the learning rate determines the step size of the model's weight update in each gradient descent. The learning rate can be a small value, such as 0.001 or 0.0001, and the best value can be selected through hyperparameter tuning. The recommended value of the learning rate is 0.001, but the learning rate scheduler can also be used to dynamically adjust the learning rate.

[0113] The optimizer is used to update the weights of the model so that the model converges as quickly as possible. The optimizer can be Adam, which is an optimization algorithm based on adaptive learning rate. It combines the advantages of Momentum and RMSProp and is used in the Transformer model. You can also choose SGD (Stochastic Gradient Descent), which can accelerate convergence, but the convergence speed may be slow. You can use Adam as the optimizer, and initialize the parameters such as beta1=0.9, beta2=0.999.

[0114] The model weights are parameters that are updated during training and are initialized to small random values. For Transformer models, weights can be randomly initialized using a uniform distribution or a normal distribution. You can also choose to use a pre-trained Transformer model (such as BERT, CodeBERT), directly load the pre-trained weights, and perform fine-tuning.

[0115] The model threshold is used as the decision boundary for binary or multi-classification tasks. For example, for a binary classification task, 0.5 may be used as the classification threshold.

[0116] The model structure parameters may include: the number of attention heads (Number of Attention Heads), which can be 8 or 12 heads, each head can focus on different contexts; the number of Transformer layers (Number of TransformerLayers), which can be set to 6 or 12 layers, and the specific choice is adjusted according to the complexity of the task; the hidden layer dimension (Hidden Size), which can be set to 512 or 768, representing the length of the feature vector at each position; the feed-forward network dimension (Feed-Forward LayerSize), the dimension of the feed-forward layer is 4 times that of the hidden layer. For example, when the hidden layer is 512, the dimension of the feed-forward layer can be set to 2048.

[0117] S320, performing a normalization operation on the sample feature vector to obtain input data.

[0118] It can be understood that the normalization operation converts the sample feature vector to a uniform range (such as [0, 1] or [-1, 1]), which helps to speed up the recognition model training process and prevent the recognition model from being affected by different dimensions of the features.

[0119] For example, Min-Max normalization can be used to scale the data to the range [0,1] for normalization of input data. The Min-Max normalization formula is Z-score standardization can be used to convert data into a distribution with a mean of 0 and a standard deviation of 1. This is suitable for situations where the eigenvalues ​​have large differences in different dimensions. The Z-score standardization formula is The sample feature vector can be subjected to Min-Max normalization or Z-score normalization to generate standardized input data.

[0120] S330: construct an initial recognition model according to the network parameter information.

[0121] Exemplarily, the input layer of the initial recognition model is constructed, that is, the normalized sample feature vector is received and the position information is added (through position encoding). The input is a normalized feature vector, which represents the code snippet of the sample. The input data can be padded or truncated according to its sequence length. Since the Transformer model does not have sequence position information, positional encoding can be added. Positional encoding is a vector that represents the position information of each input feature in the sequence, which is calculated by sine and cosine functions.

[0122] Construct the encoding layer of the initial recognition model. Each layer consists of a multi-head self-attention mechanism and a feedforward neural network. The key part of each layer of the Transformer model is the multi-head self-attention mechanism, which allows the model to focus on different parts of the input sequence at the same time. The input features are transformed linearly to generate query, key and value matrices, and then the similarity of each position to other positions (attention weight) is calculated. Finally, the updated representation of each input position is obtained by weighted summation. For example, the number of attention heads is 8, and the dimension of each attention head is 64 (the total dimension is 512, that is, 8 heads × 64 dimensions). After the self-attention mechanism in each Transformer layer, it is followed by a feedforward neural network, which includes two fully connected layers (with nonlinear activation function ReLU). For example, the hidden layer dimension is 512 or 768, and the feedforward layer dimension is 2048.

[0123] Construct the residual connection and layer normalization of the initial recognition model. After the output of the self-attention mechanism and the feedforward neural network, residual connection (Residual Connection) and layer normalization (Layer Normalization) can be added to facilitate the stability of recognition model training and the effective propagation of gradients.

[0124] Construct the output layer of the initial recognition model. For classification tasks, the output of the Transformer model will pass through a classification layer (a fully connected layer) to generate the final prediction. The size of the output depends on the specific task (such as binary classification or multi-classification).

[0125] S340, based on the input data, perform a model training operation on the initial recognition model to obtain a recognition model.

[0126] Exemplarily, the normalized input data can be input into the Transformer model (initial recognition model), and the input data is processed through each layer of the model, through the multi-head attention mechanism and the feedforward neural network to obtain feature representation, and the cross-entropy loss function (Cross-Entropy Loss) is used to calculate the loss of the model, and the weight of the model is updated by gradient descent (using Adam optimizer), and the model parameters are adjusted to minimize the loss, and forward propagation and back propagation are repeated until the model reaches a predetermined training round (epochs), or the loss converges. During the training process, the learning rate scheduler (such as ReduceLROnPlateau) can be used to dynamically adjust the learning rate to prevent too fast convergence or falling into a local optimal solution. 10 to 100 training rounds can be set, and the size and complexity of the data set can be adjusted. The appropriate batch size (such as 32 or 64) can be selected to balance the training speed and memory usage. After the training is completed, the obtained model is the recognition model, which can perform function entry recognition or other tasks on the new sample feature vector. Inference.

[0127] Exemplarily, S340, based on the input data, performs a model training operation on the initial recognition model to obtain a recognition model, including:

[0128] S341, recognition process: inputting the input data into the initial recognition model so that the initial recognition model recognizes the function entry features in the input data and obtains the output result.

[0129] For example, the normalized sample feature vector can be used as input data and input into the initial recognition model. The initial recognition model (Transformer model) receives the input data and outputs the prediction result by analyzing the structure and context of the input data, such as the classification probability of whether a certain code snippet is a function entry. After being processed by multiple encoding layers and self-attention mechanisms, the output result is generated. The output result includes the function entry feature vector or other related features predicted by the model, which is a probability distribution or classification result.

[0130] S342, error calculation process: Calculate the error between the output result and the expected result to obtain the error result. The expected result includes the function entry feature vectors in the first annotation result and the second annotation result.

[0131] For example, the error calculation measures the accuracy of the model prediction by comparing the model output results with the expected results. The error calculation method can use the cross-entropy loss function (Cross-Entropy Loss), which is used for classification problems and is suitable for multi-classification tasks. The cross-entropy loss function is used to measure the difference between the predicted probability distribution and the actual distribution. The cross-entropy loss formula is Among them, y i is the expected result, is the output result. The mean square error (MSE) can be used for regression tasks to calculate the difference in the function entry feature vector. The mean square error formula is The error result is the difference between the model prediction value and the expected value, which measures the current performance of the model. The error value will be used for subsequent model adjustments.

[0132] S343, judgment process: judging whether the accuracy condition of the initial recognition model meets the termination condition, and obtaining a judgment result. The accuracy condition includes the evaluation index value, and the termination condition includes the preset index value, or the accuracy condition includes the actual number of training times, and the termination condition includes the preset number of training times.

[0133] It can be understood that the accuracy condition is a standard used to measure the performance of the model during the model training process. Evaluation indicators can be used, such as accuracy, the proportion of correctly identified function entries in the prediction results; F1 score, an evaluation indicator that comprehensively considers accuracy and recall; loss value, whether the cross entropy loss or mean square error of the model reaches the expected minimum value. The termination condition is used to determine whether to stop training. The termination condition can include a preset indicator value, which is set manually. If the accuracy, F1 score or loss value of the model reaches a preset threshold (for example, the accuracy exceeds 90%), the training is stopped.

[0134] The accuracy condition can use the actual number of training times to count the actual number of training times of the model. The termination condition can use the preset number of training times. The model training reaches a specified number of epochs, such as 50 or 100 epochs, which can also be used as the termination condition.

[0135] For example, the accuracy condition of the initial recognition model is compared with the termination condition to determine whether to continue training. If the termination condition is met, the model training will stop; otherwise, the next stage of adjustment process will be entered.

[0136] Optionally, in step S343, it is determined whether the accuracy condition of the initial recognition model meets the termination condition, and a determination result is obtained, including:

[0137] S3431, obtain a preset indicator value.

[0138] Exemplarily, the preset index value is a standard for evaluating model performance. According to specific task requirements, the user can input the preset index value he wants to set through the human-computer window. The preset index values ​​may include: Accuracy is used to measure the proportion of correct model predictions, and the preset value of accuracy can be 0.90 (90%); Precision is used to measure the proportion of samples predicted by the model as positive that are actually positive, and the preset value of precision can be 0.85; Recall is used to measure the proportion of positive samples correctly identified by the model among all actual positive samples, and the preset value of recall can be 0.85; F1 value is the harmonic mean of precision and recall, which is used for the evaluation of unbalanced data sets, and the preset value of F1 value can be 0.85.

[0139] S3432: Calculate the evaluation index value of the initial recognition model according to the output result and the expected result, wherein the evaluation index value includes accuracy, precision, recall or F1 value.

[0140] For example, the calculation formula of accuracy is: Among them, TP (True Positive) is predicted to be positive and it is actually positive, TN (True Negative) is predicted to be negative and it is actually negative, FP (False Positive) is predicted to be positive but it is actually negative, and FN (False Negative) is predicted to be negative but it is actually positive. The calculation formula of precision is: The calculation formula of recall is: The calculation formula of F1 value is:

[0141] Assume that the comparison between the model output and the expected result is TP=80, TN=90, FP=10, FN=20; then the accuracy is The accuracy is The recall rate is The F1 value is

[0142] S3433, comparing the evaluation index value of the initial recognition model with the preset index value, determining whether the evaluation index value of the initial recognition model is greater than or equal to the preset index value, and obtaining a determination result.

[0143] For example, the calculated evaluation index values ​​are compared with the preset standard values ​​one by one, accuracy: 0.85 vs preset value 0.90; precision: 0.89 vs preset value 0.85; recall: 0.80 vs preset value 0.85; F1 value: 0.84 vs preset value 0.85. By comparison, it can be judged that the accuracy rate does not reach the preset value (0.85 < 0.90), the accuracy rate exceeds the preset value (0.89 > 0.85), the recall rate does not reach the preset value (0.80 < 0.85), and the F1 value does not reach the preset value (0.84 < 0.85). From the comparison results, it can be seen that some indicators of the model (such as accuracy) have exceeded the preset standard, but other indicators (such as accuracy, recall and F1 value) have not yet reached expectations, so the model has not yet met the termination conditions and needs further training and optimization.

[0144] S344, adjustment process: when the judgment result indicates that the accuracy condition of the initial recognition model does not meet the termination condition, the weight and threshold of the initial recognition model are adjusted according to the error result.

[0145] For example, if the judgment result shows that the model does not meet the accuracy condition, the gradient of the parameters (weights and biases) of each layer is calculated through back propagation through each layer of the model according to the error result. According to the calculated gradient and the settings of the optimizer (such as Adam), the weight of the model is updated. For binary or multi-classification tasks, the classification threshold can be dynamically adjusted according to the performance of the model. For example, if the model has a lot of misclassifications, it may be necessary to adjust the probability threshold of the classification (such as from 0.5 to 0.6).

[0146] Optionally, S344, adjusting the weight and threshold of the initial recognition model according to the error result, includes:

[0147] S3441, according to the error result and the weight and threshold in the network parameter information, calculate the weight error gradient and the threshold error gradient to obtain the error gradient result. The error gradient result includes the weight error gradient and the threshold error gradient.

[0148] It can be understood that the error gradient of the weight is the partial derivative of the model loss function with respect to each weight, indicating the degree of influence of each weight on the model error. The error gradient of the threshold is the partial derivative of the loss function with respect to each threshold, indicating the degree of influence of each threshold on the model error.

[0149] Exemplarily, the error gradient of the model is calculated by backpropagation, and the backpropagation step may include forward propagation, error calculation, and gradient calculation. In step S342, the loss between the output result and the expected result has been calculated, and the loss can be used to calculate the weight error gradient and the threshold error gradient. For each weight ω, the error gradient is the partial derivative of the loss function L with respect to the weight ω, and the weight error gradient calculation formula is For each threshold θ, the error gradient is the partial derivative of the loss function L with respect to the threshold θ. The threshold error gradient calculation formula is: The chain rule can be used to propagate the error of the output layer forward layer by layer, and the gradient of the weight and threshold of each layer can be calculated.

[0150] S3442, calculate the weight update value and the threshold update value according to the error gradient result, the learning rate in the network parameter information, and the weight and threshold in the network parameter information.

[0151] It can be understood that the weight update follows the formula of gradient descent. The learning rate controls the step size of the update. The learning rate (η) determines the amplitude of the weight and threshold update. If the learning rate is too large, the model may skip the optimal solution; if the learning rate is too small, the model converges more slowly.

[0152] Exemplarily, based on the gradient descent algorithm, the weight update value is calculated as Where ΔW is the weight update value, η is the learning rate, is the weight error gradient. The threshold update value calculation formula is Where Δθ is the threshold update value, η is the learning rate, is the threshold error gradient.

[0153] Assume that the weight error gradient Threshold Error Gradient The learning rate η = 0.001, according to the weight update value calculation formula, the weight update value is calculated as According to the threshold update value calculation formula, the threshold update value is calculated as

[0154] S3443, adjusting the weight and threshold of the initial recognition model according to the weight update value and the threshold update value.

[0155] Exemplarily, the new weight of the model is calculated according to the weight update value, and the calculation formula is W new =W old +ΔW, where W new is the new weight, W old is the current weight, and ΔW is the weight update value. The weight of each layer is adjusted according to the calculated new weight, so that the model can be updated in the direction of reducing the error.

[0156] The new threshold of the model is calculated based on the threshold update value, and the calculation formula is θ new =θ old +Δθ, where θ new is the new threshold, θ old is the current threshold, and Δθ is the threshold update value. The threshold is updated according to the error gradient to adjust the threshold of the model's activation function or the threshold of the classification decision.

[0157] The adjustment process can be iteratively performed after each training (each epoch), gradually reducing the error value until the model reaches a preset evaluation metric or termination condition.

[0158] S345, iterating the recognition process, error calculation process, judgment process and adjustment process until the accuracy condition of the initial recognition model reaches the termination condition.

[0159] For example, the recognition process, error calculation process, judgment process and adjustment process are repeatedly iterated, and the model can be trained through multiple epochs. In each iteration, as the weights and thresholds are continuously adjusted, the error of the model is gradually reduced and the accuracy is gradually improved.

[0160] S346, when the judgment result indicates that the accuracy condition of the initial recognition model reaches the termination condition, the initial recognition model is determined as the recognition model.

[0161] Exemplarily, when the judgment result indicates that the accuracy condition of the model reaches the termination condition, the training is stopped. At this point, the error of the model has converged and the performance has reached the preset standard. The trained initial recognition model is determined as the final recognition model, and the recognition model has been iteratively optimized and can accurately identify the function entry features in the input data.

[0162] Through the above steps and multiple iterative training, the model is adjusted to the optimal state, making the recognition model more accurate and precise.

[0163] S20, using the recognition model to identify the function entry of the test set data to obtain a recognition result, wherein the recognition model is a deep learning model, the recognition model is used to identify the function entry, and the recognition result includes a function entry feature vector of the test set data.

[0164] It can be understood that the recognition model can include CodeBERT, which is a model based on BERT, specially designed for code tasks and can process code snippets in multiple programming languages; GraphCodeBERT is similar to CodeBERT, but has enhanced understanding of code structure (such as AST, abstract syntax tree), which is suitable for tasks requiring syntax analysis; PLBART is a model specially designed for code generation and transformation, which is suitable for processing complex programming tasks.

[0165] Exemplarily, the code snippet (test set data) can be converted into a sequence of tokens in the vocabulary. For example, keywords, identifiers, parameters, etc. in the function definition are converted into a sequence of symbols that the recognition model can understand. In the code, the function entry depends on the context of the code (such as comments, variable declarations, class definitions, etc.). Therefore, sufficient contextual information can be retained in the code snippet so that the model can more accurately identify the function entry. The preprocessed code input is converted into a format that the deep learning model can process (such as vectorization).

[0166] A suitable model can be selected to identify function entries. The model performs self-attention calculations on the input code (preprocessed test set data) to capture key features in the code, such as the grammatical patterns of function definitions (such as def, function, return, etc.). Based on the contextual features extracted by the model, a task-specific head is used to output the location of the function entry. The task head is a classifier or sequence tagger that predicts which locations in the code snippet are function entries. For each code segment identified as a function entry, the model generates a corresponding feature vector. The recognition results can include a feature vector for each function entry in the test set data.

[0167] In a possible implementation, S20, using the recognition model to identify the function entry of the test set data to obtain the recognition result includes:

[0168] S21, preprocess the test set data to obtain the test set feature vector.

[0169] Exemplarily, comments and blank lines in the test set can be removed, and the actual code content can be retained. The cleaned code maintains the integrity of the code structure for subsequent segmentation and processing. The code in the cleaned test set is segmented according to basic blocks or code lines. A code block partitioning strategy similar to the sample data can be used, such as each function definition as a basic block, or each statement as a segmentation unit. Extract the code elements in each segmentation unit, for example, extract keywords, variable names, operators, etc. The extracted code element set is used for subsequent feature vectorization. Using the same word vectorization technology as the sample data, the Skip Gram model can be used to generate code word vectors, which is consistent with the processing method of the sample data. The preprocessed test set data will be converted into a test set feature vector, representing the vector representation of each code segmentation unit in the test set.

[0170] S22, inputting the test set feature vector into the recognition model so that the recognition model recognizes the function input feature vector of the test set data to obtain a recognition result.

[0171] For example, the preprocessed test set feature vector can be input into the trained recognition model. The recognition model uses multiple Transformer layers to process the input feature vector, and learns the context information of each segmentation unit through the self-attention mechanism. The feature vector of each segmentation unit is gradually captured and understood by the model through the hierarchical structure of the model. After being processed by the model, the recognition model will output the function entry feature vector in the test set feature vector.

[0172] Through the above steps, the test set data will be processed by the model to obtain the recognition result, and finally the function entry in the code can be accurately identified.

[0173] S30, determining the function entry code of the test set data according to the recognition result.

[0174] It can be understood that the function entry code of the test set data can be determined by clustering methods or by using graph neural networks. The clustering method is to cluster similar function entry feature vectors together, and it can be determined which feature vectors represent the same or similar function entry. Clustering algorithms can include K-Means, DBSCAN, hierarchical clustering, etc. After clustering, the actual code of the function entry can be determined by mapping the clustering results back to the original code.

[0175] Exemplarily, a suitable clustering algorithm can be selected to cluster the function entry feature vectors of the test set data, and the function entry feature vectors with similar structures and semantics will be classified into the same class. Once the clustering is completed, the class where the function entry feature vector belongs will correspond to the function entry of the test set data (code). Therefore, the feature vector in each class can be mapped back to the original code to determine the specific function entry code.

[0176] It can be understood that graph neural networks (GNNs) are suitable for processing dependencies and structural information in code. The feature vector of each function entry can be regarded as a node of the graph, and the dependency of the function (such as function call chain, variable usage) can be regarded as the edge of the graph. Through the propagation mechanism of graph neural networks, richer code structure information can be captured and the location of the function entry can be determined.

[0177] Exemplarily, the graph structure between function entries can be constructed through the call relationship, variable dependency, control flow, etc. in the test set data (code). For example, if function A calls function B, there will be an edge between function A and B. Each function entry feature vector in the test set data (code) can be used as a node in the graph, and the function entry feature vector represents the semantic and structural information of the function entry. In the graph neural network, each node (function entry feature vector) exchanges information with adjacent nodes (i.e., the dependency relationship between functions), and this process is called message passing. Through the message passing mechanism, the node gradually updates its feature vector to capture more complex global information. Multi-layer graph neural networks can gradually incorporate more contextual information into the representation of the node, thereby further enhancing the semantic representation of the feature vector. After several layers of graph propagation, the node (function entry feature vector) will integrate more global information, and by classifying each node feature vector, it can be identified whether the node is a function entry, or nodes with similar features can be aggregated together through clustering methods. After the training is completed, the feature vector of each function entry can be mapped back to the original test set code through the output of the graph neural network to determine the specific location and code of the function entry.

[0178] In a possible implementation, S30, determining the function entry code of the test set data according to the recognition result, includes:

[0179] For example, in the clustering model training process, a suitable clustering algorithm (such as K-means, DBSCAN, etc.) can be selected. K-Means clustering is a commonly used unsupervised learning algorithm, which is used to divide feature vectors into K clusters. The feature vectors in each cluster are close to each other in the vector space. DBSCAN clustering is suitable for processing irregularly shaped data, can automatically detect noise points and outliers, and is suitable for use when the distribution of feature vectors is complex.

[0180] The sample feature vectors corresponding to the sample data are clustered. Each cluster contains a group of similar feature vectors, indicating that the function entry codes corresponding to the feature vectors are similar in some syntax, structure, or semantics. Assuming that the function entry in the sample data has been labeled and the feature vector of each function entry has been extracted, these feature vectors can be used as clustering input. K-means or other clustering algorithms can be used to cluster the feature vectors of the sample data, and the feature vectors in each cluster and their corresponding original codes are stored for subsequent search.

[0181] S31, calculating the distance between the test set feature vector and each cluster center, and determining the cluster family with the shortest distance between the test set feature vector and the cluster center as the target cluster family. The cluster center is used to characterize the center of each cluster family, and the cluster family includes the function entry code in the sample data and the function entry feature vector in the sample data.

[0182] For example, the distance between each feature vector in the test set feature vector and all cluster centers can be calculated to determine which cluster group each test set feature vector is closest to. The distance calculation method may include Euclidean distance, which measures the straight-line distance between two points and is applicable to the distance calculation of feature vectors. The Euclidean distance calculation formula is: Among them, x is the test set feature vector, c i is the i-th cluster center, and n is the dimension of the vector. Cosine Similarity measures the similarity between two vectors by calculating the cosine of the angle between them. The formula for calculating cosine similarity is For each feature vector in the test set feature vector, the cluster family corresponding to the cluster center with the shortest distance is selected according to the calculation result, which is called the target cluster family.

[0183] S32, calculating the similarity between the function entry feature vector of the test set data in the recognition result and the function entry feature vector in each sample data in the target cluster family, and determining the function entry feature vector in the sample data with the greatest similarity as the target function entry feature vector.

[0184] For example, after finding the target cluster family corresponding to the test set feature vector, the similarity between the test set feature vector and the function entry feature vector of each sample data in the target cluster family is calculated. The similarity calculation can use cosine similarity, and the calculation formula is: Among them, x is the function entry feature vector of the test set, and y is the sample function entry feature vector in the target cluster family. The function entry feature vector in the sample data with the largest similarity is selected as the target function entry feature vector.

[0185] S33, extracting the function entry code corresponding to the target function entry feature vector from the target cluster family, and determining the function entry code corresponding to the target function entry feature vector as the function entry code of the test set data.

[0186] Exemplarily, the function entry feature vector of each sample data corresponds to a certain actual function entry code. After determining the target function entry feature vector, the function entry code corresponding to the feature vector can be directly extracted from the sample data. The extracted target function entry code is used as the function entry code of the test set data, and the recognition result is output.

[0187] Through the above steps, clustering methods are used to reduce the search space, and then fine matching is performed within the cluster, which can greatly improve the matching efficiency and accuracy.

[0188] In another possible implementation, S30, determining the function entry code of the test set data according to the recognition result, includes:

[0189] Exemplarily, the graph neural network (GNN) training process: a code graph representation corresponding to the sample data of the labeled function entry can be constructed, for example, the abstract syntax tree (AST) represents the grammatical structure of the code, the control flow graph (CFG) represents the execution flow of the code, and the data flow graph (DFG) represents the flow relationship of data in the code.

[0190] The compiler front end (such as Clang, Python ast module, LLVM and other tools) can be used to convert the code of each function entry into an abstract syntax tree (AST) or other graph structures. The nodes of the graph represent the syntax elements or basic blocks in the code, and the edges represent the relationships between nodes (such as parent-child relationships, dependencies, control flows, data flows, etc.). The feature vector is extracted from the code of each function entry (it can be a feature vector generated by the Transformer model, or it can be generated based on the vocabulary, syntax, complexity and other information of the code). The feature vector can be used as the initial feature of the graph node, representing the high-dimensional feature representation of each node.

[0191] The code graph (such as AST or CFG) in the sample data and the initial features (feature vectors) of each graph node are used as the input of the graph neural network (GNN). GNN learns the mapping relationship between the feature vectors and structural information of the graph nodes to generate code snippets. The loss function can be optimized based on the degree of match between the generated code and the real code. Each layer of GNN updates the representation of each node in the graph by aggregating the feature vectors of each node and its neighboring nodes. After multiple rounds of message passing, GNN generates a global graph embedding that captures the structural information of the entire function. Based on the feature representation of each node or the global graph embedding, GNN gradually generates code snippets and restores the original code of the function entry.

[0192] S301, constructing a graph structure corresponding to the test set data according to the test set data to obtain the test set graph information.

[0193] Exemplarily, each test set data fragment can be represented as a graph structure (Graph), and the graph structure construction method can include an abstract syntax tree (AST), a control flow graph (CFG), and a data flow graph (DFG). The method of constructing the graph structure is consistent with the graph structure construction method of the sample data in the GNN training process. After the graph structure of the test set data is constructed, the generated graph information will contain the characteristics of each node (such as the function entry feature vector) and the connection relationship between the nodes. The test set graph information will be used for subsequent graph neural network processing.

[0194] S302, input the function entry feature vector of the test set data in the recognition result and the test set graph information into the graph neural network, so that the graph neural network predicts the graph node that matches the function entry feature vector of the test set data, and obtains the graph node feature corresponding to the function entry feature vector of the test set data.

[0195] Exemplarily, the function entry feature vector of the test set data and the test set graph information can be input into the graph neural network. Each layer of the graph neural network will aggregate the features of the node with the features of the neighboring nodes and update the feature representation of the node. The feature vector of each node is updated through the information of the neighboring nodes, gradually capturing the global and local relationships in the code snippet. GNN uses a message passing mechanism to aggregate the features of neighboring nodes. After several layers of propagation, the node fuses information from the entire graph. After multiple layers of propagation of the graph neural network, the network can output the features of each graph node and predict the graph node that best matches the input function entry feature vector. Through graph neural network processing, the graph node features that match the input function entry feature vector are obtained. The graph node features represent the position of the corresponding function entry in the graph in the test set.

[0196] S303, using a graph decoder to decode the graph node features corresponding to the function entry feature vector of the test set data to obtain the function entry code of the test set data.

[0197] It can be understood that the task of the graph decoder is to decode the graph node features obtained after GNN processing into actual code fragments, that is, function entry codes.

[0198] Exemplarily, the graph decoder will map the graph node features back to specific code snippets based on the output of the graph neural network (graph node features). The decoder can match the function entry feature vector with code elements (such as function name, parameters, variables, etc.). The result generated by the decoder is a specific code line or code block, representing the corresponding function entry code. After the decoding process of the graph decoder, the function entry code of the test set data is finally generated.

[0199] Through the graph structure mapping method of GNN, the grammatical structure and control flow information of the code can be fully utilized, making the generation of original code from the function entry feature vector more accurate and efficient.

[0200] It should be understood that the size of the serial numbers of the steps in the above embodiments does not mean the order of execution. The execution order of each process should be determined by its function and internal logic, and should not constitute any limitation on the implementation process of the embodiments of the present application.

[0201] Corresponding to the function entry feature recognition method based on deep learning described in the above embodiment, the embodiment of the present application also provides a function entry feature recognition device based on deep learning, and each unit of the device can implement each step of the function entry feature recognition method based on deep learning. Figure 6 A structural block diagram of a function entry feature recognition device based on deep learning provided in an embodiment of the present application is shown. For ease of explanation, only the parts related to the embodiment of the present application are shown.

[0202] Reference Figure 6 , the device comprises:

[0203] The acquisition unit is used to acquire test set data, wherein the test set data includes codes in different programming languages ​​and codes in different styles.

[0204] The recognition unit is used to use the recognition model to recognize the function entry of the test set data to obtain the recognition result. The recognition model is a deep learning Transformer model, the recognition model is used to recognize the function entry, and the recognition result includes the function entry feature vector of the test set data.

[0205] The function entry code obtaining unit is used to determine the function entry code of the test set data according to the recognition result.

[0206] It should be noted that the information interaction, execution process and other contents between the above-mentioned units are based on the same concept as the method embodiment of the present application. Their specific functions and technical effects can be found in the method embodiment part and will not be repeated here.

[0207] The technicians in the relevant field can clearly understand that for the convenience and simplicity of description, only the division of the above-mentioned functional units and modules is used as an example for illustration. In practical applications, the above-mentioned function allocation can be completed by different functional units and modules as needed, that is, the internal structure of the device can be divided into different functional units or modules to complete all or part of the functions described above. The functional units and modules in the embodiment can be integrated in a processing unit, or each unit can exist physically separately, or two or more units can be integrated in one unit. The above-mentioned integrated unit can be implemented in the form of hardware or in the form of software functional units. In addition, the specific names of the functional units and modules are only for the convenience of distinguishing each other, and are not used to limit the scope of protection of this application. The specific working process of the units and modules in the above-mentioned device can refer to the corresponding process in the aforementioned method embodiment, which will not be repeated here.

[0208] The present application also provides a function entry feature recognition device based on deep learning. Figure 7 This is a schematic diagram of the structure of a function entry feature recognition device based on deep learning provided in one embodiment of the present application. Figure 7 As shown, the function entry feature recognition device 6 based on deep learning in this embodiment includes: at least one processor 60 ( Figure 7 Only one is shown), at least one memory 61 ( Figure 7 Only one is shown) and a computer program 62 stored in the at least one memory 61 and executable on the at least one processor 60. When the processor 60 executes the computer program 62, the deep learning-based function entry feature recognition device 6 implements the steps in any of the above-mentioned deep learning-based function entry feature recognition method embodiments, or the deep learning-based function entry feature recognition device 6 implements the functions of each unit in the above-mentioned device embodiments.

[0209] Exemplarily, the computer program 62 may be divided into one or more modules / units, which are stored in the memory 61 and executed by the processor 60 to complete the present application. The one or more modules / units may be a series of computer program instruction segments capable of completing specific functions, which are used to describe the execution process of the computer program 62 in the deep learning-based function entry feature recognition device 6.

[0210] The function entry feature recognition device 6 based on deep learning can be a computing device such as a desktop computer, a notebook, a PDA, and a cloud server. The function entry feature recognition device based on deep learning can include, but is not limited to, a processor 60 and a memory 61. Those skilled in the art can understand that Figure 7It is only an example of the function entry feature recognition device 6 based on deep learning, and does not constitute a limitation of the function entry feature recognition device 6 based on deep learning. It may include more or fewer components than shown in the figure, or a combination of certain components, or different components, for example, it may also include input and output devices, network access devices, buses, etc.

[0211] The processor 60 may be a central processing unit (CPU), or other general-purpose processors, digital signal processors (DSP), application-specific integrated circuits (ASIC), field-programmable gate arrays (FPGA) or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components, etc. A general-purpose processor may be a microprocessor or any conventional processor, etc.

[0212] In some embodiments, the memory 61 may be an internal storage unit of the function entry feature recognition device 6 based on deep learning, such as a hard disk or memory of the function entry feature recognition device 6 based on deep learning. In other embodiments, the memory 61 may also be an external storage device of the function entry feature recognition device 6 based on deep learning, such as a plug-in hard disk, a smart memory card (Smart Media Card, SMC), a secure digital (Secure Digital, SD) card, a flash card (Flash Card), etc. equipped on the function entry feature recognition device 6 based on deep learning. Further, the memory 61 may also include both the internal storage unit of the function entry feature recognition device 6 based on deep learning and an external storage device. The memory 61 is used to store an operating system, an application program, a boot loader (BootLoader), data, and other programs, such as the program code of the computer program, etc. The memory 61 may also be used to temporarily store data that has been output or is to be output.

[0213] An embodiment of the present application further provides a computer-readable storage medium, wherein the computer-readable storage medium stores a computer program, and when the computer program is executed by a processor, the steps in any of the above method embodiments are implemented.

[0214] An embodiment of the present application provides a computer program product. When the computer program product runs on a function entry feature recognition device based on deep learning, the function entry feature recognition device based on deep learning implements the steps in any of the above-mentioned method embodiments.

[0215] If the integrated unit is implemented in the form of a software functional unit and sold or used as an independent product, it can be stored in a computer-readable storage medium. Based on this understanding, the present application implements all or part of the processes in the above-mentioned embodiment method, which can be completed by instructing the relevant hardware through a computer program, and the computer program can be stored in a computer-readable storage medium, and the computer program can implement the steps of the above-mentioned various method embodiments when executed by the processor. Among them, the computer program includes computer program code, and the computer program code can be in source code form, object code form, executable file or some intermediate form. The computer-readable medium may at least include: any entity or device capable of carrying the computer program code to a function entry feature recognition device based on deep learning, a recording medium, a computer memory, a read-only memory (ROM, Read-Only Memory), a random access memory (RAM, Random Access Memory), an electric carrier signal, a telecommunication signal, and a software distribution medium. For example, a USB flash drive, a mobile hard disk, a magnetic disk or an optical disk. In some jurisdictions, according to legislation and patent practice, computer-readable media cannot be electric carrier signals and telecommunication signals.

[0216] In the above embodiments, the description of each embodiment has its own emphasis. For parts that are not described or recorded in detail in a certain embodiment, reference can be made to the relevant descriptions of other embodiments.

[0217] Those of ordinary skill in the art will appreciate that the units and algorithm steps of each example described in conjunction with the embodiments disclosed herein can be implemented in electronic hardware, or a combination of computer software and electronic hardware. Whether these functions are performed in hardware or software depends on the specific application and design constraints of the technical solution. Professional and technical personnel can use different methods to implement the described functions for each specific application, but such implementation should not be considered to be beyond the scope of this application.

[0218] In the embodiments provided in the present application, it should be understood that the disclosed function entry feature recognition apparatus, equipment and method based on deep learning can be implemented in other ways. For example, the above-described function entry feature recognition apparatus and device embodiments based on deep learning are merely schematic. For example, the division of the modules or units is only a logical function division. There may be other division methods in actual implementation. For example, multiple units or components can be combined or integrated into another system, or some features can be ignored or not executed. Another point is that the mutual coupling or direct coupling or communication connection shown or discussed can be an indirect coupling or communication connection through some interfaces, devices or units, which can be electrical, mechanical or other forms.

[0219] The units described as separate components may or may not be physically separated, and the components shown as units may or may not be physical units, that is, they may be located in one place or distributed on multiple network units. Some or all of the units may be selected according to actual needs to achieve the purpose of the solution of this embodiment.

[0220] The embodiments described above are only used to illustrate the technical solutions of the present application, rather than to limit them. Although the present application has been described in detail with reference to the aforementioned embodiments, a person skilled in the art should understand that the technical solutions described in the aforementioned embodiments may still be modified, or some of the technical features may be replaced by equivalents. Such modifications or replacements do not deviate the essence of the corresponding technical solutions from the spirit and scope of the technical solutions of the embodiments of the present application, and should all be included in the protection scope of the present application.

Claims

1. A method for identifying function entry features based on deep learning, characterized in that: include: Acquire test set data; wherein the test set data includes codes in different programming languages ​​and codes in different styles; Using a recognition model to identify the function entry of the test set data, and obtaining a recognition result; wherein the recognition model is a deep learning model, the recognition model is used to identify the function entry, and the recognition result includes a function entry feature vector of the test set data; According to the recognition result, the function entry code of the test set data is determined.

2. The method for identifying function entry features based on deep learning according to claim 1, characterized in that: The method further comprises: Acquire sample data; wherein the sample data includes a function entry code; Performing data preprocessing on the sample data to obtain a sample feature vector; wherein the sample feature vector is used to train the recognition model, and the sample feature vector is obtained based on extracting lexical features of the sample data, extracting grammatical features of the sample data, or extracting context features of the sample data; Based on the sample feature vector, the recognition model is obtained; wherein the recognition model is a deep learning Transformer model; The obtaining of sample data comprises: Acquire initial data; wherein the initial data is obtained based on collecting data from an open source code library; Using an automated annotation tool to identify and annotate the function entry of the initial data to obtain a first annotation result; wherein the automated annotation tool is used to identify the function entry of the initial data and annotate the function entry of the initial data in the initial data; Obtain a second annotation result; wherein the second annotation result is obtained based on manually annotating the function entry of the initial data; The first labeling result and the second labeling result are combined to obtain the sample data.

3. The method for identifying function entry features based on deep learning as claimed in claim 2, characterized in that: The step of performing data preprocessing on the sample data to obtain a sample feature vector includes: Performing code cleaning on the sample data to obtain first data; wherein the code cleaning is used to remove irrelevant comments and blank lines in the sample data; Perform code segmentation on the first data to obtain second data, and capture structural feature information corresponding to each segmentation unit in the second data to obtain structural information; wherein the code segmentation is used to segment the first data into multiple basic blocks or code lines, the segmentation unit is used to represent the basic blocks or code lines, and the structural information includes structural feature information corresponding to each segmentation unit in the second data; Performing word vectorization on the second data to obtain third data; wherein the word vectorization is used to convert each segmentation unit in the second data into a word vector, and the third data includes the word vector corresponding to each segmentation unit; Integrate the third data and the structural information to obtain the sample feature vector; The performing word vectorization on the second data to obtain third data includes: Extracting code elements in each segmentation unit in the second data to obtain a set of code elements corresponding to each segmentation unit; wherein the code elements in each segmentation unit are used to represent each code line in each basic block or each word in each code line; According to the combination rule information corresponding to each segmentation unit, each code element in the code element set corresponding to each segmentation unit is combined to obtain the combination data corresponding to each segmentation unit; wherein the combination rule information corresponding to each segmentation unit is used to represent the order of each code line in each basic block or the order of each word in each code line; Obtain parameter information of a conversion model; wherein the conversion model is used to convert code lines or basic blocks into word vectors, and the conversion model is a Skip Gram model in Word2Vec; According to the parameter information of the conversion model, the combined data corresponding to each segmentation unit is input into the conversion model, so that the conversion model calculates the word vector corresponding to each code element in the combined data corresponding to each segmentation unit; The word vectors corresponding to each code element in the combined data corresponding to each segmentation unit are integrated to obtain the third data.

4. The method for identifying function entry features based on deep learning according to claim 3, characterized in that: The obtaining of the recognition model based on the sample feature vector comprises: Acquire network parameter information; wherein the network parameter information includes a learning rate of the model, an optimizer of the model, a weight and threshold of the model, and a structural parameter of the model; Performing a normalization operation on the sample feature vector to obtain input data; Constructing an initial recognition model according to the network parameter information; Based on the input data, a model training operation is performed on the initial recognition model to obtain the recognition model.

5. The method for identifying function entry features based on deep learning as claimed in claim 4, characterized in that: The performing a model training operation on the initial recognition model based on the input data to obtain the recognition model comprises: Recognition process: inputting the input data into the initial recognition model so that the initial recognition model recognizes the function entry features in the input data and obtains an output result; Error calculation process: calculating the error between the output result and the expected result to obtain an error result; wherein the expected result includes the function entry feature vectors in the first annotation result and the second annotation result; Judgment process: judging whether the accuracy condition of the initial recognition model meets the termination condition, and obtaining a judgment result; wherein the accuracy condition includes an evaluation index value, and the termination condition includes a preset index value, or the accuracy condition includes an actual number of training times, and the termination condition includes a preset number of training times; Adjustment process: when the judgment result indicates that the accuracy condition of the initial recognition model does not meet the termination condition, the weight and threshold of the initial recognition model are adjusted according to the error result; Iterating the recognition process, the error calculation process, the judgment process and the adjustment process until the accuracy condition of the initial recognition model reaches the termination condition; When the judgment result indicates that the accuracy condition of the initial recognition model reaches the termination condition, determining the initial recognition model as the recognition model; The step of determining whether the accuracy condition of the initial recognition model meets the termination condition and obtaining a determination result includes: Obtaining the preset indicator value; Calculate the evaluation index value of the initial recognition model according to the output result and the expected result; wherein the evaluation index value includes accuracy, precision, recall rate or F1 value; Comparing the evaluation index value of the initial recognition model with the preset index value, determining whether the evaluation index value of the initial recognition model is greater than or equal to the preset index value, and obtaining the determination result; The step of adjusting the weight and threshold of the initial recognition model according to the error result includes: According to the error result and the weight and threshold in the network parameter information, a weight error gradient and a threshold error gradient are calculated to obtain an error gradient result; wherein the error gradient result includes the weight error gradient and the threshold error gradient; Calculate a weight update value and a threshold update value according to the error gradient result, the learning rate in the network parameter information, and the weight and threshold in the network parameter information; The weight and threshold of the initial recognition model are adjusted according to the weight update value and the threshold update value.

6. The method for identifying function entry features based on deep learning as claimed in claim 5, characterized in that: The step of using the recognition model to identify the function entry of the test set data to obtain a recognition result includes: Performing data preprocessing on the test set data to obtain a test set feature vector; The test set feature vector is input into the recognition model so that the recognition model recognizes the function input feature vector of the test set data to obtain a recognition result.

7. The method for identifying function entry features based on deep learning according to claim 6, characterized in that: Determining the function entry code of the test set data according to the recognition result includes: Calculating the distance between the test set feature vector and each cluster center, and determining the cluster group with the shortest distance between the test set feature vector and the cluster center as the target cluster group; wherein the cluster center is used to characterize the center of each cluster group, and the cluster group includes the function entry code in the sample data and the function entry feature vector in the sample data; Calculate the similarity between the function entry feature vector of the test set data in the recognition result and the function entry feature vector in each of the sample data in the target cluster, and determine the function entry feature vector in the sample data with the greatest similarity as the target function entry feature vector; A function entry code corresponding to the target function entry feature vector is extracted from the target cluster family, and the function entry code corresponding to the target function entry feature vector is determined as the function entry code of the test set data.

8. The method for identifying function entry features based on deep learning according to claim 6, characterized in that: Determining the function entry code of the test set data according to the recognition result includes: According to the test set data, a graph structure corresponding to the test set data is constructed to obtain test set graph information; Inputting the function entry feature vector of the test set data in the recognition result and the test set graph information into a graph neural network, so that the graph neural network predicts a graph node that matches the function entry feature vector of the test set data, and obtains graph node features corresponding to the function entry feature vector of the test set data; A graph decoder is used to decode the graph node features corresponding to the function entry feature vector of the test set data to obtain the function entry code of the test set data.

9. A function entry feature recognition device based on deep learning, characterized in that: include: An acquisition unit, used to acquire test set data; wherein the test set data includes codes in different programming languages ​​and codes in different styles; An identification unit, used to identify the function entry of the test set data using a recognition model to obtain a recognition result; wherein the recognition model is a deep learning Transformer model, the recognition model is used to identify the function entry, and the recognition result includes a function entry feature vector of the test set data; The function entry code obtaining unit is used to determine the function entry code of the test set data according to the recognition result.

10. A function entry feature recognition device based on deep learning, comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, characterized in that: When the processor executes the computer program, the method according to any one of claims 1 to 8 is implemented.