Malicious code author identification and code infringement detection method based on multi-feature fusion
Through a multi-feature fusion architecture, combined with crawler technology and Tree-LSTM network, the problem of identifying the author and distinguishing originality and infringement in malicious code detection is solved, achieving accurate identification of malicious code authors and infringement detection, improving detection accuracy and efficiency.
Patent Information
- Application Number
- CN202410452888.6
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-04-16
- Publication Date
- 2024-09-27
AI Technical Summary
Existing malicious code detection technology is difficult to accurately identify the true identity of the malicious code author and distinguish original code from infringing code, especially when faced with complex and concealed malicious code, and code sharing and reuse increase the difficulty of distinguishing legitimate references from infringing uses. difficulty.
Using a multi-feature fusion method, through in-depth analysis of wording features, typography features and syntactic features, combined with Python crawler technology, Selenium simulation browser, IVF-PQ algorithm and Tree-LSTM network, a multi-modal feature fusion architecture is constructed to achieve Accurate identification of malicious code authors and code infringement detection.
It achieves effective traceability and code infringement detection of malicious code authors, improves the accuracy and efficiency of detection, adapts to large-scale query needs, and updates the database in real time to adapt to code style changes.
Smart Images

Figure FT_10 
Figure FT_2 
Figure FT_9
Abstract
Description
Technical Field
[0001] The present invention relates to the field of cyberspace security technology, and in particular to a method for malicious code author identification and code infringement detection based on multi-feature fusion, which achieves accurate tracing of malicious code and intellectual property protection by integrating multimodal feature fusion technology. Background Art
[0002] With the rapid development and widespread application of information technology, cyberspace security has become one of the focuses of global attention. In recent years, the writing and dissemination of malicious code has shown the characteristics of diversification, concealment and complexity, which not only seriously threatens personal privacy, corporate data and even the security of national critical infrastructure, but also the plagiarism, plagiarism and illegal tampering of malicious code have caused many intellectual property disputes. Traditional malicious code detection technology often focuses on single-dimensional feature analysis, but in the face of increasingly cunning malicious code authors, it is often difficult to accurately identify their true identity based on a single feature, and it is even more impossible to efficiently distinguish between original code and infringing code.
[0003] At the same time, with the popularization and development of open source culture, code sharing and reuse are becoming more and more common, which to a certain extent increases the difficulty of distinguishing between legitimate citations and infringing uses. Existing malicious code detection methods have limitations in identifying the unique coding habits of individual malicious code authors, identifying the similarities between code fragments, and determining whether the code infringes on the intellectual property rights of others.
[0004] Therefore, there is an urgent need for a technical solution that can integrate multiple types of features to achieve deep mining and accurate identification of malicious code authors, and at the same time, an efficient infringement detection mechanism is needed, so as to effectively curb the spread of malicious code while effectively protecting the intellectual property rights of software developers from infringement. It is in this context that the present invention proposes a method for malicious code author identification and code infringement detection based on multimodal feature fusion, which integrates advanced artificial intelligence and machine learning technologies to conduct a comprehensive and multi-angle analysis of malicious code, and strives to achieve breakthrough progress in the fields of network security protection and intellectual property protection. Summary of the invention
[0005] In view of the above problems, the present invention aims to provide a method for identifying malicious code authors and detecting code infringement based on multi-feature fusion, which adopts a unique multi-feature fusion classification architecture to improve the performance of the detection method and the accuracy of the detection method. It can also be successfully applied to unknown samples. The technical solution is as follows:
[0006] A method for identifying malicious code authors and detecting code infringement based on multi-feature fusion includes the following steps:
[0007] S1: Data collection, processing and annotation: Using Python crawler technology, we bypassed the anti-crawling mechanism of Codeforces by building a proxy IP pool and using Selenium to simulate a real browser. At the same time, we simulated user login on AtCoder and Niuke.com to obtain API interface permissions, thereby capturing and integrating the compiled active user code submission records from the three platforms as the experimental data set.
[0008] S2: Code feature extraction and feature fusion: To identify the code author, we systematically conduct in-depth analysis and extraction from three dimensions: word features, typesetting features, and syntactic features. In the process of word feature extraction, we first perform word segmentation according to various programming specifications, including but not limited to dividing identifiers based on camel case naming and snake case naming, and use fixed-length substring extraction when necessary to take into account vocabulary statistics and typesetting preferences, such as the use of spaces and line breaks; at the same time, we count the frequency of keywords, and use the tf-idf algorithm to calculate the importance of rare identifier naming, as well as the frequency of comments. In the extraction of typesetting features, we identify and distinguish between reused modules (i.e. "wheels") and uniquely written parts in the code, use hash values to compare the similarity of reused modules, and perform line code length statistics on uniquely written parts. We also explore the author's consistent indentation style and blank line usage habits by detecting absolute and relative indentation rules. As for syntactic features, we use the abstract syntax tree (AST) to build and structure recursive neural network (RvNN) technology, especially the improved long short-term memory network (LSTM) technology and the child-sum tree-LSTM architecture based on subtree output and suitable for tree structure, to recursively capture and transform the hierarchical structure and grammatical connections of the code to form a robust syntactic feature representation. Finally, we use feature fusion technologies such as bilinear pooling to efficiently integrate the extracted multi-features together to provide a high-quality input feature set for the subsequent code author identification model.
[0009] S3: Database query: In a database built with user-encoded feature vectors, we face the problem of predicting the top k possible authors of each code segment based on k-nearest neighbor query. To solve the problem of efficient search of high-dimensional data, we applied approximate nearest neighbor search technology, and especially introduced the IVF-PQ algorithm, which combines clustering and quantization strategies to improve search speed and maintain a certain accuracy: first, the data set is divided by clustering and the nprobe value is set to reduce the search range, and then the vectors within each cluster are quantized in blocks with the help of PQ technology to achieve efficient storage and retrieval; in response to the dynamic insertion requirements of the database, we proposed an optimized IVF-PQ maintenance scheme, that is, when inserting new user features, only necessary clustering and quantization updates are made, and re-clustering is performed to avoid algorithm performance degradation when the number of cluster points exceeds the limit; at the same time, we also designed a heuristic method, by generating unit vectors in hyperspace and maintaining the projection value sorting in the red-black tree, using multi-tree query to merge the results and sort and remove duplicates to obtain approximate nearest neighbor output.
[0010] S11: Implement data crawling by writing Python web crawler code to crawl submission records of websites such as codeforces, atcoder, and Niuke, including the use of proxy IP pools and Selenium to deal with anti-crawler mechanisms.
[0011] S12: Process the collected code dataset and manually annotate the code of the same author.
[0012] S21: Code word feature extraction: We will use word segmentation to extract identifiers in the code and filter out identifiers of keywords or commonly used functions. Then, we can segment each word and further process it according to the naming standards and conventions of the code. At the same time, we can also extract features such as the frequency of keywords and whether comments are used.
[0013] S22: Code layout feature extraction: We can count the usage preferences of spaces, tabs, and line breaks in the code, and analyze information such as the location of braces and tags and indentation style. By identifying the layout features of the code, we can analyze the style and habits of the code author.
[0014] S23: Code syntactic feature extraction: We can construct the abstract syntax tree (AST) of the code to analyze the grammatical structure and organization of the code. Then, we can use algorithms such as the Child-sumTree-LSTM to extract the syntactic features of the code and calculate the statistical features such as the frequency and depth of the leaf nodes.
[0015] S24: Feature fusion: Through fusion methods such as the bilinear pooling algorithm, we can integrate and reduce the dimension of different feature information to obtain more comprehensive and accurate code features. This can help us better understand and distinguish the coding styles and habits of different code authors.
[0016] S31: Database establishment: A database is established based on the feature vector of each user.
[0017] S32: Compare and select the appropriate approximate nearest neighbor search algorithm according to the specific situation, and use the IVF-PQ algorithm to divide the data set into multiple subsets and quantify them.
[0018] S33: Maintain the database during dynamic insertion to facilitate modification and query at any time.
[0019] Compared with the prior art, the present invention has the following beneficial effects:
[0020] (1) This invention proposes a complete set of malicious code author identification and code infringement detection methods, which can effectively trace the malicious code author and effectively detect code infringement. Using this method, we have established a database for the feature vector of each user. In this way, we can query more codes more efficiently and expand the database at the same time.
[0021] (2) The present invention is not limited to calculating the similarity between two codes at a time. When used on a large scale, it turns to an approximate k-nearest neighbor query algorithm, which can better adapt to large-scale queries compared with other widely used code author identification and code infringement detection methods.
[0022] (3) The present invention is not limited to one feature of the code. We have extracted multiple features of the code, such as word usage features, typesetting features, and syntactic features. At the same time, during pooling and fusion, each feature is given a certain weight after importance evaluation, which makes the query more accurate and scientific.
[0023] (4) The Tree-LSTM network is used as a model and trained. It has greater advantages in dealing with long-term dependency tasks. Compared with other widely used code author identification and code infringement detection methods, it performs better in all model evaluation indicators.
[0024] (5) Taking the timeliness issue into consideration, a scheduled web crawler is used to update the vector database in real time and quickly, adapting to the user's code style in a timely manner. BRIEF DESCRIPTION OF THE DRAWINGS
[0025] Figure 1 The overall architecture of the model.
[0026] Figure 2Syntax tree structure.
[0027] Figure 3 The structure of a unit in an RNN.
[0028] Figure 4 The structure of a unit in LSTM.
[0029] Figure 5 Recurrent neural networks can combine past outputs with current inputs, but tend to ignore long-term dependencies.
[0030] Figure 6 The structure of BiLSTM.
[0031] Figure 7 Child-sum_Tree-LSTM structure.
[0032] Figure 8 MCB algorithm based on Count Sketch and FFT.
[0033] Fig. 9 ROC curve based on the best results of each model in the feature ablation experiment.
[0034] Fig.10 Evaluation values of each model in the feature ablation experiment, such as accuracy, F1, and AUC of the ROC curve. Fig.11 The AUC value of each model during the learning process of the ablation experiment and the maximum value of the Youden J statistical index (J = TPR-FPR) at each point on the ROC curve.
[0035] Fig.12 ROC curves of each model drawn based on the experimental results of three feature extraction algorithms.
[0036] Fig.13 The final comparison bar chart of various evaluation values such as F1 under the best number of training rounds for each model in the comparative experiment.
[0037] Fig.14 A table drawn based on the specific values of the final experimental results of each model in the comparative experiment. Specific implementation methods
[0039] The following is combined with Figure 1 The present invention is further described in detail with specific examples.
[0040] 1. Detection device
[0041] The present invention proposes a relatively complete malicious code author identification and code infringement detection device based on multi-feature fusion. The device first extracts features from the code file, and the feature extraction includes three parts: code word feature extraction, code typesetting feature extraction, and code syntax feature extraction. Then, the feature fusion feature is performed using a bilinear pooling algorithm to obtain a feature vector of the code. After that, the author query and infringement detection can be performed by searching in the database using an approximate nearest neighbor search algorithm.
[0042] 1.1 Data acquisition and data processing
[0043] In order to obtain a data set for the evaluation of the effect of this project, this project will use Python web crawlers to crawl code data sets containing author information on the Internet. We will select several well-known online evaluation systems for algorithm competition questions in China and abroad - Codeforces, AtCoder, and Niuke.com as the main platforms to obtain experimental data sets. Among them, Codeforces has an anti-crawler mechanism, which will block frequent access from the same IP with verification codes when the website traffic is large. Therefore, when crawling Codeforces, we need to collect and purchase a certain amount of proxy IPs to form a proxy IP pool for rotation, and use Selenium to disguise as a real browser for crawling, and avoid the competition period when crawling regularly to improve the efficiency and success rate of crawling. Platforms such as AtCoder and Niuke.com have strict authentication mechanisms, and their submission record lists or details require login to access, so we will register users and use crawlers to simulate login. Then we request the API of these websites according to their API documents to obtain some recently active users, the competition data of each user, the submission list, and the detailed code of each submission (we only keep the compiled code).
[0044] Brief description of code features
[0045] Code features are divided into lexical features, layout features, and syntactical features, which represent the statistical features of the naming of each identifier or keyword in the code, the code author's preference for using spaces, tabs, and line breaks, and the structural features of the syntax tree.
[0046] Our research involves two fields: algorithm competition and project design. The code features are different. For example, in the field of algorithm competition, the efficiency of code writing needs to be improved as much as possible. Usually, identifiers are given short and non-standard names for convenience. Some contestants also try not to use spaces and line breaks for convenience, unless the IDE has a formatting function. In view of this situation, we plan to collect project data sets online after crawling the algorithm competition code data to ensure the comprehensiveness of the data set.
[0047] 1.2 Code word feature extraction and feature fusion
[0048] This project intends to use the following methods to measure the word characteristics of the code
[0049] (1) Extraction of word importance features:
[0050] In the first step, we have several options to experiment with, one of which is word segmentation. We first treat all symbols that cannot be used as identifiers as spaces in the original text and scan the document to extract identifiers between spaces (i.e., names of variables, functions, macros, etc.).
[0051] Then we individually filter out keywords or identifiers of commonly used functions and containers in the standard library, segment each word, and then perform downstream operations.
[0052] We can segment words according to the naming conventions of the code. Different programming languages and projects may have different naming conventions, but generally follow the following common naming conventions: CamelCase, which uses a mixed case format to distinguish each word, and no spaces or connectors are used between words. CamelCase is divided into UpperCamelCase and LowerCamelCase according to whether the first letter is capitalized. Snake_case, also known as the underscore method, uses all lowercase letters, and words are connected with underscores "_". Hungarian notation, a variable naming rule in programming, indicates the type or attribute of the variable by adding some lowercase letters as prefixes to the variable name (such as i for integers and fn for functions).
[0053] Since identifiers are named according to these naming conventions in scenarios with strict code standards, word segmentation is usually easy to perform. We can use the following methods to perform word segmentation at the same time (that is, we will separate a word when we encounter one of the following methods): we can perform word segmentation by underscore to consider the case of snake case; we can perform word segmentation before capital letters to consider camel case. Since most modern IDEs have the function of checking variable types, Hungarian notation is not commonly used by ordinary programmers, so it is not considered.
[0054] Another method of extracting code word information while taking into account the characteristics of code typesetting is to select an appropriate k and extract all substrings (also known as subsegments, i.e., strings of several consecutive characters in the code) of length k in the text to count the number of occurrences of each string. If the length is selected appropriately when extracting substrings, it will be possible to simultaneously extract the author's preferred typesetting features such as whether there is a line break before the curly brace and whether there is a space between each symbol. For example, when we extract a substring of length 4, when writing a C++ language program, if the author is accustomed to not adding a space between for and the following left bracket, "for(" will appear more frequently. If the author prefers to add a space at this time, "or(" and "for" will appear more frequently. And because the source of some of our test data sets - the code written in the field of algorithm competitions needs to be very fast, when the IDE used does not have the function of automatic identifier completion, the author usually names the identifier in an irregular manner for convenience, and usually does not appear with complete words and word segmentation marks, so word segmentation will be difficult to achieve at this time. Therefore, the word segmentation step can be omitted or substring extraction can be used to extract code word information.
[0055] Since the strings extracted by the second algorithm are mostly meaningless, we do not need to care about their specific content, so we calculate the hash value after extracting the words to speed up our calculation. Since the algorithm will become very slow when the substring extraction data set is large, we use Rolling Hash (also known as Rabin-Karp algorithm) to speed up our algorithm again.
[0056] Since these word features are very sensitive even for the code written by the same person for different problems, we need to reduce the impact of these features on the judgment results. Therefore, we need to scale these dimensions down. We can instead calculate the logarithm of the above dimensions of the feature vector, which can achieve better results.
[0057] We need to count the frequency of each keyword in the identifier segmentation. Since the frequency of keywords such as for is more important in code author identification than the naming of general identifiers with greater variables, we consider them separately and occupy several dimensions in the feature vector.
[0058] For words such as identifier names, they only appear in a very small part of the code, so we can use the tf-idf algorithm to better calculate the degree of distinction of these words to the code; but for keywords, they appear in almost every code, so it does not make much sense to calculate the idf value in the tf-idf algorithm for them. Therefore, in order to speed up the calculation, the frequency of these keywords is directly calculated as a feature here.
[0059] Since code authors have preferences for whether to write comments, comment frequency is also a part of feature extraction. In large projects, the code is long and usually requires comments. Therefore, large projects contain a large number of comments, which means that when the data set and query data are large enough, it is also possible to extract the comments and then pass them into the natural language author identification model.
[0060] (2) Code layout feature extraction:
[0061] When writing code, in order to avoid writing code from scratch, reduce repetitive work and low-level mistakes made when writing large amounts of code, and make the code more standardized, code writers usually package and test some common, extensible, and highly compatible codes (commonly known as "wheels", the term will be used below) in advance, and directly transplant and reuse them every time a project that requires the algorithm is written. We can divide the code into wheels and parts that are rewritten each time it is written (hereinafter referred to as "non-wheels"). Since wheels may use code written by others or code written by the author a long time ago, the code style is also different from the part written by oneself.
[0062] To speed up the judgment, for the code of a single source file, all structures, classes, and the content before the first structure or function in the code are directly regarded as wheels. If the project consists of many source files, we use the feature of the file system to retain the file modification date, set a modification time threshold, and regard the files modified before the threshold minus the latest modified file as wheels.
[0063] After identifying the wheel part, we will remove the whitespace and comments and calculate the hash value to quickly determine whether multiple codes use the same wheel. For the non-wheel part, that is, the part that each code needs to write that is unique to the code that solves other problems, we will calculate the average length of each line of code, the standard deviation of the line length, and other statistical data. For the non-wheel part, since its code style is time-sensitive and can well reflect the author's recent code style, its feature extraction will be detailed below.
[0064] Due to statistical laws, data such as averages and frequencies tend to be stable as the number of lines of code in the dataset of the same author increases. Therefore, these features are relatively stable for the same author and are less affected by code length and different titles.
[0065] In addition, we can also identify the author of the code by the indentation style. Specifically, we scan the entire code and count the number of consecutive spaces and tabs after each line break, which is called the absolute indentation of the line in this article; if one line has only one character added to the suffix of the previous line, the added character is called the relative indentation of the line. Since the same person usually uses only one IDE for code, and its indentation style is usually the same, we first check whether the absolute indentation of two adjacent lines has a common prefix, and calculate whether the relative indentation of all lines is unified, and record whether the indentation used by the user is unified in a separate dimension of the feature vector; if not, we use the relative indentation with the largest proportion (whether to use spaces or tabs, and the frequency of use) as the indentation style feature of the user. In addition, some indentation styles also specify the position and indentation of braces and labels, so we separately process the left brace, right brace, whether there is a line break before and after the label, and its relative indentation relative to the previous statement as features.
[0066] However, it should be noted that there are very few common indentation styles, which have little impact on the accuracy of author recognition. Therefore, in order to maximize the efficiency of this project, this project used the above-mentioned algorithm that does not require prior learning and has a time complexity linear to the input data size to perform text scanning when extracting features related to the indentation style, instead of using methods in the field of deep learning.
[0067] In addition, executing the above algorithm will only consider the line breaks before and after braces and tags, but not the line breaks in other places in the code. Some authors prefer to add blank lines (lines containing only whitespace characters) before and after a sub-block of code that is isolated, complete, and can be a separate paragraph in the code, even if these codes are in the middle of the same block of statements marked by braces. Therefore, we also need to count the frequency of blank lines in the code.
[0068] In addition, there are many other code formatting features. We can refer to the code standard system of well-known Internet companies, or the documentation of code formatting software to obtain them.
[0069] (3) Code syntax feature extraction:
[0070] Abstract Syntax Tree (AST) is an abstraction for program source code. It omits information irrelevant to program functions, such as whitespace characters and comments in the program source code, and only represents the structure and function of the program source code in a tree-like data structure. It is widely used in computer science in the fields of compilers, interpreter preprocessing, and static code analysis.
[0071] The syntax tree represents the structure of the program by parsing the source code into a hierarchical structure of a series of grammatical units (such as statements, expressions, declarations, etc.). Each node has a type and attributes to represent different grammatical units in the code, such as variables, functions, operators, etc., to reflect the grammatical structure and semantics in the source code, and the relationship between the nodes describes the hierarchical relationship and interaction between them. The compiler or interpreter converts the source code into executable machine instructions or execution results by traversing and operating the syntax tree. In addition, the syntax tree can also be used for code analysis.
[0072] The structure of the syntax tree is as follows Figure 2 shown.
[0073] Since the syntax tree ignores some layout features on the surface of the code (such as the number of whitespace characters), it is highly robust to code style formatting, information loss after code compilation to generate binary files, and most code obfuscation software. Therefore, when code authors occasionally use the code style formatting function of the IDE or use code obfuscation software, identifying code authors based on the syntax tree still has a good effect.
[0074] It is not necessary to use machine learning algorithms to construct a syntax tree. You can directly scan the source code once to find out the node and depth of each bracket in advance, and then scan it again to recursively construct it. The algorithm has linear time complexity. You can also extract some simple features from the syntax tree with linear time complexity without using machine learning algorithms, such as the frequency, maximum depth, average depth, and standard deviation of the depth of all leaf nodes in the syntax tree, as well as the frequency, maximum depth, average depth, and standard deviation of the depth of various types of leaves, the average and standard deviation of the length of each node in the source code, and the average number and standard deviation of function parameters corresponding to nodes of function definition type, and other statistical data.
[0075] However, in order to improve the accuracy of code author identification, we will use algorithms in the field of machine learning to complete the vectorization and feature extraction of syntax trees. The following is an introduction to the relevant algorithms.
[0076] Recurrent Neural Network (RNN) is an artificial neural network model with a special structure that allows information to be transmitted cyclically in the network. The key to this network structure is that its hidden layer nodes can store and process previous inputs, allowing the network to have memory and time dependency. The recurrent neural network dynamically updates the parameters in the network by combining the current input with the hidden state of the previous time step in each time step. Its structure is as follows Figure 3As shown. The advantage of recurrent neural networks over convolutional neural networks (CNNs) is that recurrent neural networks can process input sequences of arbitrary length, and the network size does not change with the length of the input sequence. However, convolutional neural networks can only process input sequences of fixed length.
[0077] On the other hand, a recursive neural network (sometimes referred to as RvNN) is a generalization of a recurrent neural network that uses a tree structure to organize data. A recursive neural network can pass information to a node through all its child nodes, and gradually build a representation of the entire tree structure from the child nodes. Since an ordered tree can be used to simulate any recursive one-to-many structure (sometimes called a recursive tree), compared to traditional sequence processing models, a recursive neural network naturally has the ability to process data with a tree structure. A typical recursive neural network model is the Tree-LSTM mentioned below.
[0078] Any recursive neural network can be used to vectorize the abstract syntax tree, but many recursive neural networks have some problems (see below). Therefore, we need to improve our algorithm.
[0079] Long Short-Term Memory (LSTM) network is a special type of recurrent neural network that performs better than ordinary time recurrent neural networks in processing sequence data with long-term dependencies. In 2013, LSTM achieved a record of 17.7% error rate in autonomous speech recognition using the TIMIT natural speech database. Google has used LSTM in Google Voice's speech recognition function since 2015 and almost halved the error rate. Since 2016, Google Translate has begun using LSTM, which has reduced its error rate by 60% and increased translation speed. In addition, companies such as Apple, Microsoft, Amazon and some Chinese companies are also using LSTM.
[0080] Each unit of LSTM is Figure 4 As shown in the figure, the biggest feature is its gating mechanism, including input gate, forget gate and output gate. These gating units can selectively control the flow of information, thereby effectively handling long-term dependencies and performing well in solving traditional RNN gradient vanishing and gradient exploding problems. The details are as follows:
[0081] The gating mechanism of LSTM can effectively capture and retain key time series information, allowing it to better handle tasks with long-term dependencies, such as language models, audio processing, and natural language processing. For example, in the sentence "Since LSTM can handle long-term dependencies and has a certain memory capacity for sequence data, it works well in time series prediction tasks, such as weather forecasting...", the "it" near the end of the sentence refers to the "LSTM" at the beginning of the sentence. There may be a long text in the middle that does not mention it. At this time, the impact of the features introduced by "LSTM" in the traditional RNN has been weakened by the units in the middle, so it may not be possible to establish a connection between "LSTM" and "it" (such as Figure 5 As shown), it is not as good as LSTM.
[0082] LSTM can better control the flow of gradients through the gating mechanism, thereby alleviating these problems. In contrast, when the traditional RNN uses the chain rule to calculate the gradient during back-propagation training, it may easily suffer from the problem of gradient vanishing or gradient exploding when multiplying a large number of gradients less than 1 or a large number of gradients greater than 1.
[0083] Based on the above advantages, LSTM has broad application prospects in time series prediction and language models in natural language processing, speech recognition, audio processing, and machine translation.
[0084] There are many variants of LSTM, such as the Bidirectional Long Short-Term Memory (BiLSTM) network, a variant of the LSTM recurrent neural network that combines forward and reverse information flows. It can simultaneously utilize past and future contextual information to more comprehensively understand and model sequence data.
[0085] Compared with traditional LSTM, the data of bidirectional LSTM propagates in both the forward and backward directions. By running two layers of LSTM at each time step, a forward LSTM and a backward LSTM (such as Figure 6 ) to capture the forward and reverse context information. The forward LSTM processes the information from the start position of the sequence to the current position, while the reverse LSTM processes the information from the end position of the sequence to the current position. Finally, the outputs of the two directions are fused (the fusion methods include summation, averaging, concatenation, etc.) to form a comprehensive context representation of the current position.
[0086] Through the combination of forward and reverse LSTM, the bidirectional LSTM can not only understand the contextual information of the current and past positions, but also accurately utilize the information of the future positions, making it more predictive at any time in the sequence, more fully understand and model sequence data, and more fully capture long-term dependencies when modeling sequence data. Therefore, it has important applications in the fields of sequence labeling, machine translation, speech recognition, and natural language generation, providing more powerful modeling, feature extraction, and prediction capabilities. For example, the following defined sentences are usually in the form of concept + "is" + explanation. When the concept exists in different fields but contains the same name, the forward unidirectional LSTM alone will not know how to explain the concept, while the bidirectional LSTM can know from the explanation in the following text.
[0087] For example, the sentences "neural networks are mathematical models used to estimate or approximate functions" and "neural networks are composed of interconnected, functionally related neurons" represent two interpretations of "neural networks". The forward-only unidirectional LSTM will not know which field the "neural network" is in because it does not know the future context, while the bidirectional LSTM will have different outputs for the two "neural networks".
[0088] LSTM can also be extended to the recursive case, sometimes called Tree-LSTM. Figure 7 The method is briefly described below.
[0089] When the Tree-LSTM propagates forward, each node needs the output of all its sons, so we need to traverse the entire tree in some order from leaf to root, such as depth first search (DFS, the method is that if a node has sons that have not been traversed, its corresponding subtree is recursively traversed, and the next son is traversed after the subtree of a son is traversed, and backtracking is performed after all sons are traversed) when backtracking, or in the reverse order of DFS order.
[0090] It is easy to find that when we visit a node in either of the two orders, all nodes in its subtree have been output. In implementation, the return value of our traversal algorithm can be the hidden layer (output) of the unit of the subtree corresponding to the passed node, so when we are about to backtrack, we already know the unit output of the subtree corresponding to all the sons of a point and pass it to the unit corresponding to the current node for calculation.
[0091] When considering the calculation of a unit, we abstract the relationship between each node and all its sons for easy processing.
[0092] The feature vector corresponding to the current node is used as the input value of the current unit; the output of each child node is independently built with a forget gate and merged at the memory unit, and the sum of the output vectors of each child hidden layer is passed through other gates.
[0093] The pseudo code is as follows:
[0094]
[0095] In addition, during implementation, the node traversal order (also known as DFS order) is usually preprocessed as the logical node processing order, thereby avoiding the large time overhead caused by explicitly calling DFS after each input to the model.
[0096] Child-sum Tree-LSTM cannot preserve the order of child nodes. Therefore, if the order of child nodes is an important feature, you must use N-ary Tree-LSTM or use the order of child nodes as input features. This project uses the latter.
[0097] When processing the syntax tree to obtain the feature information of each node, due to its high dimension, the vector formed by concatenating its feature information should be embedded in a low-dimensional representation using a dimensionality reduction algorithm, and then the code structure information such as its depth on the syntax tree should be integrated to obtain the feature vector of the input current unit.
[0098] Now that we have implemented the Tree-LSTM neural network, we will start training it.
[0099] During training, in order to measure and minimize the error of the model output, we need a loss function. When used to calculate code similarity, it is more appropriate to use the cosine similarity loss function. When the code author is the same, we hope that the cosine similarity is as large as possible, otherwise we hope that the cosine similarity is as small as possible. The calculation method is as follows:
[0100]
[0101] All values smaller than margin will be truncated.
[0102] Finally, we use the back-propagation (BP for short, which refers to the back propagation of errors) algorithm to train our neural network.
[0103] The training dataset we input is part of the dataset collected and normalized on the online evaluation system of each algorithm competition topic in Section 2.1. Each piece of data has its author label, which is then converted into a label vector. The dimension of this vector is the number of users in the training set. The dimension value corresponding to the author is 1, and the other dimensions are 0, that is, one-hot representation. After we initialize the network parameters such as weights and biases, we start to iterate the BP algorithm. Each iteration includes:
[0104] Forward propagation: The process of forward propagation is unfolded through time. First, the first time step of the input sequence is input into the neural network. Then, at each time step, the output of the current time step can be obtained by calculating the state and weight of the current time step. At the same time, at each time step, the loss value is calculated based on the output of the network and the target output. The loss function we choose here is the cosine similarity loss function. This output will be passed to the next time step as input, and the process is repeated until the last time step of the sequence is reached and its output result is read out.
[0105] Back propagation: The loss value is propagated forward from the output layer to each time step through the back propagation algorithm. Back propagation will calculate the gradient value to update the weights and bias terms so that the network parameters can be adjusted in the next training iteration. The chain rule is generally used to calculate the gradient of the loss function for the network parameters, but in general RNNs, it may cause gradient vanishing or gradient exploding problems, so we use Tree-LSTM in this project to reduce the possibility of such problems.
[0106] Parameter update: Use the gradient descent algorithm or its variants to update the network parameters according to the calculated gradient. This step controls the step size of the parameter update by pre-selecting an appropriate learning rate (also known as the training factor, the rate at which the gradient is amplified when updating the network parameters).
[0107] Finally, the network stops when it reaches convergence conditions or the number of iterations is manually set.
[0108] (4) Feature Fusion
[0109] If we directly concatenate the feature vectors output by each part, the dimension will be too large to be acceptable. Therefore, we use a feature fusion algorithm, which is equivalent to reducing the dimension of the concatenated result of the feature vectors.
[0110] Since a single feature vector may not be able to fully capture the diversity and complexity of the data set, it is necessary to fuse two or more features. After we get our output data, we will select and use a pooling algorithm such as the bilinear pooling algorithm to implement multimodal feature pooling fusion. In some literature, modality refers to information obtained by different media, while in other literature it refers to the features of the same data calculated from the perspectives of different fields. This article adopts the latter definition.
[0111] Bilinear Pooling is a method for feature fusion, which is often used in computer vision tasks, natural language processing and other fields. The so-called bilinear is the calculation of the element-by-element product of vectors. Therefore, bilinear pooling combines the information of two different feature vectors by performing element-by-element product operations and summarizing the results. However, the dimension of the element-by-element product of two feature vectors is the product of the dimensions of the two vectors, which is often unacceptable. Here we first use the Count Sketch mapping function for each feature function, and then use the fast Fourier transform (FFT) to find its convolution. The pseudo code is as follows Figure 8 shown.
[0112] For the case where there are 3 or more eigenvectors, each vector can be multiplied by a certain weight, the first two eigenvectors can be fused, and the result can be fused with the third vector, and so on.
[0113] 1.3 Database Query
[0114] After finding the feature vector of each user, we built a database. Our query is to find the top k possible authors of each code, which is abstracted into a mathematical model called k-nearest neighbor (kNN) query
[0115] Approximate Nearest Neighbor Search is a technique for efficiently searching for approximate nearest neighbor data points in high-dimensional data. This technique is very useful in various scenarios, such as image retrieval, audio processing, natural language processing, and recommendation systems. Approximate nearest neighbor search makes a trade-off between accuracy and efficiency, sacrificing the accuracy of the algorithm in exchange for space and time savings. By adjusting the parameters of the algorithm, a suitable compromise between accuracy and search speed can be found to meet application requirements.
[0116] The IVF-PQ (Inverted File System with Product Quantization) algorithm is a commonly used method. The algorithm divides the data set into multiple cluster centers and assigns each data point to the most similar cluster center, ignoring the distant clusters to improve search efficiency while ensuring high accuracy. Specifically, the IVF-PQ algorithm consists of two main steps.
[0117] The first step is clustering. First, select some data points as cluster centers and calculate the similarity of all data points to the cluster centers. Then, assign each data point to the cluster center that is most similar to it. This process divides the data set into multiple subsets, each containing the data points that are most similar to the corresponding cluster center. When querying, pre-setting the nprobe value means that only the clusters closest to the first nprobe are searched and the others are ignored.
[0118] The second step is quantization. Quantization can be understood as vector dimensionality reduction. For each subset, the data points are quantized into a set of short codewords using the ProductQuantization (PQ) technique. In simple terms, PQ divides the data points in each subset into several small subspaces and clusters the subspaces separately. Then, for each data point, it is assigned to the most similar cluster center in each subspace to obtain the codeword representation.
[0119] By dividing the data set into multiple subsets and quantizing them, the IVF-PQ algorithm can search only some data points when querying, thereby speeding up the search. The specific process is to first find the most similar codeword based on the query vector, and only search the subset containing the codeword. Then, for each subset, further sorting and searching are performed based on the similarity between the query vector and each codeword, and finally an approximate top k nearest neighbor result is obtained. At this time, a larger k is generally taken and the distance is calculated using a naive algorithm to re-sort the results and take the top several.
[0120] However, users are constantly inserted into the actual database. We proposed the following algorithm to maintain the clustering of the IVF-PQ algorithm: First, the insertion will be made once in the IVF part and once in the PQ part, and the center of the cluster in the IVF part will change. Therefore, the residual-based IVF-PQ algorithm will cause the residuals of the points in the entire cluster in the IVF algorithm to need to be updated, and the time complexity is too high. And the residual is taken to improve the accuracy. Here we will take a larger k and sort the results to alleviate the problems caused by accuracy. Therefore, we directly use IVF-PQ based on the original vector. At this time, only the IVF part and the PQ part have the operations of querying the nearest cluster center, inserting, and recalculating the cluster center once. In addition, as more and more points are inserted, the number of points in one cluster may be too large or the boundary between two adjacent clusters may not be obvious, resulting in poor performance of the algorithm. Therefore, if this happens, we will add a new point when the number of points in a cluster is greater than (t is a selected threshold, here we take 2), extract the points in this cluster and its adjacent clusters, re-run the clustering algorithm, and modify the clusters where these points are located to the newly calculated clusters.
[0121] In addition, we have proposed several other heuristic algorithms that support dynamic insertion and maintenance of the database. For example, we can select a threshold k (100 in this project), randomly generate k unit vectors in the entire hyperspace, and then use vector dot multiplication to find the directed length of the projection of each vector in the database on the unit vector for these k unit vectors, and then use red-black trees (supporting dynamic insertion and fast neighbor search) to maintain the order of these directed lengths. When querying, we also calculate the k projections of the query vector and query the k red-black trees for the vectors that are close to the top 4 of the directed length of its projection. After merging the results, we use a naive algorithm to sort and remove duplicates as the result of the ANN.
[0122] Afterwards, we will experiment with our proposed algorithm and common algorithms one by one and compare their effects.
[0123] 2. Model effect evaluation
[0124] In our model, a neural network is used. During training, the loss function can be used to evaluate the inconsistency between the model prediction and the actual result. Cosine similarity can be used here to calculate the loss function and as a marker to measure the similarity of the input code when evaluating the model.
[0125] From this, we can compare the similarity with a threshold to get the final judgment result of the model (i.e., whether the authors of the code are the same or different), and measure the model effect on multiple sets of inputs. We use accuracy (ACC) to evaluate. Accuracy refers to the proportion of correctly classified samples to the total number of input samples. Therefore, when we train the algorithm, we draw the loss function and the accuracy change function graph (loss curve, ACC curve) as the number of training rounds increases, and finally determine the round with the lowest loss and the highest ACC. If the effect is not ideal, it is generally because some pre-selected hyperparameters before training are not selected properly.
[0126] 3. Experiment and result analysis
[0127] The following is an introduction to the dataset and basic settings used, followed by our experimental results.
[0128] 3.1 Dataset
[0129] We used a code dataset that we crawled using a Python-written crawler from online evaluation websites for algorithm competition questions such as codeforces, atcoder, and Niuke.
[0130] After that, we use Python to write a script to divide the dataset into a training dataset and a validation dataset. In the code author identification experiment, the author sets of the training dataset and the validation dataset must be different, but in the code similarity experiment, the author sets of the training dataset and the validation dataset can be different.
[0131] Since it is inefficient to directly use the code to train and evaluate the model, we preprocess the code to produce syntax trees and node feature vectors so that the preprocessed values can be reused in multiple rounds of training the same model.
[0132] 3.2 Experimental Setup
[0133] This experiment uses Nvidia GTX 4060 11GB GPU for model training and reasoning. The main programming language environment of the experiment is Python 3.10.11, and the operating system version used is Windows 11.
[0134] 3.3 Experimental Results Evaluation
[0135] We used the accuracy, precision, recall, F1 value, ROC curve and its AUC (area under the curve), and the maximum value of the Youden index J = TPR-FPR to evaluate the model. We used feature ablation experiments to evaluate the effect of our model.
[0136] Accuracy refers to the ratio of the number of samples correctly classified by the classifier to the total number of samples. Accuracy is one of the most intuitive evaluation indicators, but it may be problematic in the case of unbalanced data sets or skewed categories.
[0137] Precision refers to the ratio of the number of samples correctly identified as positive examples by the classifier to the number of samples identified as positive examples by the classifier. Precision measures the accuracy of the classifier's determination of positive examples.
[0138] Recall refers to the ratio of the number of samples correctly identified as positive examples by the classifier to the number of true positive examples. Recall measures the coverage of the classifier for positive examples.
[0139] The F1 value is the harmonic mean of precision and recall, and is an indicator that comprehensively considers precision and recall. The F1 value can be used to comprehensively evaluate the prediction performance of a classifier on different categories.
[0140] The ROC curve (Receiver Operating Characteristic Curve) is a curve that measures the performance of a binary classifier at different thresholds. The ROC curve represents the relationship between TPR (True Positive Rate) and FPR (False Positive Rate), and can be used to describe the performance of a classifier. TPR is also known as recall rate, hit rate, and sensitivity. TPR = TP / (TP+FN), which is the vertical axis; and FPR is the ratio of negative samples (FP) that are incorrectly marked as positive examples to all negative samples (FP+TN), which is the horizontal axis. The ROC curve can provide the performance changes of the classifier at different thresholds.
[0141] AUC (Area Under the Curve) is the area under the ROC curve, which is often used to measure the performance of a classifier. The value of AUC ranges from 0 to 1, and the larger the value, the better the performance of the classifier. A perfect classifier has an AUC of 1, while a random classifier has an AUC of 0.5.
[0142] The strategy of optimizing the performance of the classifier can be to select the threshold corresponding to the point with the largest Youden index J as the adjusted optimal threshold. Since we want the true positive rate to be as large as possible and the false positive rate to be as small as possible, by finding the point with the largest (TPR-FPR), we can find the best performance point of the classifier under different thresholds. This maximum point can help select the most appropriate threshold to balance the detection ability and error rate of the classifier, thereby evaluating the optimal performance of the model.
[0143] 3.4 Code Similarity Experiment and Feature Ablation Experiment
[0144] Feature ablation experiment is a method used to evaluate the effect of a model. It evaluates the influence of features on the model by gradually removing different features from the model input and observing the changes in model performance. This method can help us understand the degree of dependence of the model on different features and provide important guidance for feature selection, model optimization or model interpretation.
[0145] The general steps for conducting a feature ablation experiment are as follows:
[0146] Determine the model to be evaluated: Select an already trained model as the evaluation object.
[0147] Define baseline performance: Before performing feature ablation experiments, you should first determine the baseline performance of the model on the full feature set. This can be used as a baseline for comparison to evaluate the impact of feature ablation on model performance.
[0148] Gradually remove features: Gradually remove features from the model input, which can be done according to different strategies, such as in descending order of feature importance, or randomly select features to be removed in turn. After each feature is removed, re-evaluate the performance of the model.
[0149] Evaluate performance changes: For each feature ablation, record the performance indicators of the model on the test set, such as accuracy, precision, recall, and F1 value, and adjust the threshold to obtain the ROC curve, its AUC, etc. By comparing the performance changes under each feature ablation, you can understand the contribution of different features to the model performance.
[0150] Analyze results and adjust the model: Based on the results of the feature ablation experiment, analyze the impact of features on model performance and adjust the model as needed, such as reselecting features, adjusting model structure or parameters, to improve model performance or interpretability.
[0151] Feature ablation experiments can help us better understand the model, thereby guiding us in feature selection and model optimization, and improving the performance and interpretability of the model.
[0152] Specifically, in this experiment, the number of categories (the number of code authors in the dataset) is 8. We proposed and implemented three feature extractors, and changed several hyperparameters of Child-sum Tree-LSTM and the features used to conduct feature ablation experiments. Among them, No. 0 uses a similarity algorithm based on the frequency vector of the hash value of the code substring, No. 3 uses the code style feature, and the rest use the Tree-LSTM model; in the model No. 1, we regard several features such as node depth as numerical features and directly use their numerical values, while other LSTM models regard them as categorical features and convert them into scaled one-hot encoding vectors and concatenate them, and try to remove each feature separately and conduct ablation experiments: In the experiments No. 4, 5, and 6, the node depth, the hash value of the concatenated subtree token, and the node type number are removed independently, and the subnode order feature is removed in the experiments No. 7 and 8; the number of model layers in the experiment No. 7 is different from that of other models, with only 1 layer.
[0153] The experimental training effect is as follows Figures 9-11 .
[0154] 3.5 Code Similarity Experiment and Model Comparison Experiment
[0155] In addition, we also used model comparison experiments. The general steps for conducting model comparison experiments are as follows:
[0156] Determine the evaluation indicators: Select appropriate performance indicators to measure the model effect, using accuracy, precision, recall, F1 value, etc. According to the task requirements and data characteristics, select appropriate indicators to accurately measure the model performance.
[0157] Data preparation: Select a suitable data set, preprocess and divide it to ensure the quality and consistency of the data. The data set is usually divided into training set, validation set and test set. The training set is used for model training, the validation set is used to adjust hyperparameters and select models, and the test set is used for final model evaluation.
[0158] Model selection: Based on the task requirements and available models, select a group of representative models for comparison. You can choose models with different algorithms, or models with different architectures or hyperparameter settings of the same algorithm.
[0159] Model training and validation: Use the same training set and validation set to train each model and adjust the hyperparameters. Use cross-validation, grid search and other techniques to select the best hyperparameter combination to optimize model performance.
[0160] Model evaluation: Use the test set to evaluate the trained model, calculate and compare the performance of the model on the evaluation indicators, observe the differences between different models, and determine the optimal model.
[0161] Statistical analysis: Use statistical methods to obtain evaluation indicators, compare and analyze the performance of different models, and determine whether there are significant differences.
[0162] Result interpretation: Based on the experimental results, explain and analyze the performance of each model on different evaluation indicators, determine the best model, and further explore methods to improve the model, such as feature selection, model fusion, etc.
[0163] In this experiment, the number of categories (the number of code authors in the dataset) is 25. Numbers 0 to 3 have the same meaning as the corresponding numbered models in the feature ablation experiment, but the number of LSTM layers is increased to 6.
[0164] The experimental results are as follows Figures 12-14 .
[0165] 3.6 Experimental Results Analysis
[0166] From the experimental results, we can see that among the three feature extractors we proposed and implemented, since the algorithm based on code style features uses one-hot encoding, the cosine similarity distribution is relatively discrete, resulting in a broken line ROC curve; when the number of categories (the number of code authors in the data set) is small (8), the similarity detection model based on Child-sum Tree-LSTM performs better, and the model based on tree shape features without using subtree hash value features performs better than other models, and the Tree-LSTM model that treats several features as numerical features performs better; when the number of categories is large; although the AUC and other indicators of the similarity algorithm based on the code substring hash value frequency vector have slightly decreased, the performance of the Tree-LSTM model that treats several features as numerical features has dropped sharply. Therefore, the algorithm we proposed uses Child-sumTree-LSTM and the statistical feature vector of the code substring hash value to fuse as the feature vector of the code.
[0167] 4 References
[0168] The following are the relevant literature retrieved.
[0169] [1]Kai Sheng Tai et al. Improved Semantic Representations From Tree-Structured Long Short-Term Memory Networks[J / OL].arXiv:1503.00075,2015-2-28.
[0170] [2]David M.W.Powers.Visualization of Tradeoff in Evaluation:fromPrecision-Recall&PN to LIFT,ROC&BIRD[J / OL].arXiv:1505.00401,2015-5-3。
Claims
1. A method for identifying malicious code authors and detecting code infringement based on multi-feature fusion, characterized in that: The following steps are involved: S1: Data collection, processing and annotation: Using Python crawler technology, we bypassed the anti-crawling mechanism of Codeforces by building a proxy IP pool and using Selenium to simulate a real browser. At the same time, we simulated user login on AtCoder and Niuke.com to obtain API interface permissions, thereby capturing and integrating the compiled active user code submission records from the three platforms as the experimental data set. S2: Code feature extraction and feature fusion: To address the problem of identifying code authors, we systematically conduct in-depth analysis and extraction from three dimensions: word usage features, typesetting features, and syntactic features. In the process of word usage feature extraction, we first perform word segmentation in accordance with various programming specifications, including but not limited to dividing identifiers based on principles such as camel case naming and snake case naming, and use fixed-length substring extraction when necessary to take into account vocabulary statistics and typesetting preferences, such as the use of spaces and line breaks; at the same time, we count the frequency of keywords, and use the tf-idf algorithm to calculate the importance of rare identifier naming, as well as consider the frequency of comments. In terms of typesetting feature extraction, we identify and distinguish reused modules in the code (i.e. "Wheels") and uniquely written parts, using hash values to compare the similarity of reused modules, while performing statistical analysis on the line length of uniquely written parts, and exploring the author's consistent indentation style and blank line usage habits by detecting absolute and relative indentation rules. As for syntactic features, we use the abstract syntax tree (AST) to build and structure recursive neural network (RvNN) technology, especially the improved long short-term memory network (LSTM) and the child-sum tree-LSTM architecture based on subtree output, to recursively capture and transform the hierarchical structure and grammatical connections of the code to form a robust syntactic feature representation. Finally, we use feature fusion techniques such as bilinear pooling to efficiently integrate the extracted multi-features together to provide a high-quality input feature set for the subsequent code author identification model. S3: Database query: In a database built with user-encoded feature vectors, we face the problem of predicting the top k possible authors of each code segment based on k-nearest neighbor query. To solve the problem of efficient search of high-dimensional data, we applied approximate nearest neighbor search technology, and especially introduced the IVF-PQ algorithm, which combines clustering and quantization strategies to improve search speed and maintain a certain accuracy: first, the data set is divided by clustering and the nprobe value is set to reduce the search range, and then the vectors within each cluster are quantized in blocks with the help of PQ technology to achieve efficient storage and retrieval; in response to the dynamic insertion requirements of the database, we proposed an optimized IVF-PQ maintenance scheme, that is, when inserting new user features, only necessary clustering and quantization updates are made, and re-clustering is performed to avoid algorithm performance degradation when the number of cluster points exceeds the limit; at the same time, we also designed a heuristic method, by generating unit vectors in hyperspace and maintaining the projection value sorting in the red-black tree, using multi-tree query to merge the results and sort and remove duplicates to obtain approximate nearest neighbor output.
2. According to claim 1, a method for identifying malicious code authors and detecting code infringement based on multi-feature fusion, characterized in that: The specific process of step S1 is as follows: S11: Implement data crawling by writing Python web crawler code to crawl submission records of websites such as codeforces, atcoder, and Niuke, including the use of proxy IP pools and Selenium to deal with anti-crawler mechanisms. S12: Process the collected code dataset and manually annotate the code of the same author.
3. According to claim 1, a method for identifying malicious code authors and detecting code infringement based on multi-feature fusion, characterized in that: The specific process of step S2 is as follows: S21: Word feature extraction: We will use word segmentation to extract identifiers in the code and filter out identifiers of keywords or commonly used functions. Then, we can segment each word and further process it according to the naming standards and conventions of the code. At the same time, we can also extract the frequency features of keywords and whether comments are used. S22: Code layout feature extraction: We can count the usage preferences of spaces, tabs, and line breaks in the code, and analyze information such as the location of braces and tags and indentation style. By identifying the layout features of the code, we can analyze the style and habits of the code author. S23: Code syntactic feature extraction: We can build an abstract syntax tree (AST) of the code to analyze the grammatical structure and organization of the code. Then, we can use algorithms such as recurrent neural network (RNN) and bidirectional long short-term memory (BiLSTM) to extract the syntactic features of the code and calculate the statistical features such as the frequency and depth of leaf nodes. S24: Feature fusion: Through fusion methods such as the bilinear pooling algorithm, we can integrate and reduce the dimension of different feature information to obtain more comprehensive and accurate code features. This can help us better understand and distinguish the coding styles and habits of different code authors.
4. According to claim 1, a method for identifying malicious code authors and detecting code infringement based on multi-feature fusion, characterized in that: The specific process of step S3 is as follows: S31: Database establishment: A database is established based on the feature vector of each user. S32: Select an approximate nearest neighbor search algorithm to search, and use the IVF-PQ algorithm to divide the data set into multiple subsets and quantify them. S33: Select other heuristic algorithms for dynamically inserting and maintaining the database according to the specific situation to facilitate query at any time.
Citation Information
Cited By
Code snippet extraction iteration use method and system based on parallelization
CN119201131A
Fine-grained binary code similarity detection method based on code retrieval and subgraph matching
CN120256980A
