Model reference · open weights

stable-code

LLMs stabilityai Text gen 1 build Its own licence terms 6k dl/mo

stable-code is an open-weight language model from Stability AI. stable-code-3b (BF16) weighs 2.3 GB; the smallest configuration that runs it is RTX 3060 12 GB.

  • Stable Code 3B is a 2.8B parameter decoder-only language model developed by Stability AI for text generation and code completion.
  • It supports English and 18 programming languages, with a context length of 16,384 tokens and Fill in Middle capability.
  • The model is released under the Stability AI Community License.

Summary of the stabilityai/stable-code-3b model card, 2026-10-01

What it is

Released byStability AI
Released2024-01-09
Parameters2.8B
VRAM2.3 GB for the weights

What it runs on

Memory and cards for stable-code-3b (BF16)

2.3 GBweights, file size
328 MBcache per 1K tokens
460 MBruntime overhead, at least
16,384 tokenscontext max
CardRequests at onceContext maxMemory
8K each
RTX 3060 12 GB3all 16K11.6 GB
RTX 4060 Ti 16 GB4all 16K15.4 GB
RTX 3090 24 GB7all 16K23.4 GB
RTX 4090 24 GB7all 16K23.4 GB
RTX 5090 32 GB10all 16K31.0 GB
L40S 48 GB15all 16K44.0 GB
A100 80 GB28all 16K78.2 GB
H100 80 GB28all 16K78.1 GB
RTX PRO 6000 Blackwell 96 GB33all 16K93.8 GB
DGX Spark (GB10) 128 GB unified38all 16K107 GB
H200 141 GB50all 16K138 GB
B200 180 GB64all 16K176 GB
2× RTX 3060 12 GB
split by layers (llama.cpp)
7all 16K11.6 GB a card
2× RTX 4060 Ti 16 GB
split by layers (llama.cpp)
10all 16K15.4 GB a card
2× RTX 4090 24 GB
split by layers (llama.cpp)
16all 16K23.4 GB a card
2× RTX 3090 24 GB
split by layers (llama.cpp)
16all 16K23.4 GB a card
Memory needed at each load
Requests at once8K tokens each
15.4 GB
516.2 GB
824.2 GB
1645.7 GB
3288.7 GB
64175 GB

One card, with vLLM's small-card settings.

From the model card

What Stability AI says about stable-code

Read the model card

Please note: For commercial use, please refer to https://stability.ai/license.

Model Description

stable-code-3b is a 2.7B billion parameter decoder-only language model pre-trained on 1.3 trillion tokens of diverse textual and code datasets. stable-code-3b is trained on 18 programming languages (selected based on the 2023 StackOverflow Developer Survey) and demonstrates state-of-the-art performance (compared to models of similar size) on the MultiPL-E metrics across multiple programming languages tested using BigCode's Evaluation Harness.

ModelSizePythonC++JavascriptJavaPHPRust
Stable Code3B32.4%30.9%32.1%32.1%24.2%23.0%
CodeLLama7B30.0%28.2%32.5%31.1%25.7%26.3%
Deepseek Coder1.3B28.6%29.2%28.7%29.0%23.6%18.5%
Wizard Coder3B31.6%25.6%26.2%25.8%25.3%20.4%
StarCoder3B21.6%19.8%21.5%20.5%19.0%16.9%
Replit Code V1.53B23.0%25.9%26.2%23.6%23.2%21.5%
Deci Coder1B19.1%6.8%18.4%16.7%2.1%1.7%

Key Features

  • Fill in Middle Capability (FIM)
  • Supports Long Context, trained with Sequences upto 16,384

Usage

Get started generating text with stable-code-3b by using the following code snippet:

import torch
from transformers import AutoModelForCausalLM, AutoTokenizer
tokenizer = AutoTokenizer.from_pretrained("stabilityai/stable-code-3b")
model = AutoModelForCausalLM.from_pretrained(
  "stabilityai/stable-code-3b",
  torch_dtype="auto",
)
model.cuda()
inputs = tokenizer("import torch\nimport torch.nn as nn", return_tensors="pt").to(model.device)
tokens = model.generate(
  **inputs,
  max_new_tokens=48,
  temperature=0.2,
  do_sample=True,
)
print(tokenizer.decode(tokens[0], skip_special_tokens=True))

Run with Fill in Middle (FIM) ⚡️

from transformers import AutoModelForCausalLM, AutoTokenizer
tokenizer = AutoTokenizer.from_pretrained("stabilityai/stable-code-3b")
model = AutoModelForCausalLM.from_pretrained(
  "stabilityai/stable-code-3b",
  torch_dtype="auto",
  attn_implementation="flash_attention_2",
)
model.cuda()
inputs = tokenizer("def fib(n):    else:\n        return fib(n - 2) + fib(n - 1)", return_tensors="pt").to(model.device)
tokens = model.generate(
  **inputs,
  max_new_tokens=48,
  temperature=0.2,
  do_sample=True,
)
print(tokenizer.decode(tokens[0], skip_special_tokens=True))

Run with Flash Attention 2 ⚡️

from transformers import AutoModelForCausalLM, AutoTokenizer
tokenizer = AutoTokenizer.from_pretrained("stabilityai/stable-code-3b", trust_remote_code=True)
model = AutoModelForCausalLM.from_pretrained(
  "stabilityai/stable-code-3b",
  trust_remote_code=True,
  torch_dtype="auto",
+ attn_implementation="flash_attention_2",
)
model.cuda()
inputs = tokenizer("import torch\nimport torch.nn as nn", return_tensors="pt").to(model.device)
tokens = model.generate(
  **inputs,
  max_new_tokens=48,
  temperature=0.2,
  do_sample=True,
)
print(tokenizer.decode(tokens[0], skip_special_tokens=True))

Model Details

  • Developed by: Stability AI
  • Model type: stable-code-3b models are auto-regressive language models based on the transformer decoder architecture.
  • Language(s): English, Code
  • Library: GPT-NeoX
  • License: Stability AI Community License.
  • Commercial License: to use this model commercially, please refer to https://stability.ai/license
  • Contact: For questions and comments about the model, please email lm@stability.ai

Model Architecture

The model is a decoder-only transformer similar to the LLaMA (Touvron et al., 2023) architecture with the following modifications:

ParametersHidden SizeLayersHeadsSequence Length
2,796,431,3602560323216384
  • Position Embeddings: Rotary Position Embeddings (Su et al., 2021) applied to the first 25% of head embedding dimensions for improved throughput following Black et al. (2022).
  • Tokenizer: We use a modified version of the GPTNeoX Tokenizer.NeoX. We add special tokens to train for Fill in the Middle (FIM) capabilities like and along with other special tokens.

Training

Training Dataset

The dataset is comprised of a filtered mixture of open-source large-scale datasets available on the HuggingFace Hub: Falcon RefinedWeb extract (Penedo et al., 2023), along with CommitPackFT and Github Issues (BigCode., 2023), and StarCoder (Li et al., 2023). We further supplement our training with data from mathematical domains (Azerbayev, Zhangir, et al., 2023 and, Yu, Longhui, et al., 2023).

Top 18 programming languages trained on:

  • C
  • CPP
  • Java
  • JavaScript
  • CSS
  • Go
  • HTML
  • Ruby
  • Rust
  • Markdown
  • Shell
  • Php
  • Sql
  • R
  • Typescript
  • Python
  • Jupyter-Clean
  • RestructuredText

Training Procedure

The model is pre-trained on the aforementioned datasets in bfloat16 precision, optimized with AdamW.

Training Infrastructure

  • Hardware: stable-code-3b was trained on the Stability AI cluster across 256 NVIDIA A100 40GB GPUs (AWS P

Quoted from the model card on Hugging Face. The full card is behind the Hugging Face link above.

Benchmarks

Reported results

As published on the model card: the maker's own numbers, not measured by AxForge.

TaskDatasetMetricScore
text-generationMultiPL-HumanEval (Python)pass@132.400
text-generationMultiPL-HumanEval (C++)pass@130.900
text-generationMultiPL-HumanEval (Java)pass@132.100
text-generationMultiPL-HumanEval (JavaScript)pass@132.100
text-generationMultiPL-HumanEval (PHP)pass@124.200
text-generationMultiPL-HumanEval (Rust)pass@123
© 2026 AxForge · EU-hosted AI infrastructure Pricing Docs Trust Privacy Terms