← Latest papers
🤖 machine learning

Pretraining on Call Graphs: When Binary Analysis Tasks Profit From Context

This paper investigates how integrating call graph context into binary function embeddings improves robustness and benefits context-dependent tasks like namespace-related functions, while revealing that such enhancements do not universally generalize across downstream tasks and may even create a trade-off between semantic and syntactic performance.

Original authors: Samuel Valenzuela, Johannes Kinder

Published 2026-08-04
📖 5 min read🧠 Deep dive

Original authors: Samuel Valenzuela, Johannes Kinder

Original paper licensed under CC BY 4.0 (http://creativecommons.org/licenses/by/4.0/). This is an AI-generated explanation of the paper below. It is not written or endorsed by the authors. For technical accuracy, refer to the original paper. Read full disclaimer

Imagine you are a detective trying to solve a mystery, but the only clues you have are written in a secret code that changes every time the author writes it. This is the world of binary code analysis. When a computer program is compiled, it turns into a stream of machine instructions that looks nothing like the original human-readable code. It's like taking a delicious cake, baking it, and then trying to figure out the recipe just by tasting the crumbs. The challenge is that two different bakers can make the exact same cake using slightly different ingredients or steps, yet the result tastes identical. In the digital world, this means two pieces of code can look completely different on the surface but do the exact same thing.

To crack these codes, scientists use machine learning to create "embeddings." Think of an embedding as a unique ID card or a fingerprint for a piece of code. If two fingerprints match, the code is likely doing the same thing. Usually, these ID cards are made by looking at just one function (a small task within the program) in isolation. But what if we gave the detective a map of the whole neighborhood? In programming, this map is called a call graph, which shows which functions call other functions. The big question is: does looking at the neighborhood help us identify the suspect better, or does it just confuse the detective with too much noise?

This paper, titled "Pretraining on Call Graphs: When Binary Analysis Tasks Profit From Context," dives into exactly that question. The researchers, Samuel Valenzuela and Johannes Kinder, wanted to see if adding the "neighborhood context" (the call graph) to the code's ID card actually makes the detective smarter. They took two of the smartest existing code-detectives (called CLAP and jTrans) and taught them to look at the call graph using a special type of AI called a Graph Neural Network (GNN). They tested these new, context-aware detectives on three different jobs: finding matching code, guessing what a function is named, and figuring out which compiler settings were used to build it.

Here is what they found, and it's a bit of a plot twist. When the goal was to find matching code (a task called Binary Code Similarity Detection), the context-aware detectives were amazing. By looking at the call graph, they could spot matches that the original detectives missed, especially when the code was huge or complicated. For example, when the call graph had around 64 nodes, the original detectives started to get lost, but the new ones kept their cool.

However, the story takes a sharp turn when the detectives tried to do other jobs. When the researchers asked them to guess the name of a function (a semantic task), the results were mixed. While the complex Graph Neural Network detectives actually got worse at it, a simpler approach that just averaged the neighborhood information performed just as well as, or even better than, the original detectives. It turns out that training the AI to be a master of "finding matches" didn't necessarily help it name things correctly, and the complex models might have overcomplicated the task.

Even more interestingly, when the task was to spot technical details like which compiler optimization level was used (a syntactic task), the outcome depended on the method. The complex Graph Neural Network detectives performed poorly, getting worse the more context they had. However, the simple averaging models actually got better at spotting these technical details when given access to larger call graphs. This suggests that while complex models focusing on the big picture of the neighborhood might miss tiny technical cracks, a simple look at the whole neighborhood can actually help aggregate those low-level technical patterns effectively.

The researchers also discovered that this "neighborhood map" wasn't equally helpful for everyone. It worked wonders for functions that are part of a larger group or namespace (like a library of tools), but it didn't help much for functions that were just doing their own isolated logic. In fact, the study suggests that if you want your AI to be good at spotting technical details, you might actually want to use a simple averaging approach rather than a complex one, as the complex models tend to blur the lines for syntactic tasks.

In short, the paper suggests that while adding context from a call graph makes binary code analysis much more robust for finding similar code, it comes with a trade-off. It seems to blur the lines for other tasks, making the complex AI less precise at naming functions or spotting technical details, though simple averaging methods can sometimes improve on these fronts. The authors conclude that there is a delicate balance: you can't have the best of both worlds easily. If you train your model to understand the big picture of how functions talk to each other, it might stop paying attention to the small, technical details that are crucial for other types of analysis. This isn't a failure, but a discovery of a new rule in the game of code analysis: sometimes, knowing your neighbors helps you find a match, but it might make you forget exactly who you are, unless you know how to look at the neighborhood simply.

Drowning in papers in your field?

Get daily digests of the most novel papers matching your research keywords — with technical summaries, in your language.

Try Digest →