News for hackers. Stuff that matters.
Re:Reproduce GPT-2 (124M) in llm.c in 90 minutes for $20 by benterix on Tuesday May 28, 2024 @12:40PM (#40502642)
I just hope than in a couple of years we'll see a submission here titled "Reproduce GPT-4 on legacy RTX 4090."

Because currently even with open source (?) models we are still consumers, and the training is still the domain of the rich.

Re:Reproduce GPT-2 (124M) in llm.c in 90 minutes for $20 by ravetcofx on Tuesday May 28, 2024 @12:55PM (#40502797)
Accessing the dataset to train from scratch will be the biggest hurdle, now a lot of the pile has had ladder pulled since GPT-4
Re:Reproduce GPT-2 (124M) in llm.c in 90 minutes for $20 by GaggiX on Tuesday May 28, 2024 @01:55PM (#40503500)
https://huggingface.co/datasets/HuggingFaceFW/fineweb has 15T cleaned and deduplicated english web data tokens.
Re:Reproduce GPT-2 (124M) in llm.c in 90 minutes for $20 by ravetcofx on Tuesday May 28, 2024 @02:27PM (#40503867)
Holy crap, Does huggingface charge for bandwidth if you're downloading 45 terabytes??
Re:Reproduce GPT-2 (124M) in llm.c in 90 minutes for $20 by drexlspivey on Tuesday May 28, 2024 @02:47PM (#40504075)
I believe they are hosting it on Cloudflare who doesn’t charge for egress
Re:Reproduce GPT-2 (124M) in llm.c in 90 minutes for $20 by fragmede on Tuesday May 28, 2024 @03:02PM (#40504266)
More specifically, Cloudflare R2 doesn't charge for egress, and Cloudflare doesn't charge for egress to members in the Bandwidth Alliance which include Azure, Google Cloud, Oracle, Alibaba Cloud, and others, though critically not AWS.

They very much do charge egress fees elsewhere.

Re:Reproduce GPT-2 (124M) in llm.c in 90 minutes for $20 by andersa on Wednesday May 29, 2024 @12:21AM (#40508432)
Fun trivia: downloading 45TB costs about $60, according to Cloudflare.
Re:Reproduce GPT-2 (124M) in llm.c in 90 minutes for $20 by verticalscaler on Wednesday May 29, 2024 @07:17AM (#40510685)
That's what Cloudflare charges. It costs them around 6 cents.
Re:Reproduce GPT-2 (124M) in llm.c in 90 minutes for $20 by kazanz on Wednesday May 29, 2024 @12:56PM (#40514133)
Wish I could say I'm surprised you're getting downvotes. Carrier costs are some of the lowest costs for hosting providers. Yet that fact seems to elude a majority of the community here.
Re:Reproduce GPT-2 (124M) in llm.c in 90 minutes for $20 by andersa on Wednesday May 29, 2024 @05:36PM (#40517311)
That's what they said it costs on their blog, not that they charge that. https://blog.cloudflare.com/aws-egregious-egress

Where are you getting 6 cents from?

Re:Reproduce GPT-2 (124M) in llm.c in 90 minutes for $20 by CamperBob2 on Tuesday May 28, 2024 @01:15PM (#40503003)
Someone will come along and say "Why don't you just mirror Anna's Archive?" in 3...2...1...
Re:Reproduce GPT-2 (124M) in llm.c in 90 minutes for $20 by sebzim4500 on Wednesday May 29, 2024 @05:32AM (#40510100)
I think between Anna's Archive, fineweb and as many github repos as you can scrape you can get a pretty decent dataset.

I doubt Anna's Archive would produce a good model on its own though.

Re:Reproduce GPT-2 (124M) in llm.c in 90 minutes for $20 by meiraleal on Tuesday May 28, 2024 @01:16PM (#40503006)
I'm okay with paying for datasets
Re:Reproduce GPT-2 (124M) in llm.c in 90 minutes for $20 by CamperBob2 on Tuesday May 28, 2024 @01:27PM (#40503150)
Depends on how the courts rule. If the copyright maximalists prevail, only the wealthiest entities will be able to afford to license a useful data set.

Paradoxically enough, this is the outcome that most "Hacker News" denizens seem to be rooting for.

Re:Reproduce GPT-2 (124M) in llm.c in 90 minutes for $20 by groby_b on Tuesday May 28, 2024 @03:58PM (#40504918)
It's almost as if people believe in fairness and compensating people for their work.

Also, it's worth noting that this is only true as long as we're stuck in the "must train on the entire sum total of human output ever created" local minimum for machine learning. Given that most biological entities learn with much less data, this might well be the thing that prods ML research to using an approach that isn't "IDK, buy a few containers of GPUs, and half a DC of storage, see if that makes things better".

Re:Reproduce GPT-2 (124M) in llm.c in 90 minutes for $20 by nwsm on Wednesday May 29, 2024 @11:24AM (#40512964)
> It's almost as if people believe in fairness and compensating people for their work.

Yet in this case we are talking about compensating the compilers/massagers/owners of the datasets, not the original authors from wherever the data was originally scraped.

Re:Reproduce GPT-2 (124M) in llm.c in 90 minutes for $20 by wizzwizz4 on Wednesday May 29, 2024 @01:45PM (#40514670)
Copyright is hideously broken, but in theory: the owners only own it because they compensate the authors, which they only do out of an expectation of future profit (on average).

That theory's a fantasy, because extractive systems involving gatekeepers get established, but in this specific case, enforcing copyright would make things fairer for authors. There's no extractive copyright-taking gatekeeper for websites: scrapers don't get copyright, so can't re-license the material they've scraped (unless it's permissively-licensed or something).

Re:Reproduce GPT-2 (124M) in llm.c in 90 minutes for $20 by meiraleal on Tuesday May 28, 2024 @01:53PM (#40503463)
I'd still get most of my dataset from torrent but I could pay for specific things like high quality source code.
Re:Reproduce GPT-2 (124M) in llm.c in 90 minutes for $20 by exe34 on Tuesday May 28, 2024 @01:15PM (#40503004)
i suppose you wouldn't be able to use it for external services, but internally, I'm sure you can find some books that fell off the back of a truck...
Re:Reproduce GPT-2 (124M) in llm.c in 90 minutes for $20 by HeatrayEnjoyer on Tuesday May 28, 2024 @01:20PM (#40503065)
No reason you can't go external. GPT was trained using ebook torrent sites
Re:Reproduce GPT-2 (124M) in llm.c in 90 minutes for $20 by artninja1988 on Tuesday May 28, 2024 @02:33PM (#40503937)
OpenAI has enough money to hire lawyers to defend it until the end of time though
Re:Reproduce GPT-2 (124M) in llm.c in 90 minutes for $20 by vineyardmike on Tuesday May 28, 2024 @01:17PM (#40503012)
We won’t ever get there or need to because GPT-4 wasn’t trained on one GPU it was trained on thousands. The (most likely) biggest meaningful difference between -2 and -4 is the number of parameters and the training data/duration. I don’t think you’d really learn much more.
Re:Reproduce GPT-2 (124M) in llm.c in 90 minutes for $20 by elicksaur on Tuesday May 28, 2024 @07:18PM (#40506615)
It’s not about learning. It’s about owning. Exactly the reason OpenAI stopped being open. Having GPT-4-quality LLMs created by anyone with a gaming PC would be pretty radical.
Re:Reproduce GPT-2 (124M) in llm.c in 90 minutes for $20 by vineyardmike on Tuesday May 28, 2024 @09:27PM (#40507320)
And you won’t get there. Those models are far too large for a 2024 GPU. Llama-3 70b is arguably close to GPT-4 but is still too large for gaming GPUs (and probably for many years of GPU updates)
Re:Reproduce GPT-2 (124M) in llm.c in 90 minutes for $20 by elicksaur on Wednesday May 29, 2024 @12:17AM (#40508407)
“You won’t get there” is a pretty vast statement for all of the future. Two fairly reasonable predictions: 1) the compute needed to get GPT4 performance will decrease. 2) the compute on consumer GPUs will increase.

At some point they cross, and you will be able to run a GPT4-quality LLM on a consumer GPU. At some point after that, you’ll be able to run a GPT4-quality LLM on a 2024 consumer GPU if you can find one.

Important to emphasize, I’m not saying “GPT-4”. Llama-3 was trained on 24k GPU clusters. “Able to do the exact same processing at 1/24k the compute” is different from “Able to get equivalent performance at 1/24k compute”. Even then, given a long enough time scale, the former is possible.

Re:Reproduce GPT-2 (124M) in llm.c in 90 minutes for $20 by vineyardmike on Wednesday May 29, 2024 @11:20AM (#40512902)
> 1) the compute needed to get GPT4 performance will decrease. 2) the compute on consumer GPUs will increase.

I’m assuming we’re just talking inference here…

Sure compute abilities for consumers will increase but the original comment had a fixed GPU - the 4090. I can already eke out LLama3:8b on my MacBook Air, and Apple will sell you a laptop capable of running the full sized LLama.

There is a direct correlation between parameters and “knowledge” for an LM. There’s some open questions as to density (LLaMa3 specifically challenged previous assumptions) but it seems implausible to fit an equivalent model as GPT4 into 24gb vram. Just like compression, you can’t shrink forever.

GPT-4 and GPT-2 are pretty similar architecturally (I assume). So if abilities don’t matter, we can already run GPT-2 so we’re basically there for 4.

Re:Reproduce GPT-2 (124M) in llm.c in 90 minutes for $20 by anthonix1 on Tuesday May 28, 2024 @02:52PM (#40504133)
FWIW, I'm seeing ~318,000 toks/sec throughput on a 4x AMD 7900 XTX machine (less than $4k worth of GPU), using the same settings as in the post (0.5M batch size etc).
Re:Reproduce GPT-2 (124M) in llm.c in 90 minutes for $20 by pama on Tuesday May 28, 2024 @05:56PM (#40506035)
Did you reproduce the evaluation as well?
Re:Reproduce GPT-2 (124M) in llm.c in 90 minutes for $20 by anthonix1 on Tuesday May 28, 2024 @08:10PM (#40506887)
It converges similarly on smaller datasets.

About to kick off a training from scratch run on the same fineweb-10B, which at 324k toks/sec should take about 8.6 hours. And with my kWh cost, that is about $2.50 cost to train.

Will report back tomorrow when the training has finished..

Re:Reproduce GPT-2 (124M) in llm.c in 90 minutes for $20 by anthonix1 on Wednesday May 29, 2024 @10:10AM (#40512201)
So... successfully reproduced in ~8.75 hours, taking about 18 kWh / $2.70

The first run actually failed at step 3000 or so, and I realized I had a bug in my attention / matmul kernels, but after fixing that and restarting it worked great

[1] https://github.com/anthonix/llm.c

Re:Reproduce GPT-2 (124M) in llm.c in 90 minutes for $20 by pama on Friday May 31, 2024 @11:44PM (#40542707)
What was the final loss? Is this hardware available for rent somewhere?
Re:Reproduce GPT-2 (124M) in llm.c in 90 minutes for $20 by anthonix1 on Friday June 07, 2024 @11:37AM (#40609679)
Final loss from that fineweb-10B run (since then I'm up to ~100k toks/sec/GPU):

step 18865/18865 | train loss 3.280550 | norm 0.4362 | lr 0.00e+00 | 1669.06 ms | 55.4% A100 fp16 MFU | 314058 tok/s Writing state to log124M/state_00018865_00003.bin val loss 3.296179

You can buy these GPUs on Amazon for under $1k. I heard the MI300X may be available in Azure now or at least very soon.

Re:Reproduce GPT-2 (124M) in llm.c in 90 minutes for $20 by Manabu-eo on Wednesday May 29, 2024 @06:16PM (#40517705)
How much % of the theoretical FLOPs are you getting with those 7900 XTX on training?
Re:Reproduce GPT-2 (124M) in llm.c in 90 minutes for $20 by anthonix1 on Wednesday May 29, 2024 @07:07PM (#40518173)
55.4% in the last run, at running temperature
Re:Reproduce GPT-2 (124M) in llm.c in 90 minutes for $20 by auspiv on Tuesday May 28, 2024 @02:34PM (#40503954)
Considering it takes 8x A100 GPUs (80GB VRAM) to train GPT-2, I think it'll take far more than a single 4090.
Re:Reproduce GPT-2 (124M) in llm.c in 90 minutes for $20 by bufo on Tuesday May 28, 2024 @02:48PM (#40504083)
The RTX 4090 has about the same BF16 Tensor Core TOPs than the A100, assuming 50% MFU (like the A100 40 GB PCIe) it would take 8x longer on 1 RTX 4090 vs 8x A100 80GB SXM, so 12 hours. Datasheet here for the TOPs https://images.nvidia.com/aem-dam/Solutions/geforce/ada/nvid... 50% MFU should be achievable on the 4090.
Re:Reproduce GPT-2 (124M) in llm.c in 90 minutes for $20 by anthonix1 on Wednesday May 29, 2024 @10:12AM (#40512217)
Nah, I reproduced on 4x 7900 XTX machine in 8.75 hours, so a single 7900 XTX (costs less than $1k) could do it in under 24 hours. Was hitting 55.4% MFU.
Re:Reproduce GPT-2 (124M) in llm.c in 90 minutes for $20 by benterix on Tuesday June 04, 2024 @04:43AM (#40572108)
Do you have a link to a description of your setup? I assume there are some quirks on the way and getting this done requires some substantial work. A submission on that would be very interesting, at least to me.
Re:Reproduce GPT-2 (124M) in llm.c in 90 minutes for $20 by Invictus0 on Tuesday May 28, 2024 @01:21PM (#40503074)
I'm not saying this to be rude, but I think you have a deep misunderstanding of how AI training works. You cannot just skip the matrix multiplications necessary to train the model, or get current hardware to do it faster.
Re:Reproduce GPT-2 (124M) in llm.c in 90 minutes for $20 by xdavidliu on Tuesday May 28, 2024 @03:41PM (#40504748)
was the first sentence really necessary? The second sentence seems fine by itself.
Re:Reproduce GPT-2 (124M) in llm.c in 90 minutes for $20 by nickpsecurity on Tuesday May 28, 2024 @07:16PM (#40506600)
Re:Reproduce GPT-2 (124M) in llm.c in 90 minutes for $20 by benterix on Wednesday May 29, 2024 @06:17AM (#40510347)
No offence taken! As far as my (shallow!) understanding goes, the main challenge is the need for many GPUs with huge amounts of memory, and it still takes ages to train the model. So regarding the use of consumer GPUs, some work has been done already, and I've seen some setups where people combine of these and are successful. As for the the other aspects, maybe at some point we distill what is really needed to a smaller but excellent dataset that would give similar results in the final models.
Re:Reproduce GPT-2 (124M) in llm.c in 90 minutes for $20 by sabareesh on Tuesday May 28, 2024 @04:43PM (#40505413)
Re:Reproduce GPT-2 (124M) in llm.c in 90 minutes for $20 by huac on Wednesday May 29, 2024 @09:54AM (#40512047)
25% MFU :( maybe because of the P2P nerf?
Re:Reproduce GPT-2 (124M) in llm.c in 90 minutes for $20 by sabareesh on Wednesday May 29, 2024 @12:13PM (#40513555)
This much bigger model (500M), P2P is enabled via Mailbox. It is expected because of memory to compute ratio
Re:Reproduce GPT-2 (124M) in llm.c in 90 minutes for $20 by huac on Wednesday May 29, 2024 @12:20PM (#40513671)
can you elaborate?
Re:Reproduce GPT-2 (124M) in llm.c in 90 minutes for $20 by anthonix1 on Wednesday May 29, 2024 @10:22AM (#40512312)
Maybe get a 7900 XTX. 122 TFLOPS of BF16/FP16 for less than $1k and I'm getting 55.4% MFU
Re:Reproduce GPT-2 (124M) in llm.c in 90 minutes for $20 by sabareesh on Wednesday May 29, 2024 @12:13PM (#40513564)
These are not apples to apple comparison, as this is running across GPU and much bigger model
Re:Reproduce GPT-2 (124M) in llm.c in 90 minutes for $20 by doubloon on Wednesday May 29, 2024 @03:33AM (#40509436)
Dude im hoping we get rid of Nvidia completely. I can run llama.cpp inference on a 7B model on my 24 core cpu intel machine using just CPU and it only uses about 4gb of ram and is not that slow. If we could have massive parallel arm core or even riscv machines without the Cuda issues with proprietary driver hell it would be much more open source. And much less wonkage for the normie user