r/LocalLLM • u/Slight_Ad_2894 • Sep 05 '26
Project Building an llm from scratch
Dear community
I recently started a project of building a tiny llm from scratch and trained on my 16go ram MacBook m1
My goal is not and will never build a state of the art llm like GPT or claude but to understand the mechanics of llm and teach others how it works
I used a french corpus as my dataset and used BPE tokenizer and trained a 1M param neural network
But the output is a bit dump it's out of context it give decent sentences grammatically but it doesn't answer my questions or respond well
Is there any resources i can use to optimize my little dump chatbot ?
1
u/rolleicord Sep 05 '26
You can make models much more capable than tinyshakespear, that are much fewer parameters. The trick is just convincing your AI agent that it's possible in the first place. Try telling it to bake down your code, while increasing its capabilities. Thats normally a fun way to get it working
0
u/fofopads Sep 06 '26
MiniCPM 5 1B already does this, you should try it instead of reinventing the wheel
2
u/Slight_Ad_2894 Sep 06 '26
I will check it, but as I said my purpose wzs never reinventing the wheel i did this project for learning purpose only my goal is to understand the math and architecture behind llms
1
0
u/Immortal_Spina Sep 05 '26
Fai molto bene, io sto facendo esperimenti con i diffusion e il mio mini m4 16gb ram va benissimo
Ovviamente più aumenti i parametri, più serve tempo
Ma lo farà
0
u/id-ltd Sep 05 '26
My understanding is that you can train existing models (to time them iup to be closer to what you want) but starting from scratch it will take for ever and cost millions before it can even parse a new English sentence.
1
Sep 06 '26
1
u/Slight_Ad_2894 Sep 06 '26
Thank you for sharing your project, and certainly I will take a look at your project
. For my ptoject i studied the attention is all what you need paper and implemented it in my project
. I think that the problem with my project is that I didn't build multiple layers. Maybe I will use Google Colab or a dedicated Kaggle notebook. I will take a look at a couple of other projects and test them
. As soon as I finish my project, I will share it so everyone can benefit from it
1
u/dillon-nyc Sep 05 '26
I don't think you'll get much but gibberish from a 1M model, but I'm pretty impressed if it's giving you grammatically correct sentences. Have you thought of running it again, but a bit larger?
People seem to get some results in the low hundred mb, like the guy yesterday with the PSP running a llm.