Meta Global AI Developer Hackathon. $1M in prizes.Get notified
Model Cards & Prompt formats

Meta Code Llama

Model Card

You can find details about this model in the model card.

Meta Code Llama 7B, 13B, and 34B

Completion

In this format, the model continues to write code following the code that is provided in the prompt. An implementation of this prompt can be found here.

<s>{{ code_prompt }}

Instructions

The instructions prompt template for Meta Code Llama follow the same structure as the Meta Llama 2 chat model, where the system prompt is optional, and the user and assistant messages alternate, always ending with a user message. Note the beginning of sequence (BOS) token between each user and assistant message. An implementation for Meta Code Llama can be found here.

<s>[INST] <<SYS>>
{{ system_prompt }}
<</SYS>>
​
{{ user_message_1 }} [/INST] {{ model_answer_1 }} </s>
<s>[INST] {{ user_message_2 }} [/INST]

Infilling

Infilling can be done in two different ways: with the prefix-suffix-middle format or the suffix-prefix-middle. An implementation of this format is provided here.

Notes:

  • Infilling is only available in the 7B and 13B base models—not in the Python, Instruct, 34B, or 70B models
  • The BOS character is not used for infilling when encoding the prefix or suffix, but only at the beginning of each prompt.

Prefix-suffix-middle

<s><PRE>{{ code_prefix }}<SUF>{{ code_suffix }}<MID>

Suffix-prefix-middle

<s><PRE><SUF>{{ code_suffix }}<MID>{{ code_prefix }}
Meta
Products
Models
Documentation
Resources
Community
Terms & policies