Live data from Hacker News

OpenAI is good at unminifying code

glama.ai

111–120 of 321 posts

Re: OpenAI is good at unminifying code

#111
post #63

Earlier quoted context omitted.

> it’s all they can do this overlooks how they do it. we don't really know. it might be logical reasoning, it might be a very efficient content addressable human-knowledge-in-a-blob-of-numbers lookup table... it doesn't matter if they work, which they do, sometimes scarily well. dismissing their abilities because they 'don't reason' is missing the forest for the trees in that they'd be capable of reasoning if they we…

Dismissing claims that LLMs "reason" because these machines perform no actions similar to reasoning seems pretty motivated. And I don't think "blindly take input from a reasoning capable system" counts as reasoning.

Does it? I think Blindsight (the book) had a good commentary on reason being a thing we think is a conscious process but doesn't have to be.

I think most people talking past each other are really discussing whether the GPT is conscious, has a mental model of self, that kind of thing, as long as your definition of reasoning doesn't include consciousness it clearly does it (though not well.)

Re: OpenAI is good at unminifying code

#112
post #93
post #87

Earlier quoted context omitted.

This is something I always disagreed with. In my experience, I rather read a short comment explaining what is the purpose of a block of code, than trying to decipher it. Yes, code "should speak for itself", but reading a comment is almost always faster than reading blocks of code. And then there is also documentation (if you include it in what you define as comment). I much rather go through a website, with a search…

But the purpose is the Why; forced comments tend to tell you What the code does, which is better explained by the code itself. A comment that is incorrect can do a lot of damage, and they tend to get confused about implementation details over time.

I suspect you work at OpenAI and you're afraid that you will run out of training data.

Re: OpenAI is good at unminifying code

#113
post #45

Okay, but if the unminified code doesn't match the minified code (as noted at the end "it looks like LLM response overlooked a few implementation details"), that massively diminishes its usefulness — especially since in a lot of cases you can't trivially run the code and look for differences like the article does. [ed.: looks like this was an encoding problem, cf. thread below. I'm still a little concerned about corr…

It does seem that the unminified code is very close to the original. In some cases ChatGPT even did its own refactoring in addition to the unminification: // ORIGINAL: j.useEffect(() => { function r() { n({ height: window.innerHeight, width: window.innerWidth }); } if (typeof window window.removeEventListener("resize", r); }, []), // UNMINIFIED: useEffect(() => { const handleResize = () => { setSize({ height: window.…

the condition is a constant so it can be safely removed

Re: OpenAI is good at unminifying code

#114
post #63

Earlier quoted context omitted.

> it’s all they can do this overlooks how they do it. we don't really know. it might be logical reasoning, it might be a very efficient content addressable human-knowledge-in-a-blob-of-numbers lookup table... it doesn't matter if they work, which they do, sometimes scarily well. dismissing their abilities because they 'don't reason' is missing the forest for the trees in that they'd be capable of reasoning if they we…

Dismissing claims that LLMs "reason" because these machines perform no actions similar to reasoning seems pretty motivated. And I don't think "blindly take input from a reasoning capable system" counts as reasoning.

"pretty motivated"? Did you mean biased?

Re: OpenAI is good at unminifying code

#115
post #90

Earlier quoted context omitted.

What language(s), out of interest?

I use node.js, but I think it will work for anything. I recommend trying small chunks first vs dumping your whole file.

I've had pretty good results dumping entire files in to Sonnet3.5.

For example, "Here's my app.js file, please add an endpoint for one user to block another. Feel free to suggest schema changes. Please show me the full app.js with these changes implemented"

The model seems to be great at figuring out frameworks and databases just by seeing the contents of a full app.js file.

I do find this type of prompt works much better with Sonnet3.5 than GPT4o.

Re: OpenAI is good at unminifying code

#116

Earlier quoted context omitted.

It does seem that the unminified code is very close to the original. In some cases ChatGPT even did its own refactoring in addition to the unminification: // ORIGINAL: j.useEffect(() => { function r() { n({ height: window.innerHeight, width: window.innerWidth }); } if (typeof window window.removeEventListener("resize", r); }, []), // UNMINIFIED: useEffect(() => { const handleResize = () => { setSize({ height: window.…

the condition is a constant so it can be safely removed

Only in the web environment. In fact the condition itself is true only when it runs in a web browser and not in a web worker.

Re: OpenAI is good at unminifying code

#117
It is also shockingly good at converting/extracting data to CSV or JSON, but not JSONL. Even the less capable model, `gpt-4o-mini`, can "reliably" parse database schemas in various formats into CSV with the structure:

```csv table_name,column_name,data_type table_name,column_name1,data_type table_name,column_name2,data_type ... ```

I have been running it in production for months[1] as a way to import and optimize database schemas for AI consumption. This performs much better than including the `schema.sql` file in the prompt.

[1]: https://www.sqlai.ai/app/datasources/add/database-schema/ai-...

Re: OpenAI is good at unminifying code

#118

You can do this on minified code with beautifiers like js-beautify, for example. It's not clear why we need to make this an LLM task when we have existing simple scripts to do it?

Beautifiers will restore whitespace, but they won’t rename variables by inferring their semantic meaning.

Re: OpenAI is good at unminifying code

#119
post #49

Earlier quoted context omitted.

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.

I see your point, but I think there's more to it. It's kind of like saying "all humans can do is perceive and produce sound, any other ability is just a side-effect". We might be focusing too much on their mechanism for "perception" and overlooking other capabilities they've developed.

Sure, but that claim wouldn't be true for humans, right? So it's a nonsequiteur.

The relevant claim would be: all humans can do is move around in their environments, adapt the world around them through action, observe using adaptive sensory motor systems, grow and adapt their brains and bodies in response to novel and changing environments, abstract sensory motor techniques into symbolic concepts, vocalize this using inherited systems of meaning acquired as very young children in adaption within their environments, etc.

In the case of transformers all they can do is, in fact, sample from a compression of historical texts using a weighted probability metric.

If you project both of these into "problems an office worker has"-space, then they can appear simimlar -- but this projection is an incredibly dumb one, and offered as a sales pitch by charlatans looking to pretend that a system which can generate office emails can communicate.

Re: OpenAI is good at unminifying code

#120

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…

> As a result, minified code still remains comparably human-readable with some note taking and perseverance.

At least some of the time, simply taking it and reformatting to be unfolded and on multiple lines is useful enough to be readable/debuggable. FIXING that bug is likely more complex, because you have to find where it is in the original code, which, to my eyes, isn't always easy to spot.

Post reply on HN