Use AIUnderstand AIBuild with AI
Build with AI·Model deep dive·· 5 min read

Carbon-X: A 14B Chat Model That Reads DNA and Explains It in English

Hugging Face Bio's Carbon-X takes raw DNA in a chat message and answers in English. Run it with Transformers or vLLM and call it as an agent tool.

The code in this post comes from the model's docs and hasn't been run in our CI yet. If something breaks, let us know.

Carbon-X is an open 14.8B-parameter language model from Hugging Face Bio, trained on DNA sequences and ordinary text together. You paste raw DNA into a chat message and it replies in English: it can judge whether a mutation looks benign or pathogenic, classify sequences, predict the next bases of a sequence, and explain its reasoning. It starts from Qwen3-14B. The card says it has not been clinically validated and must not be used for medical decisions.

Key specs

Parameters 14.8B, decoder-only, 40 layers, hidden size 5120
Base model Qwen/Qwen3-14B
Context window 40,960 tokens
Tokenizer Qwen3 BPE for text plus 5,515 DNA tokens (non-overlapping 6-mers)
Training 302B tokens of mid-training, then supervised fine-tuning and reinforcement learning with verifiable rewards
Library Transformers v5 or later, trust_remote_code=True for the tokenizer
License Apache 2.0

DNA and text share one token stream in one decoder, with no separate DNA encoder. One DNA token covers 6 base pairs.

What the card reports

Across five DNA benchmarks, Carbon-X averages 66.7% with thinking disabled. The card lists GPT-6.1 Sol at 67.5%, Opus 5.5 at 60.9%, and Qwen3-14B 27 points lower. The per-task picture is mixed:

Benchmark Carbon-X Best listed
BioReason Coding 74.9 74.9 (Carbon-X)
BioReason Non-SNV 85.1 94.8 (Opus 5.5)
GenomeQA 63.6 67.2 (GPT-6.1 Sol)
NextBase 39.4 39.4 (Carbon-X)
FrontierVEP 70.4 76.2 (Opus 5.5)

Two of the five are weak spots the card calls out: splice-site and histone-mark questions score 29.8% and 34.6% on GenomeQA. The comparison models are run at the reasoning effort that gave each its best average; Carbon-X answers directly without extended reasoning.

Install

Terminal window
pip install -U transformers

Run it

This is the card’s own example: a reference sequence and a variant, with a question.

variant.py
import torch
from transformers import AutoModelForCausalLM, AutoTokenizer
model_id = "HuggingFaceBio/Carbon-X"
tokenizer = AutoTokenizer.from_pretrained(model_id, trust_remote_code=True)
model = AutoModelForCausalLM.from_pretrained(model_id, dtype=torch.bfloat16, device_map="cuda")
messages = [
{
"role": "user",
"content": (
"Reference: ATGGTGCATCTGACTCCTGAGGAGAAGTCTGCCGTTACTGCCCTGTGGGGCAAGG\n"
"Variant: ATGGTGCATCTGACTCCTGTGGAGAAGTCTGCCGTTACTGCCCTGTGGGGCAAGG\n\n"
"Is this variant likely to be benign or pathogenic? Explain your reasoning."
),
}
]
inputs = tokenizer.apply_chat_template(
messages,
add_generation_prompt=True,
enable_thinking=False,
return_tensors="pt",
return_dict=True,
).to(model.device)
outputs = model.generate(**inputs, max_new_tokens=1024)
print(tokenizer.decode(outputs[0][inputs["input_ids"].shape[1]:], skip_special_tokens=True))

The card says Carbon-X was post-trained and evaluated with enable_thinking=False, and recommends keeping it that way. generate() picks up the sampling defaults from generation_config.json (temperature 0.6, top-p 0.95, top-k 20), which are also the settings behind the reported results.

How DNA gets tokenized

You don’t need special markup. The tokenizer finds DNA in your text and wraps it in <dna>…</dna> tags:

ids = tokenizer("Describe this sequence: ACGTACGATTCA")["input_ids"]
print(tokenizer.convert_ids_to_tokens(ids))
# ['Describe', 'Ġthis', 'Ġsequence', ':', 'Ġ', '<dna>', 'ACGTAC', 'GATTCA', '</dna>']

Details from the card:

  • Runs of at least 6 A/C/G/T bases are tagged and tokenized as 6-mers. Lowercase bases are uppercased.
  • A 6-mer containing any other character, such as N, becomes a single <oov> token. Filter to canonical bases first if you want full resolution.
  • Sequences whose length isn’t a multiple of 6 use dedicated tail tokens for the last 1–5 bases.
  • Pass auto_dna_tags=False to the tokenizer or apply_chat_template() to turn detection off.
  • The first load needs Hub access, because the tokenizer downloads the pinned BPE vocabulary it builds on.

Serve it with vLLM

Terminal window
pip install -U vllm
vllm serve HuggingFaceBio/Carbon-X --trust-remote-code
client.py
from openai import OpenAI
client = OpenAI(base_url="http://localhost:8000/v1", api_key="EMPTY")
response = client.chat.completions.create(
model="HuggingFaceBio/Carbon-X",
messages=[{"role": "user", "content": "What does this sequence encode?\n\nATGGTGCATCTGACTCCTGAGGAGAAGTCTGCCGTT"}],
extra_body={"chat_template_kwargs": {"enable_thinking": False}},
)
print(response.choices[0].message.content)

The card notes that vLLM also applies the generation_config.json sampling defaults unless your request overrides them. llama.cpp and other GGUF runtimes are not supported, because the DNA tokenizer is custom Python code.

Use it as a tool for an agent

The card’s pattern is to wrap the served model in a function that a general-purpose assistant can call. Sequences go in by name, so the agent never has to copy long DNA strings.

ask_carbon.py
from openai import OpenAI
carbon = OpenAI(base_url="http://localhost:8000/v1", api_key="EMPTY")
def ask_carbon(question: str, sequences: dict[str, str], context: str = "") -> str:
"""Ask Carbon-X a question about one or more named DNA sequences."""
parts = [context, question] if context else [question]
parts += [f"{name}: <dna>{seq}</dna>" for name, seq in sequences.items()]
response = carbon.chat.completions.create(
model="HuggingFaceBio/Carbon-X",
messages=[{"role": "user", "content": "\n\n".join(parts)}],
max_tokens=4096,
extra_body={"chat_template_kwargs": {"enable_thinking": False}},
)
return response.choices[0].message.content

The card also ships full examples (examples/agent_tool.py, an Inspect agent, and a skills/carbon-dna/ skill for coding agents) in the model repo. Its tips for agent use:

  • Pass DNA by reference, from files or a lookup table.
  • Say in the system prompt that you want Carbon-X’s view, since agents often answer DNA questions themselves.
  • Leave counting, coordinates and edits to code. For variants, compute the position and the reference and alternate bases in code and pass them as context.
  • Cap max_tokens and set a client timeout, because long DNA generations are slow.

Gotchas

  • Not for medical decisions. The card says it has not been clinically validated.
  • Genetic data is sensitive. Depending on whether you run it locally, through an inference provider or in a Space, your input may be handled differently. The card tells you to understand how your data is handled first. Keeping the weights on your own hardware is one option.
  • Exact operations are shaky. It can miscount bases, confuse coordinates or make wrong edits, especially when locating positions in long sequences.
  • Give it context. Without a gene, strand, coordinates or annotations, it may invent a sequence’s identity or function.
  • Don’t use it to design DNA. Quality degrades on long generation, and the card says it reads and explains sequences but wasn’t trained to design new ones.
  • Long inputs. Mid-training used 8,192-token sequences (up to about 49 kbp), and the card hasn’t evaluated inputs much longer than that.
  • Leave thinking off. The template supports enable_thinking=True, but the model wasn’t trained or evaluated that way.

When to pick it

Pick Carbon-X if you do research on DNA and want an open model you can run on one 80 GB GPU, keep on your own infrastructure, and call from an agent. It is strongest, per the card, on coding-variant effects and next-base prediction.

Skip it if you need clinical-grade answers, exact sequence arithmetic, DNA design, or a model that runs on a GGUF runtime. For anything involving exact positions, let ordinary code do that part and use the model for the interpretation.

Related