News for hackers. Stuff that matters.
Re:Decompiling 2024: A Year of Resurgance in Decompilation R... by benob on Thursday January 30, 2025 @07:00AM (#42877002)
> If you’ve ever talked to me in person, you’d know that I’m a disbeliever of AI replacing decompilers any time soon

Decompilation, seen as a translation problem, is by any means a job that suits AI methods. Give time to researchers to gather enough mappings between source code and machine code, get used to training large predictive models, and you shall see top notch decompilers that beat all engineered methods.

Re:Decompiling 2024: A Year of Resurgance in Decompilation R... by donatj on Thursday January 30, 2025 @07:57AM (#42877300)
It's pattern matching, plain and simple, An area where AI excels. AI driven decomp is absolutely on its way
Re:Decompiling 2024: A Year of Resurgance in Decompilation R... by dartos on Thursday January 30, 2025 @08:10AM (#42877393)
Maybe in conjunction with a deterministic decompiler.

precision wrt translation, especially when the translation is not 1-to-1, is not excellent with LLMs.

In fact, their lack of precision is what makes them so good at translating natural languages!

Re:Decompiling 2024: A Year of Resurgance in Decompilation R... by ChrisKnott on Thursday January 30, 2025 @08:32AM (#42877509)
It's also perfect for RL because it can compile it's output and check it against the input. It's a translation exercise where there's already a perfect machine translator in one direction.

It probably just hasn't happened because decompilation is not a particularly useful thing for the vast majority of people.

Re:Decompiling 2024: A Year of Resurgance in Decompilation R... by thesz on Thursday January 30, 2025 @04:01PM (#42882137)
Let me parrot you, it's fun.

"It's pattern matching, plain and simple, an area where pattern matching algorithms excel. Pattern matching driven decomp absolutely leads"

Decompilation is a dependence graph problem, one can formulate decompilation as a graph transformation/rewrite. Neural networks are notoriously bad at graphs.

Re:Decompiling 2024: A Year of Resurgance in Decompilation R... by gsam on Thursday January 30, 2025 @09:17PM (#42884163)
> Neural networks are notoriously bad at graphs.

AlphaFold is based on graph neural networks. The biggest issue is that we still do not know how to best encode graph problems in ways neural networks can exploit. Current graph neural network techniques exploit certain invariants but cannot distinguish between various similar graphs. And yet, they're still generating meaningful insights.

Re:Decompiling 2024: A Year of Resurgance in Decompilation R... by thesz on Friday January 31, 2025 @03:50AM (#42885826)
> AlphaFold is based on graph neural networks.

And what is the size of graphs processed by AlphaFold? How does it compare to the size of program dependence graph?

Here's evaluation of boolean satisfiability encoding of protein folding problem: https://pmc.ncbi.nlm.nih.gov/articles/PMC7197060/

Boolean satisfiability solvers are used in satisfiability modulo theories solvers that, in turn, are used to prove various things about programs.

Re:Decompiling 2024: A Year of Resurgance in Decompilation R... by kachapopopow on Thursday January 30, 2025 @07:57AM (#42877295)
Typical obfuscation sure. vms, obfuscation and everything in between is just noise to AI.
Re:Decompiling 2024: A Year of Resurgance in Decompilation R... by wzdd on Thursday January 30, 2025 @09:23AM (#42877925)
> Decompilation, seen as a translation problem, is by any means a job that suits AI methods.

Compilation is also a translation problem but I think many people would be leery of an LLM-based rust or clang -- perhaps simply because they're more familiar with the complexities involved in compilation than they are with those involved in decompilation.

(Not to say it won't eventually happen in some form.)

Re:Decompiling 2024: A Year of Resurgance in Decompilation R... by chrisco255 on Thursday January 30, 2025 @10:30AM (#42878655)
LLMs are not deterministic, and I want deterministic builds from compiled code to assembly. I also do not want the LLM to arbitrarily change the functionality, I have no such guarantees.
Re:Decompiling 2024: A Year of Resurgance in Decompilation R... by sitkack on Thursday January 30, 2025 @11:20AM (#42879238)
Compilers aren't deterministic in the ways that people would think matter.

We will have LLM based compilers in the near future. Determinism is a property of the system, not the components.

Re:Decompiling 2024: A Year of Resurgance in Decompilation R... by LowLevelMahn on Thursday January 30, 2025 @12:09PM (#42879752)
"near" like never :)
Re:Decompiling 2024: A Year of Resurgance in Decompilation R... by sitkack on Thursday January 30, 2025 @02:07PM (#42880996)
You want to put money on it?

You set the criteria.

Re:Decompiling 2024: A Year of Resurgance in Decompilation R... by pjc50 on Friday January 31, 2025 @05:30AM (#42886396)
Let me know when an LLM compiler is licensed for use on critical infrastructure. Admittedly Java doesn't meet this bar (see "You acknowledge that Licensed Software is not designed or intended for use in the design, construction, operation or maintenance of any nuclear facility" https://www.oracle.com/technetwork/java/javase/downloads/jdk... )
Re:Decompiling 2024: A Year of Resurgance in Decompilation R... by IshKebab on Thursday January 30, 2025 @05:47PM (#42882973)
I wouldn't be at all leery of LLM-based compilers (as long as their output is verified to be correct and reasonable).
Re:Decompiling 2024: A Year of Resurgance in Decompilation R... by pjc50 on Friday January 31, 2025 @05:31AM (#42886405)
Verification is the hard bit! That's why sel4 is so unique.
Re:Decompiling 2024: A Year of Resurgance in Decompilation R... by IshKebab on Friday January 31, 2025 @08:49AM (#42887614)
That's a different kind of verification entirely.
Re:Decompiling 2024: A Year of Resurgance in Decompilation R... by __alexander on Thursday January 30, 2025 @09:30AM (#42878013)
> Give time to researchers to gather enough mappings between source code and machine code, get used to training large predictive models, and you shall see top notch decompilers that beat all engineered methods.

Not anytime soon. There is more to a decompiler than assembly being converted to x language. File parsers, disassemblers, type reconstruction, etc are all functionality that have to run before a “machine code” can be converted to the most basics of decompiler output.

Re:Decompiling 2024: A Year of Resurgance in Decompilation R... by jcranmer on Thursday January 30, 2025 @10:59AM (#42878961)
Yes and no.

My first priority for a decompiler is that the output is (mostly) correct. (I say mostly because there's lots of little niggling behavior you probably want to ignore, like representing a shift instruction as `a << b` over `a << (b & 0x1f)`). When the decompiler's output is incorrect, I can't trust it anymore, and I'm going to go straight back to the disassembly because I need to work with the correct output. And AI--especially LLMs--are notoriously bad at the "correct" part of translation.

If you look at decompilation as a multistep problem, the main steps are a) identify the function/data symbol boundaries, b) lift the functions to IR, c) recover type information (including calling convention for functions), d) recover high-level control flow, and e) recover variable names.

For step b, correctness is so critical that I'm wary of even trusting hand-generated tables for disassembly, since it's way too easy for someone to copy something by hand. But on the other hand, this is something that can be machine-generated with something that is provably correct (see, e.g., https://cs.stanford.edu/people/eschkufz/docs/pldi_16.pdf). Sure, there's also a further step for recognizing higher-level patterns like manually-implemented-bswap, but that's basically "implement a peephole optimizer," and the state of the art for compilers these days is to use formally verifiable techniques for doing that.

For a lot of the other problems, if you instead categorize them as things where the AI being wrong doesn't make it incorrect, AI can be a valuable tool. For example, control flow structuring can be envisioned as identifying which branches are gotos (including breaks/continues/early returns), since a CFG that has no gotos is pretty trivial to structure. So if your actual AI portion is a heuristic engine for working that out, it's never going to generate wrong code, just unnecessarily complicated code.

Re:Decompiling 2024: A Year of Resurgance in Decompilation R... by svilen_dobrev on Thursday January 30, 2025 @11:25AM (#42879293)
> identifying which branches are gotos

mmh. Yesterday i tried some LLM-augmented "analysis", given a 50 lines source of C, a function with few goto's in it.. somehow all "explanations" were ~correct except it completely ignored the goto's. Using a deepseek-r1-...7b, ollama's default, probably too weak ; but i don't believe other models would be 100% correct either.

Re:Decompiling 2024: A Year of Resurgance in Decompilation R... by sitkack on Thursday January 30, 2025 @11:22AM (#42879258)
You are right on a lot of things, but LLMs are the best bijective lens that humanity has ever discovered. They can invert functions we didn't think were invertible.

If given a mostly correct transform from binary back to code, how would we fix that?

Exactly!

Heuristics are dead.

Re:Decompiling 2024: A Year of Resurgance in Decompilation R... by thesz on Thursday January 30, 2025 @02:08PM (#42881011)
> Heuristics are dead

I guess it is an example of an heuristic.

Re:Decompiling 2024: A Year of Resurgance in Decompilation R... by ahartmetz on Friday January 31, 2025 @12:33AM (#42884964)
Absolutely. LLMs use methods that are not really provably solving the given problem, they just happen to work in most relevant cases. That's a heuristic.
Re:Decompiling 2024: A Year of Resurgance in Decompilation R... by sitkack on Friday January 31, 2025 @08:00AM (#42887220)
http://www.incompleteideas.net/IncIdeas/BitterLesson.html

> Our methodology leverages state-of-the-art natural language processing techniques to systematically evaluate the evolution of research approaches in computer vision. The results reveal significant trends in the adoption of general-purpose learning algorithms and the utilization of increased computational resources. We discuss the implications of these findings for the future direction of computer vision research and its potential impact on broader artificial intelligence development.

https://arxiv.org/abs/2410.09649v1

Re:Decompiling 2024: A Year of Resurgance in Decompilation R... by ahartmetz on Friday January 31, 2025 @08:47AM (#42887592)
I know that these algorithms are the best that exists for many tasks, but any non-deterministic non-provable algorithm is still technically a heuristic. Also, currently, the bitter lesson seems to be that more of the same runs into diminishing returns, contrary to "The Bitter Lesson"(tm). There will probably be a better AI architecture at some point, but "lol just add more GPUs / data / RAM" times are kind of over for now.
Re:Decompiling 2024: A Year of Resurgance in Decompilation R... by sitkack on Friday January 31, 2025 @11:12AM (#42888932)
You are misinterpreting the bitter lesson, it only gets more bitter with time!

The arxiv paper is well written, worth a read.

Re:Decompiling 2024: A Year of Resurgance in Decompilation R... by ahartmetz on Friday January 31, 2025 @12:48PM (#42889784)
I don't think that I misunderstood - it says that more computing power beats "hand-engineering". But more computing power doesn't seem to work that well anymore to improve AI performance - and there is not much more computing power coming in the next couple of years, not orders of magnitude more for free like it used to be. Case in point: the somewhat disappointing new nVidia generation.
Re:Decompiling 2024: A Year of Resurgance in Decompilation R... by sitkack on Friday January 31, 2025 @03:16PM (#42891414)
> it says that more computing power beats "hand-engineering".

This is the simplistic tl;dr, but that isn't what is says. You should reread the essay and the linked arxiv paper.

It is much more than throwing more compute at a problem.

Re:Decompiling 2024: A Year of Resurgance in Decompilation R... by Vt71fcAqt7 on Thursday January 30, 2025 @01:28PM (#42880614)
>And AI--especially LLMs--are notoriously bad at the "correct" part of translation.

Can't you just compare the compiled binaries to see if they are the same? Is the issue that you don't have the full toolchain so there are different outputs from the two compilers? Thinking about it though you could probably figure out which compiler was used using those same differences though..

Re:Decompiling 2024: A Year of Resurgance in Decompilation R... by CFLAddLoader on Thursday January 30, 2025 @02:15PM (#42881095)
The expected outcome of using a LLM to decompile is a binary that is so wildly different from the original that they cannot even be compared.

If you only make mistakes very rarely and in places that don't cause cascading analysis mistakes, you can recover. But if you keep making mistakes all over the place and vastly misjudge the structure of the program over and over, the entire output is garbage.

Re:Decompiling 2024: A Year of Resurgance in Decompilation R... by Vt71fcAqt7 on Thursday January 30, 2025 @02:43PM (#42881400)
That makes sense. So it can work for small functions but not an entire codebase which is the goal. Does that sound correct? If so, is it useful for small functions (like, let's say I identify some sections of code I think are important becuase they modify some memory location) or is this not useful?
Re:Decompiling 2024: A Year of Resurgance in Decompilation R... by CFLAddLoader on Thursday January 30, 2025 @02:59PM (#42881563)
There are lots of parts of analysis that really matter for readability but aren't used as inputs to other analysis phases and thus mistakes are okay.

Things like function and variable names. Letting an LLM pick them would be perfectly fine, as long as you make sure the names are valid and not duplicates before outputting the final code.

Or if there are several ways to display some really weird control flow structures, letting an LLM pick which to do would be fine.

Same for deciding what code goes in which files and what the filenames should be.

Letting the LLM comment the code as it comes out would work too, as if the comments are misleading you can just ignore or remove them.

Re:Decompiling 2024: A Year of Resurgance in Decompilation R... by fulafel on Friday January 31, 2025 @12:48AM (#42885011)
No, but for verifying equivalence you could use some symbolic approach that is provably correct. The LLM could help there by making its output verifiable.
Re:Decompiling 2024: A Year of Resurgance in Decompilation R... by helltone on Friday January 31, 2025 @04:34AM (#42886104)
Program equivalence is undecidable, in general, but also in practice (in my experience) most interesting cases quickly escalate to require an unreasonable amount of compute. Personally, I think it is easier to produce correct-by-construction decompilation by applying sequences of known-correct transformations, rather than trying to reconstruct correctness a posteriori. So perhaps the LLM could produce such sequence of transforms rather than outputting the final decompiled program only.
Re:Decompiling 2024: A Year of Resurgance in Decompilation R... by fulafel on Friday January 31, 2025 @02:58PM (#42891224)
Yes, something like this, the intermediate verified steps wouldn't have to be shown to the user.
Re:Decompiling 2024: A Year of Resurgance in Decompilation R... by pjc50 on Friday January 31, 2025 @05:23AM (#42886357)
It can take quite a bit of engineering just to get the same source to produce the same results in many C or C++ toolchains. "Reproducible builds" require work; all sorts of trivial things like the length of pathnames can perturb the results. Not to mention having to have the same optimizer flags.

"Do these two binaries always behave the same for the same inputs" is practically an unsolvable problem in general. You can get fairly close with something like AFL (American fuzzy lop, a fuzzer and also a type of rabbit).

(Someone should really make an LLM bot that scans HN for instances of "just" and explain why you can't just do that, it's such a red flag word)

Re:Decompiling 2024: A Year of Resurgance in Decompilation R... by mahaloz on Thursday January 30, 2025 @12:02PM (#42879678)
I agree with many other sentiments here that if it can replace decompilers, then surely it can replace compilers... which feels unlikely soon. So far, I've seen four end-to-end binary-to-code AI approaches, and none have had convincing results. Even those that crawled all of GitHub continue to have issues of making fake code, not understanding math, omitting portions of code, and (a personal irritant for me) being unable to map what address a line of decompilation came from.

However, I also acknowledge that AI can solve many pattern-based problems well. I think a considerable value can be extracted from AI by focusing in on micro decisions in the decompiler process, like variable types, as recent work has.

Re:Decompiling 2024: A Year of Resurgance in Decompilation R... by jcranmer on Thursday January 30, 2025 @01:03PM (#42880325)
I'd feel a lot more comfortable in the prospects of AI if their big boosters weren't so gung-ho about it replacing absolutely everything. Compilers (and by extension decompilers) are one of the areas where we have the ability to have formal proofs of correctness [1]--and the fact that AI people seem to be willing to throw all of that away in favor of their maybe-correct-but-does-it-really-matter-if-it's-not tools is extremely distressing to me.

[1] And one of the big advances in compilers in the past decade or so is the fact that compilers are actually using these in practice!

Re:Decompiling 2024: A Year of Resurgance in Decompilation R... by pjc50 on Friday January 31, 2025 @05:36AM (#42886432)
> I'd feel a lot more comfortable in the prospects of AI if their big boosters weren't so gung-ho about it replacing absolutely everything. Compilers (and by extension decompilers) are one of the areas where we have the ability to have formal proofs of correctness [1]--and the fact that AI people seem to be willing to throw all of that away in favor of their maybe-correct-but-does-it-really-matter-if-it's-not tools is extremely distressing to me.

God yes. These people are infuriating; it's as if they've abandoned the concept of provable correctness, or never understood it in the first place, and replaced it with "looks good enough to me on a few examples". Some sort of gambler's fallacy where if you get a right answer once it doesn't matter how many wrong answers you get.

Re:Decompiling 2024: A Year of Resurgance in Decompilation R... by thesz on Thursday January 30, 2025 @02:05PM (#42880974)
> Give time to researchers to gather enough mappings between source code and machine code, get used to training large predictive models, and you shall see top notch decompilers that beat all engineered methods.

Decompilation is about dependencies which makes it a graph problem.

One such problem is boolean satisfiability and this particular kind of problem is extremely important. It also very easy to gather mappings between CNF and solutions. Actually, randomization of standard benchmarks is now part of SAT competitions, AFAIK.

Have you seen any advances there using large predictive models?

Proper decompilation is even harder, it is much like halting problem than SAT. Imagine that there is a function that gets inlined and, therefore specialized. One definitely wants source for the original function and calls to it, not a listing of all specializations.

This moves us to the space of "inverse guaranteed optimization" and as such it requires approximation of the solution of halting problem.