Live data from Hacker News

OpenAI is good at unminifying code

glama.ai

171–180 of 321 posts

Re: OpenAI is good at unminifying code

#171
post #150

Earlier quoted context omitted.

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…

I feel you’re downplaying the obfuscatory power of name-mangling. Reversing that (giving everything meaningful names) is surely a difficult problem?

JSNice[1] is an academic project that did a pretty good job of this in the 2010s and they give some pointers on how it is accomplished[2].

[1]: http://jsnice.org/

[2]: https://www.sri.inf.ethz.ch/jsnice

Re: OpenAI is good at unminifying code

#172

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…

Yep, I've tried to use LLMs to disassemble and decompile binaries (giving them the hex bytes as plaintext), they do OK on trivial/artificial cases but quickly fail after that.

Re: OpenAI is good at unminifying code

#173
post #153
post #147

Earlier quoted context omitted.

> reading a comment is almost always faster than reading blocks of code Not to a competent programmer when reading well-written code. This also means that you read what the code does, rather than what a comment says the code does. Otherwise you will be blind to bugs. Any experienced developer will tell you that code very often doesn't do what the original programmer thought it did.

> Not to a competent programmer when reading well-written code. No, literally reading a one line about what the next 4 lines do is mechanically faster. It does not matter that you are good or bad, it is about simple reading speed. > This also means that you read what the code does, rather than what a comment says the code does. Otherwise you will be blind to bugs. Any experienced developer will tell you that code ver…

> For me, this type of thinking that comment are unnecessary, that competent ppl can just read the code, etc. is actually a sign of younger dev who never had to work on a long-lived codebase.

It sounds like you're conflating "helpful comments that explain why" with "no comments are needed ever because read the code", and we're talking past each other.

Re: OpenAI is good at unminifying code

#174
post #134

Earlier quoted context omitted.

More tools should be built on ASTs, great work! I'm still waiting for the AST level version control tbh

Unison supposedly has an AST-aware version control system: https://www.unison-lang.org/

Wow this looks so cool.

Re: OpenAI is good at unminifying code

#175

Earlier quoted context omitted.

There is a certain justice in the use of OpenAI as a name for their product, given that OpenAI has turned the generic technical GPT name into a brand.

GPT is not a brand. A court ruling turned down that notion. It's a technology.

That only means it’s not a legally recognised brand, but it is a brand nonetheless if people associate the two (and they do). A bit like the way people associate tissue paper with Kleenex, or photocopies with Xerox, or git with GitHub.

Re: OpenAI is good at unminifying code

#176

Earlier quoted context omitted.

All jokes aside, I've never heard anyone call vacuuming hoover. I wonder if that was a older statement?

I've also never heard anyone call photocopying "xeroxing". I'm guessing maybe it's an age thing.

It depends on the region. In certain countries Gillette is used for any shaving razor.

Re: OpenAI is good at unminifying code

#177

Earlier quoted context omitted.

All jokes aside, I've never heard anyone call vacuuming hoover. I wonder if that was a older statement?

I've also never heard anyone call photocopying "xeroxing". I'm guessing maybe it's an age thing.

growing up in India over past 4 decades .. 'Xerox' was/is the default and most common word used for photocopying ... only recently have I started using/hearing the term 'photocopy'.

every town and every street had "XEROX shops" where people went to get various documents photocopied for INR 1 per page for example

Most photocopy centers are still called XEROX Shops -- and their boards say that in big bold text: https://www.google.com/search?q=xerox+shop+india&udm=2

It doesnt matter if they use Canon, HP, or other brands of machines

Re: OpenAI is good at unminifying code

#178
post #97

Author of HumanifyJS here! I've created specifically a LLM based tool for this, which uses LLMs on AST level to guarantee that the code keeps working after the unminification step: https://github.com/jehna/humanify

Thanks for your tool. Have you been able to quantify the gap between your local model and chatgpt in terms of ‘unminification performance’?

Re: OpenAI is good at unminifying code

#179
post #91

>I apologize, GPT-4, for mistakenly accusing you of making mistakes. I am testing large language models against a ground truth data set we created internally. Quite often when there is a mismatch, I realize the ground truth dataset is wrong, and I feel exactly like the author did.

Apologizing to a program seems rather silly though. Do you apologize to your compiler when you have a typo in your code, and have to make it do all that work again?

If the compiler could listen and update its functions based on the tone of what I said to it, yes I probably would.
Post reply on HN