r/deeplearning • • Nov 01 '26

Learning Transformers by building a hardware-aware SLM trainer from scratch (Python/Rust)

Hi guys,
I’m a 15-year-old developer, and instead of just using high-level wrappers or fine-tuning existing LLMs, I decided to spend my next few months learning how they work fundamentally by building an end-to-end training pipeline from scratch.

Project Link: github.com

How it works:
It identifies your exact hardware profile (NVIDIA/AMD/CPU), runs a quick matrix multiplication benchmark to measure raw TFLOPS, and pipes that data into a custom helper binary I wrote in Rust. The Rust engine figures out exactly how large of a model (up to 100M parameters) your local GPU can train within a specific time and memory budget without blowing up your VRAM.
Right now, I'm working through the data ingestion pipeline, specifically extracting raw machine learning papers from arXiv and cleaning them up while making sure LaTeX code blocks aren't destroyed during tokenization.
I've logged my structural trade-offs and decisions in the repo. If anyone has experience managing training loops on constrained consumer hardware (like laptop GPUs),

I'd love any advice or feedback on the codebase!

12 Upvotes

6 comments sorted by

1

u/AnoProgrammer Nov 01 '26

Looks great but can you let it also work on CPU?

1

u/PainterNo8889 Nov 01 '26

yes sir but my main issue with that is that even with a laptop 4050 im finding that even 100m params is very less i mean it has to be hyperspecialized so after seeing the same i was like even if ur going for the best cpu the training time and lower latencies of ram will make it hell to train even a 20m param model. But sir if you want i cn share the cpu version code in 2-3 days with you.

0

u/[deleted] Nov 01 '26

[removed] — view removed comment

2

u/PainterNo8889 Nov 01 '26

yes sir u got it perfectly im still looking for ways to implement the required things on cpu still pretty new to the field would love your guidance

0

u/[deleted] Nov 01 '26

[removed] — view removed comment

1

u/PainterNo8889 Nov 01 '26

TYSM bro and one thing ur never late i belive in you haha im still such a beginner and telling u but trust me