Stable Code Instruct 3B β Base Model
This repository stores an unchanged copy of
stabilityai/stable-code-instruct-3b
for use as a base model in future fineβtuning projects (including Stephen).
π About the Model
stable-code-instruct-3b
is a 2.7B parameter decoder-only transformer from Stability AI, tuned for multiβlanguage code generation and conversational coding assistance.
It is suitable as a starting point for specialized code assistants,
including fineβtuned variants with domainβspecific datasets.
Key Features:
- General purpose code generation across multiple programming languages.
- Instructionβtuned for better conversational performance.
- Strong performance on MultiPL-E benchmarks.
π Performance (MultiPL-E Benchmark)
Language | pass@1 |
---|---|
Python | 32.4% |
C++ | 30.9% |
Java | 32.1% |
JavaScript | 32.1% |
PHP | 24.2% |
Rust | 23.0% |
π Usage
import torch
from transformers import AutoModelForCausalLM, AutoTokenizer
model_id = "dgtalbug/stable-code-instruct-3b"
tokenizer = AutoTokenizer.from_pretrained(model_id, trust_remote_code=True)
model = AutoModelForCausalLM.from_pretrained(
model_id, torch_dtype=torch.bfloat16, trust_remote_code=True
).cuda().eval()
messages = [
{"role": "system", "content": "You are a helpful coding assistant."},
{"role": "user", "content": "Write a Python function to reverse a string."}
]
prompt = tokenizer.apply_chat_template(messages, add_generation_prompt=True, tokenize=False)
inputs = tokenizer([prompt], return_tensors="pt").to(model.device)
tokens = model.generate(
**inputs,
max_new_tokens=200,
temperature=0.5,
top_p=0.95,
top_k=100,
do_sample=True,
use_cache=True
)
output = tokenizer.batch_decode(tokens[:, inputs.input_ids.shape[-1]:], skip_special_tokens=True)[0]
print(output)
π License
This model follows the Stability AI Community License.
For commercial use, refer to Stability AI licensing terms.
π Note for FineβTuning
This repository is not modified β it is kept as a clean base model for derivative works.
Fineβtuned versions (e.g., Stephen) will be released in separate repositories.
- Downloads last month
- 254
Evaluation results
- pass@1 on MultiPL-HumanEval (Python)self-reported32.400
- pass@1 on MultiPL-HumanEval (C++)self-reported30.900
- pass@1 on MultiPL-HumanEval (Java)self-reported32.100
- pass@1 on MultiPL-HumanEval (JavaScript)self-reported32.100
- pass@1 on MultiPL-HumanEval (PHP)self-reported24.200
- pass@1 on MultiPL-HumanEval (Rust)self-reported23.000