HuggingFaceBio/Carbon-X
Post-training of Carbon-X, a 14B DNA and language model: SFT of the midtrained Carbon-X-Base on FineDNA, then async GRPO with verifiable DNA rewards, thinking off.
Command builder
Train · Local machine · 8 GPUs, H100 or H200 class (FlashAttention 3), per stage
hf download trl-lib/trl-recipes --repo-type space --include "recipes/carbon-x/*" --local-dir trl-recipes
cd trl-recipes/recipes/carbon-x/Carbon-X
STAGE=sft bash train_local.sh
Guide
Two stages, each on one machine with 8 GPUs (h200x8 on HF Jobs), from the released checkpoints:
- SFT of
HuggingFaceBio/Carbon-X-Baseon thesft_mixconfig ofHuggingFaceBio/FineDNA: 20 subsets, 3 epochs, loss on assistant tokens only, DeepSpeed ZeRO-3. The mixture covers variant-effect reasoning (about 30%), sequence classification, DNA operations and skills, sequence recovery, biology Q&A, and chat and instruction-following data that keep the model a good assistant. - RL of
Carbon-X-SFTwithAsyncGRPOTraineron therl_mixconfig: 16 completions per prompt, thinking off, rewards from code-checked verifiers. vLLM generates on 4 GPUs while FSDP2 trains on the other 4.
| SFT | RL | |
|---|---|---|
| Learning rate | 1e-5, cosine to 1e-6 | 1e-6 |
| Batch | 32 sequences (2 per GPU × 2 accumulation × 8 GPUs) | 16 completions per prompt, 134 accumulation steps on 4 GPUs |
| Length | 9,984 tokens | 4,096 completion tokens, 16,384 tokens per micro-batch |
| Other | Liger kernels, FlashAttention 3, max grad norm 0.2 | clip ε 0.2 / 0.28 (DAPO clip-higher), rollouts at most 4 updates stale, max grad norm 0.2 |
The released model comes from two RL rounds: one epoch over 98,433 prompts chosen from the SFT model's own pass rates,
then a second round from that checkpoint on 58,249 prompts re-selected from its rollouts (about 2.2 passes in all).
rl.yaml runs one round. Its rewards cover variant-effect prediction (with a penalty for rationales the sequence does
not support), sequence-feature classification, basic DNA operations, DNA skills, positions within sequences, biology
multiple-choice questions and instruction following. They are in
src/carbon_x/rewards.py.
Train #
job.sh runs one stage on an 8-GPU machine. It clones
huggingface/carbon at commit 4ca3ce3e, installs its uv.lock (TRL 1.16.0,
vLLM 0.25.1, Transformers 5.12.1, DeepSpeed 0.18.9) and runs training/posttraining/sft.py or rl.py with their
configs. train_hf_jobs.sh sends it to an h200x8 job; train_local.sh runs it on your machine.
STAGE=sft bash train_hf_jobs.sh
STAGE=rl MODEL=<you>/Carbon-X-SFT bash train_hf_jobs.sh
MODELis the checkpoint to start from. Without it, SFT starts fromCarbon-X-Baseand RL from the releasedCarbon-X-SFT.- Checkpoints are pushed to your namespace as they are saved:
<you>/Carbon-X-SFTat every epoch, and<you>/Carbon-X-RL(private) every 30 steps. The job needs nothing else: no bucket, no upload. MAX_STEPS=2makes a smoke run.TIMEOUTsets the job's limit (default3d).
These scripts have not been run as written. The released model was trained on SLURM, and its RL stage served vLLM on a separate 8-GPU node; on one node, vLLM gets 4 GPUs and training's gradient accumulation doubles to keep the batch.
Evaluate #
The five benchmarks of the model card, from
HuggingFaceBio/DNAIntelligenceIndex, run as
Inspect tasks with thinking off, the model's generation_config.json sampling and one
sample per problem.
| Benchmark | Task | Metric | Carbon-X |
|---|---|---|---|
| BioReason Coding | bioreason_coding_sequence_only |
balanced accuracy | 74.9 |
| BioReason Non-SNV | bioreason_non_snv |
balanced accuracy | 85.1 |
| GenomeQA | genomeqa_mcq_carbon |
mean of 6 task accuracies | 63.6 |
| NextBase | seqrecqa_varlen |
per-base accuracy | 39.4 |
| FrontierVEP | vepqa_single_1k |
accuracy | 70.4 |
eval_hf_jobs.sh submits one rtx-pro-6000 job per benchmark with the repository's evaluation/evaluate.py, and
writes Inspect logs and a summary.json per benchmark to your private bucket <you>/Carbon-X-Evals. eval_local.sh
serves the model with vLLM on your GPUs and runs the same tasks with Inspect.
MODEL=<you>/Carbon-X-RL bash eval_hf_jobs.sh
BENCHMARKS="vepqa_single_1k genomeqa_mcq_carbon" LIMIT=8 bash eval_hf_jobs.sh # quick check
Hyperparameters
Serving (vLLM)
Hardware
Datasets
Training
Evaluation
TRL version
This recipe runs on a TRL release from PyPI, with no fork and no patch.
pip install "trl[peft]==1.16.0"