Calibrated sequence-level failure prediction and adaptive redundancy allocation for DNA data storage.
DNA data storage encodes digital information into synthetic DNA oligonucleotides. Errors introduced during synthesis, PCR amplification, storage decay, and sequencing can cause Reed-Solomon (RS) error correction to fail — resulting in data loss.
Current practice allocates the same number of RS parity bytes to every oligo, regardless of how error-prone its sequence is. This project proposes a machine learning approach: predict which oligos are likely to fail, then adaptively reallocate parity bytes from safe sequences to risky ones, keeping the total storage budget neutral.
The pipeline covers the full experimental workflow:
- Synthetic DNA channel simulation (DeSP-inspired Monte Carlo model)
- Feature extraction from raw sequence composition
- Calibrated ML model training (XGBoost, Random Forest, Logistic Regression)
- Adaptive redundancy allocation vs. uniform and oracle baselines
- Feature ablation and distribution shift robustness analysis
- Paper-ready figure generation
The pipeline runs across 16 dataset configurations (4 × 2 × 2):
| Axis | Values |
|---|---|
| Substitution rate | 1%, 5%, 9%, 12% |
| Coverage depth (K) | K=5, K=3 |
| Encoding scheme | Simple (2-bit), Constrained (R∞-P8) |
Each configuration generates 2,000 oligos, simulates 30 Monte Carlo channel runs per oligo, and records failure frequency as the ML target.
├── src/
│ ├── sequence_generator.py # Synthetic oligo generation + channel simulation
│ ├── feature_extractor.py # ~80 sequence features per oligo
│ └── dataset_assembler.py # Train/val/test splits (70/15/15)
├── models/
│ ├── train.py # XGBoost / RF / LR training with grid search
│ ├── calibrate.py # Platt scaling, isotonic regression, temperature scaling
│ └── evaluate.py # ECE, Brier score, PR-AUC, AUROC
├── allocation/
│ ├── mechanism.py # Budget-neutral parity reallocation logic
│ └── experiment.py # Allocation experiments (XGBoost vs. Oracle vs. Uniform)
├── analysis/
│ ├── ablation.py # Feature group ablation analysis
│ ├── distribution_shift.py # Cross-regime transfer experiments
│ └── figures.py # Paper figures (Figs 2–5, S1, S4)
├── configs/
│ └── experiment_config.yaml # All hyperparameters and grid settings
└── run_pipeline.py # End-to-end orchestrator with checkpointing
pip install numpy pandas scipy scikit-learn xgboost shap matplotlib seaborn pyyaml pyarrowPython 3.10+ recommended.
Run all stages end-to-end:
python run_pipeline.pyResume from a specific stage after interruption:
python run_pipeline.py --from-stage trainRun a single stage:
python run_pipeline.py --only figures --forceCheck pipeline status:
python run_pipeline.py --status| Stage | Description |
|---|---|
datasets |
Generate sequences, simulate channel, extract features |
train |
Train and calibrate all models across 16 configs |
gate_check |
Validate model quality before allocation experiments |
allocation |
Run adaptive vs. uniform vs. oracle allocation (48 experiments) |
ablation |
Feature group ablation across all 16 configs |
distribution_shift |
Cross-substitution-regime transfer robustness tests |
figures |
Generate all paper figures |
After the full pipeline completes:
results/
├── ablation/ # 16 CSVs — per-group metric deltas
├── distribution_shift/ # 4 CSVs — ECE/Brier/PR-AUC under transfer
└── figures/
├── fig2_reliability_diagrams.png
├── fig3_shap_importance.png
├── fig4_frr_vs_delta.png
├── fig5_distribution_shift.png
├── fig_s1_feature_distributions.png
└── fig_s4_cost_reliability.png
Key metric — Failure Reduction Rate (FRR): how much the adaptive allocation reduces failures vs. the uniform baseline, at the same total parity budget.
- Calibration matters: raw model scores are used directly as risk values in the allocation mechanism, so probability calibration (Platt scaling for XGBoost, isotonic for RF) is critical — not just discrimination
- Single-class guard: at low substitution rates and high coverage, virtually no sequences fail. A
DummyClassifieris used in these cases rather than forcing a meaningless classifier - Budget neutrality: the allocation mechanism strictly enforces that total parity bytes added equals total parity bytes removed — no free lunch
- Monte Carlo evaluation: FRR is estimated over 30 independent channel simulation runs per configuration to account for stochastic variation
All experiment parameters are in configs/experiment_config.yaml, including substitution rates, coverage depths, model hyperparameter grids, RS thresholds, and allocation delta values.