Marketplace · Text & chat

starcoder2:3b

Call starcoder2:3b through one OpenAI-compatible API. It's served by 1 host on the Inpherio grid, each at a price it sets — your request goes to the cheapest healthy one, and fails over to the next if it's down.

From
£0.06
per 1M output tokens
£1 buys about 17 million tokens (≈ 13 million words)
Hosts
1
Loaded now
1

At a glance.

code

  • Type: Text & chat
  • Hosts serving it now: 1 (1 with it loaded in memory)
  • Engines: ollama
  • Context window: up to 16,384 tokens
  • Rentable: a whole host from £0.04 an hour (rentals)
python · openai sdk
from openai import OpenAI
client = OpenAI(base_url="https://inpherio.co.uk/v1",
                api_key=INPHERIO_API_KEY)
reply = client.chat.completions.create(
    model="starcoder2:3b",
    messages=[{"role": "user", "content": "Hello"}],
)

starcoder2:3b in detail.

StarCoder2 is the next generation of transparently trained open code LLMs that comes in three sizes: 3B, 7B and 15B parameters.

Published by
bigcode
Parameters
3B
Download size
1.7 GB (as packaged for Ollama)
Quantisation
Q4_0
Format
gguf
Architecture
starcoder2
Licence
BigCode OpenRAIL-M
Task
text generation
Library
transformers
First published
29 Nov 2023
Last updated
4 Mar 2024
Downloads (30 days)
34,597 on Hugging Face
Likes
227

starcoder2 text-generation code

The model card

Published by the model's authors on Hugging Face — shown as they wrote it, unedited by Inpherio.

StarCoder2

Table of Contents

  1. Model Summary
  2. Use
  3. Limitations
  4. Training
  5. License
  6. Citation

Model Summary

StarCoder2-3B model is a 3B parameter model trained on 17 programming languages from The Stack v2, with opt-out requests excluded. The model uses Grouped Query Attention, a context window of 16,384 tokens with a sliding window attention of 4,096 tokens, and was trained using the Fill-in-the-Middle objective on 3+ trillion tokens.

Use

Intended use

The model was trained on GitHub code as well as additional selected data sources such as Arxiv and Wikipedia. As such it is _not_ an instruction model and commands like "Write a function that computes the square root." do not work well.

Generation

Here are some examples to get started with the model. You can find a script for fine-tuning in StarCoder2's GitHub repository.

First, make sure to install transformers from source:

pip install git+https://github.com/huggingface/transformers.git

Running the model on CPU/GPU/multi GPU

  • _Using full precision_
### pip install git+https://github.com/huggingface/transformers.git # TODO: merge PR to main
from transformers import AutoModelForCausalLM, AutoTokenizer

checkpoint = "bigcode/starcoder2-3b"
device = "cuda" # for GPU usage or "cpu" for CPU usage

tokenizer = AutoTokenizer.from_pretrained(checkpoint)
### for multiple GPUs install accelerate and do `model = AutoModelForCausalLM.from_pretrained(checkpoint, device_map="auto")`
model = AutoModelForCausalLM.from_pretrained(checkpoint).to(device)

inputs = tokenizer.encode("def print_hello_world():", return_tensors="pt").to(device)
outputs = model.generate(inputs)
print(tokenizer.decode(outputs[0]))
>>> print(f"Memory footprint: {model.get_memory_footprint() / 1e6:.2f} MB")
Memory footprint: 12624.81 MB
  • _Using torch.bfloat16_
### pip install accelerate
import torch
from transformers import AutoTokenizer, AutoModelForCausalLM

checkpoint = "bigcode/starcoder2-3b"
tokenizer = AutoTokenizer.from_pretrained(checkpoint)

### for fp16 use `torch_dtype=torch.float16` instead
model = AutoModelForCausalLM.from_pretrained(checkpoint, device_map="auto", torch_dtype=torch.bfloat16)

inputs = tokenizer.encode("def print_hello_world():", return_tensors="pt").to("cuda")
outputs = model.generate(inputs)
print(tokenizer.decode(outputs[0]))
>>> print(f"Memory footprint: {model.get_memory_footprint() / 1e6:.2f} MB")
Memory footprint: 6312.41 MB

Quantized Versions through bitsandbytes

  • _Using 8-bit precision (int8)_
### pip install bitsandbytes accelerate
from transformers import AutoTokenizer, AutoModelForCausalLM, BitsAndBytesConfig

### to use 4bit use `load_in_4bit=True` instead
quantization_config = BitsAndBytesConfig(load_in_8bit=True)

checkpoint = "bigcode/starcoder2-3b"
tokenizer = AutoTokenizer.from_pretrained(checkpoint)
model = AutoModelForCausalLM.from_pretrained(checkpoint, quantization_config=quantization_config)

inputs = tokenizer.encode("def print_hello_world():", return_tensors="pt").to("cuda")
outputs = model.generate(inputs)
print(tokenizer.decode(outputs[0]))
>>> print(f"Memory footprint: {model.get_memory_footprint() / 1e6:.2f} MB")
Read the rest of the model card

load_in_8bit

Memory footprint: 3434.07 MB

load_in_4bit

print(f"Memory footprint: {model.get_memory_footprint() / 1e6:.2f} MB")

Memory footprint: 1994.90 MB

### Attribution & Other Requirements

The pretraining dataset of the model was filtered for permissive licenses and code with no license only. Nevertheless, the model can generate source code verbatim from the dataset. The code's license might require attribution and/or other specific requirements that must be respected. We provide a [search index](https://huggingface.co/spaces/bigcode/search-v2) that lets you search through the pretraining data to identify where the generated code came from, and apply the proper attribution to your code.

### Limitations

The model has been trained on source code from 600+ programming languages. The predominant language in source is English although other languages are also present. As such the model is capable to generate code snippets provided some context but the generated code is not guaranteed to work as intended. It can be inefficient, contain bugs or exploits. See [the paper](https://huggingface.co/papers/2402.19173) for an in-depth discussion of the model limitations. 

### Training

### Model

- **Architecture:** Transformer decoder with grouped-query and sliding window attention and Fill-in-the-Middle objective
- **Pretraining steps:** 1.2 million
- **Pretraining tokens:** 3+ trillion
- **Precision:** bfloat16

### Hardware

- **GPUs:** 160 A100

### Software

- **Framework:** TODO
- **Neural networks:** [PyTorch](https://github.com/pytorch/pytorch)

### License

The model is licensed under the BigCode OpenRAIL-M v1 license agreement. You can find the full agreement [here](https://huggingface.co/spaces/bigcode/bigcode-model-license-agreement).

### Citation

@misc{lozhkov2024starcoder, title={StarCoder 2 and The Stack v2: The Next Generation}, author={Anton Lozhkov and Raymond Li and Loubna Ben Allal and Federico Cassano and Joel Lamy-Poirier and Nouamane Tazi and Ao Tang and Dmytro Pykhtar and Jiawei Liu and Yuxiang Wei and Tianyang Liu and Max Tian and Denis Kocetkov and Arthur Zucker and Younes Belkada and Zijian Wang and Qian Liu and Dmitry Abulkhanov and Indraneil Paul and Zhuang Li and Wen-Ding Li and Megan Risdal and Jia Li and Jian Zhu and Terry Yue Zhuo and Evgenii Zheltonozhskii and Nii Osae Osae Dade and Wenhao Yu and Lucas Krauß and Naman Jain and Yixuan Su and Xuanli He and Manan Dey and Edoardo Abati and Yekun Chai and Niklas Muennighoff and Xiangru Tang and Muhtasham Oblokulov and Christopher Akiki and Marc Marone and Chenghao Mou and Mayank Mishra and Alex Gu and Binyuan Hui and Tri Dao and Armel Zebaze and Olivier Dehaene and Nicolas Patry and Canwen Xu and Julian McAuley and Han Hu and Torsten Scholak and Sebastien Paquet and Jennifer Robinson and Carolyn Jane Anderson and Nicolas Chapados and Mostofa Patwary and Nima Tajbakhsh and Yacine Jernite and Carlos Muñoz Ferrandis and Lingming Zhang and Sean Hughes and Thomas Wolf and Arjun Guha and Leandro von Werra and Harm de Vries}, year={2024}, eprint={2402.19173}, archivePrefix={arXiv}, primaryClass={cs.SE} }

Sources: bigcode/starcoder2-3b on Hugging Face · starcoder2:3b on Ollama. Collected from public sources on 8 Nov 2026; the host serving it may run a different build or quantisation — the marketplace shows each host's own measurements.

Who's serving it.

Every host benchmarked this model on its own hardware before serving it. Prices are set by each host; health is scored by the platform from what it observes.

Hosts serving starcoder2:3b right now
HostTierPriceMeasured speedHealthStateRent
7B-A1B (5G)L1£0.03 in · £0.06 out11 tok/s · 126 ms first token82loaded£0.04/h

Live data, refreshed on every visit. How billing works.

Room on the grid for your machine.

Right now one machine serves starcoder2:3b. If it drops, so does every request for it — a second host is what turns it into failover, and the grid needs that more than another copy. The router weighs price, measured speed, health and whether the model is already loaded — so a host with a sharper price or quicker hardware wins the next call.

Hosts now
1
1 loaded in memory
Price to beat
£0.06
per 1M output tokens
Fastest measured
11 tok/s

Set your own price — you keep 85% of what it earns, and new hosts start with 12 months fee-free (up to £250 of earnings). A payout fee of £2 + 1% per payout to a UK bank account, £2 + 2% to any other country applies when you're paid. Install the connector, load starcoder2:3b, and the platform benchmarks it on your hardware before your first request.