AI & XML / LLM test suite / Results / Models / codellama:7b

Model description

A large language model that can generate and discuss code through text prompts.

Model family

codellama

Context

16K

Input

Text

Size

38 GB

Family sizes

7b, 13b, 34b, 70b

Readme excerpt

Code Llama is a model for generating and discussing code, built on Llama 2. It was designed to make developer workflows faster and more efficient and help people learn programming. It can generate both code and natural language about code. Code Llama supports many of today’s most widely used programming languages, including Python, C++, Java, PHP, TypeScript (JavaScript), C#, Bash and more.

Parameter counts

Parameter count 7 billion View ollama run codellama:7b 13 billion View ollama run codellama:13b 34 billion View ollama run codellama:34b 70 billion View ollama run codellama:70b

Usage

CLI

ollama run codellama "Schreibe mir eine Funktion, die die Fibonacci-Folge ausgibt"

API

curl -X POST http://localhost:11434/api/generate -d '{ "model": "codellama", "prompt": "Schreibe mir eine Funktion, die die Fibonacci-Folge ausgibt" }'

Variants

instruct Fine-tuned to produce helpful and safe natural-language answers python A specialized Code Llama variant further fine-tuned on 100 billion tokens of Python code code Foundation model for code completion

Example prompts

Ask questions

ollama run codellama:7b-instruct 'Du bist ein erfahrener Programmierer, der einfachen, prägnanten Code und Erklärungen schreibt. Schreibe eine Python-Funktion, die die n-te Fibonacci-Zahl erzeugt.'

Fill-in-the-middle (FIM) or infilling

ollama run codellama:7b-code '<PRE> def compute_gcd(x, y): <SUF>return result <MID>'

Fill-in-the-middle (FIM) is a special prompt format allowing the code completion model to fill in code between two existing code blocks. Code Llama expects a specific format for infilling:

<PRE> {prefix} <SUF>{suffix} <MID>

<PRE>, <SUF> and <MID> are special tokens that control the model.

Code review

ollama run codellama ' Wo liegt der Fehler in diesem Code? def fib(n): if n <= 0: return n else: return fib(n-1) + fib(n-2) '

Write tests

ollama run codellama "schreibe einen Unit-Test für diese Funktion: $(cat example.py)"

Code completion

ollama run codellama:7b-code '# Eine einfache Python-Funktion zum Entfernen von Leerzeichen aus einer Zeichenkette:'

Further information

How to prompt Code Llama Background paper CodeLlama GitHub Hugging Face

1270 Runs 1340 evaluated 27.8 % Score 5.0 % exactly correct

Help on evaluation, score and exact correctness

Score is a graded quality measure: correct = 100 %, mostly_correct = 80 %, partial = 50 %, wrong/not_answered = 0 %.

Exactly correct is stricter: only correct-labeled runs count. Mostly correct increases score but does not count as exactly correct.

Evaluated counts all runs with a substantive judgment. LLM-judge errors also count as evaluated, with score 0 %.

Test case Category

x

back to top