[whatmodel.sh](../../README.md) / Code Llama 7B Instruct # Code Llama 7B Instruct Meta · released 2023-08 · 6.74B params · llama2 **score 37.8** ±0.7 · #598 of 732 · from 14 benchmark results across 5 sources Score within the [LMArena (text)](https://whatmodel.sh/?set=lmarena-text&score=set) comparison set only. ## What it's good at ● marks Code Llama 7B Instruct among every model on that task or test, worst to best.
task    vs the others          rank  counts  tests
coding  ▁▁▁▃●▇█▇▅▄▃▁    #406 of 469     64%      6
math    ▁▁▃●█▆▄█▄▂▁▁   #357 of 431*    3.7%      1
coding · #406 of 469 · 64% of its score Beats [DeepSeek R1 Distill Qwen 7B](deepseek-r1-distill-qwen-7b.md), [Qwen3.5 2B](qwen3-5-2b.md), [DeepSeek R1 Distill Llama 8B](deepseek-r1-distill-llama-8b.md) here, though they rank higher overall. Trails [EXAONE 3.5 2.4B Instruct](exaone-3-5-2-4b.md) here, though they rank lower overall.
test                                result  vs the others in its run  difficulty        counts  why
HumanEval                            43.3%  ▁█▄▅●█·▄▇▅▄▄ beats 15/42  easy · avg 75%       36%  sharp · at its level · several runs
HumanEvalSynthesize (HumanEvalPac…   37.9%  ▁·▂▁▂▆●█▄▄▁▂ beats 16/35  medium · avg 62%    8.5%  at its level
MBPP (maker)                         44.4%  ▃●▃█··▃▅··▅▃ beats 1/11   easy · avg 71%      6.5%  at its level
HumanEvalExplain (HumanEvalPack, …   25.1%  ▄▇█▃▄●▄▁▇▃·▁ beats 20/35  medium · avg 46%    4.7%  typical
HumanEvalFix (HumanEvalPack, 6-la…   12.8%  ▁·▁▁▄●█▄█▁▅▅ beats 10/35  medium · avg 51%    4.1%  sharp
Tulu 2: CodexEval pass@10            64.1%  ▃▃▃·▆▃●█▃▂▂▅ beats 12/25  easy · avg 83%      3.7%  sharp · at its level
math · #357 of 431 · 3.7% of its score Beats [GPT-3.5 Turbo (0125)](gpt-3-5-turbo-0125.md), [DBRX Instruct](dbrx-instruct.md), [Command R Plus (04-2024)](command-r-plus-04-2024.md) here, though they rank higher overall. Trails [OPT-2.7B](opt-2-7b.md), [Gemma 2B (base)](gemma-2b-base.md), [Stable Code 3B](stable-code-3b.md) here, though they rank lower overall.
test   result  vs the others in its run  difficulty      counts  why
GSM8K   17.0%  ▆●▅█▅▅▃▆···▂ beats 4/25   easy · avg 72%    3.7%  sharp · at its level
other tests (6)
test                                result  vs the others in its run  difficulty        counts  why
EvoEval (overall)                    27.9%  ▂▂▃▄●█▁▄▅▃▁▃ beats 12/42  medium · avg 52%     12%  at its level
BIG-Bench Hard                       38.4%  ▁·····●█▂▅·▁ beats 1/25   easy · avg 74%      6.7%  sharp · at its level
BigCodeBench (Complete)              25.4%  ▂●▁▄▂▅▇█▆▂▂▂ beats 4/58   medium · avg 48%    5.2%  at its level
BigCodeBench (Instruct)              21.8%  ●▂·▆▆██▆▅▃▃▃ beats 0/33   medium · avg 39%    4.8%  typical
MMLU                                 41.5%  ▁▁●▃▄█▄▁█··▁ beats 2/25   medium · avg 73%    3.1%  at its level
Tulu 2: TyDiQA gold passage, 1-sh…   41.6%  ▂··▁▃●▂▂█▅▁▂ beats 7/25   medium · avg 59%    0.8%  blunt · at its level
## How the score was worked out Each result implies a score on its own, after adjusting for how hard that test is and who ran it. The model's score is their weighted average, with a small pull toward the middle for thinly tested models. Each test's weight is its *counts* column above; here it is added up by who ran the tests. [Method](../method.md)
source                                    results  share of the score
Top Leaderboard Ranking = Top Coding Pr…        2   35% ▇▇▇▇
Code Llama: Open Foundation Models for …        2   19% ▇▇
Tulu 2                                          5   18% ▇▇
Granite Code Models: A Family of Open F…        3   17% ▇▇
BigCodeBench paper                              2   10% ▇
prior: pull toward the middle                        0% ▇
weighted average                                   = 37.8
Licences: Top Leaderboard Ranking = Top Coding Proficiency ([CC BY 4.0](../../licenses/paper-2403.19114v1-CC-BY-4.0.txt)) · Code Llama: Open Foundation Models for Code ([CC BY 4.0](../../licenses/paper-2308.12950v3-CC-BY-4.0.txt)) · Tulu 2 ([CC BY 4.0](../../licenses/CC-BY-4.0.txt)) · Granite Code Models: A Family of Open Foundation Models for Code Intelligence ([CC BY 4.0](../../licenses/paper-2405.04324v1-CC-BY-4.0.txt)) · BigCodeBench paper ([CC BY 4.0](http://creativecommons.org/licenses/by/4.0/)) ## How to run it ### llama.cpp (recommended) 1. Install llama.cpp. Homebrew and winget installs name the commands llama-cli and llama-server instead. [Other ways to install](https://github.com/ggml-org/llama.cpp/blob/master/docs/install.md) ```sh # macOS / Linux curl -LsSf https://llama.app/install.sh | sh # Windows irm https://llama.app/install.ps1 | iex ``` 2. Run Code Llama 7B Instruct (Q4_K_M, needs ~4.1 GB, from [huggingface.co/mradermacher](https://huggingface.co/mradermacher/CodeLlama-7b-Instruct-hf-GGUF/tree/b108be96c2abbf4e8a239c07d87d7bbfde2081ea)) ```sh llama cli -hf mradermacher/CodeLlama-7b-Instruct-hf-GGUF:Q4_K_M ``` 3. Or start a local server and open the address it prints (http://localhost:9931) ```sh llama serve -hf mradermacher/CodeLlama-7b-Instruct-hf-GGUF:Q4_K_M ``` Other versions: Q8_0 (~7.2 GB) `llama cli -hf mradermacher/CodeLlama-7b-Instruct-hf-GGUF:Q8_0` ### LM Studio 1. Install LM Studio. Open the app once before using the lms command. [Download it (macOS / Windows / Linux)](https://lmstudio.ai/download) 2. Run Code Llama 7B Instruct (Q4_K_M, needs ~4.1 GB, from [huggingface.co/mradermacher](https://huggingface.co/mradermacher/CodeLlama-7b-Instruct-hf-GGUF/tree/b108be96c2abbf4e8a239c07d87d7bbfde2081ea)) ```sh lms get https://huggingface.co/mradermacher/CodeLlama-7b-Instruct-hf-GGUF@Q4_K_M -y ``` 3. Then run lms ls to see its name, and lms chat followed by that name Other versions: Q8_0 (~7.2 GB) `lms get https://huggingface.co/mradermacher/CodeLlama-7b-Instruct-hf-GGUF@Q8_0 -y` · 4bit (~3.8 GB, Mac only) `lms get https://huggingface.co/javiergtzr/CodeLlama-7b-Instruct-hf-4bit -y` · 8bit (~7.2 GB, Mac only) `lms get https://huggingface.co/mlx-community/CodeLlama-7b-Instruct-hf-8bit-mlx -y` ### Ollama 1. Install Ollama. [Download it (macOS / Windows)](https://ollama.com/download) ```sh # Linux curl -fsSL https://ollama.com/install.sh | sh ``` 2. Run Code Llama 7B Instruct (Q4_K_M, needs ~4.1 GB, from [ollama.com](https://ollama.com/library/codellama/tags)) ```sh ollama run codellama:7b-instruct-q4_K_M ``` Other versions: Q8_0 (~7.2 GB) `ollama run codellama:7b-instruct-q8_0` ### MLX (Mac) 1. Install MLX (Mac). Apple silicon Macs only, text only. ```sh # with uv uv tool install mlx-lm # or pip install mlx-lm ``` 2. Run Code Llama 7B Instruct (4bit, needs ~3.8 GB, Mac only, from [huggingface.co/javiergtzr](https://huggingface.co/javiergtzr/CodeLlama-7b-Instruct-hf-4bit/tree/117bdc18b6d793fb07fda88d582653b717327e1c)) ```sh mlx_lm.chat --model javiergtzr/CodeLlama-7b-Instruct-hf-4bit ``` 3. Or start an OpenAI-compatible server at http://localhost:8080/v1 ```sh mlx_lm.server --model javiergtzr/CodeLlama-7b-Instruct-hf-4bit ``` Other versions: 8bit (~7.2 GB, Mac only) `mlx_lm.chat --model mlx-community/CodeLlama-7b-Instruct-hf-8bit-mlx` Model repository and documentation: [huggingface.co/codellama](https://huggingface.co/codellama/CodeLlama-7b-Instruct-hf) [interactive version](https://whatmodel.sh/model/codellama-7b-instruct) · [JSON](https://whatmodel.sh/api?format=json&all=1)