Live data from Hacker News

OpenAI is good at unminifying code

glama.ai

301–310 of 321 posts

Re: OpenAI is good at unminifying code

#301

Earlier quoted context omitted.

> JS minification is fairly mechanical and comparably simple, so the inversion should be relatively easy. Just because a task is simple doesn't mean its inverse need be. Examples: - multiplication / prime factorization - deriving / integrating - remembering the past / predicting the future Code unobfuscation is clearly one of those difficult inverse problems, as it can be easily exacerbated by any of the following pr…

Of course, it is not generalizable! In my experience though, most minifiers do only the following: - Whitespace removal, which is trivially invertible. - Comment removal, which we never expect to recover via unminification. - Renaming to shorter names, which is tedious to track but still mechanical. And most minifiers have little understanding of underlying types anyway, so they are usually very conservative and rare…

> - Comment removal, which we never expect to recover via unminification.

ChatGPT is quite good at adding meaningful comments back to uncommented code, actually.

Paste some code and add "comment the shit out of this" as a prompt.

Re: OpenAI is good at unminifying code

#302
post #271

JS minification is fairly mechanical and comparably simple, so the inversion should be relatively easy. It would be of course tedious enough to be manually done in general, but transformations themselves are fairly limited so it is possible to read them only with some notes to track mangled identifiers. A more general unminification or unobfuscation still seems to be an open problem. I wrote handful of programs that…

The act of reducing the length of variable names by replacing something descriptive (like "timeFactor") with something much shorter ("i") may be mechanical and simple, but it is destructive and reversing that is not relatively easy; in fact, its impossible to do without a fairly sophisticated understanding of what the code does. That's what the LLM did for this; which isn't exactly surprising, but it is cool; being s…

I never meant to be dismissive, in fact my current job is to build a runtime for ML accelerator! I rather wanted to show that unminification is much easier than unobfuscation, and that the SOTA model is yet to do the latter.

Also, it should be noted that the name reconstruction is not a new problem and was already partly solved multiple times before the LLM era. LLM is great in that it can do this without massive retraining, but the reconstruction depends much on the local context (which was how earlier solutions approached the problem), so it doesn't really show its reasoning capability.

Re: OpenAI is good at unminifying code

#303

Earlier quoted context omitted.

I would say the actual difficulty greatly varies. It is generally easy if you have a good guess about what the code would actually do. It would be much harder if you have nothing to guess, but usually you should have something to start with. Much like debugging, you need a detective mindset to be good at reverse engineering, and name mangling is a relatively easy obstacle to handle in this scale. Let me give some con…

I believe the person you're responding to is saying that it's hard to do automated / programmatically. Yes a human can decode this trivial example without too much effort, but doing it via API in a fraction of the time and effort with a customizable amount of commentary/explanation is preferable in my opinion.

Indeed that aspect was something I failed to get initially, but I still stand by my opinion because most of my reconstruction had been local. Local "reasoning" can be often done without the actual reasoning, so while it's great that we can automate the local reasoning, it falls short of the full reasoning necessary to do the general unobfuscation.

Re: OpenAI is good at unminifying code

#305

I'm sure there's some number greater than zero of developers who are upset because they use minification as a means of obfuscation. Reminds me of the tool that was provided in older versions of ColdFusion that would "encrypt" your code. It was a very weak algorithm, and didn't take long for someone to write a decrypter. Nevertheless some people didn't like this, because they were using this tool, thinking it was safe…

I bet there's some kind of use case/arms race soon to happen, like this:

Website offers some kind of contest which is partly dependent on obfuscated client side code.

Clever contestants can now through it into ChatGPT to improve their chances.

Now, it begins.

Re: OpenAI is good at unminifying code

#306

Earlier quoted context omitted.

"pretty motivated"? Did you mean biased?

I assume they meant motivated as shorthand for "motivated reasoning" which implies a bias that's motivating them to reason a certain way

Oh, interesting -- that's a new one for me.

Re: OpenAI is good at unminifying code

#307
post #267

Earlier quoted context omitted.

How well does it compare to the original un-minified code if you compare it against minify + humanify. Would be neat if it can improve mediocre code.

On structural level it's exactly 1-1: HumanifyJS only does renames, no refactoring. It may come up with better names for variables than the original code though.

Can it guarantee 1-1? Doesn't Javascript allow looking up fields using a string name? That string could be computed in a complex manner.

Re: OpenAI is good at unminifying code

#308
Slightly off-topic but I remain perplexed at how "minified" Javascript is acceptable to software developers commenting online but terse code in any other language, e.g., one letter variable names, is unacceptable to a majority of software developer online commenters.

Re: OpenAI is good at unminifying code

#309
LLMs are great for self-contained boring tasks; recently I have started to refactor ruby tests with a simple prompt (getting rid of various rspec syntax in favor of more explicit notation at cost of code duplication - so kinda like unminifying things I guess) - works _ridiculously_ good as well

Re: OpenAI is good at unminifying code

#310

Earlier quoted context omitted.

Abstract functions are fully representable by function approximations in the limit n->inf; ie., sampling from a circle becomes a circle as samples -> infinity. This makes all "studies" whose aim is to approximate a fully representable abstract mathematical domain irrelevant to the question. This is just more evidence of the naivety, mendacity, and pseudoscientific basis of ML and its research.

...I see...

As you sample all pixels from all photos on a mountain, the pixels don't become the mountain.

The structure of a mountain is not a pattern of pixels. So there is no function for a statistical alg to approximate, no n->infinity which makes the approximation exact.

By sampling from historical pixel patterns in previous images you can generate images in a pixel order that makes sense to a person already acquainted with what they represent. Eg., having seen a mountain (, having perspective, colour vision, depth, counterfactual simulation, imagination, ...).

In all these disagreeably dumb research papers that come out showing "world models" and the like you have the bad mathematicians and bad programmers called "AI researchers" giving a function approximation alg an abstract mathematical domain to approximate.

ie., if the goal is to "learn a circle" and you sample points from a circle, your approximation becomes exact in n->inf, because the target is *ABSTRACT*.

It's so dumb its kinda incomprehensible. It shows what a profound lack of understanding of science is rampent across the discipline.

MNIST, Games, Chess, Circles, Rulesets, etc. are all mathematical objects (shapes, rules). It is trivial to find a mathematical approximation to a mathematical object.

The world is not made out of pixels. Models of pixel patterns are not their targets.

Post reply on HN