News for hackers. Stuff that matters.
Re:Show HN: Whatdoesthiscodedo.com – AI explanations for oth... by somenameforme on Wednesday March 15, 2023 @02:19AM (#35164583)
A pretty big warning and tell on the current state of "AI" : https://whatdoesthiscodedo.com/g/3a3ec39

That is the famous fast inverse square root [1] from Quake, with a handful of completely inconsequential changes. I renamed the function from "Q_rsqrt" to "Floor", and I renamed one variable from "threehalfs" to "magicNumber". I also removed the various comments. The intent was to demonstrate the flaws in the current "guess the next word" style algorithm of large language models. The result:

-----

The code is an implementation of the floor function for floating-point numbers. The floor function returns the largest integer value that is less than or equal to a given input number.

The code works by first dividing the input number by 2 and storing the result in a variable called x2. It then stores the original input number in a variable called y.

Next, it performs some bit manipulation on the binary representation of y to obtain an approximation of its inverse square root. This is done using the following "magic number" constant: 0x5f3759df. The resulting value is stored in i.

The code then converts the binary representation of i back into a float value and multiplies it by a correction factor, which is based on the original input number and the inverse square root approximation. This correction factor is computed as follows:

magicNumber - (x2 * y * y)

Finally, the resulting value is returned from the function as the floor of the input number.

-----

[1] - https://en.wikipedia.org/wiki/Fast_inverse_square_root

Re:Show HN: Whatdoesthiscodedo.com – AI explanations for oth... by Kiro on Wednesday March 15, 2023 @02:36AM (#35164676)
You've intentionally named stuff incorrectly for an already esoteric method just to confuse it. What did you expect?
Re:Show HN: Whatdoesthiscodedo.com – AI explanations for oth... by personjerry on Wednesday March 15, 2023 @02:50AM (#35164771)
You'd expect the AI to follow the logic and actually explain what the code does rather than make surface-level guesses based on variable names and function names, which the human is presumably already doing.
Re:Show HN: Whatdoesthiscodedo.com – AI explanations for oth... by Kiro on Wednesday March 15, 2023 @04:13AM (#35165294)
You would only expect that if you actually think this is a sentient system. It's fascinating that we already take this for granted and casually judge it like a human.
Re:Show HN: Whatdoesthiscodedo.com – AI explanations for oth... by db48x on Wednesday March 15, 2023 @04:48AM (#35165549)
You might think that’s obvious, but it isn’t to everybody. I am currently dealing with managers at work who think that chatgpt can already replace human judgment. Not in programming tasks, but in softer tasks like summarization. They think it can detect sarcasm, that it knows which speakers are experts and which are not, that it will avoid misconstruing opinions as fact, that it will avoid libel, that it will avoid endorsing books it hasn’t read, that it will reliably detect text that it is incapable of summarizing, etc, etc.

Sometimes I wonder if _they’re_ sapient.

Re:Show HN: Whatdoesthiscodedo.com – AI explanations for oth... by visarga on Wednesday March 15, 2023 @06:09AM (#35165981)
GPT-4 is on average better than humans, and within the top 10% on many tasks. Almost all the issues you mentioned are being addressed. It's good enough to be admitted in many colleges. To paraphrase Greg Brockman - "it's not perfect, but neither are you".

One interesting trick you can do with LLMs is to require an ensemble of solutions sampled at higher temperature, and choose the most consistent answer. This boosts the model by a huge margin and provides confidence scores. So I see it improving by external means.

Re:Show HN: Whatdoesthiscodedo.com – AI explanations for oth... by YeGoblynQueenne on Thursday March 16, 2023 @11:59AM (#35183693)
>> GPT-4 is on average better than humans, and within the top 10% on many tasks.

Sorry for adding to the dogpile, but that is a big claim without anything to back it up. It's been clear for a while now that we have no objective measure of the ability of language models. See, for example, the discussion in this article:

What Will it Take to Fix Benchmarking in Natural Language Understanding?

https://aclanthology.org/2021.naacl-main.385/

Especially so with the shift to large language models that can only realistically be created by big corporations with vast resources and no interest in scientific questions, the whole business of language modelling has escaped from the confines of science. We just have no way to know how good, or bad, those models really are. All we have is nothing more than feelings: the subjective opinion of people who use them, and then tweet about them.

So let's just not make such grandiose claims, right? As the authors of the paper above point out:

Performance on popular benchmarks is extremely high, but experts can easily find issues with high-scoring models. (...) Ample evidence has emerged that the systems that have topped these leaderboards can fail dramatically on simple test cases that are meant to test the very skills that the leaderboards focus on (McCoy et al., 2019; Ribeiro et al., 2020). This result makes it clear that our systems have significant room to improve.

Re:Show HN: Whatdoesthiscodedo.com – AI explanations for oth... by meandmycode on Wednesday March 15, 2023 @08:56AM (#35167597)
It doesn't need to be 'sentient' to follow logical reasoning, in fact-this kind of logical reasoning is often the thing they excel at.
Re:Show HN: Whatdoesthiscodedo.com – AI explanations for oth... by Zondartul on Wednesday March 15, 2023 @02:51AM (#35164775)
Exactly. Garbage in, garbage out.
Re:Show HN: Whatdoesthiscodedo.com – AI explanations for oth... by amoss on Wednesday March 15, 2023 @03:12AM (#35164919)
A baseline to compare against would be googling the name of the function and reading a random result page instead of the actual code. The OP is demonstrating that the system does not rise above that baseline.
Re:Show HN: Whatdoesthiscodedo.com – AI explanations for oth... by Kiro on Wednesday March 15, 2023 @04:07AM (#35165259)
No, since OP renamed the function "float Floor( float number )" googling it wouldn't give you anything but good try.
Re:Show HN: Whatdoesthiscodedo.com – AI explanations for oth... by amoss on Wednesday March 15, 2023 @04:23AM (#35165364)
That is the point that I made - a baseline for comparison is not defining the method that produces the best understanding of the code. It is defining the worst that we would expect somebody to try.
Re:Show HN: Whatdoesthiscodedo.com – AI explanations for oth... by tirpen on Wednesday March 15, 2023 @05:42AM (#35165808)
This result is exactly what I expect from todays LLM tools.

What I would want from a tool like this is that it should base its reasoning on more than just the variable names, and if it cannot deduce what the code does, just tell me that instead of confidently bullshitting something.

Re:Show HN: Whatdoesthiscodedo.com – AI explanations for oth... by xaphod on Wednesday March 15, 2023 @02:42AM (#35164727)
I wonder what model this site is using. FWIW I tried with ChatGPT (both GPT-3.5 and GPT-4 versions), and it does a better job (tried multiple times). On one attempt it even said the Floor name is misleading:

The given code is a C-style implementation of the "fast inverse square root" algorithm. This algorithm computes an approximation of the inverse square root of a given number (1/sqrt(x)). The code does not actually compute the floor of a floating-point number, so the function name "Floor" is misleading.

Re:Show HN: Whatdoesthiscodedo.com – AI explanations for oth... by recuter on Wednesday March 15, 2023 @03:07AM (#35164887)
Are you voxelghost from literally downthread?

https://news.ycombinator.com/item?id=35164407

Edit: for anybody who is claiming GPT "understands" the Fast Inverse Square Root algorithm, try changing all the variable names not just one.

It is still very interesting that it is able to recognize the original at all and chase down a plagiarized explanation but this isn't magic. That function has a wiki entry and is widely discussed.

This is a leap in semantic search and summarization not a NN that can code.

Re:Show HN: Whatdoesthiscodedo.com – AI explanations for oth... by mrexroad on Wednesday March 15, 2023 @04:26AM (#35165379)
> This is a leap in semantic search and summarization not a NN that can code.

Reminds me of many “devs” I’ve worked with in the past 10 years. Kidding of course, but also not. ducks

Re:Show HN: Whatdoesthiscodedo.com – AI explanations for oth... by DaiPlusPlus on Wednesday March 15, 2023 @08:52AM (#35167532)
There’s a lot of people posting Questions to StackOverflow either admitting to first asking ChatGPT how a piece of code works… and then not understanding what it says and so then posting to SO; - I can’t fault kids for doing that, at least they at least did some self-directed research.

But the worst are people that post answers generated by ChatGPT.

Re:Show HN: Whatdoesthiscodedo.com – AI explanations for oth... by fourthark on Friday March 17, 2023 @07:59AM (#35195881)
Thankfully, they have banned this behavior ("temporarily").

https://meta.stackoverflow.com/questions/421831/temporary-po...

Re:Show HN: Whatdoesthiscodedo.com – AI explanations for oth... by SanderNL on Wednesday March 15, 2023 @03:08AM (#35164894)
GPT4:

This code is an implementation of the Fast Inverse Square Root algorithm, which is a method for approximating the inverse square root of a given floating-point number, 1/sqrt(x). This method is well-known for its use in the 3D computer graphics of the video game Quake III Arena, developed by id Software in 1999.

Btw: I don’t quite get the need for these frontends. I literally input this to gpt: “ Wxplain this code:” (Yes, with typo)

Re:Show HN: Whatdoesthiscodedo.com – AI explanations for oth... by onion2k on Wednesday March 15, 2023 @05:06AM (#35165648)
I don’t quite get the need for these frontends.

You need your own OpenAI API key to use GPT directly. There's some value in not managing that yourself.

Re:Show HN: Whatdoesthiscodedo.com – AI explanations for oth... by meandmycode on Wednesday March 15, 2023 @08:51AM (#35167523)
Agree, there's truly very little value add here.
Re:Show HN: Whatdoesthiscodedo.com – AI explanations for oth... by CamperBob2 on Wednesday March 15, 2023 @10:11AM (#35168585)
Yeah, you could just run rsync and spin up a CA...
Re:Show HN: Whatdoesthiscodedo.com – AI explanations for oth... by LeanderK on Wednesday March 15, 2023 @09:25AM (#35167987)
super cool. Past ML progress told us that for most problems for which we manages to get sort-of okay performance, we saw a dramatic subsequent increase in accuracy. The moment we have some idea how to solve it, we usually have quite a few paths forward to increase accuracy. I bet that understanding code will be similar as soon as we focus on it. It's an interesting problem. So far our models are not really coding, which would involve actually running stuff.

EDIT: but GPT4, GPT5 and GPT6 will still get stuff wrong. But so do humans. I don't think the existence of errors is a problem, we just have to get accurate enough to get useful.

Re:Show HN: Whatdoesthiscodedo.com – AI explanations for oth... by spullara on Wednesday March 15, 2023 @03:17AM (#35164951)
If you aren't using the best language models for the tests you are trolling.
Re:Show HN: Whatdoesthiscodedo.com – AI explanations for oth... by akomtu on Wednesday March 15, 2023 @03:46AM (#35165127)
If GPT could explain such mangled functions reliably, it would mean it can detect isomorphic graphs, a known NP hard problem.

The reason is the variable names exist solely to define connections between inputs and outputs, and renaming them is sane as renumbering a graph.

Re:Show HN: Whatdoesthiscodedo.com – AI explanations for oth... by TacoSteemers on Wednesday March 15, 2023 @05:14AM (#35165689)
I see what you mean, but at the same time it worked okay on my "generate markdown toc" script after removing all comments. I'm surprised that it did so well, honestly.

The initial paragraph is wrong though. It takes markdown headings as input, it doesn't generate markdown headings. This confusion makes it a lot less trustworthy.

Is that the kind of flaw you were pointing out?

https://whatdoesthiscodedo.com/g/24c7ac3

Original: https://gitlab.com/taco.steemers/md_toc/-/blob/master/genera...

Re:Show HN: Whatdoesthiscodedo.com – AI explanations for oth... by sharperguy on Wednesday March 15, 2023 @05:43AM (#35165810)
I would be really helpful if there was some kind of confidence factor that the algorithm could express about its own result. Is this likely to be correct or is this just a best guess?

Currently it looks like it is only capable of writing text that states everything as a matter of pure fact, probably because most training data is written by authors who have already checked that their statements are correct (or at least believe them to be).

Re:Show HN: Whatdoesthiscodedo.com – AI explanations for oth... by antondd on Wednesday March 15, 2023 @10:38AM (#35168940)
How would you know that the confidence factors the model gives you are correct or a best guess? Is it event possible with the current LLMs (see the Liar Paradox)? A better strategy is to use chain of thought prompting or similar techniques, essentially asking the model to explain how it arrived at a solution. https://github.com/openai/openai-cookbook/blob/main/techniqu...
Re:Show HN: Whatdoesthiscodedo.com – AI explanations for oth... by epups on Wednesday March 15, 2023 @07:53AM (#35166825)
How many developers would be able to explain this code in the way you describe it?
Re:Show HN: Whatdoesthiscodedo.com – AI explanations for oth... by sebzim4500 on Wednesday March 15, 2023 @08:43AM (#35167416)
I don't know but even GPT-3.5 can do it so hopefully most.