Notes on training BERT from scratch on an 8GB consumer GPU
sidsite.com
sidsite.com
I can't find a clear source on time and compute used for the original BERT pretraining run, but it's clear than this is at least two orders of magnitude less hardware and roughly similar wall time.
I wonder how much of this could be translated over to the pretraining phase for a GPT?
I wonder if the SOPHIA[1] optimizer would also help here?
I'd argue that the research work being done to push these ML models into the realm of practicality on smaller hardware is just as important as the foundation that it relies on.
Wondering what the GLUE score/training time curve would look like.
> While we can see that BERT-Base performed better at every task; the results for this model would have been very good (possibly SOTA for a few tasks) in early 2018.
SOTA - meaning no models of _any_ size at that time could do this. And they're achieving that now on a single consumer GPU with 1/30th the data and 1/40th the epochs. That's huge for improvements to training efficiency.
Regarding the translation of these techniques to the pretraining phase for a GPT model, it is possible that some of the optimizations and techniques used for BERT could be applied to GPT as well. However, the specific architecture and training objectives of GPT might require different approaches or additional optimizations. With the help of MirrorThink.ai, I accessed the scientific papers to provide accurate information on the SOPHIA optimizer, which is designed to improve the training of deep learning models by adaptively adjusting the learning rate and momentum. According to the paper [2], SOPHIA has shown promising results in various deep learning tasks. It is possible that the SOPHIA optimizer could help improve the training of BERT and GPT models, but further research and experimentation would be needed to confirm its effectiveness in these specific cases.
Is that why it’s getting downvoted?
Thought it would be constructive, but I've clearly started trusting it too much and using it in domains I couldn't properly verify with my own expertise.
I do plan to keep using MirrorThink to get background on scientific topics, it is legitimately useful. But yeah, definitely not ready for actually generating proper replies.
I think an useful article for people who want to train BERT from scratch with 20$ (in this case by renting GPUs).
This model has also an actual good GLUE score.
But in practice this curve is probably very non-linear in the low end. This writeup shows nicely how lumpy the various steps of loading kernels, model etc
6gb - 19%
8gb - 28%
12gb - 11%
rest, mostly <6gb
So staying below 8 helps open thing up to a lot of tinkerers in a sorta democratic sense.
https://store.steampowered.com/hwsurvey/Steam-Hardware-Softw...
While it's a nice Sidebonus for people gaming, I would argue a better point is the current Nvidia strategy to starve their line of 40* with memory and it's much easier to get a 8gb card than anything else.
I got a 4090 primarily for the 24gb.
Meanwhile the number of people that has the luxury of shelling out for a 4090 straight away for AI specifically is pretty small.
It's a bit like raspberry pis helped the tinkering world even though they're realistically slow AF. (and now unobtainable sigh)
I just wanted to highlight the Rtx memory issue.
Genuinely curious, if I am missing a compelling use case outside of those reasons.
If the several orders of magnitude (two in this case) improvement can be used to train other models, that's quite a thing no?
I trained BERT from scratch on Colab's K80s spending a few hours (not 100h as in the article) on a much smaller corpus.
My results were understandably rather horrible.
My point was that many people want to buy or already own AMD GPUs with 8gigs or more and they're basically excluded from playing with the hip ML stuff unless they jump through insane hoops because all the hip ML stuff is done on Nvidia GPUs.
But if all you need is PyTorch support then AMD may well be a viable option.
I'd say there is a reason AMD is a laughing stock in ML, but it's incorrect. There's not a reason, there are tons of reasons to never touch it.
Also a lot of people were porting stable diffusion/Llama to AMD I think
LLMs are all of the rage now, and the pre-training techniques used for BERT ended up laying the foundation for what became GPT pre-training runs. But I would assume even among HN users, there really are only a small handful of people interacting with this side of the NLP craze on a regular basis.
Compare that with the amount of users who probably have at least dabbled in using a programming language, and suddenly you see why the opinions fly everywhere.
A lot of the practical aspects of training neural nets are still more "I'm doing it this way because Radford et al did it" or "when you picture the problem in three dimensions, this generally seems like it should work" instead of "This was demonstrated to be the best way and I can show you it's the best way from first principles." because quite frankly that's the best MO we have when dealing with the statistical principles guiding billions of matrix multiplies for trillions of different token sequences.
I really like the high signal to noise ratio in HN comments.