Code Llama 7B Instruct
The 7B instruction-tuned Code Llama from Meta writes and explains code from plain-English requests. It is the smallest Instruct size in the family.
Overview
Code Llama 7B Instruct is the smallest instruction-tuned size of Code Llama, Meta's family of code models. Meta built the 7B by training Llama 2 further on 500B tokens of code and code-related data, then trained the Instruct version on natural-language instructions paired with the expected output. Requests go in as plain English, like the default prompt here, which asks for a JavaScript function that detects positive numbers.
Meta's model card marks code completion, infilling and instruction chat for this size, and this page gives you the chat side. Training took place between January and July 2023 on sequences of 16,000 tokens.
Choosing a variant: Meta suggests the 7B and 13B sizes for code completion and says the 34B and 70B give the best results. Use this page for contained requests, such as one function or a short script. When a prompt is harder and answer quality matters more, try Code Llama 34B Instruct.
What you can build
- A helper in an internal tool that writes small utility functions from a description.
- A "fix this" button that sends a failing function with its error message and gets a corrected version back.
- Shell one-liners generated from a plain description of the job.
Meta lists Python, C++, Java, PHP, TypeScript (JavaScript), C# and Bash among the supported languages.
Inputs
Only the prompt is required: the request in plain English, plus any code it refers to. A system prompt goes in front of every request. Its default asks for helpful answers that stay safe, and you can replace it with your own rules, such as a target language or code style. Fill in user_id and session_id to keep a separate chat history per user and per conversation.
Advanced settings cover temperature (0 to 5, default 0.7), top_p, top_k, repetition and length penalties, reply length limits and semicolon-separated stop sequences. There is also a seed, 123456 by default. Quantization is on by default. It runs the weights at lower precision to save memory, which the field note says can slightly affect output quality.
Outputs
A single text reply holding the code and any explanation.
Recommended settings
Turn do_sample off for code you intend to run, as the field note advises for code generation. For alternative implementations, leave sampling on near 0.7 and change the seed between runs.
Limitations
- Infilling is on Meta's list for this size, but the page has no prefix or suffix inputs, so requests go in as chat prompts.
- Meta lists natural languages other than English as out of scope.
- Meta warns that outputs can be inaccurate or objectionable. Review and test generated code before it ships.
- Training ended in July 2023, so later library releases are unknown to the model.
Safety & compliance
Code Llama is released under the same community license as Llama 2, and Meta's Acceptable Use Policy for Code Llama also applies. Meta intends it for commercial and research use in English and relevant programming languages, and asks developers to run safety testing and tuning for their specific application before deploying it.
API quick start
Run CodeLlama-7b-Instruct-hf with a single API call.
{
"prompt": "Can you write a javascript function that …",
"user_id": "...",
"session_id": "...",
"system_prompt": "You are a helpful, respectful and honest …"
}curl -X POST "https://api.wiro.ai/v1/Run/meta-llama/codellama-7b-instruct-hf" \
-H "Content-Type: application/json" \
-H "x-api-key: YOUR_WIRO_API_KEY" \
--data-binary @- <<'JSON'
{
"prompt": "Can you write a javascript function that …",
"user_id": "...",
"session_id": "...",
"system_prompt": "You are a helpful, respectful and honest …"
}
JSONOther models you might like
Explore similar llm & chat models.



