Skip to main content

Model guide

StarCoder2 7B

StarCoder2 7B sits between the 3B and 15B code-completion checkpoints. It suits a comparison of editor completions using identical code prefixes and tests. Keep the distinction between completion and chat: this base checkpoint does not become an instruction assistant merely because a chat interface can load it.

7BCode16,384 token contextView the model card →

At a glance

Parameters
7B
Accepts
Text
Returns
Text, including code
Published context limit
16,384 tokens
Model format
safetensors · GGUF
Software and download hosts
transformers · Ollama. Follow the exact setup below; this list does not establish support for every format, input type or software version.
Suggested compression
Q4_K_M
Model-weight download
Q4_K_M weights · 4.40 GBsecond-state (community conversion)starcoder2-7b-Q4_K_M.gguf
Languages
17 programming languages

Will it fit?

StarCoder2 7B · Q4_K_M download. Fit depends on your computer, the app you run it in and the conversation length you need.

Check on your computer

Best for

  • Code completion — supply the code before and after the gap. Choose an Instruct checkpoint for chat.
  • Run the same incomplete function through 3B and 7B. Test whether the insertion respects the code on both sides of the cursor.

Choose something else when

  • If your editor sends a chat message instead of an infill prompt, change the integration or select a chat model.

First setup

For fill-in-the-middle, supply the code before and after the missing section using the publisher’s <fim_prefix>, <fim_suffix> and <fim_middle> format. Prefix: def double(x): followed by an indented return. Suffix: assert double(3) == 6. Submit the prefix and suffix using the displayed infill tokens, then run the assembled function. See the model instructions.

For memory planning, load the linked quantization at 4,096-token context with one request at a time. Record available RAM and VRAM before loading, after loading and while completing a representative code prefix, using Task Manager on Windows, Activity Monitor on macOS or nvidia-smi for an NVIDIA GPU. Increase the context only after the short run leaves adequate memory for other programs. Weight size alone cannot establish fit.

Other models for this task