Paper Feed

Issue 43 · Project 03 HF model AI / ML trending #17 ✓ read

HuggingFaceBio/Carbon-X

text-generation · transformers

TL;DR: Carbon-X is a 14.8B Qwen3-derived chat model that reads and writes raw DNA in the same token stream as English — no separate DNA encoder, just a hybrid tokenizer that packs DNA into non-overlapping 6-mers. You paste a reference and variant sequence into a chat message and it answers "pathogenic, because..." in plain English. Self-reported results put it ~27 points above its Qwen3-14B base on five DNA benchmarks, roughly matching GPT-6.1 Sol at a claimed ~1/1,800 the inference cost, on a single 80 GB GPU. Apache 2.0, weights up, from Hugging Face plus genomics labs in Beijing and Naples.

What it is and why it's interesting

The genomics-model landscape has mostly split into two camps: DNA foundation models (Evo, Nucleotide Transformer, etc.) that embed sequences but can't talk, and chat LLMs that talk but treat DNA as character soup. Carbon-X is the "omni-modal" move applied to genomics: one decoder, one vocabulary, DNA and language interleaved freely in prompts and responses. The framing matters more than the exact numbers — it means variant interpretation, sequence QA, and next-base prediction all become conversational tasks that compose with annotations, context, and reasoning, and the model can be dropped into agent loops as a DNA tool.

How it works

Start from Qwen3-14B. Add 5,515 DNA tokens: 4,096 canonical 6-mers (so one token = 6 bp), 1,364 tail tokens for lengths not divisible by 6 (decoding is exactly lossless), plus DNA-boundary markers. Runs of ≥6 A/C/G/T bases in a prompt are auto-detected and tagged; anything with ambiguity codes falls back to coarser handling.

Training is a careful three-stage recipe:

  1. Embedding warm-up: ~10B tokens with the transformer body frozen, so only the new DNA embeddings learn.
  2. Mid-training: 302B tokens at 8,192 sequence length on a 55% raw DNA / 20% English / 15% biology text / 10% instruction mix. The README is unusually candid that learning rate was the dominant knob — too low and DNA stays at chance, too high and English collapses.
  3. Post-training: SFT on 20 task mixtures (variant-effect reasoning ~30%), then two rounds of asynchronous GRPO with code-checked verifiable rewards, including a penalty for ungrounded rationales. Everything with thinking disabled — it answers directly, which is where the cost advantage comes from.
Prompt: "Is this variant pathogenic? ATGGTGCATCTG..." Text → Qwen3 BPE 151,669 tokens DNA → 6-mers (1 token = 6 bp) 4,096 6-mers + 1,364 tail tokens Single 14.8B decoder, one token stream "Likely pathogenic: the A→T change disrupts..."
No DNA encoder or adapter — text and 6-mer DNA tokens are interleaved in one causal stream, so DNA can appear in both prompts and responses.

Evidence

All numbers are self-reported, from the authors' own harness, with two of five benchmarks (FrontierVEP, NextBase) built by the team. With that caveat:

Five-benchmark DNA averagescore (%)01020304050607066.7Carbon-X (no reasoning)67.5GPT-6.1 Sol Max60.9Opus 5.5 Max50.4Kimi K349.8Gemini 4 Argon47.1DeepSeek V4.1 FlashSelf-reported; comparison models shown at their best reasoning effort. Qwen3-14B base: ~27 pts lower.

It leads outright on coding-variant effects (74.9 vs 71.0 for GPT-6.1 Sol) and next-base prediction (39.4 vs 32.9), and trails frontier models on non-SNV variants and single-base VEP. English ability survives the DNA diet: 79.3% IFEval prompt-strict. The cost claim — 300 vs32K–$4M to triage ClinVar's 2.4M VUS — is plausible given short direct answers on local hardware, but uses the authors' own pricing assumptions.

The GenomeQA breakdown is honest and revealing: 93% on organism classification and 90% on motifs, but 29.8% on splice sites and 34.6% on histone marks — tasks where specialized encoders do well. The 6-mer, single-direction causal view may genuinely limit these.

What to expect

  • Real artifacts: safetensors weights, custom tokenizer code, agent examples (examples/, a Claude Code/Codex skill in skills/carbon-dna/), detailed training recipe. No training data release noted.
  • Dependencies: Transformers v5+, trust_remote_code=True for the tokenizer. vLLM supported; llama.cpp/GGUF explicitly not — the Python tokenizer can't be ported, so DNA would mis-tokenize.
  • Hardware: one 80 GB GPU in bf16.
  • Gaps: not clinically validated; miscounts bases and positions (pair with code tools); hallucinates sequence identity without context; not a sequence designer — generation quality degrades on long DNA; inputs beyond ~16k tokens untested despite the 40,960 window.
  • Trust check: decontamination is described (span overlap, n-grams, homology search), but independent replication of the variant-effect numbers — especially against ClinVar-derived baselines like AlphaMissense — is the thing to watch for.

Try it

pip install -U transformers
from transformers import AutoModelForCausalLM, AutoTokenizer
import torch

tok = AutoTokenizer.from_pretrained("HuggingFaceBio/Carbon-X", trust_remote_code=True)
model = AutoModelForCausalLM.from_pretrained("HuggingFaceBio/Carbon-X",
                                             dtype=torch.bfloat16, device_map="cuda")
msgs = [{"role": "user", "content":
    "Reference: ATGGTGCATCTGACTCCTGAGGAGAAGTCTGCC\n"
    "Variant:   ATGGTGCATCTGACTCCTGTGGAGAAGTCTGCC\n\n"
    "Benign or pathogenic? Explain."}]
inputs = tok.apply_chat_template(msgs, add_generation_prompt=True,
                                 enable_thinking=False, return_tensors="pt",
                                 return_dict=True).to(model.device)
out = model.generate(**inputs, max_new_tokens=1024)
print(tok.decode(out[0][inputs["input_ids"].shape[1]:], skip_special_tokens=True))

Or serve it: vllm serve HuggingFaceBio/Carbon-X --trust-remote-code. Keep enable_thinking=False — that's how it was trained and evaluated.