Skip to main content

Model guide

StarCoder2 3B

StarCoder2 3B is a code-completion model, not an instruction-tuned chat assistant. Give it a source-code prefix or a supported fill-in-the-middle template rather than asking a conversational question. It is the compact StarCoder2 option for experimenting with editor completion and evaluating the resulting code.

3BCode16,384 token contextView the model card →

At a glance

Parameters
3B
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 · 1.85 GBsecond-state (community conversion)starcoder2-3b-Q4_K_M.gguf
Languages
17 programming languages

Will it fit?

StarCoder2 3B · 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.
  • Complete a missing line between a function signature and its return statement. Supply the prefix and suffix in StarCoder2’s infill format.

Choose something else when

  • For a conversational explanation of the code, choose an instruction-tuned coding 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