karpathy/llama2.c
Inference Llama 2 in one file of pure C observed · 2026-08-28
Health v2 · maintenance only
28/100
- Activity 0
- Release rhythm 35
- Longevity 81
Flags: no_releases
How is this computed?
round(0.45*activity + 0.35*rhythm + 0.20*longevity); archived -> min(score, 10) — computed 2026-09-02. Adoption (stars, forks) is never an input.
- gap_med: n/a
- age_days: 1137
- days_rel: n/a
- days_push: 757
- n_releases_24m: 0
Adoption not part of the score
20028 stars · 2617 forks observed · 2026-08-28
What it is AI-extracted, prompt v1, taxonomy v1, 2026-08-29, confidence not recorded
A minimal, dependency-free implementation of the Llama 2 LLM architecture that trains in PyTorch and runs inference in a single ~700-line pure C file. It can also load Meta's Llama 2 checkpoints (fp32), though it is intended for small models and educational use.
Use cases
- run a llama 2 model in pure c
- learn how transformer llm inference works internally
- train a tiny llama 2 model and generate text from it
- embed a small language model in a c program with no dependencies
- study a minimal alternative to llama.cpp
- generate stories with a small language model on a laptop
When to choose
- you want to read and understand every line of an LLM inference engine
- you need to run very small (up to ~7B fp32, practically much smaller) Llama 2 models with zero dependencies
- you are teaching or learning how LLMs work end to end, from training to inference
When to avoid
- you need production-grade performance, quantization, or broad model support - use llama.cpp instead
- you want to serve large models or use GPU acceleration
- you need a maintained, feature-rich inference stack rather than an educational project
Facets
library · maturity active
llm-inference machine-learning deep-learning llm-training large-language-models deep-learning artificial-intelligence education c cross-platform cli llama-2 minimalist educational single-file tinystories transformer-inference
1 source
- readme: https://github.com/karpathy/llama2.c · fetched 2026-08-28 · 020d72eb8e15
Member repositories
| Repository | Role | Health v2 |
|---|---|---|
| karpathy/llama2.c | main | 28 |
For agents
markdown · JSON · MCP: product_card(name="karpathy/llama2.c")
Data as of 2026-08-30T08:39:29.467469+00:00 · Report a problem