# karpathy/llm.c

LLM training in simple, raw C/CUDA

Repository: https://github.com/karpathy/llm.c
Canonical: https://ross.abutalabs.com/products/llmc
Language: Cuda
License: MIT
License Family: permissive
Last push: 2025-06-26T17:03:40+00:00

## Health v2 (maintenance only)
Score: 37/100 (v2, computed 2026-09-02T17:46:02.011165+00:00)
- activity 28, release rhythm 35, longevity 62
- inputs: {"age_days": 877, "days_push": 433, "days_rel": null, "gap_med": null, "n_releases_24m": 0}
- flags: no_releases
- formula: round(0.45*activity + 0.35*rhythm + 0.20*longevity); archived -> min(score, 10)

## Adoption (not part of the score)
Stars 30879, forks 3744 (observed 2026-08-28T04:11:56.502104+00:00)

## What it is
llm.c is a pure C/CUDA implementation for training large language models like GPT-2 and GPT-3, with no dependency on PyTorch or Python. It includes a compact ~1,000-line CPU reference implementation and a faster-than-PyTorch CUDA training path.

## Use cases
- train a GPT-2 model from scratch in pure C
- learn how LLM training works at the CUDA level
- pretrain GPT-2/GPT-3 scale models without PyTorch
- study a minimal readable LLM training implementation
- benchmark custom CUDA training against PyTorch
- run LLM pretraining on a single GPU with fp32

## When to choose
- you want to understand or modify every detail of LLM training in C/CUDA
- you need a lightweight training stack without PyTorch's overhead
- you're reproducing GPT-2/GPT-3 pretraining on NVIDIA GPUs
- you're learning CUDA through a real, high-performance codebase

## When to avoid
- you need a production training framework with broad model support
- you want fine-tuning, RLHF, or inference features out of the box
- you don't have NVIDIA GPUs and need multi-backend support
- you prefer Python ecosystem tooling and integrations

## Facets
- artifact type: library
- maturity: active
- function: llm-training, deep-learning, machine-learning, gpu-computing
- domain: large-language-models, deep-learning, machine-learning, gpu-computing
- platform: cpp, c
- tags: cuda, gpt-2, gpt-3, pretraining, educational, no-pytorch, karpathy, linux, gpu

## Member repositories
- karpathy/llm.c (main) score 37

## Provenance
- Observed fields: from GitHub, fetched 2026-08-28T04:11:56.502104+00:00.
- Health v2: computed from the inputs above; adoption is never an input.
- Inferred fields (summary, facets, guidance): AI-extracted, prompt v1, taxonomy v1, on 2026-08-29T16:52:36.136171+00:00, confidence not recorded.
  - readme: https://github.com/karpathy/llm.c (fetched 2026-08-28T04:11:56.502104+00:00, sha c6ba00b6e2cf)
- Data as of 2026-08-30T08:39:29.467469+00:00.
