[whatmodel.sh](../../README.md) / Code Llama 7B (base) # Code Llama 7B (base) Meta · released 2023-08 · 6.74B params · llama2 **score 35.7** ±0.5 · #620 of 732 · from 37 benchmark results across 8 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 (base) among every model on that task or test, worst to best.
task    vs the others         rank  counts  tests
coding  ▁▁▁▃●▇█▇▅▄▃▁   #419 of 469     79%     11
math    ▁▁▃●█▆▄█▄▂▁▁   #366 of 431    8.6%      2
coding · #419 of 469 · 79% 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 [Llama 3.2 1B Instruct](llama-3-2-1b.md), [SmolLM2 1.7B Instruct](smollm2-1-7b.md) here, though they rank lower overall.
test                                result  vs the others in its run  difficulty        counts  why
HumanEval                            37.8%  ▁·▁▁▃●▆▅█▃▁▁ beats 22/99  easy · avg 76%       35%  sharp · at its level · several runs
HumanEval+                           35.4%  ▁·▁▁▁▃●▄▄█▃▁ beats 23/99  easy · avg 70%       14%  sharp · at its level
MBPP                                 39.0%  █·▅▃▃●▅▃▃▅·▅ beats 7/15   easy · avg 81%       10%  at its level · several runs
HumanEvalSynthesize (HumanEvalPac…   31.2%  ▁·▂▁▂●▅█▄▄▁▂ beats 8/35   medium · avg 62%    4.0%  at its level
MBPP+                                46.8%  ▁···▁▁▂●▇█▆▂ beats 16/75  easy · avg 66%      3.2%  at its level
CRUXEval-I (maker)                   35.9%  ▁··▁▅●█▇▁··▁ beats 6/22   medium · avg 56%    2.7%  at its level · several runs
CRUXEval-O (maker)                   34.2%  ▁·▂●▁█▁▂···▁ beats 6/22   medium · avg 54%    2.4%  blunt · at its level · several runs
DS-1000                              21.5%  ▄▄·▄●█▄█·█·▄ beats 3/12   medium · avg 49%    2.3%  typical
HumanEvalExplain (HumanEvalPack, …   13.9%  ▄●█▃▄▇▄▁▇▃·▁ beats 7/35   medium · avg 46%    2.1%  typical
Tulu 2: CodexEval pass@10            58.7%  ▃▃▃·▆●▃█▃▂▂▅ beats 10/25  easy · avg 83%      1.9%  sharp · at its level
HumanEvalFix (HumanEvalPack, 6-la…   14.2%  ▁·▁▁▄█●▄█▁▅▅ beats 13/35  medium · avg 51%    1.7%  sharp
math · #366 of 431 · 8.6% 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-1.3B](opt-1-3b.md), [OPT-2.7B](opt-2-7b.md), [Gemma 2B (base)](gemma-2b-base.md) here, though they rank lower overall.
test   result  vs the others in its run  difficulty      counts  why
GSM8K   12.0%  ●▂▅█▅▅▃▆···▂ beats 1/25   easy · avg 75%    6.7%  sharp · at its level · several runs
MATH     4.1%  ▃·●····▃···█ beats 1/5    hard · avg 27%    2.0%  several runs
other tests (11)
test                                result  vs the others in its run   difficulty        counts  why
BIG-Bench Hard                       43.4%  ▁·····▂●▂▅·▁ beats 4/25    easy · avg 74%      3.0%  sharp
MMLU                                 33.8%  ●▁▃▃▄█▄▁█··▁ beats 0/25    medium · avg 73%    2.5%  at its level · several runs
BigCodeBench (Complete)              28.7%  ▂▁▁●▂▅▇█▆▂▂▂ beats 8/58    medium · avg 48%    2.5%  at its level
ARC Challenge                        34.5%  ▄▁▁▂▁●█▇▃▂▃▂ beats 35/140  easy · avg 75%      1.2%  sharp · at its level
WinoGrande                           62.3%  ▁▁▁▁▂▁▁●▇█▃▁ beats 45/131  easy · avg 84%      0.7%  at its level
Natural Questions (closed book)      11.0%  ▂▁▁▁▂▄▄●▅█▅▁ beats 28/68   medium · avg 45%    0.6%  typical
HellaSwag                            62.9%  ▁▁▁▂▂▂▄●█▇▄▂ beats 49/135  easy · avg 88%      0.5%  at its level
TriviaQA                             34.9%  ▁▁▂▂▄▄▃●▅█▅▂ beats 31/80   easy · avg 80%      0.4%  at its level · noisy
Tulu 2: TyDiQA gold passage, 1-sh…   47.6%  ▂··▁▃▂▂●█▅▁▂ beats 11/25   medium · avg 59%    0.4%  blunt · at its level
ARC Easy                             59.4%  ▁▃▂▄●█▅▃▁··▁ beats 28/100  easy · avg 85%      0.3%  blunt · at its level
PIQA                                 72.8%  ▁▁▁▂▂●▅█▅▃▁▁ beats 31/123  easy · avg 86%      0.2%  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
EvalPlus / EvalPerf published evaluatio…        3   37% ▇▇▇▇
Granite Code Models: A Family of Open F…        8   15% ▇▇
StarCoder 2 and The Stack v2: The Next …        4   15% ▇▇
Mistral 7B                                     12   11% ▇
Code Llama: Open Foundation Models for …        2    9% ▇
Tulu 2                                          5    8% ▇
BigCodeBench paper                              1    2% ▇
CRUXEval published evaluation results (…        2    2% ▇
prior: pull toward the middle                        0% ▇
weighted average                                   = 35.7
Licences: EvalPlus / EvalPerf published evaluation runs ([Apache-2.0](../../licenses/evalplus-published-runs-Apache-2.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)) · StarCoder 2 and The Stack v2: The Next Generation ([CC BY-SA 4.0](../../licenses/paper-2402.19173v1-CC-BY-SA-4.0.txt)) · Mistral 7B ([CC BY 4.0](../../licenses/paper-2310.06825v1-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)) · BigCodeBench paper ([CC BY 4.0](http://creativecommons.org/licenses/by/4.0/)) · CRUXEval published evaluation results ([MIT](../../licenses/cruxeval-published-results-MIT.txt)) ## 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 (base) (Q4_K_M, needs ~4.1 GB, from [huggingface.co/TheBloke](https://huggingface.co/TheBloke/CodeLlama-7B-GGUF/tree/98596f7f6c318118824bcbee4b0e20010ec510ec)) ```sh llama cli -hf TheBloke/CodeLlama-7B-GGUF:Q4_K_M ``` 3. Or start a local server and open the address it prints (http://localhost:9931) ```sh llama serve -hf TheBloke/CodeLlama-7B-GGUF:Q4_K_M ``` Other versions: Q8_0 (~7.2 GB) `llama cli -hf TheBloke/CodeLlama-7B-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 (base) (Q4_K_M, needs ~4.1 GB, from [huggingface.co/TheBloke](https://huggingface.co/TheBloke/CodeLlama-7B-GGUF/tree/98596f7f6c318118824bcbee4b0e20010ec510ec)) ```sh lms get https://huggingface.co/TheBloke/CodeLlama-7B-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/TheBloke/CodeLlama-7B-GGUF@Q8_0 -y` · 4bit (~3.8 GB, Mac only) `lms get https://huggingface.co/mlx-community/CodeLlama-7b-hf-4bit-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 (base) (Q4_K_M, needs ~4.1 GB, from [ollama.com](https://ollama.com/library/codellama/tags)) ```sh ollama run codellama:7b-code-q4_K_M ``` Other versions: Q8_0 (~7.2 GB) `ollama run codellama:7b-code-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 (base) (4bit, needs ~3.8 GB, Mac only, from [huggingface.co/mlx-community](https://huggingface.co/mlx-community/CodeLlama-7b-hf-4bit-mlx/tree/5d4a7e74c57a13350df444e25862fda846fc76f8)) ```sh mlx_lm.chat --model mlx-community/CodeLlama-7b-hf-4bit-mlx ``` 3. Or start an OpenAI-compatible server at http://localhost:8080/v1 ```sh mlx_lm.server --model mlx-community/CodeLlama-7b-hf-4bit-mlx ``` Model repository and documentation: [huggingface.co/codellama](https://huggingface.co/codellama/CodeLlama-7b-hf) [interactive version](https://whatmodel.sh/model/codellama-7b) · [JSON](https://whatmodel.sh/api?format=json&all=1)