Source Code Embeddings Based on Control Flow Graphs and Markov Chains for Program Classification

Predictive compilation and intelligent source code analysis tasks necessitate the development of practical source code embeddings that preserve the contextual and semantic information of the code, allowing to achieve high quality of predictions made by machine learning algorithms. In this research we propose a novel source code embedding based on a Markov chain model which is constructed for a control flow graph (CFG). The code embedding is assessed on 2 classification problems: a problem of heterogeneous mapping of OpenCL programs to either CPU or GPU; and a problem of determining the type of the task implemented in by a given Python program solving unique programming exercise in a massive open online course. The results show that CFG-based Markov chains can improve the quality of classification results when compared to abstract syntax tree (AST)-based Markov chains, histogram-based embeddings and embeddings that are based on complex neural networks. In addition., we show that the use of term frequency-inverse document frequency (TF-IDF) model does not improve the quality of classification results when compared to simple histograms of AST node types or opcodes.

Authors

Institutions

Publication Details

Published
2024-11-13
DOI
https://doi.org/10.1109/summa64428.2024.10803670
Primary Topic
Advanced Malware Detection Techniques
Type
article
Field-Weighted Citation Impact
0.00
Controls
|||
ALL TIME
JAN
FEB
MAR
APR
MAY
JUN
JUL
AUG
SEP
OCT
article

Source Code Embeddings Based on Control Flow Graphs and Markov Chains for Program Classification

Liliya Demidova, Artyom V. Gorchakov, Vladimir V. Maslennikov
Advanced Malware Detection Techniques
article

Source Code Embeddings Based on Control Flow Graphs and Markov Chains for Program Classification

Liliya Demidova, Artyom V. Gorchakov, Vladimir V. Maslennikov
article en

Abstract

Predictive compilation and intelligent source code analysis tasks necessitate the development of practical source code embeddings that preserve the contextual and semantic information of the code, allowing to achieve high quality of predictions made by machine learning algorithms. In this research we propose a novel source code embedding based on a Markov chain model which is constructed for a control flow graph (CFG). The code embedding is assessed on 2 classification problems: a problem of heterogeneous mapping of OpenCL programs to either CPU or GPU; and a problem of determining the type of the task implemented in by a given Python program solving unique programming exercise in a massive open online course. The results show that CFG-based Markov chains can improve the quality of classification results when compared to abstract syntax tree (AST)-based Markov chains, histogram-based embeddings and embeddings that are based on complex neural networks. In addition., we show that the use of term frequency-inverse document frequency (TF-IDF) model does not improve the quality of classification results when compared to simple histograms of AST node types or opcodes.

MIREA - Russian Technological University (RU)
Openalex Percentile: Top 73%
Advanced Malware Detection Techniques
AI Navigator

Ask Laika to Summarize, Analyze, and Connect papers live on the map.

Summarize Papers & Methodologies

Extract key findings, datasets, and comparative methods across publications.

Benchmark Rankings & Visual Analytics

Rank top research institutions, authors, funders, topics, and journals by Field-Weighted Citation Impact (FWCI) and paper volume with instant charts.

Connect Distant Disciplines

Bridge topological clusters on the map to find hidden collaborative intersections.