Live data from Hacker News

OpenAI is good at unminifying code

glama.ai

191–200 of 321 posts

Re: OpenAI is good at unminifying code

#191
post #68

Earlier quoted context omitted.

Better Hoover it up!

I got hurt doing it so applied some Bandaids.

Don't say Velcro!

https://www.youtube.com/results?search_query=don't+say+velcr...

(Content warning: profanity. This search page is SFW, but the videos it links to may not be.)

Re: OpenAI is good at unminifying code

#192
post #135

Earlier quoted context omitted.

>>ChatGPT is trained well enough on all things AWS It was scary to me how to chatting with GPT or Claude would give me information which was a lot more clear than what I could deduce after hours of reading AWS documentation. Perhaps, the true successor to Google search has arrived. One big drawback of Google was asking questions that can't be converted to a full long conversation. To that end. LLM chat is the ultimat…

ChatGPT is phenomenal for trying new techniques/libraries/etc. It's very good at many things. In the past few weeks I've used it to build me a complex 3D model with lighting/etc with Three.JS, rewrote the whole thing into React Three Fiber (also with ChatGPT), for a side project. I've never used Three.JS before and my only knowledge of computer graphics is from a class I took 20 years ago. For work I've used it to wr…

And we are still at the beginning of this. Some what like where Google search was in early 2000s.

As IDE integration grows and there are more and better models, that can do this better than ever. We will unlock all sort of productivity benefits.

There is still skepticism about making these work at scale, with regards to both electricity and compute requirement for the larger audience. But if they can get this to work, we might see a new era tech boom way bigger than we have seen anything before.

Re: OpenAI is good at unminifying code

#193

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…

As a point of order Code Minification != Code Obfuscation. Minification does tend to obfuscate as as side effect, but it is not the goal, so reversing minification becomes much easier. Obfuscation on the other hand can minify code, but crucially that isn't the place it starts from. As the goal is different between minificaiton and obfuscation reversing them takes different efforts and I'd much rather attempt to rever…

Yeah, having run some state of the art obfuscated code through ChatGPT, it still fails miserably. Even what was state of the art 20 years ago it can't make heads or tails of.

Re: OpenAI is good at unminifying code

#194
post #184

This might be fun: Train on java compiled to class files. Then go from class back to java. Or even: Train java compiled to class files, and have separate models that train from Clojure to class and Scala to class files. Then see if you can find some crufty (but important) old java project and go: crufty java -> class -> Clojure (or Scala). If you could do the same with source -> machine instructions, maybe COBAL to C…

I agree, it is fun!

LLM source recovery from binaries is thing. The amazing part is that they are pretty good at adding back meaningful variable names to the generated source code.

Re: OpenAI is good at unminifying code

#195
post #12

LLMs are excellent at text transformation. It's their core strength and I don't see it being used enough.

It’s not only their core strength — it’s what transformers were designed to do and, arguably, it’s all they can do. Any other supposed ability to reason or even retain knowledge (rather than simply regurgitate text without ‘understanding’ its intended meaning) is just a side effect of this superhuman ability.

Hinton claims they do reason. I am going to go with Hinton on this.

Re: OpenAI is good at unminifying code

#196
That's an interesting finding so far!

> The provided code is quite complex, but I'll break it down into a more understandable format, explaining its different parts and their functionalities.

Reading the above statement generated by ChatGPT, I asked myself: Will we live to the day where these LLMs could take a large binary executable as input, read it, analyze it, understand it, then reply with the above statement?

> I followed up asking to "implement equivalent code in TypeScript and make it human readable" and got the following response.. To my surprise, the response is not only good enough, but it is also very readable.

What if this day came and we can ask these LLMs to rewrite the binary code in [almost] any programming language we want? This would be exciting, yet scary to just think about!

Re: OpenAI is good at unminifying code

#197
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

What kind of question does it ask the LLM? Giving it a whole function and asking "What should we rename ?" repeatedly until everything has been renamed?

Asking it to do it on the whole thing, then parsing the output and checking that the AST still matches?

Re: OpenAI is good at unminifying code

#198
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

how do you make an LLM work on the AST level? do you just feed a normal LLM a text representation of the AST, or do you make an LLM where the basic data structure is an AST node rather than a character string (human-language word)?

Re: OpenAI is good at unminifying code

#199
post #165
post #146

Earlier quoted context omitted.

It's just a rule of thumb, like anything else. In most code, "why" is the hard part; I see that you are incrementing that account by a penny from out of the blue, but why? When you are in code where "what" is the hard part, like an implementation of a book algorithm or some tricky performance optimization, then by all means comment that. Really all this rule amounts to is // Increment by a penny accountValue += 1 is…

I do agree that documenting the why is way more important than the how/what. But having a short comment to summarize a block of code like: // Parse the filename and remove the extension let fext_re = Regex::new(r"(.\*)\.(.+)$").unwrap(); let page_cap = fext_re.captures(fname).unwrap(); let page_base_filename = page_cap.get(1).unwrap().as_str(); Is still useful. Instead of having to read the next few line of code, I a…

This would be entirely self-documenting by replacing that with a function named after what it does, then the comment isn't necessary.

To boot, a unit test could be written that would reveal the bug in the regular expression that makes it only work with filenames that have an asterisk before the extension. Unless you intended that (unlikely), in which case the comment is wrong/not comprehensive and misdirects the reader.

Re: OpenAI is good at unminifying code

#200
post #190

Earlier quoted context omitted.

This does seem to be a smart use of the tools available to skip the grind and get to the point of the leetcode questions. However, I wonder about this: What will you do in a live interview situation? Will you pull up ChatGPT?

I have been told by people working in $200k+/$300k+ SWE jobs to look up at the answers and just be able to regurgitate something along the lines of the Grind 75 answers as a first step. As a next step - even within these 75 questions, Grind 75's eighth answer and fourteenth answer are answered essentially the same way, as are other questions in there. So the next step would be to see these patterns (binary search, pr…

You are doing it right. Pattern matching and lightening fast regurgitation are what is needed. There isn't enough time to "solve and implement".
Post reply on HN