llama2.c/README.md at master · karpathy/llama2.c
With the code in this repo you can train the Llama 2 LLM architecture from scratch in PyTorch, then export the weights to a binary file, and load that into one ~simple 500-line C file (run.c) that inferences the model. Alternatively, you can load, finetune, and inference Meta's Llama 2 (but this is still being actively fleshed out). Hence, this repo is a "fullstack" train + inference solution for Llama 2 LLM, with a focus on minimalism and simplicity. 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. I recommend looking at the TinyStories paper for inspiration. Please note that this started recently as just a fun weekend project: I took my earlier nanoGPT, tuned it to implement the Llama-2 architecture instead of GPT-2, and the meat of it was writing the C inference engine in run.c. So the project is young and moving quickly. Hat tip to the awesome l
llama2.c 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
Explore this link on the map →related reading
- ⭐️ Fast LLM Inference From Scratchandrewkchan.dev
- The Llama Hitchiking Guide to Local LLMs – hackerllamaosanseviero.github.io
- How is LLaMa.cpp possible?finbarr.ca
- Optimizing inference · Hugging Facehuggingface.co
- Composer2.pdfcursor.com
- LLM Inference Performance Engineering: Best Practices | Databricks Blogdatabricks.com
- Llama 2 · Hugging Facehuggingface.co
- Inference characteristics of Llama · Cursorcursor.com
- Getting Caught Up to Modern LLM Research | Samarth Goeldev.samarthgoel.com
- Accelerating LLaMA with Fabric: A Comprehensive Guide to Training and Fine-Tuning LLaMA - Lightning AIlightning.ai
- LLM Architecture Gallery | Sebastian Raschka, PhDsebastianraschka.com
- Fine-Tuning Llama-2: Tailoring Models to Unique Applicationsanyscale.com