ML-Based Static Profiling
This page summarizes a research project developed in collaboration between the Faculty of Mathematics, University of Belgrade, and Oracle. The project focuses on machine learning for profile inference in the GraalVM Native Image ahead-of-time compiler. Its models predict branch probabilities and method hotness, which guide compiler decisions about inlining, loop optimizations, code layout, and the balance between execution speed and executable size.
A program profile describes a program's runtime behavior, including branch probabilities and the execution frequencies of methods and basic blocks. In instrumentation-based dynamic profiling, profile-guided optimization (PGO) collects this information by running an instrumented build on representative workloads, then recompiles the application with the collected profile. Dynamic profiling is the standard approach to obtaining high-quality profiles for high-performance applications. The extra build and profiling run lengthen the build pipeline, while instrumentation increases execution time and memory use, adding costs that accumulate in continuous integration and can exceed embedded systems' resource limits. Developers must create representative workloads and maintain them as code evolves, and the resulting complexity and resource demands limit adoption. A static profiler predicts the profile from program code at compile time. This gives the compiler profile information in a single build without a profiling run of the application being compiled. Machine learning models trained offline on profiles from other programs learn patterns that make these predictions accurate.
Static profiling has brought together companies and universities for more than three decades. At MICRO 1994, Wu and Larus, then at Sequent Computer Systems and the University of Wisconsin–Madison, presented foundational work on static branch frequency and program profile analysis. VESPA, presented at OOPSLA 2021 by researchers at Facebook, now Meta, and the Federal University of Minas Gerais (UFMG), uses a neural network for static profiling in binary optimization. Rotem and Cummins at Meta use machine learning for profile-guided optimization without application profiles. Raman and Li at Google learn branch probabilities from datacenter workloads. This project brings machine learning based static profiling to Oracle GraalVM Native Image, which ships it as a built-in capability.
Selected Papers
Seven selected papers. Six published. One in progress.
Profiling Beyond IR: Method-Signature Embeddings for Static Profiling
Status: In progress.
Authors: Stefan Milenkovic, Lazar Milikic, Milan Cugurovic, Aleksandar Prokopec, Boris Spasojevic, Vojin Jovanovic, and Milena Vujošević Janičić.
The GraalNN figure shows method signatures split into tokens and encoded into a compact representation that joins control-flow graph features to predict branch probabilities. The GraalMHC figure shows package, class, and method names encoded separately and added to existing program features to classify methods as cold or warm, guiding their compilation strategy.
Package, class, and method names contain semantic clues that structural program features leave unused. This manuscript adds compact identifier embeddings to two GraalVM Native Image profilers.
Compared with an embedding-free baseline, the GraalNN extension reduces Barista binary size by 4.14% and compilation time by 1.58% at O2. At O3, the reductions reach 6.53% and 5.51%, with runtime neutral to slightly improved. The GraalMHC extension cuts binary size by up to about 11% at a runtime cost of a few percent. Its custom embedding data occupies 2.77 MB, compared with 163 MB for GloVe.
GraalMHC++: A Tunable ML Framework for Size-Aware Optimizing Compilation
Venue: Journal of Systems and Software (Elsevier).
Date: October 2026.
Status: Published.
Special Issue on AI Techniques for Performance, Reliability, and Sustainability of Modern Software Systems.
Authors: Milan Cugurovic, Aleksandar Prokopec, Boris Spasojevic, Vojin Jovanovic, and Milena Vujošević Janičić.
The figure above shows static features extracted from a method's signature, access modifiers, compiler representation, and dataflow graph. A single XGBoost model turns these features into a hotness score, and a configurable threshold converts that score into a cold or warm classification that selects size-oriented or performance-oriented compilation.
Optimizations such as inlining and loop unrolling can enlarge binaries even when they target code that rarely executes. The decision threshold is exposed as a compiler option, allowing different size and performance trade-offs without training and distributing separate models.
Across Barista microservices and Renaissance applications at O2 and O3, thresholds from 0.1 to 0.7 reduce binary size by 8% to 32% with a 1% to 8% performance loss. A threshold of 0.3 delivers 12% to 21% smaller binaries at a 1% to 3% performance loss. A more aggressive threshold of 0.9 reaches size savings of up to 43%. The framework is integrated into Oracle GraalVM Native Image.
The Promise of Static Profiling: Exploring the Limits
Venue: MoreVMs Workshop, Programming 2026, Munich, Germany.
Date: March 2026.
Status: Published.
Authors: Milan Cugurovic, Aleksandar Prokopec, Boris Spasojevic, Vojin Jovanovic, and Milena Vujošević Janičić.
The figure above shows dynamic profiling followed by selection of branch, call count, virtual call, or monitor profiles, individually or in combination. The retained profiles guide compilation, and evaluation of the resulting programs estimates the performance and binary size gains an ideal static profiler could achieve for the same workloads.
Most static profilers predict branch behavior, leaving the value of other profile types less explored. The estimates apply to the tested workloads within the compiler's profiling model.
Across 31 standalone applications and 7 microservice applications, combining all four profile types improves standalone runtime performance by 25% and microservice throughput by 40%. It also reduces binary size by 20.7% and 30%, respectively. The results identify call count and virtual call prediction as promising directions for extending static profiling beyond branch probabilities.
GraalMHC: ML-Based Method-Hotness Classification for Binary-Size Reduction in Optimizing Compilers
Venue: International Conference on Compiler Construction (CC), Sydney, Australia.
Date: January 2026.
Status: Published.
Authors: Milan Cugurovic, Aleksandar Prokopec, Boris Spasojevic, Vojin Jovanovic, and Milena Vujošević Janičić.
The figure above shows features extracted from a method's signature, access modifiers, compiler representation, and dataflow graph, then passed to an XGBoost classifier. The resulting cold or warm label guides Oracle GraalVM Native Image to favor smaller code for cold methods and performance-oriented optimizations for warm methods.
Applying performance-oriented optimizations to rarely executed methods increases binary size without a corresponding runtime benefit.
Three separately trained models expose different size and performance trade-offs. S1 reduces binary size by 9% to 13% with a 1% to 2% performance loss. S2 achieves 15% to 25% reductions at a 3% to 5% loss, while S3 reaches 17% to 35% reductions at a 5% to 7% loss. The evaluation also reports 7% to 10% shorter compilation times.
GraalNN: Context-Sensitive Static Profiling with Graph Neural Networks
Venue: International Symposium on Code Generation and Optimization (CGO), Las Vegas, USA.
Date: March 2025.
Status: Published.
Authors: Lazar Milikic, Milan Cugurovic, and Vojin Jovanovic.
The figure above shows a method's control-flow graph encoded by a graph neural network, followed by branch probability prediction. During inlining, the caller's graph is combined with the callee's graph before encoding, so the resulting branch profiles reflect calling context and guide compiler optimization.
Learning directly from control-flow graphs reduces the need to handcraft features that describe program structure.
Integrated into GraalVM Native Image, the framework achieves a 10.13% geometric mean runtime speedup on industry-standard benchmarks, with a 2.94% increase in binary size, relative to compilation without profiles. With the O3 optimization budget, real-world microservice applications gain 13.16% throughput with a 5.05% binary size increase relative to unprofiled compilation at the same budget.
GraalSP: Polyglot, Efficient, and Robust Machine Learning-Based Static Profiler
Venue: Journal of Systems and Software (Elsevier).
Date: July 2024.
Status: Published.
Authors: Milan Čugurović, Milena Vujosević Janičić, Vojin Jovanović, and Thomas Würthinger.
Figure 3 shows the decision tree, XGBoost ensemble, and deep neural network architectures evaluated for branch prediction. Figure 19 illustrates the code and control-flow features extracted for a branch in heapSort. These features feed the deployed lightweight XGBoost regression model, whose branch probability predictions guide compiler optimization.
The feature set works across languages that compile to Java bytecode, including Java, Scala, and Kotlin. Branch probability heuristics protect optimization decisions from inaccurate estimates and outliers.
The profiler is integrated into the Graal compiler. An evaluation on 28 benchmarks reports a 7.46% geometric mean reduction in execution time compared with the default compiler configuration, which assigns uniform branch probabilities. GraalSP provides profile-guided optimization without asking application developers to collect a dynamic profile or maintain a separate profiling workload.
Dynamic Profiling and Static Prediction of the Program Execution Profiles in the Context of Compiler Optimizations
Venue: InfoM: Journal of Information Technology and Multimedia Systems, volume 23, issue 78, pages 17 to 27.
Date: December 2023.
Status: Published.
Authors: Milan Čugurović.
The figure above shows static code features collected alongside execution profiles from instrumented programs. Matching features and profiles are merged into a labeled dataset, which is then used to train a model that predicts execution profiles directly from program code.
Profile-guided optimizations use execution profiles to guide decisions such as inlining and code layout. This survey compares instrumentation-based and sample-based dynamic profiling, explaining how profile quality, collection cost, and resource limits affect their use. It then examines static profile prediction as a way to obtain this information directly from program code during compilation.
The paper follows the development from hand-written heuristics to machine learning models, distinguishing branch classification from regression that predicts execution probabilities. It reviews how features drawn from source code, compiler intermediate representations, and executable code describe program behavior, and identifies feature design as a central challenge. The comparison outlines when each profiling approach is useful and motivates further work on regression models and more general program representations.
Patents
Five U.S. patent applications.
Tunable Machine Learning for Size-Aware Optimizing Compilation
U.S. patent application.
Date: October 2026. Status: Filed.
The application concerns tunable machine learning for size-aware compiler optimization.
Static Profiling Using Signature Embeddings
U.S. patent application.
Date: August 2026. Status: Filed.
The application concerns the use of signature embeddings in static profiling.
Static Profiling with Graph Neural Networks
Date: May 2026. Status: Published.
The application covers graph neural network prediction of branch frequencies from control-flow graphs. The predictions form program profiles used to guide compiler optimization.
Machine Learning Method Hotness Classification in Optimizing Compilers
U.S. patent application.
Date: December 2025. Status: Filed.
The application concerns machine learning classification of method hotness for compiler optimization.
Machine Learning Based Static Profiling
Date: July 2025. Status: Published.
The application covers predicting branch frequencies with a regression model using features extracted from a program's intermediate representation. The resulting static profile guides code optimization.
Defended Theses
Two theses.
Prediction of Program Profiles Using Machine Learning Techniques
Original title: Predviđanje profila izvršavanja programa tehnikama mašinskog učenja.
Type: PhD thesis.
Author: Milan Čugurović.
Institution: Faculty of Mathematics, University of Belgrade.
Defense date: December 24, 2025.
Mentor: Milena Vujošević Janičić, Faculty of Mathematics, University of Belgrade.
Committee members:
- Filip Marić, Faculty of Mathematics, University of Belgrade.
- Mladen Nikolić, Faculty of Mathematics, University of Belgrade.
- Saša Misailović, University of Illinois Urbana-Champaign.
This thesis presents GraalSP, which predicts branch probabilities from Graal's high-level graph representation using XGBoost and corrective heuristics for languages that compile to Java bytecode. Integrated into Enterprise GraalVM Native Image, it achieves a 7.46% geometric mean execution-time speedup across 28 benchmarks relative to the uniform-profile baseline. The thesis also introduces GraalSP-PLog, a tool for inspecting individual predictions and model errors.
Improving the GraalMHC Static Profiler Using Semantics from Method Names
Original title: Побољшање статичког профајлера GraalMHC коришћењем семантике из имена метода.
Type: Master thesis.
Author: Stefan Milenković.
Institution: Faculty of Mathematics, University of Belgrade.
Defense date: August 7, 2026.
Mentor: Milena Vujošević Janičić, Faculty of Mathematics, University of Belgrade.
Committee members:
- Mirko Spasić, Faculty of Mathematics, University of Belgrade.
- Milan Čugurović, Faculty of Mathematics, University of Belgrade.
This thesis extends the GraalMHC profiler family in GraalVM Native Image with word embeddings of fully qualified method names, comparing GloVe with a custom-trained embedding. Compared with the profiler without method-name semantics, it produces 4.7% to 6.4% smaller executables at O2 with a runtime regression of less than 2.4%, and 8.4% to 10.8% smaller executables at O3 with a regression of up to 4.4%. The custom embedding achieves better results than GloVe while occupying 2.77 MB versus 163 MB.
Full Publication List
Seventeen entries.
Journal Articles
- M. Čugurović, A. Prokopec, B. Spasojević, V. Jovanović, and M. Vujošević Janičić. GraalMHC++: A Tunable ML Framework for Size-Aware Optimizing Compilation. Journal of Systems and Software (Elsevier), Special Issue on AI Techniques for Performance, Reliability, and Sustainability of Modern Software Systems. October 2026. ScienceDirect
- I. Ristović, M. Čugurović, S. Stanojević, M. Spasić, V. Marinković, and M. Vujošević Janičić. Machine Learning-Driven Prediction of Optimal Control Flow Graph Traversal Strategy. Serbian Journal of Electrical Engineering, volume 22, issue 3, pages 353 to 376. 2025. doiSerbia
- M. Čugurović, M. Vujošević Janičić, V. Jovanović, and T. Würthinger. GraalSP: Polyglot, Efficient, and Robust Machine Learning-Based Static Profiler. Journal of Systems and Software (Elsevier). July 2024. ScienceDirect
- M. Čugurović. Dynamic Profiling and Static Prediction of the Program Execution Profiles in the Context of Compiler Optimizations. InfoM: Journal of Information Technology and Multimedia Systems, volume 23, issue 78, pages 17 to 27. December 2023. InfoM
Conference and Workshop Papers
- M. Čugurović, A. Prokopec, B. Spasojević, V. Jovanović, and M. Vujošević Janičić. The Promise of Static Profiling: Exploring the Limits. MoreVMs Workshop, Companion Proceedings of the 10th International Conference on the Art, Science, and Engineering of Programming (<Programming> '26), Munich, Germany. March 2026. ACM Digital Library
- M. Čugurović, A. Prokopec, B. Spasojević, V. Jovanović, and M. Vujošević Janičić. GraalMHC: ML-Based Method-Hotness Classification for Binary-Size Reduction in Optimizing Compilers. International Conference on Compiler Construction (CC), Sydney, NSW, Australia. January 2026. ACM Digital Library
- M. Čugurović, I. Ristović, S. Stanojević, M. Spasić, V. Marinković, and M. Vujošević Janičić. ML-Driven Prediction of Optimal Control Flow Graph Traversal Algorithm in Modern Applications. 12th International Conference IcETRAN, Čačak, Serbia. June 2025. Best Paper Award for Young Researchers
- L. Milikić, M. Čugurović, and V. Jovanović. GraalNN: Context-Sensitive Static Profiling with Graph Neural Networks. International Symposium on Code Generation and Optimization (CGO), Las Vegas, Nevada, USA. March 2025. ACM Digital Library
- I. Ristović, M. Čugurović, S. Stanojević, M. Spasić, V. Marinković, and M. Vujošević Janičić. Efficient Traversal of Program Control Flow Graphs. Conference YuInfo 2024, Kopaonik, Serbia. March 2024.
Extended Abstracts and Talks
- S. Milenković, M. Čugurović, and M. Vujošević Janičić. Improving ML-Based Static Profiling Using Method Names. Symposium Mathematics and Applications, Faculty of Mathematics, University of Belgrade, volume XV. 2025.
- M. Čugurović and M. Vujošević Janičić. GraalSP Profiles Logger: A Tool for Analyzing and Interpreting Predictions of the ML-Based Static Profilers. Conference on Artificial Intelligence, Department of Technical Sciences SASA and Mathematical Institute SASA. December 2024.
- M. Spasić, I. Ristović, S. Stanojević, M. Čugurović, M. Karličić, and M. Vujošević Janičić. Performance Evaluation of the GraalVM Compiler on a Distributed Computing Cluster. XV Serbian Mathematical Congress, Faculty of Mathematics, University of Belgrade. 2024.
- M. Čugurović and M. Vujošević Janičić. Creation and Analysis of a Dataset for Predicting Execution Probabilities of Virtual Methods in Object-Oriented Programs. Conference on Artificial Intelligence, Mathematical Institute SASA. December 2023.
- M. Čugurović, I. Ristović, S. Stanojević, M. Spasić, V. Marinković, and M. Vujošević Janičić. Comparative Analysis of Program Control Flow Graph Traversal Algorithms. Symposium Mathematics and Applications, Faculty of Mathematics, University of Belgrade, volume XIII(1). 2023.
- M. Čugurović. Prediction of Program Profiles Using Machine Learning Techniques. Seminar for Artificial Intelligence, Mathematical Institute SASA. March 2022.
Invited Talks
- M. Čugurović. Prediction of Program Execution Profiles Using Machine Learning Techniques. Invited talk at INFORMATIKA 2026: New Trends in the Development of Information Systems, Serbian Informatics Society. May 2026.
In Progress
- Stefan Milenković, Lazar Milikić, Milan Čugurović, Aleksandar Prokopec, Boris Spasojević, Vojin Jovanović, and Milena Vujošević Janičić. Profiling Beyond IR: Method-Signature Embeddings for Static Profiling.
Milan Čugurović
Oracle, Belgrade · Faculty of Mathematics, University of Belgrade
Last updated October 2026.

