Live data from Hacker News

Llm.c – LLM training in simple, pure C/CUDA

github.com

181–189 of 189 posts

Re: Llm.c – LLM training in simple, pure C/CUDA

#181
post #176

Earlier quoted context omitted.

Speed of hardware did. Back in 80a they already knew the principles of llm training. It only took one week to train 10.000 tokens.

Got a reference on that claim?

I think 6 months ago there was a old video from theate 80s/ beginning 90s at a US university where a professor experimented with a llm from scratch. If I find that one I will post it. But definitely they knew the principles back then.

Re: Llm.c – LLM training in simple, pure C/CUDA

#182

Earlier quoted context omitted.

Sure neural networks in of themselves are conceptually simple, and not difficult to code. Andrew Ng's original Coursera class is all you need to go from zero knowledge to building MATLAB based neural nets in this same hard coded style. However, there is a huge difference in functionality (hence complexity) in a framework such as PyTorch vs hardcoding a single NN. It's a bit like the difference between writing a toy c…

I know all this things. Again: look at MLX.

I looked at the MLX codebase - certainly pretty tight, although also very poorly commented/documented.

I'm still not sure MLX vs PyTorch is really a fair comparison though since PyTorch is a much more mature framework and of course supports many different backends, as opposed to MLX which is just Metal or CPU.

Comparing these is a bit like comparing the new programming language of the day vs older ones that have accumulated a log of cruft/complexity. The shiny new language will likely look just as crufty after it has accumulated all the additional functionality of the older one.

Re: Llm.c – LLM training in simple, pure C/CUDA

#183

If I was starting from scratch, what resources should I start with to build up an understanding of what this code does and how to read it? It's quite dense and my knowledge of LLMs is quite minimal. Are these terse variable names standard in LLM-land?

If you are starting from scratch?

https://karpathy.ai/zero-to-hero.html

Do those, then come back to this and it will make more sense.

Re: Llm.c – LLM training in simple, pure C/CUDA

#184

Kind of amazing that something that can be expressed in ~1000 lines of code has completely turned the world on its head.

Speed of hardware did. Back in 80a they already knew the principles of llm training. It only took one week to train 10.000 tokens.

Wasn't AIAYN from 2017?

Re: Llm.c – LLM training in simple, pure C/CUDA

#186

Candle is a minimalist ML framework for Rust with a focus on performance (including GPU support) and ease of use https://github.com/huggingface/candle

You can also target WASM. Depending on the model size, it can be really good. Here are some examples of quantized models.

Vision Model https://huggingface.co/spaces/radames/Candle-Moondream-2 Blip Image Captioning https://huggingface.co/spaces/radames/Candle-BLIP-Image-Capt... Microsoft Phi 2 https://huggingface.co/spaces/radames/Candle-phi1-phi2-wasm-...

Re: Llm.c – LLM training in simple, pure C/CUDA

#187

Is this able to replace PyTorch, ... in normal practice? No. Does this show that in general the most used ML frameworks are a mess? Yes.

CUDA code is way faster than his code, so not exactly a mess.

Furthermore pytorch made learning very approachable. It would have been impossible for me to learn c and deep learning.

Re: Llm.c – LLM training in simple, pure C/CUDA

#189
post #137

Earlier quoted context omitted.

Ah, not really

“Here’s one I trained earlier”?

Nah, recent research shows that we don't need mountains of data to have very competent models. I don't have any links on hand but quick web browsing should return some relevant information
Post reply on HN