Rendered at 09:38:13 GMT+0000 (Coordinated Universal Time) with Cloudflare Workers.
derf_ 2 days ago [-]
It is surprisingly easy to get unexpected negative values with floating point operations. One I remember was a square root that was failing on a negative argument despite that argument being clamped against zero. The problem was that the clamp was using some macros
#define MIN(a, b) ((a) < (b) ? (a) : (b))
#define MAX(a, b) ((a) < (b) ? (b) : (a))
and the arguments were being clamped with MAX(x, 0). Well, if x is negative zero, it is not less than 0, so the macro returns x. The square root then looks at the sign bit and fails. Negative zero is a perfectly possible result from a series of calculations that destructively cancel.
n923263 2 days ago [-]
> The square root then looks at the sign bit and fails.
Every FP standard I know of that has negative zero requires that sqrt(-0) == 0. Eg (IEEE754-2008, probably the most popular and I don't have a PDF for 1985 or whatever):
> The operation squareRoot(x) computes √ x. It has a positive sign for all operands ≥ 0, except that squareRoot(−0) shall be −0.
> [Invalid operation if] g) squareRoot if the operand is less than zero [emphasis added]
So that's a clear-cut compiler / FP library bug.
setopt 2 days ago [-]
Wait, sqrt(-0) is defined as -0 and not +0? Isn’t that surprising behavior?
n923263 1 days ago [-]
+0 would also be annoying - there's not really a good answer here.
A result of -0.0 can mean two things (not counting it just being wrong):
a: the real (as in number) result is exactly zero, with a negative sign by coincidence (eg (1-1)/(0-1)).
b: the real result is strictly less than zero, but even tinier than the smallest denormal, so it was rounded up to zero.
Case (a) means you must have sqrt(-0) == 0, or you get problems like derf_'s.
In case of case (b), having a square root be negative (impossible!) is the best indication we can squeeze in that something might be weird.
contravariant 1 days ago [-]
I mean either way sqrt(-0)^2 fails to equal -0, so both option are annoying.
The real answer would be something like 0i, but that's not available.
pwdisswordfishq 1 days ago [-]
Why not −0i?
contravariant 1 days ago [-]
It's customary to use the branch cut where sqrt(-1) = i.
Honestly it doesn't really matter but that's because you can't actually tell i and -i apart.
AnimalMuppet 1 days ago [-]
Because i is not a meaningful concept in floating point numbers.
setopt 1 days ago [-]
Next time we revise the floating point standard, we should add an "i bit" :)
lr1970 17 hours ago [-]
> It is surprisingly easy to get unexpected negative values with floating point operations.
This why one should NEVER compute variance as difference of E(x^2) - (E(x))^2. Mathematically with infinite precision it is the same as E((x-E(x))^2) but in floating point arithmetic one can easily get negative variance when subtracting two floating numbers.
sva_ 2 days ago [-]
Interesting choice to post bug reports to arxiv now? Pretty significant finding though if true.
They didn't really show any real world impacts - maybe in distillation? And what impact using logits throughout would have?
This seems like an engineering tradeoff decision and each of their changes they haven't quantified it - how much slower does each change give you for an effect in the simulated/real world?
Could you just cast things to float64 and call it a day?
divyekapoor 2 days ago [-]
The issue is a nice find and the fix is comprehensive. They left nothing to comment about. :D
carterschonwald 2 days ago [-]
lol , in august i found and upstreamed a gnarly pytorch miscompilatio read write corruption that would cause 100x relative error in gradients if your tensor dimensions arent a multiple of a large power of 2. granted everyone seems to pick powers of two usually
tomrod 2 days ago [-]
Isn't open source awesome?
About a decade ago, I found a ton of "mistakes" (with legacy discussions I was unaware of at the time) that affected SciPy modules for things like hamming and jaccard. Was totally different than the intended mathematical definitions!
lhk931122 1 days ago [-]
I'm not sure why this topic blew up. For a long time I've gotten negative values a lot when using the KL div loss, so I had 0 clipping + epsilon on it? But back then I was working in float32 so I didn't care, but if you do a lot of work with fewer bits like these days, I think it could get kind of critical.
lambda 2 days ago [-]
What a weird way to submit a bug report and patch: publishing an AI generated preprint. Seems like a pull request would be a better way to handle this?
bobmarleybiceps 2 days ago [-]
it is sort of surprising how many parts of pytorch seem (sort of) buggy / numerically not great... I think they just have sooo many operations that some are (relatively) unused and don't receive as much attention. (though kl-divergence seems pretty important (??))
I wonder if it's also because ML stuff is just pretty insensitive to numerical issues, so users don't notice it.
thenickdude 2 days ago [-]
I'm reminded of this article that explains that the realities of floating point numbers can introduce non-linearity into an otherwise linear neural network:
I've been using pytorch since the beginning, and it's pretty rare that I'd reach for the inbuilt KL-divergence. Not because I don't use it, but because there are so many ways to evaluate it, and I'll often hand-roll the one that seems easiest given the project. I suspect others would do the same thing.
And yeah, ML is pretty resistant to this sort of bug.
PaulKeeble 2 days ago [-]
Its really buggy with a mix of devices especially when they aren't all CUDA. I have run into a lot of problems just having an AMD card in the machine even if I am not trying to use it! Image creation and editting has been broken ever since I added a 9070 XT to my PC, its mere presence is enough to break pytorch for anything image related.
big-chungus4 2 days ago [-]
What other parts of pytorch are buggy?
bobmarleybiceps 2 days ago [-]
"buggy" probably is probably too strong of a word. Maybe "weird edge cases in ops that aren't commonly used" is more accurate.
Like I think L-BFGS has less support than the other optimizers, since no one really uses it on large models. But its implementation could have been improved a lot for people who do use it on small models. (IDK stuff is probably better now with AI-assisted dev vs. when I last looked)
Der_Einzige 2 days ago [-]
So obvious this entire paper was generated by Claude. That's good in terms of the epistemological correctness of the claim being higher than it was historically (lots of lies before AI agents in research), but it's infuriating to notice this from literally the first sentence "A KL divergence is never negative..."
I really, REALLY want whoever at Anthropic is okay with the tiny pool of annotators that their model is way WAY too over RL'd on to reincarnate into a durian fruit or something.
I don't care that the author used AI to write something. I do care that the ensuing prose is really crappy.
knollimar 2 days ago [-]
Performative negatives drive me wild. I don’t want the models telling me what they didn’t do, ESPECIALLY if I told them not to do it already, and especially in place of due diligence with a hedge about the token steps it took to nominally comply
ameliaquining 2 days ago [-]
My vague understanding is that making LLMs not sound like LLMs is basically an unsolved technical problem, and not for lack of trying.
I wonder if a diffusion strategy would produce less llm-ey prose. I suspect what the llm is doing is it's picking a "generally common" token (e.g. "not" after "it's") and then it's only way out is to llm speak
(It's not <x>, it's <y>)
The system is sort of trapped by its causal mask
CuriouslyC 2 days ago [-]
Pangram has some sort n-gram sliding window that identifies clusters of n-grams that are statistically more likely to be common AI models than human. You can fix it just with a different sampling algorithm that re-weights the next token distribution to avoid common llm-isms.
I personally think it’s kinda a dumb premise: models write like this because in many cases they lack true understanding of the meaningful aspects of a problem. If models had true understanding, then you could tell them to write succinctly, specifically, and pragmatically and then they’d produce the sorts of beautiful explanations one finds in good textbooks, or well-abstracted/architected large systems. Translating the ineffable remains difficult. RL will continue to be used to attempt alignment though
ameliaquining 1 days ago [-]
I don't think this can be it, because LLMs still write like LLMs even on nontechnical topics, and on topics simple enough that understanding is not in question.
munchler 2 days ago [-]
I don’t understand. What about that sentence is crappy or indicative of AI slop?
marginalia_nu 2 days ago [-]
The double negation GP highlights is a bit awkward, and the initial sentence restates the title of the paper. To be honest I'm not sure the alternative would flow better in this case.
The abstract at least doesn't really set off my claudar. "The sign is only the visible part of a silent failure." is the one sentence that does give a bit of a reading. But you also have sentence (fragments) like "With the repaired code they all but vanish." which feels disconnected and is worse prose than current AI models would output. If the paper itself has been authored by an AI model, my guess it has undergone human revisions.
munchler 2 days ago [-]
Can the value legitimately be 0? If so, then “always positive” would be incorrect and “always non-negative” would be even more awkward.
marginalia_nu 2 days ago [-]
Yeah I'm kind of landing in the same place, "greater than or equal to zero" doesn't really flow either. The two negations are in two different senses so I'd probably leave it as it is.
zem 2 days ago [-]
huh, I read the title as a humorous way to point out a flaw in pytorch, like "look, you can calculate your way into a literal impossibility here". I thought it was a great title.
seanhunter 2 days ago [-]
There’s nothing wrong with that sentence. The KL divergence is indeed never negative, and it’s perfectly fine to say it that way. The more idiomatic way to say it in maths is even more awkward which is that the KL divergence is always non-negative.
Luc 2 days ago [-]
Next sentence:
"The sign is only the visible part of a silent failure."
Ugh.
Pangram detects the abstract as 100% AI.
BigTTYGothGF 2 days ago [-]
> I do care that the ensuing prose is really crappy
The prose is awful, but that's the bed ML made, and now they should lie in it.
fluxem 2 days ago [-]
Here we go, a slop paper for a contrived problem. They assume two near identical distributions, which is never the case in real training
Every FP standard I know of that has negative zero requires that sqrt(-0) == 0. Eg (IEEE754-2008, probably the most popular and I don't have a PDF for 1985 or whatever):
> The operation squareRoot(x) computes √ x. It has a positive sign for all operands ≥ 0, except that squareRoot(−0) shall be −0.
> [Invalid operation if] g) squareRoot if the operand is less than zero [emphasis added]
So that's a clear-cut compiler / FP library bug.
A result of -0.0 can mean two things (not counting it just being wrong):
a: the real (as in number) result is exactly zero, with a negative sign by coincidence (eg (1-1)/(0-1)).
b: the real result is strictly less than zero, but even tinier than the smallest denormal, so it was rounded up to zero.
Case (a) means you must have sqrt(-0) == 0, or you get problems like derf_'s.
In case of case (b), having a square root be negative (impossible!) is the best indication we can squeeze in that something might be weird.
The real answer would be something like 0i, but that's not available.
Honestly it doesn't really matter but that's because you can't actually tell i and -i apart.
This why one should NEVER compute variance as difference of E(x^2) - (E(x))^2. Mathematically with infinite precision it is the same as E((x-E(x))^2) but in floating point arithmetic one can easily get negative variance when subtracting two floating numbers.
They didn't really show any real world impacts - maybe in distillation? And what impact using logits throughout would have?
This seems like an engineering tradeoff decision and each of their changes they haven't quantified it - how much slower does each change give you for an effect in the simulated/real world?
Could you just cast things to float64 and call it a day?
About a decade ago, I found a ton of "mistakes" (with legacy discussions I was unaware of at the time) that affected SciPy modules for things like hamming and jaccard. Was totally different than the intended mathematical definitions!
I wonder if it's also because ML stuff is just pretty insensitive to numerical issues, so users don't notice it.
https://openai.com/index/nonlinear-computation-in-deep-linea...
In this case, the "bug" actually allows the neural net to be more powerful than designed.
And yeah, ML is pretty resistant to this sort of bug.
Like I think L-BFGS has less support than the other optimizers, since no one really uses it on large models. But its implementation could have been improved a lot for people who do use it on small models. (IDK stuff is probably better now with AI-assisted dev vs. when I last looked)
I really, REALLY want whoever at Anthropic is okay with the tiny pool of annotators that their model is way WAY too over RL'd on to reincarnate into a durian fruit or something.
I don't care that the author used AI to write something. I do care that the ensuing prose is really crappy.
Pangram, for what it's worth, thinks the paper is a mix of human and AI, though it's possible it could be getting tripped up by the formatting: https://www.pangram.com/history/4df21841-c6cb-4345-9a5b-8a68...
(It's not <x>, it's <y>)
The system is sort of trapped by its causal mask
I personally think it’s kinda a dumb premise: models write like this because in many cases they lack true understanding of the meaningful aspects of a problem. If models had true understanding, then you could tell them to write succinctly, specifically, and pragmatically and then they’d produce the sorts of beautiful explanations one finds in good textbooks, or well-abstracted/architected large systems. Translating the ineffable remains difficult. RL will continue to be used to attempt alignment though
The abstract at least doesn't really set off my claudar. "The sign is only the visible part of a silent failure." is the one sentence that does give a bit of a reading. But you also have sentence (fragments) like "With the repaired code they all but vanish." which feels disconnected and is worse prose than current AI models would output. If the paper itself has been authored by an AI model, my guess it has undergone human revisions.
"The sign is only the visible part of a silent failure."
Ugh.
Pangram detects the abstract as 100% AI.
The prose is awful, but that's the bed ML made, and now they should lie in it.