# tairov/llama2.mojo

Inference Llama 2 in one file of pure 🔥

Repository: https://github.com/tairov/llama2.mojo
Canonical: https://ross.abutalabs.com/products/llama2mojo
Homepage: https://www.modular.com/blog/community-spotlight-how-i-built-llama2-by-aydyn-tairov
Language: Mojo
License: MIT
License Family: permissive
Topics: inference, llama, llama2, modular, mojo, performance, simd, vectorization, parallelize, tensor, transformer-architecture
Last push: 2026-02-09T08:48:39+00:00

## Health v2 (maintenance only)
Score: 57/100 (v2, computed 2026-09-03T02:20:16.233290+00:00)
- activity 66, release rhythm 35, longevity 77
- inputs: {"age_days": 1088, "days_push": 205, "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 2125, forks 138 (observed 2026-08-28T04:06:16.823987+00:00)

## What it is
A single-file implementation of Llama 2 transformer inference written in pure Mojo, leveraging SIMD and vectorization for fast CPU inference. It outperforms llama2.c and llama.cpp on small Llama models and serves as a showcase of Mojo's performance capabilities.

## Use cases
- run llama 2 inference locally on cpu
- benchmark mojo vs c and python llama2 implementations
- learn how transformer inference works in a single file
- experiment with simd vectorized matrix multiplication
- run tinyllama and stories models from the terminal

## When to choose
- you want fast CPU inference of small Llama 2 models without GPU dependencies
- you are learning Mojo or studying optimized transformer inference code
- you want a minimal single-file LLM inference implementation

## When to avoid
- you need production LLM serving with batching, quantization, or GPU support
- you need to run large models beyond ~1B parameters
- you require a stable long-term dependency, since it tracks Mojo nightly versions

## Facets
- artifact type: cli-tool
- maturity: active
- function: llm-inference, machine-learning, benchmarking
- domain: large-language-models, deep-learning, performance, developer-tools
- platform: cli
- tags: mojo, llama2, simd, vectorization, single-file, transformer, cpu-inference, educational, macos, linux, cpu

## Member repositories
- tairov/llama2.mojo (main) score 57

## Provenance
- Observed fields: from GitHub, fetched 2026-08-28T04:06:16.823987+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-30T02:52:41.858289+00:00, confidence not recorded.
  - readme: https://github.com/tairov/llama2.mojo (fetched 2026-08-28T04:06:16.823987+00:00, sha bdf5d79083b1)
  - homepage: https://www.modular.com/blog/community-spotlight-how-i-built-llama2-by-aydyn-tairov (fetched 2026-08-29T10:32:40.418179+00:00, sha 3a8fd8fe7221)
  - site_page: https://docs.modular.com/ (fetched 2026-08-29T10:32:40.421047+00:00, sha 05fe31f74212)
  - site_page: https://www.modular.com/company/about (fetched 2026-08-29T10:32:40.424964+00:00, sha 3b5f4e72598e)
  - site_page: https://www.modular.com/pricing (fetched 2026-08-29T10:32:40.422780+00:00, sha bc1180bba7dd)
- Data as of 2026-08-30T08:39:29.467469+00:00.
