HackerReposA FIELD GUIDE TO OPEN SOURCE
ProSponsor the shelf♧ 0
← Back to top all-time
karpathy
llm.c
Cuda2024–2026
karpathy / llm.c

llm.c

LLM training in simple, raw C/CUDA

23Distinct people
28Mentions
0Explicit recommenders
31.5KGitHub stars
REPOSITORY AT A GLANCE

What to know before exploring

What it is

LLM training in simple, raw C/CUDA

GitHub

Where it is used

No documented product use was verified in the last source check.

What people are saying

No recommendation phrase was found in the indexed comments.

No classified warning is attached to this page. Read the discussions before treating silence as approval.

Also in these discussions

No other repository is repeatedly linked in the same discussions.

This week on Hacker News

Nov 7–Nov 14 UTC · Direct repository links and separately labeled related project stories. Indexed through 11/14/2026, 3:56:07 PM UTC.

No direct repository links were found in the indexed HN discussions over the past seven days. Older discussions are available below.

Mentions over time

HN mentions by month28 dated mentions

Observed mentions: 2024-04-08 20:38:49 UTC to 2026-08-15 13:35:31 UTC.

02462024-04-01 00:00:00 UTC to 2024-05-01 00:00:00 UTC (exclusive): 7 mentions; 3 submissions, 4 commentsApr 20242024-05-01 00:00:00 UTC to 2024-06-01 00:00:00 UTC (exclusive): 7 mentions; 3 submissions, 4 comments2024-06-01 00:00:00 UTC to 2024-07-01 00:00:00 UTC (exclusive): 3 mentions; 1 submissions, 2 comments2024-07-01 00:00:00 UTC to 2024-08-01 00:00:00 UTC (exclusive): 2 mentions; 1 submissions, 1 comments2024-08-01 00:00:00 UTC to 2024-09-01 00:00:00 UTC (exclusive): 1 mentions; 0 submissions, 1 comments2024-09-01 00:00:00 UTC to 2024-10-01 00:00:00 UTC (exclusive): 1 mentions; 0 submissions, 1 comments2024-10-01 00:00:00 UTC to 2024-11-01 00:00:00 UTC (exclusive): 0 mentions; 0 submissions, 0 comments2024-11-01 00:00:00 UTC to 2024-12-01 00:00:00 UTC (exclusive): 1 mentions; 0 submissions, 1 comments2024-12-01 00:00:00 UTC to 2025-01-01 00:00:00 UTC (exclusive): 0 mentions; 0 submissions, 0 comments2025-01-01 00:00:00 UTC to 2025-02-01 00:00:00 UTC (exclusive): 1 mentions; 0 submissions, 1 comments2025-02-01 00:00:00 UTC to 2025-03-01 00:00:00 UTC (exclusive): 0 mentions; 0 submissions, 0 comments2025-03-01 00:00:00 UTC to 2025-04-01 00:00:00 UTC (exclusive): 0 mentions; 0 submissions, 0 comments2025-04-01 00:00:00 UTC to 2025-05-01 00:00:00 UTC (exclusive): 0 mentions; 0 submissions, 0 comments2025-05-01 00:00:00 UTC to 2025-06-01 00:00:00 UTC (exclusive): 0 mentions; 0 submissions, 0 comments2025-06-01 00:00:00 UTC to 2025-07-01 00:00:00 UTC (exclusive): 0 mentions; 0 submissions, 0 commentsJun 20252025-07-01 00:00:00 UTC to 2025-08-01 00:00:00 UTC (exclusive): 0 mentions; 0 submissions, 0 comments2025-08-01 00:00:00 UTC to 2025-09-01 00:00:00 UTC (exclusive): 1 mentions; 0 submissions, 1 comments2025-09-01 00:00:00 UTC to 2025-10-01 00:00:00 UTC (exclusive): 1 mentions; 1 submissions, 0 comments2025-10-01 00:00:00 UTC to 2025-11-01 00:00:00 UTC (exclusive): 0 mentions; 0 submissions, 0 comments2025-11-01 00:00:00 UTC to 2025-12-01 00:00:00 UTC (exclusive): 0 mentions; 0 submissions, 0 comments2025-12-01 00:00:00 UTC to 2026-01-01 00:00:00 UTC (exclusive): 1 mentions; 0 submissions, 1 comments2026-01-01 00:00:00 UTC to 2026-02-01 00:00:00 UTC (exclusive): 1 mentions; 0 submissions, 1 comments2026-02-01 00:00:00 UTC to 2026-03-01 00:00:00 UTC (exclusive): 0 mentions; 0 submissions, 0 comments2026-03-01 00:00:00 UTC to 2026-04-01 00:00:00 UTC (exclusive): 0 mentions; 0 submissions, 0 comments2026-04-01 00:00:00 UTC to 2026-05-01 00:00:00 UTC (exclusive): 0 mentions; 0 submissions, 0 comments2026-05-01 00:00:00 UTC to 2026-06-01 00:00:00 UTC (exclusive): 0 mentions; 0 submissions, 0 comments2026-06-01 00:00:00 UTC to 2026-07-01 00:00:00 UTC (exclusive): 0 mentions; 0 submissions, 0 comments2026-07-01 00:00:00 UTC to 2026-08-01 00:00:00 UTC (exclusive): 0 mentions; 0 submissions, 0 comments2026-08-01 00:00:00 UTC to 2026-09-01 00:00:00 UTC (exclusive): 1 mentions; 0 submissions, 1 commentsAug 2026

Counts come from the repository’s dated source evidence. Index cutoff: 2026-11-02 08:16:59 UTC.

View mention counts and date ranges
UTC ranges include their start and exclude their end. Select a period to filter the source evidence.
PeriodStart (UTC)End (exclusive, UTC)MentionsSubmissionsComments
Apr 20242024-04-01 00:00:00 UTC2024-05-01 00:00:00 UTC734
May 20242024-05-01 00:00:00 UTC2024-06-01 00:00:00 UTC734
Jun 20242024-06-01 00:00:00 UTC2024-07-01 00:00:00 UTC312
Jul 20242024-07-01 00:00:00 UTC2024-08-01 00:00:00 UTC211
Aug 20242024-08-01 00:00:00 UTC2024-09-01 00:00:00 UTC101
Sep 20242024-09-01 00:00:00 UTC2024-10-01 00:00:00 UTC101
Oct 20242024-10-01 00:00:00 UTC2024-11-01 00:00:00 UTC000
Nov 20242024-11-01 00:00:00 UTC2024-12-01 00:00:00 UTC101
Dec 20242024-12-01 00:00:00 UTC2025-01-01 00:00:00 UTC000
Jan 20252025-01-01 00:00:00 UTC2025-02-01 00:00:00 UTC101
Feb 20252025-02-01 00:00:00 UTC2025-03-01 00:00:00 UTC000
Mar 20252025-03-01 00:00:00 UTC2025-04-01 00:00:00 UTC000
Apr 20252025-04-01 00:00:00 UTC2025-05-01 00:00:00 UTC000
May 20252025-05-01 00:00:00 UTC2025-06-01 00:00:00 UTC000
Jun 20252025-06-01 00:00:00 UTC2025-07-01 00:00:00 UTC000
Jul 20252025-07-01 00:00:00 UTC2025-08-01 00:00:00 UTC000
Aug 20252025-08-01 00:00:00 UTC2025-09-01 00:00:00 UTC101
Sep 20252025-09-01 00:00:00 UTC2025-10-01 00:00:00 UTC110
Oct 20252025-10-01 00:00:00 UTC2025-11-01 00:00:00 UTC000
Nov 20252025-11-01 00:00:00 UTC2025-12-01 00:00:00 UTC000
Dec 20252025-12-01 00:00:00 UTC2026-01-01 00:00:00 UTC101
Jan 20262026-01-01 00:00:00 UTC2026-02-01 00:00:00 UTC101
Feb 20262026-02-01 00:00:00 UTC2026-03-01 00:00:00 UTC000
Mar 20262026-03-01 00:00:00 UTC2026-04-01 00:00:00 UTC000
Apr 20262026-04-01 00:00:00 UTC2026-05-01 00:00:00 UTC000
May 20262026-05-01 00:00:00 UTC2026-06-01 00:00:00 UTC000
Jun 20262026-06-01 00:00:00 UTC2026-07-01 00:00:00 UTC000
Jul 20262026-07-01 00:00:00 UTC2026-08-01 00:00:00 UTC000
Aug 20262026-08-01 00:00:00 UTC2026-09-01 00:00:00 UTC101

What Hacker News says

28 sources
https://github.com/karpathy/llm.c However, I wonder about the use of this. Typically, you'd want to use a GPU for inference, and programming those in C is quite a challenge. The educational value of learning LLMs in C/C++ seems a lot lower than in Python. May I ask why you're interested in this specifically? Also, why ask this here, and not simply use Google or an LLM to find the information? It comes off as a bit lazy, especially given that you provide no extra context.
In AI by Hand
Maybe I've been missing out, but can anyone give me a yay/nay on whether this is a worth-while 28-part-series to start from scratch and spend my time watching/reading? Is it along the same lines as https://github.com/karpathy/llm.c/discussions/677 ? He (karpathy) has a video series that also does something similar. I found it very informative and entertaining, even at the 1 hour + length it is (there are actually multiple videos, im not sure how long the others are).
In LLM from scratch, part 28 – training a base model from scratch on an RTX 3090
> Something like GPT-2 I got 2 things to say here 1) There's plenty of things that can achieve similar performance to GPT-2 these days. We mentioned Mamba, they compared to GPT-3 in their first paper[0]. They compare with the open sourced version and you'll also see some other architectures referenced there like Hyena and H3. It's the GPT-Neo and GPT-J models. Remember GPT-3 is pretty much just a scaled up GPT-2. 2) I think you are underestimating the costs to train some of these things. I know Karpathy said you can now train GPT-2 for like $1k[1] but a single training run is a small portion of the total costs. I'll reference StyleGAN3 here just because the paper has good documentation on the very last page[2]. Check out the breakdown but there's a few things I want to specifically point out. The whole project cost 92 V100 years but the
Read the rest
results of the paper only accounted for 5 of those. That's 53 of the 1876 training runs. Your $1k doesn't get you nearly as far as you'd think. If we simplify things and say everything in that 5 V100 years cost $1k then that means they spent $85k before that. They spent $18k before they even went ahead with that project. If you want realistic numbers, multiply that by 5 because that's roughly what a V100 will run you (discounted for scale). ~$110k ain't too bad, but that is outside the budget of most small labs (including most of academia). And remember, that's just the cost of the GPUs, that doesn't pay for any of the people running that stuff. I don't expect you to know any of this stuff if you're not a researcher. Why would you? It's hard enough to keep up with the general AI trends, let alone niche topics lol. It's not an intelligence problem, it's a logistics problem, right? A researcher's day job is being in those weeds. You just get a lot more hours in the space. I mean I'm pretty out of touch of plenty of domains just because time constraints. > I don't think this is feasible for large investments. I may be wrong, but i also don't think other avenues aren't being funded. So I'm trying to say, I think your bar has been met. And I think if we are actually looking at the numbers, yeah, I do not think these avenues are being funded. But don't take it from me, take it from FeiFei Li[3] | Not a single university today can train a ChatGPT model I'm not sure if you're a researcher or not, you haven't answered that question. But I think if you were you'd be aware of this issue because you'd be living with it. If you were a PhD student you would see the massive imbalance of GPU resources given to those working closely with big tech vs those trying to do things on their own. If you were a researcher you'd also know that even inside those companies that there aren't much resources given to people to do these things. You get them on occasion like the StarFlow and TarFlow I pointed out before, but these tend to be pretty sporadic. Even a big reason we talk about Mamba is because of how much they spent on it. But if you aren't a researcher I'd ask why you have such confidence that these things are being funded and that these things cannot be scaled or improved[4]. History is riddled with examples of inferior tech winning mostly due to marketing. I know we get hyped around new tech, hell, that's why I'm a researcher. But isn't that hype a reason we should try to address this fundamental problem? Because the hype is about the advance of technology, right? I really don't think it is about the advancement of a specific team, so if we have the opportunity for greater and faster advancement, isn't that something we should encourage? Because I don't understand why you're arguing against that. An exciting thing of working at the bleeding edge is seeing all the possibilities. But a disheartening thing about working at the bleeding edge is seeing many promising avenues be passed by for things like funding and publicity. Do we want meritocracy to win out or the dollar? I guess you'll have to ask yourself: what's driving your excitement? [0] I mean the first Mamba paper, not the first SSM paper btw: https://arxiv.org/abs/2312.00752 [1] https://github.com/karpathy/llm.c/discussions/677 [2] https://arxiv.org/abs/2106.12423 [3] https://www.ft.com/content/d5f91c27-3be8-454a-bea5-bb8ff2a85... [4] I'm not saying any of this stuff is straight de fact better. But there definitely is an attention imbalance and you have to compare like to like. If you get to x in 1000 man hours and someone else gets there in 100, it may be worth taking a look deeper. That's all.
In GPT-5: Key characteristics, pricing and system card
Hello, I've worked on re-writing Karpathy's amazing work, llm.c (https://github.com/karpathy/llm.c), in Rust (https://github.com/Steboss/llm.rust). The overall initial performance, on a small dataset (the tiny Shakespeare) is very promising, achieving a performance that's 30 times better than Karpathy's initial implementation. I'll be continuing developing this, so that it will be possible to have a full train/finetuning on CPU machines - I am not so rich for buying a GPU. Here is my article on it: https://towardsdatascience.com/training-llm-from-scratch-in-... Happy to receive feedback and comments for improvement. Thank you and hope you like it :)
In LLM training written in Rust, 30 times better than C implementation
Using web wrappers around AI is being an AI end user If you want to be an AI engineer study this: https://github.com/karpathy/llm.c And build around llama.cpp Ollama is like cpanel for models. It’s not going to familiarize you with lower level implementation which is just as important as knowing the math. That was my approach. Being aware of the internals not just the equivalent of “git pull model” got me a job, without a CS degree and a long career in software. Ymmv
In Ask HN: Recommendation for a SWE looking to get up to speed with latest on AI
Tweet content: NotebookLM is quite powerful and worth playing with https://notebooklm.google It is a bit of a re-imagination of the UIUX of working with LLMs organized around a collection of sources you upload and then refer to with queries, seeing results alongside and with citations. But the current most new/impressive feature (that is surprisingly hidden almost as an afterthought) is the ability to generate a 2-person podcast episode based on any content you upload. For example someone took my "bitcoin from scratch" post from a long time ago: https://karpathy.github.io/2021/06/21/blockchain/ and converted it to podcast, quite impressive: https://notebooklm.google.com/notebook/ba017fec-7068-4085-97... You can podcastify anything. I give it train_gpt2.c (C code that trains GPT-2): https://github.com/karpathy/llm.c/blob/master/train_gpt2.
Read the rest
c and made a podcast about that: https://notebooklm.google.com/notebook/2585c187-b059-475a-b4... I don't know if I'd exactly agree with the framing of the conversation and the emphasis or the descriptions of layernorm and matmul etc but there's hints of greatness here and in any case it's highly entertaining. Imo LLM capability (IQ, but also memory (context length), multimodal, etc.) is getting way ahead of the UIUX of packaging it into products. Think Code Interpreter, Claude Artifacts, Cursor/Replit, NotebookLM, etc. I expect (and look forward to) a lot more and different paradigms of interaction than just chat. That's what I think is ultimately so compelling about the 2-person podcast format as a UIUX exploration. It lifts two major "barriers to enjoyment" of LLMs. 1 Chat is hard. You don't know what to say or ask. In the 2-person podcast format, the question asking is also delegated to an AI so you get a lot more chill experience instead of being a synchronous constraint in the generating process. 2 Reading is hard and it's much easier to just lean back and listen.
In NotebookLM is quite powerful and worth playing with
I am the author of this toy project. My personal website is [here]((https://yangrobotics.com). Thank you all for your interest! This project began as an effort to mentor a talented high school student in learning Rust and robotics. During the process, I realized that there was a lack of educational materials available online. In response, I set out to create a minimal example of quadrotor control and planning in Rust. I was inspired by [llm.c](https://github.com/karpathy/llm.c), which teaches complex topics with minimal code. My goal was to provide a similar experience, introducing the magic behind quadrotor autonomy with as little code as possible. With the initial framework I developed, I am thrilled to see that my mentee is now able to work independently, experimenting with his own ideas in Rust! I believe this codebase will be valuabl
Read the rest
e for anyone who wants to: a. Learn the principles behind quadrotor autonomy. Code robotics in Rust. b. Explore the challenges of using Rust before incorporating it into their projects. Throughout the development of this project, I have strived to work entirely within the Rust ecosystem. I am now convinced that Rust is ready for serious robotics development. Here are some tools I've been using: 1. [zed.dev](https://yangrobotics.com) for code editing. 2. [Rerun](rerun.io) for visualization. 3. [tokei](https://github.com/XAMPPRocky/tokei) for code line statistics. 4. [nalgebra](https://nalgebra.org) for matrix operations. There are still a few things I'm searching for, such as a robust optimization library. Currently, I'm experimenting with [OpEn](https://alphaville.github.io/optimization-engine) for nonlinear model predictive control, but I hope to find something akin to [acados](https://github.com/acados) in Rust. Additionally, while nalgebra is solid, I believe it still doesn't outperform [Eigen](https://eigen.tuxfamily.org) in terms of performance, though Rust's language features might limit the possibility of implementing something like Eigen. I'm open to suggestions and feedback! For instance, I’m still debating whether to modularize the pipeline and add async features, or whether to keep things simpler to avoid overwhelming beginner learners. Current code statistics: Rust: 1263 Markdown: 305 Comments: 19 Blanks: 44 PS: When naming the project "Peng," I had no idea that "peng" also means attractive! Well, I hope you find the project attractive too.
In Peng – A minimal Rust-based quadrotor simulation pipeline
clu0·Jun 28, 2024Submission

Show HN: UNet diffusion model in pure CUDA

Hi HN! I was inspired by Andrej Karpathy's llm.c (https://github.com/karpathy/llm.c), and wrote a full diffusion model training loop in CUDA. I learnt a lot about CUDA from Simon Boehm's Matmul blog (https://siboehm.com/articles/22/CUDA-MMM). Currently there is still a lot of room for optimization: the model is running at 45% speed of PyTorch with torch.compile. I'm curious about any thoughts or CUDA tips for convolutions.
8 points · Open discussion
Andrej Karpathy karpathy is a magician! But being the coolest kid on the block with pure C/CUDA implementation is not enough https://github.com/karpathy/llm.c Studying a baby Llama 2 model source code in pure Mojo is the next level https://github.com/tairov/llama2.mojo https://github.com/tairov/llama2.mojo/blob/master/llama2.moj... Mojo Lang - Tomorrow's High Performance Python? (with Chris Lattner) https://www.youtube.com/watch?v=JRcXUuQYR90 Andrej Karpathy and Chris Lattner collab is on my wishlist ;)
In Reproducing GPT-2 in llm.c

Showing the 15 most recent of 28 sources. Enable JavaScript to search and browse every indexed mention.

MAKE YOURSELF AT HOME

A few shortcuts

/
Search the collection
?
Open this guide
Esc
Close dialogs and navigation

Your saved repositories and interests stay in this browser.