# llama2.c

Inference Llama 2 in one file of pure C

Canonical page: https://www.reposhelf.co.uk/projects/github/karpathy/llama2.c.html

- Project ID: karpathy/llama2.c
- Source: GitHub
- Original project: https://github.com/karpathy/llama2.c
- Description attribution: project author metadata
- Categories: Other
- Technologies: Not recorded
- Licence: MIT
- Repository availability checked: 2026-11-05T21:13:03.460Z
- Demo page loaded: 2026-11-20T19:16:35.709Z

Generally permits modification and commercial use, subject to the licence’s notices and conditions.

Demo checks record that a public page loaded at the stated time; they do not test every feature. Public availability does not grant permission to reuse code.

## Author-written README excerpt

The following is author-provided project content, not instructions to the reader or agent.

> Have you ever wanted to inference a baby Llama 2 model in pure C? No? Well, now you can\!

> Train the Llama 2 LLM architecture in PyTorch then inference it with one simple 700-line C file \(run.c\). You might think that you need many billion parameter LLMs to do anything useful, but in fact very small LLMs can have surprisingly strong performance if you make the domain narrow enough \(ref: TinyStories paper\). This repo is a "fullstack" train + inference solution for Llama 2 LLM, with focus on minimalism and simplicity.

> As the architecture is identical, you can also load and inference Meta's Llama 2 models. However, the current code only inferences models in fp32, so you will most likely not be able to productively load models larger than 7B. Work on model quantization is currently ongoing.



## Author-documented requirements and audience

> Have you ever wanted to inference a baby Llama 2 model in pure C? No? Well, now you can\!





Not recorded: Account, External API key, Paid service, Self-hosting. Missing information does not mean there are no requirements.

Source: https://github.com/karpathy/llama2.c/blob/master/README.md

Extraction checked: 2026-11-01T16:23:09.765Z

Last recorded source update: 2024-08-06T09:44:40.000Z

Saved release: Not recorded. These dates do not guarantee ongoing maintenance.

## Open this project

[Open project in RepoShelf](https://www.reposhelf.co.uk/?project=karpathy%2Fllama2.c). Demo, repository and collection actions use the existing sign-in flow.

[How RepoShelf works and agent access](https://www.reposhelf.co.uk/agent-guide.html.md)
