CaliMem: Search-Efficient Data Agent via Calibrated Memory
Organizations: Virginia Tech · University of Southern California · Princeton University
Abstract
Data curation is a first-order design choice in machine learning, yet tailoring training data to a downstream model and task remains costly in labor, expertise, and compute. Datasets are therefore often processed through fixed pipelines and reused across applications. We show that this assumption is fragile: across 55 dataset--model tasks spanning biological domains, the same curation recipe can help one model while hurting another. Effective curation must adapt to the downstream setting, motivating automated search over data recipes. We first build an agentic system that searches for curation policies at deployment, improving data utility via test-time curation (TTC). Although achieving performance gains, its search is driven largely by recent feedback and remains local. Adding persistent memory helps the agent retain evidence across iterations and reveals a deeper problem: it forms claims that extend beyond the conditions in which they were observed, sometimes abandoning an entire strategy after a single unsuccessful trial. To address this problem, we introduce CaliMem, a calibrated-memory agentic loop that requires the agent to predict the outcome of each proposed policy before executing it. Comparing this prediction with the observed result gives the agent a reality check on the claims behind its proposal. It uses the prediction error to retain supported claims, revise mistaken ones, and specify the conditions under which a conclusion holds. This makes the agent's beliefs testable, reduces overgeneralization, and supports more effective long-horizon exploration. Across biological and LLM post-training tasks, CaliMem consistently outperforms fixed curation baselines and published methods, and exceeds full-data training by up to 19.4%. Code is open-sourced.
Figures & tables
| Iteration | Score | Status | What changed | Agent’s note |
| 1 | 61.30 | keep | Random 50% subset (baseline) | The score to beat. |
| 4 | 63.63 | keep | Give each perturbation at least 100 cells (all of its cells if it has fewer); split the rest by perturbation size | New best: small perturbations now keep all their cells, and large ones keep their share. |
| 5 | 63.83 | keep | Control cells: 4,900 2,000 | New best: cutting controls frees cells for perturbations at little cost. |
| 6 | 67.53 | keep | Control cells: 2,000 1,000 | Large gain: more perturbation cells matter more than more controls. |
| 7 | 66.60 | discard | Control cells: 1,000 500 | Worse: 500 controls are too few, so 1,000 is the lower limit. Next, keep 1,000 controls and try a higher per-perturbation minimum. |
| 8 | 65.32 | discard | Control cells back to 1,000; per-perturbation minimum: 100 150 | Worse: a higher minimum takes cells from large perturbations, so 100 is the right minimum. |
Appendix figures & tables16 assets
Supplementary material from the paper’s appendix.
Appendix
| Domain | Dataset | Pool | Budget | Models | Headline metric | Iter. |
| Protein variant effect | blat_ecolx | 2,894 | 1,447 | ESM-2 ridge, ESM-2 MLP, AA-property ridge | Spearman | 15 |
| cp2c9_human | 3,736 | 1,868 | ||||
| tpmt_human | 2,188 | 1,094 | ||||
| pten_human | 4,387 | 2,194 | ||||
| Non-coding variant effect | clinvar_splice | 11,163 | 5,582 | DNABERT logistic, 4-mer logistic | AUPRC | 15 |
| mpra_hepg2 | 10,978 | 5,489 |
| Recipe | Kind | Rule | Default | Practice / source |
| random | – | uniform subset, floors reserved | – | seeded baseline; random training subsets in training-size studies ( Gelman et al., 2021 ; Hsu et al., 2022 ) |
| drop_dead_q20 , _q35 | F | drop variants below the -quantile of the assay score | removal of low-fitness “holes” ( Wittmann et al., 2021 ) | |
| cap_per_position_k10 , _k6 | A | at most variants per residue position | position breadth over depth ( Sruthi and Prakash, 2020 ) | |
| position_outlier_2sd | F | drop variants sd from their position’s median | 2 sd | proxy for measurement-error and read-count filtering ( Rubin et al., 2017 ; Faure et al., 2020 ) |
| flip_low_bin | F | keep only variants in ProteinGym’s non-functional bin | bin | FLIP low-versus-high split ( Dallago et al., 2021 ) |
| flip_below_median | F | keep only variants below the median score | median | median analog of the same split ( Dallago et al., 2021 ) |
| Recipe | Kind | Rule | Default | Practice / source |
| random | – | uniform subset, floors reserved | – | seeded baseline |
| all_positives | R | keep every positive, fill with random negatives | – | majority-class undersampling ( Whalen et al., 2022 ) |
| balanced_1to1 , _1to2 | A | target positive:negative ratio | 1:1, 1:2 | class rebalancing ( Kircher et al., 2014 ; Whalen et al., 2022 ) |
| gc_match_0.02 , _0.05 | F | at most as many negatives as positives per GC bin | bin width 0.02, 0.05 | GC-matched null sets ( Ghandi et al., 2014 ; Lee et al., 2015 ) |
| dedup_32mer , _24mer | F | drop windows sharing any exact -mer with a kept window | redundancy / LD pruning ( Purcell et al., 2007 ; Whalen et al., 2022 ) | |
| consequence_stratified | A | equal quota per consequence class | – | consequence annotations ( Landrum et al., 2018 ; Marin et al., 2024 ) |
| Recipe | Kind | Rule | Default | Practice / source |
| random | – | uniform subset, floors reserved | – | seeded baseline |
| qc_fixed_mito20 , _mito5 | F | genes , counts , mitochondrial fraction below threshold | 20%, 5% | tutorial thresholds ( Wolf et al., 2018 ; Hao et al., 2021 ; Luecken and Theis, 2019 ) |
| qc_mad5 , qc_mad3 | F | per-batch MAD outliers on log counts and log genes (both tails) and on mitochondrial fraction (upper tail) | 5, 3 MADs | MAD-based QC ( Lun et al., 2016 ; Germain et al., 2020 ; Heumos et al., 2023 ) |
| doublet_scrublet | F | remove doublets called by Scrublet within each batch | default threshold | Scrublet ( Wolock et al., 2019 ) ; scDblFinder ( Germain et al., 2022 ) |
| class_cap_500 , _1000 | A | at most cells per class, remainder water-filled | down-weighting abundant types ( Domínguez Conde et al., 2022 ) | |
| class_balanced | A | equal quota per class | – | type-balanced sampling ( Domínguez Conde et al., 2022 ) ; errors on small populations ( Abdelaal et al., 2019 ) |
| Recipe | Kind | Rule | Default | Practice / source |
| random | – | uniform subset, floors reserved | – | seeded baseline |
| batch_equal | A | equal quota per batch | – | unequal batch sizes ( Johnson et al., 2007 ; Korsunsky et al., 2019 ; Tran et al., 2020 ) |
| batch_sqrt | A | quota proportional to | – | square-root allocation |
| qc_fixed_mito20 | F | genes , counts , mitochondrial fraction | 20% | threshold-based QC ( Luecken and Theis, 2019 ) |
| qc_mad5 | F | per-batch outliers beyond 5 MADs | 5 MADs | MAD-based QC ( Lun et al., 2016 ; Heumos et al., 2023 ) |
| doublet_scrublet | F | remove Scrublet-called doublets per batch | default threshold | Wolock et al. (2019) |
| Component | Value |
| Initial model | OLMo-2-0425-1B (base) |
| Training hardware | 1 NVIDIA A100 GPU |
| Training epochs | 1 |
| Trainable modules | All parameters (full fine-tuning) |
| Per-device batch size | 1 |
| Gradient accumulation | 16 |
| Component | Value |
| Initial model | Llama-2-7B (base) |
| Training hardware | 1 NVIDIA A100 GPU |
| Training epochs | 1 |
| Trainable modules | All parameters (full fine-tuning) |
| Per-device batch size | 2 |
| Gradient accumulation | 8 |
| Component | Value |
| Initial model | Qwen2.5-Coder-1.5B-Instruct |
| Training hardware | 1 NVIDIA A100 GPU |
| Training epochs | 1 |
| Trainable modules | All parameters (full fine-tuning) |
| Per-device batch size | 4 |
| Gradient accumulation | 4 |
| Iteration | Score | Status | What changed from the previous iteration | Agent’s note (paraphrased) |
| 1 | 61.30 | keep | Random 50% subset (baseline) | The score to beat. |
| 2 | 57.58 | discard | All 9,700 control cells; the same number of cells for every perturbation; within each perturbation, the cells with the highest counts | Worse than baseline. At least one of the three changes hurt, most likely picking the highest-count cells, which may be doublets. |
| 3 | 60.83 | discard | Controls back to 4,900; random cells within each perturbation again | Still slightly below baseline. Picking the highest-count cells was the problem; the same number per perturbation is also slightly worse than splitting by size. |
| 4 | 63.63 | keep | Give each perturbation at least 100 cells (all of its cells if it has fewer); split the rest by perturbation size | New best: small perturbations now keep all their cells, and large ones keep their share. |
| 5 | 63.83 | keep | Control cells: 4,900 2,000 | New best: cutting controls frees cells for perturbations at little cost. |
| 6 | 67.53 | keep | Control cells: 2,000 1,000 | Large gain: more perturbation cells matter more than more controls. |
| Iteration | Score | Status | What changed from the previous iteration | Agent’s note (paraphrased) |
| 1 | 84.92 | keep | Random 50% subset (baseline) | The score to beat. One cell type has a recall of only 0.52 and drags the average down. |
| 2 | 84.42 | discard | The same number of cells for every cell type, capping the large ones | Worse: the weakest cell type improves, but the large ones lose cells. The SVM already weights classes by frequency, so balancing the counts is redundant. |
| 3 | 89.84 | keep | No count balancing; keep the 4,082 cells whose labels a cross-validated logistic regression predicts most confidently | Large gain: dropping ambiguous or mislabeled cells sharpens the linear boundary, and the weakest cell type’s recall rises from 0.52 to 0.79. |
| 4 | 88.35 | discard | Score cells with a classifier trained on the other 10x protocol instead of cross-validation | Worse: a scorer trained on one protocol is less reliable than cross-validation over the whole pool. |
| 5 | 88.96 | discard | Back to the iteration-3 cells; drop the sparsest genes (2,000 1,684 genes) | Worse: removing genes hurts; the SVM needs the full 2,000-gene panel. |
| 6 | 89.17 | discard | All 2,000 genes again; score cells with the evaluation model itself (the SVM) instead of logistic regression | Worse: the SVM scorer removes too many B cells and megakaryocytes; the gentler logistic-regression scorer stays best. |
| Model | Agent variant | \Block Protein | ||||
| (Spearman) | \Block Non-coding | |||||
| (AUPRC) | \Block Cell type | |||||
| (macro-F1) | \Block Batch | |||||
| (scIB overall) | \Block Perturbation | |||||
| (cosine) | ||||||
| \Block [l]1-2Full data (baseline) | - | 35.60 | 13.38 | 64.65 | 68.79 | 46.04 |
| Model | Agent variant | \Block OLMo-2-1B | ||
| (select 1.1%) | \Block Llama-2-7B | |||
| (select 3.7%) | \Block Qwen2.5-Coder-1.5B | |||
| (select 0.2%) | ||||
| \Block [l]1-2Random (baseline) | - | 31.00 0.52 | 42.44 0.28 | 57.72 0.24 |
| \Block [l]1-2Entire dataset | - | 30.35 | 45.70 | 62.03 |
| \Block [l]1-2LESS ( Xia et al., 2024 ) | - | 31.81 (+2.6%) | 45.05 (+6.1%) | 58.38 (+1.1%) |
Training Data Curation
Training data curation improves the quality, diversity, organization, and reliability of datasets used to train machine-learning models.
See all 156 papers