r/LocalLLM • u/oguzeldereli • 17d ago
Discussion You can now train your own LLMs with less memory, on your gaming GPUs
TL;DR: You can train your own 27B model on a 3090 with 24GB VRAM, though you would have to go through hundreds of billions of tokens for it to be good. I am working on conversion of existing models. Check repos for code and the paper if you are interested in more. I have a 40.4GB Qwen Flash Next GGUF
Hi, I do AI research. I have been working on an optimizer that doesn't need the ~16 bytes of VRAM per weight to train a model that AdamW does. I focused on training ternary networks bcs BitNet (Ma et al.) shows they match full precision quality in large scales. The problem is BitNet also keeps the full precision weights during training which means you still need to use the same amount of memory. I got this down from 16 bytes to 1 byte or even less per weight.
For you, this means, you can train your own 10-20B parameter models on your consumer GPUs. I fitted 27B model training on a single 24GB 3090 and a 23B model on a 16GB GPU. The trained model costs ~1.6 bits per weight (~6GB at 27B), 10x smaller than 16bit, and 5x smaller than Q8.
I have also been working on converting existing models and training them. This is harder and I am still working on it but I have some promising results. I quantized and trained a Qwen3.8 27B though the file I published below has adapters which are about 2GBs, pushing the file size to 8GB. I am also making a no-adapter version right now. It scores GSM8K 0.895, the same as full precision, HumanEval 0.84 vs 0.93 and runs on a 12 GB GPU at ~23 tok/s on my crippled 12GB laptop 4080, though this number can heavily be improved with custom kernels, engineering, etc. I will leave it to you guys to help me with that too.
I also quantized and trained Qwen Flash Next down to 40.4 GBs including its n-gram table (at 8GB). It largely retains the skills of the network (scores equivalent on GSM8K benchmark, a little behind on HumanEval, I unfortunately don't have compute for the larger benchmarks such as TerminalBench2.1 but perhaps some of you can help me out) but forgets facts. It mostly works fine if you give it web search as far as my experience goes but this is not strictly measured.
I am still doing work on this and I will keep working on it, perhaps even for many years. The code is open for non-commercial use. Check out:
The core repo for training: https://github.com/oguzeldereli/ttf-ternary
The repo for conversion: https://github.com/oguzeldereli/ttf-conversion
Repo for running models trained by ttf: https://github.com/oguzeldereli/ttf-home
GGUF for a converted Qwen 3.8 27B (around 8 GB and 6.7GB): https://huggingface.co/oguzeldereli/ttf-Qwen3.8-27B-GGUF
GGUF for a converted Qwen 3.8 Flash Next (around 40.4GB): https://huggingface.co/oguzeldereli/ttf-Qwen3.8-Flash-Next-GGUF
I will convert a Qwen 4 27B instance when it drops.
Full paper: https://github.com/oguzeldereli/ttf-ternary/blob/main/paper/ttf_paper1_training.pdf
Also, I would appreciate github stars if you like the project.
Edit:
The GGUF for the ~6.7GB Qwen 3.8 27B dropped on the qwen 3.8 27b repo above.
To add something, these models are not extremely good, they sometimes loop, and suck at remembering facts. However, unlike unsloth's gguf's you can actually keep training them yourself, in that sense they are pure, and you can train them on your consumer GPUs, that is to say you can get rid of the looping behavior, teach it facts that you want it to know, or specialize it for some purpose.
10
u/Human-Glove7815 17d ago
I'd love to understand how to do the training work.
9
u/q_tech_x51 17d ago
This is another great contribution to the community! Thanks!
I'm so hype to witness these techniques/methods evolve as rapidly as they are.
16
u/HiddenFaceOpenMouth 17d ago
Legend, I've been wanting a lower file size qwen3.8. Grabbing this now. Hopefully a game changer for poor old 12gb vram me.
I was running the full version using strata, which was great but dogshit slow.
7
u/Virtual_Sink3296 17d ago
Would it be possible to use the intelligence of certain Ai while training it for specific skills to create smaller models that are really good at specific tasks?
Similar to a Lora for Ai images maybe these skills could be added? Some food for thought, thank you for doing this.
5
u/Peteostro 17d ago
This is cool but why would you want to train your own models? How would you even have that much data to train these?
4
u/xaleel 17d ago
On how many tokens for how long?
I want to pretrain a ~350M model on 6-10B tokens for an experiment and testing showed it'd take ~10-15 days of it running non-stop on my 3090.
Chinchilla-optimal data size is 20 tokens per param, so around 540B tokens for the 27B model. I wonder how long it'd take with your methodology on the poor overworked GPU
2
u/sloptimizer 17d ago
This would be hugely useful for pojects like corwdgpt!
2
u/Toirem 16d ago edited 16d ago
Looks interesting ! How small could it make something like https://huggingface.co/peculiar-ragdoll/Tiel-Coder-35B-A3B-GGUF-MTP ?
The small number of active parameters means it can be used on laptop gpus with little VRAM, and I'm wondering if your approach could improve that even further
39
u/jhenryscott 17d ago
Very cool. Training is basically neglected in the home/small enterprise discussions and it’s tragic.
9
u/iam_Saurabh21 17d ago
If this actually works at scale, it’s a much bigger deal than another LLM release. The real bottleneck in AI development isn't just model architecture anymore, it's access to compute. Making serious model training possible on consumer GPUs could put AI research back into the hands of independent developers instead of leaving it exclusively to companies with million-dollar GPU clusters. The real test now is reproducibility, training stability, and benchmark performance.
6
u/Legitimate-Theory156 17d ago
Epic can't wait for pretraining costs to drop if this sir true
1
u/Hunterxmalaa 17d ago
This is brilliant I’m currently retaining a sub 1b moe on a 5060 16gb and your saying I can do at 1 byte as opposed to 16 bytes that’s a massive thoughtput increase right there will try this out
Also built a custom EXL3 15gb quant for qwen3.8 27b will be realessingnlater today
Also working on a fine tune / stf / RL application so that anyone can fine tune a model but better then unsloths version
1
u/Murflaw7424 17d ago
If I have 2 Rtx pro 6000 would the scale (and logic) hold that I could tran a 1T+ model? Like I could take GLM5.3 or DSV4.1?
Also, told it be fair to say that instead of quantization, it’s training a “trimmer” model? Or is this an efficient quantization technique with less vram required?
Edit: forgot to ask, how long does the conversion v training take? I did not see at first glance in your repo.
1
u/FeydRowan 17d ago
I have done something similar months ago, same idea of dropping the extra weight you are not the first in this space but still great work, and I got similar results as yours: https://github.com/ValerioDolci/bitbop
1
u/RageBucket 17d ago
I feel like the losses of this method are a bit understated.. I agree it's likely fairly useful large models, but for anyone doing from scratch, ground up training this has a huge impact on small models. I like your form of hysteresis used, and I'll absolutely be adapting that for my workflow though!
1
u/openroom_xyz 17d ago
Well this is amazing but I am questioning is does training the already trained models have any sense like why they are basically no better than Qwen 3.8 27b finetunes of the model that people would be using
seems there is very different from let say image generation diffusion models where basically why is the reason well yea
1
u/Tiforma 17d ago edited 17d ago
Cool man. If cutting down models by such a large amount is really possible without making the models into drooling idiots, that is revolutionary (i suspect this is too good to be true though?). Someone has to do it for one of the larger models like GLM 5.3 and deepseek etc. Also do you think this training technique can help with diffusion/image models?
1
u/Not_a_question- 17d ago
Is the total compute needed higher than if training with multiple cards?
1
u/A_Moist_Towe1 17d ago
For those of us on Mac, will we be able to use this? Being able to train a model with 128GB unified memory seems useful for building larger models at home
1
u/autisticit 17d ago
So, Bonsai ?
2
u/Plastic_Today_4044 17d ago
dude, this is amazing. I've been really interested in training ternary models for the last few months, this'll likely help a lot
2
u/biztactix 13d ago
I'll be following your work... I've long believed there's something inherantly in ternery that the big playera have just missed. There's just something in the simplicity of the maths for it and the early BitNet experiments show that it's not a completely useless tech.
1
u/Legitimate-Theory156 17d ago
Cool
1
u/344dead 17d ago
Crazy timing. I've literally spent the last two weeks learning about ternary networks and about all the research going on around optimizers and looking at non float based optimizers. This is so cool, thank you for sharing and allowing us all to learn a little more!
1
u/balarinios 16d ago
You are doing excellent work, please keep it up 💯
0
u/EditorCompetitive351 17d ago
used a 3090 with 24gb to fine-tune a 13b model on 200b tokens, got 88% on GSM8K, but inference was slow. the key was using 4bit quant with bitsandbytes and a custom training loop. your 23 tok/s on 12gb is solid, but can you share the exact config for the kernel optimization?
-2
u/throwawayformobile78 17d ago
How does one use “tokens” on their private LLM? You telling me we have to pay them in pretend money now too?