Readit News logoReadit News
jlebar commented on A simple way to generate random points on a sphere   johndcook.com/blog/2025/0... · Posted by u/piinbinary
nwallin · a day ago
Accept-reject methods are nonstarters when the architecture makes branching excessively expensive, specifically SIMD and GPU, which is one of the domains where generating random points on a sphere is particularly useful.

The Box-Muller transform is slow because it requires log, sqrt, sin, and cos. Depending on your needs, you can approximate all of these.

log2 can be easily approximated using fast inverse square root tricks:

    constexpr float fast_approx_log2(float x) {
      x = std::bit_cast<int, float>(x);
      constexpr float a = 1.0f / (1 << 23);
      x *= a;
      x -= 127.0f;
      return x;
    }
(conveniently, this also negates the need to ensure your input is not zero)

sqrt is pretty fast; turn `-ffast-math` on. (this is already the default on GPUs) (remember that you're normalizing the resultant vector, so add this to the mag_sqr before square rooting it)

The slow part of sin/cos is precise range reduction. We don't need that. The input to sin/cos Box-Muller is by construction in the range [0,2pi]. Range reduction is a no-op.

For my particular niche, these approximations and the resulting biases are justified. YMMV. When I last looked at it, the fast log2 gave a bunch of linearities where you wanted it to be smooth, however across multiple dimensions these linearities seemed to cancel out.

jlebar · a day ago
fastmath is absolutely not the default on any GPU compiler I have worked with (including the one I wrote).

If you want fast sqrt (or more generally, if you care at all about not getting garbage), I would recommend using an explicit approx sqrt function in your programming language rather than turning on fastmath.

jlebar commented on Running GPT-OSS-120B at 500 tokens per second on Nvidia GPUs   baseten.co/blog/sota-perf... · Posted by u/philipkiely
magicalhippo · 18 days ago
Maybe I'm especially daft this morning but I don't get the point of the speculative decoding.

How does the target model validate the draft tokens without running the inference as normal?

Because if it is doing just that, I don't get the point as you can't trust the draft tokens before they are validated, so you're still stuck waiting for the target model.

jlebar · 18 days ago
Just want to suggest: Ask an LLM about it! If you have access to a reasoning model like o3, I've found it to be very helpful.

I think this answer is as good as any of the human-generated ones in the thread so far, but the real power is that you can ask it follow-up questions. https://chatgpt.com/share/6894504f-4458-8008-a8c9-f371588259...

jlebar commented on Study mode   openai.com/index/chatgpt-... · Posted by u/meetpateltech
teiferer · a month ago
> Learning something online 5 years ago often involved trawling incorrect, outdated or hostile content and attempting to piece together mental models without the chance to receive immediate feedback on intuition or ask follow up questions.

That trained and sharpened invaluable skills involving critical thinking and grit.

jlebar · a month ago
> [Trawling around online for information] trained and sharpened invaluable skills involving critical thinking and grit.

Here's what Socrates had to say about the invention of writing.

> "For this invention will produce forgetfulness in the minds of those who learn to use it, because they will not practice their memory. Their trust in writing, produced by external characters which are no part of themselves, will discourage the use of their own memory within them. You have invented an elixir not of memory, but of reminding; and you offer your pupils the appearance of wisdom, not true wisdom, for they will read many things without instruction and will therefore seem [275b] to know many things, when they are for the most part ignorant and hard to get along with, since they are not wise, but only appear wise."

https://www.historyofinformation.com/detail.php?id=3439

I mean, he wasn't wrong! But nonetheless I think most of us communicating on an online forum would probably prefer not to go back to a world without writing. :)

You could say similar things about the internet (getting your ass to the library taught the importance of learning), calculators (you'll be worse at doing arithmetic in your head), pencil erasers (https://www.theguardian.com/commentisfree/2015/may/28/pencil...), you name it.

jlebar commented on Study mode   openai.com/index/chatgpt-... · Posted by u/meetpateltech
no_wizard · a month ago
>Now, everyone basically has a personal TA, ready to go at all hours of the day

This simply hasn't been my experience.

Its too shallow. The deeper I go, the less it seems to be useful. This happens quick for me.

Also, god forbid you're researching a complex and possibly controversial subject and you want it to find reputable sources or particularly academic ones.

jlebar · a month ago
> Its too shallow. The deeper I go, the less it seems to be useful. This happens quick for me.

You must be using a free model like GPT-4o (or the equivalent from another provider)?

I find that o3 is consistently able to go deeper than me in anything I'm a nonexpert in, and usually can keep up with me in those areas where I am an expert.

If that's not the case for you I'd be very curious to see a full conversation transcript (in chatgpt you can share these directly from the UI).

jlebar commented on Sam Altman Slams Meta’s AI Talent Poaching: 'Missionaries Will Beat Mercenaries'   wired.com/story/sam-altma... · Posted by u/spenvo
lossolo · 2 months ago
> That's a good spin but coming from someone who has an anonymous profile how do we know it's true (this is a general thing on HN people say things but you don't know how legit what they say is or if they are who they say they are).

Not only that, but how can we know if his interpretation or "feelings" about these discussions are accurate? How do we know he isn't looking through rose-tinted glasses like the Neumann believers at WeWork? OP isn't showing the missing discussion, only his interpretation/feelings about it. How can we know if his view of reality is accurate and unbiased? Without seeing the full discussion and judging for ourselves, we can't.

jlebar · 2 months ago
> How can we know if his view of reality is accurate and unbiased? Without seeing the full discussion and judging for ourselves, we can't.

I agree with that of course.

jlebar commented on Sam Altman Slams Meta’s AI Talent Poaching: 'Missionaries Will Beat Mercenaries'   wired.com/story/sam-altma... · Posted by u/spenvo
gist · 2 months ago
> I think that leaks like this have negative information value to the public.

To most people I'd think this is mainly for entertainment purposes ie 'palace intrique' and the actual facts don't even matter.

> The vast majority of what he and others say doesn't get leaked. So you're eavesdropping on a tiny portion of a conversation. It's impossible not to take it out of context.

That's a good spin but coming from someone who has an anonymous profile how do we know it's true (this is a general thing on HN people say things but you don't know how legit what they say is or if they are who they say they are).

> What's worse, you think you learned something from reading this article, even though you probably didn't, making you more confident in your conclusions when you should be less confident.

What conclusions exactly? Again do most people really care about this (reading the story) and does it impact them? My guess is it doesn't at all.

> I hope everyone here gets to have the experience of seeing HN discuss something that you're an expert in.

This is a well known trope and is discussed in other forms ie 'NY Times story is wrong move to the next story and you believe it' ie: https://www.epsilontheory.com/gell-mann-amnesia/

jlebar · 2 months ago
> coming from someone who has an anonymous profile how do we know it's true

My profile is trivially connected to my real identity, I am not anonymous here.

jlebar commented on Sam Altman Slams Meta’s AI Talent Poaching: 'Missionaries Will Beat Mercenaries'   wired.com/story/sam-altma... · Posted by u/spenvo
jlebar · 2 months ago
I think that leaks like this have negative information value to the public.

I work at OAI, but I'm speaking for myself here. Sam talks to the company, sometimes via slack, more often in company-wide meetings, all the time. Way more than any other CEO I have worked for. This leaked message is one part of a long, continuing conversation within the company.

The vast majority of what he and others say doesn't get leaked. So you're eavesdropping on a tiny portion of a conversation. It's impossible not to take it out of context.

What's worse, you think you learned something from reading this article, even though you probably didn't, making you more confident in your conclusions when you should be less confident.

I hope everyone here gets to have the experience of seeing HN discuss something that you're an expert in. It's eye-opening to see how confidently wrong most poasters are. It certainly has humbled my own reactions to news. (In this particular instance I don't think there's so much right and wrong but more that I think if you had actually been in the room for more of the conversation you'd probably feel different.)

Btw Sam has tweeted about an open source model. Stay tuned... https://x.com/sama/status/1932573231199707168

jlebar commented on Korean students seek 'digital undertakers' amid US visa social media screening   koreaherald.com/article/1... · Posted by u/djoldman
15155 · 2 months ago
We're talking about foreigners: if you are a guest in someone's country, home, wherever, you should be respectful and quiet.

I don't want any foreigners contributing to any political activism whatsoever, regardless of ideology.

jlebar · 2 months ago
Okay but that's not what this is about. This is saying that a foreigner cannot express private thoughts online at any point before they enter the United States.

I assume someone who goes by "15155" would believe that having private conversations online can be useful. Or do you want to post your identifying information?

jlebar commented on Korean students seek 'digital undertakers' amid US visa social media screening   koreaherald.com/article/1... · Posted by u/djoldman
15155 · 2 months ago
> anti-american but keeps their opinions to themself, and someone that has no opinions

Why do we need to be admitting anti-American individuals to this country for any reason whatsoever?

News flash: visas are a privilege, not a right.

jlebar · 2 months ago
Who gets to define what is anti-American?

Perhaps you think it's anti-American to believe that Israel is committing war crimes in Gaza. Perhaps I think it's anti-American to believe that the Jan 6 rioters should have been pardoned.

Whose purity test should we apply?

jlebar commented on Fibonacci Hashing: The Optimization That the World Forgot   probablydance.com/2018/06... · Posted by u/juancampa
jlebar · 4 months ago
I think the author has misunderstood things here.

This technique is orthogonal to integer mod. Indeed the author multiplies by their magic constant and then does an integer mod to map into their hashtable's buckets.

This technique is actually just applying a fast integer hash on the input keys to the hashtable before mapping the keys to buckets. You can then map to buckets however you want.

The additional hash is useful if and only if the input hash function for your table's keys doesn't appear to be a random function, i.e. it doesn't mix its bits for whatever reason. If your input hash functions are indeed random then this is a (small but perhaps measurable) waste of time.

Using prime-numbered table sizes is another way to accomplish basically the same thing. Dividing the input hash key by a prime forces you to look at all the bits of the input. In practice these are written as division by a constant, so they use multiplies and shifts. It's basically a hash function. (Though I'd use multiply by a magic number over divide by a prime, mul alone should be faster.)

Relatedly see this post by Daniel Lemire about an alternative to integer mod, https://lemire.me/blog/2016/06/27/a-fast-alternative-to-the-... which is interesting if your number of buckets is not a power of 2 for some reason.

u/jlebar

KarmaCake day3356January 30, 2012View Original