HuggingFaceBio/Carbon-X
- License
- apache-2.0
- Size
- not mirrored yet
No official torrent yet — requesting it tells the flock what to host next. You cannot seed a catalog-only page.
Cataloged from HuggingFaceBio/Carbon-X
All models by HuggingFaceBio →No official torrent yet — requesting it tells the flock what to host next. You cannot seed a catalog-only page.
Cataloged from HuggingFaceBio/Carbon-X
All models by HuggingFaceBio →[Image blocked: No description]
Blog | Hugging Face Bio | Code
An open 14B language model for DNA understanding and generation, from the Carbon family.
[Image blocked: Average DNA benchmark score versus cost per problem relative to Carbon-X]
Each comparison model is shown at the reasoning effort with its highest average score. Costs use standard API pricing; for Carbon-X, measured throughput per H200-hour at $5/hour.
Carbon-X is a 14.8B-parameter decoder-only language model trained jointly on DNA sequences and natural-language text. You give it raw DNA inside an ordinary chat conversation and it answers in English: it predicts whether mutations are benign or pathogenic, identifies regions that control gene activity, classifies sequences by organism group, predicts the next bases of a sequence, and explains its reasoning. Responses can contain both DNA and natural language.
DNA and text share a single token stream in a single decoder. There is no separate DNA encoder. A hybrid tokenizer keeps a BPE vocabulary for text and encodes DNA as non-overlapping 6-mers, so one DNA token covers 6 base pairs.
Across five DNA benchmarks, which cover variant-effect prediction, sequence understanding and next-base prediction, Carbon-X averages 66.7% with thinking disabled. That is 27 points above Qwen3-14B, the model it starts from, and ahead of every other open model we evaluated. It is close to GPT-6.1 Sol (67.5%) at about 1/1,800 of the inference cost per problem, and it leads every model we tested on coding-variant effects and next-base prediction (Evaluation). Carbon-X answers directly, without extended reasoning, so each problem costs few output tokens. We estimate that analysing the 2.4 million variants of uncertain significance in ClinVar would cost about $300 with Carbon-X, compared with $32,000 to $4 million with the frontier models we evaluated. The weights fit on a single 80 GB GPU in bfloat16, so researchers can keep sensitive or unpublished sequences on their own infrastructure.
<dna>, </dna> and <oov> markers. DNA in a prompt is detected and tagged automatically.Carbon-X uses a standard causal LM architecture. The DNA tokenizer is custom code, so pass trust_remote_code=True when you load the tokenizer. Carbon-X requires Transformers v5 or later.
Carbon-X was post-trained and evaluated with enable_thinking=False, and we recommend keeping it that way. generate() uses the sampling defaults from generation_config.json (temperature 0.6, top-p 0.95, top-k 20), which are also the settings we used for every reported result.
vLLM also applies the sampling defaults from generation_config.json unless you override them in the request.
The tokenizer switches between BPE for text and 6-mers for DNA. You can paste sequences directly into a message:
<dna>…</dna> and tokenized as 6-mers. Runs of at least 12 bases with up to 20% IUPAC ambiguity codes (N, R, Y, …) are tagged too. Lowercase bases are uppercased, and sequences displayed in space-separated blocks are joined. Text you have already wrapped in <dna>…</dna> is always tokenized as DNA. To turn off detection for a call, pass auto_dna_tags=False to the tokenizer or to apply_chat_template().N, becomes a single <oov> token. To keep full resolution, filter to canonical bases first.<dna>…</dna>. Decoding with skip_special_tokens=True removes the tags.We evaluate Carbon-X on five benchmarks that test whether a model can use DNA knowledge to predict mutation effects, identify biological features and recover DNA bases. Carbon-X results use thinking disabled, the default sampling settings and one sample per problem. Each comparison model is shown at the reasoning effort with its highest average score. The best score on each benchmark is in bold.
BioReason and GenomeQA come from the literature; we built FrontierVEP and NextBase.
Carbon-X also remains a capable assistant. On IFEval it reaches 79.3% prompt-level strict accuracy, or 84.0% averaged over the four IFEval metrics.
All training data was decontaminated against these benchmarks with three checks: whole-span DNA overlap, text n-gram overlap and sequence homology search.
Carbon-X starts from Qwen3-14B. We add the DNA tokens to its vocabulary with randomly initialised embeddings. We then train for about 10B tokens with the transformer body frozen, so that only the new DNA embeddings learn, before unfreezing the whole model.
The full model is then trained for 302B tokens with a sequence length of 8,192 and a global batch size of 512 sequences (≈ 4.2M tokens per step, 72,000 steps). The learning rate follows a cosine schedule from 5e-5 to 5e-6 after 2,000 warmup steps. In our ablations, learning rate was the dominant knob at this stage. A low learning rate preserves English but leaves DNA at chance, and a high one learns DNA but forgets English. The data mixture is:
The mid-trained model is fine-tuned for 3 epochs on a mixture of 20 dataset subsets. The learning rate follows a cosine schedule from 1e-5 to 1e-6, with a global batch size of 32, examples of up to 9,984 tokens and the loss computed on assistant tokens only. The mixture covers:
The fine-tuned model is then trained with asynchronous GRPO and verifiable rewards in two rounds, with thinking disabled:
Both rounds use 16 samples per prompt, completions of up to 4,096 tokens, a learning rate of 1e-6, asymmetric clipping (ε = 0.2 / 0.28) and a maximum gradient norm of 0.2. Rewards are task-specific, code-checked verifiers. They cover variant-effect prediction (with a penalty for ungrounded rationales), sequence-feature classification, basic DNA operations, DNA skills, locating positions within sequences, biology multiple-choice questions and instruction following.
A general-purpose assistant can call Carbon-X when a question involves DNA. Serve Carbon-X with vLLM (Serving with vLLM) and wrap it in a function that takes a question and named DNA sequences:
The snippet above is a core call. We provide the options below as examples, each one is self-contained, so pick the one that fits your agent:
Any agent with tool calling: examples/agent_tool.py [blocked] describes ask_carbon as an
OpenAI-style tool and runs a minimal agent loop. The agent refers to sequences by name and your code looks up the DNA,
because language models often miscopy long sequences.
Inspect: examples/inspect_agent.py [blocked] wraps Carbon-X in an @tool for an
Inspect react() agent, with each sample's DNA kept in metadata.
Coding agents (Claude Code, Codex CLI): skills/carbon-dna/ [blocked] is a ready-made skill. Its
script needs only the Python standard library and has two commands: ask (a question about named DNA files) and
compare (rank equal-length variants by sequence likelihood). You need a GPU with about 80 GB of memory and vLLM
(pip install -U vllm); the skill itself needs no extra packages or API keys. Start Carbon-X, install the skill and
point it at the server:
Carbon-X runs with vLLM or Transformers. llama.cpp and other GGUF runtimes are not supported: the DNA tokenizer is custom Python code that they cannot load, so DNA would be tokenized incorrectly.
context.max_tokens to what you need and a client timeout, since long DNA generations are slow (see Limitations).Carbon-X is a starting point for research on connecting DNA and language. It has not been clinically validated, and it should not be used to make medical decisions.
enable_thinking=True, but Carbon-X was post-trained and evaluated with thinking disabled.Apache 2.0.
Carbon-X is a joint collaboration between the research teams at Hugging Face, Zhongguancun Academy, and the Telethon Institute of Genetics and Medicine/University of Naples “Federico II”.
[Image blocked: Hugging Face, Zhongguancun Academy, Telethon Institute of Genetics and Medicine and University of Naples Federico II]
pip install -U transformersimport torchfrom 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))pip install -U vllmvllm serve HuggingFaceBio/Carbon-X --trust-remote-codefrom 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)>>> ids = tokenizer("Describe this sequence: ACGTACGATTCA")["input_ids"]>>> tokenizer.convert_ids_to_tokens(ids)['Describe', 'Ġthis', 'Ġsequence', ':', 'Ġ', '<dna>', 'ACGTAC', 'GATTCA', '</dna>']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.contentvllm serve HuggingFaceBio/Carbon-X --trust-remote-code # one 80 GB GPUhf download HuggingFaceBio/Carbon-X --include "skills/*" --local-dir carbon-xcp -r carbon-x/skills/carbon-dna ~/.claude/skills/ # Codex CLI: ~/.codex/skills/export CARBON_BASE_URL=http://localhost:8000/v1 # or the address of your vLLM server