Skip to content

jepa.cpp

jepa.cpp runs Meta's JEPA vision models — I-JEPA, V-JEPA 2, V-JEPA 2.1 — plus LeJEPA-style ViTs, LeVJEPA and LeWorldModel on a plain CPU, in C/C++ on ggml, with an optional CUDA backend. Each checkpoint is converted once into a single GGUF file that carries the weights and everything needed to run them — dimensions, positional-encoding scheme, preprocessing recipe, class labels — so at run time the requirement is one binary and one file. There is no Python in the inference path and no per-model C++ code: a new checkpoint of a known family is a converter run, because the loader builds the graph from the file's metadata. Seven model bundles of six families ship today — image and video embedding, video classification, latent-space prediction and action-conditioned world-model rollout — through four command-line tools, one C header, and a Python package (pip install jepa-cpp) that wraps that header and returns numpy arrays. The converted files are published on Hugging Face under jepacpp, so converting anything yourself is optional: scripts/download_models.sh fetches them.

jepa.cpp in four numbers: the same SSv2 validation top-1 as PyTorch, faster on a CPU,
much faster on one GPU, and half the weights at q8_0, over a bar chart of one image
through V-JEPA 2.1 ViT-B on PyTorch, on jepa.cpp's CPU engine and on its CUDA engine

Every number on it is read from tests/results/*.json and the GPU tables of performance.md, measured on a 96-core Threadripper 7995WX and two RTX 4500 Ada; scripts/gen_hero_figure.py redraws it.

Where to go

page what is on it
Getting started build (CPU and CUDA), download the published GGUFs or convert the checkpoints yourself, the per-model licence table, one worked example per tool, running the test suite
Architecture the shared ViT graph, the family matrix, the 3-D RoPE specification, preprocessing, attention and precision, batching, the GPU backend, the runtime switches, and the parity methodology
GGUF format the file format, version 1: every metadata key, the canonical tensor names, the token order, the quantization rules
Performance the speed and memory scores: CPU and CUDA encoders against PyTorch, end-to-end classification, predictors, batching, thread scaling, quantization
Accuracy the fidelity and task scores: f32 exactness, f16/q8_0 and GPU cosines, Imagenette and UCF-101 k-NN, the SSv2 validation top-1, the dtype recommendation per backend
C API the complete include/jepa.h reference, generated from the header
Internals the converter, the V-JEPA tensor and RoPE notes, the ggml-level notes behind the video graph, and the fixtures the parity tests replay
Appendix the raw measurement reports the curated pages draw from — parity, benchmarks, quantization, image accuracy, video accuracy

The full results figure

Three panels: encoder latency per item for PyTorch and jepa.cpp on the CPU and on one GPU, top-1
against PyTorch on Imagenette, UCF-101 and SSv2, and what each dtype costs in weights and in
time

The same measurements at model resolution: latency per item across the four backends, every accuracy row against its PyTorch baseline, and what each dtype costs in weights and in time. The three panels also stand alone, beside the tables they draw — latency and quantization on performance.md, accuracy on accuracy.md; scripts/gen_results_figure.py --split redraws all four.

Machine-readable twins of the measured tables live in tests/results/*.json: benchmarks.json, accuracy-image.json, accuracy-video.json, accuracy-ssv2.json, batching.json.