Instructions to use HuggingFaceBio/Carbon-500M with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use HuggingFaceBio/Carbon-500M with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="HuggingFaceBio/Carbon-500M")# Load model directly from transformers import AutoTokenizer, AutoModelForCausalLM tokenizer = AutoTokenizer.from_pretrained("HuggingFaceBio/Carbon-500M") model = AutoModelForCausalLM.from_pretrained("HuggingFaceBio/Carbon-500M") - Notebooks
- Google Colab
- Kaggle
- Local Apps
- vLLM
How to use HuggingFaceBio/Carbon-500M with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "HuggingFaceBio/Carbon-500M" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "HuggingFaceBio/Carbon-500M", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }'Use Docker
docker model run hf.co/HuggingFaceBio/Carbon-500M
- SGLang
How to use HuggingFaceBio/Carbon-500M with SGLang:
Install from pip and serve model
# Install SGLang from pip: pip install sglang # Start the SGLang server: python3 -m sglang.launch_server \ --model-path "HuggingFaceBio/Carbon-500M" \ --host 0.0.0.0 \ --port 30000 # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:30000/v1/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "HuggingFaceBio/Carbon-500M", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }'Use Docker images
docker run --gpus all \ --shm-size 32g \ -p 30000:30000 \ -v ~/.cache/huggingface:/root/.cache/huggingface \ --env "HF_TOKEN=<secret>" \ --ipc=host \ lmsysorg/sglang:latest \ python3 -m sglang.launch_server \ --model-path "HuggingFaceBio/Carbon-500M" \ --host 0.0.0.0 \ --port 30000 # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:30000/v1/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "HuggingFaceBio/Carbon-500M", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }' - Docker Model Runner
How to use HuggingFaceBio/Carbon-500M with Docker Model Runner:
docker model run hf.co/HuggingFaceBio/Carbon-500M
library_name: transformers
license: apache-2.0
language:
- dna
tags:
- dna
- genomic
- transformers
- speculative-decoding
Carbon-500M
A small generative DNA model from the Carbon family.
Carbon-500M is intended primarily as a draft model for speculative decoding β it shares the tokenizer and DNA template format of Carbon-3B and Carbon-8B, so it can be paired with either as the target model to reduce wall-clock generation cost at no quality loss. It is not designed to be competitive with the 3B/8B Carbon models on downstream benchmarks.
For the full design rationale, tokenizer specification, evaluation protocol, and usage notes (DNA tag wrapping, 6-mer constraints, scoring helpers), please refer to the Carbon-3B model card β this card focuses only on facts specific to Carbon-500M.
TODO: update teh tokenizer code
Facts
- 500M-parameter decoder-only autoregressive DNA model (Llama-style architecture).
- Hybrid tokenizer shared with the rest of the Carbon family (6-mer for DNA + Qwen3 BPE for English text; each DNA token β 6 bp).
- Pre-training tokens: 600B 6-mer tokens (β 3.6 T DNA base pairs).
- Sequence length: 8 192tokens (β 48 kbp).
- Loss schedule: cross-entropy 0 β 300 B tokens, then switch to the hybrid Factorised Nucleotide Supervision (FNS) loss from 300 B β 600 B tokens. The switch happens later than for Carbon-3B because Carbon-500M's training was very stable and tolerated the later transition.
- Data mixture: identical to the decay-phase mixture used by Carbon-3B β 50 % Generator-style eukaryotic genes / 25 % mature mRNA / 10 % splice-enriched mRNA / 15 % GTDB bacterial genomes. Same weights across the whole 600 B run.
- Precision: bfloat16. Optimizer: AdamW. Positional embedding: RoPE.
- No long-context training stage β the model stays at its 8 k-token native context so 48kbp.
- Released as a standard Hugging Face causal LM (
LlamaForCausalLM).
How to use
Wrap DNA in <dna>...</dna> exactly as for the larger models. See the Carbon-3B card for tokenizer details.
from transformers import AutoModelForCausalLM, AutoTokenizer
import torch
repo = "HuggingFaceBio/Carbon-500M"
tok = AutoTokenizer.from_pretrained(repo, trust_remote_code=True)
model = AutoModelForCausalLM.from_pretrained(
repo, torch_dtype=torch.bfloat16,
).cuda().eval()
prompt = "<dna>ATGCGCTAGCTACGATCGATCGTAGCTAGCTAGCTAGCTACG"
inputs = tok(prompt, return_tensors="pt", add_special_tokens=False).to("cuda")
out = model.generate(**inputs, max_new_tokens=64, do_sample=False)
print(tok.decode(out[0][inputs.input_ids.shape[1]:]))
Recommended use: speculative decoding with Carbon-3B / Carbon-8B
Carbon-500M is most useful when paired with a larger Carbon model as the verifier. Hugging Face Transformers supports this natively through the assistant_model argument:
from transformers import AutoModelForCausalLM, AutoTokenizer
import torch
tok = AutoTokenizer.from_pretrained("HuggingFaceBio/Carbon-3B", trust_remote_code=True)
draft = AutoModelForCausalLM.from_pretrained(
"HuggingFaceBio/Carbon-500M", torch_dtype=torch.bfloat16
).cuda().eval()
target = AutoModelForCausalLM.from_pretrained(
"HuggingFaceBio/Carbon-3B", torch_dtype=torch.bfloat16
).cuda().eval()
prompt = "<dna>ATGCGCTAGCTACGATCGATCGTAGCTAGCTAGCTAGCTACG"
inputs = tok(prompt, return_tensors="pt", add_special_tokens=False).to("cuda")
out = target.generate(
**inputs, max_new_tokens=256, do_sample=False,
assistant_model=draft,
)
print(tok.decode(out[0][inputs.input_ids.shape[1]:]))
Output is guaranteed identical to greedy decoding with the target model alone; only wall-clock latency is reduced.
Evaluation
Carbon-500M is benchmarked against β 1B-parameter DNA models on the standard Carbon evaluation suite. See the Carbon-3B card for the task definitions and methodology.
TODO Loubna: add one downstream table comparing Carbon-500M to other 1B-class baselines. -->
License
Apache 2.0.