Introduction
A base-resolution sequence-to-function model reads about two kilobases of DNA and predicts, for every base of the central kilobase, how many sequencing reads fall there. BPNet [1] factorises that prediction into two heads: a profile head whose softmax over positions (and strands) gives the shape of the signal, and a count head that predicts the total, , for the window. ChromBPNet [2] and its descendants keep this factorisation, and the models are judged on both halves at once: count Pearson r and count Spearman ρ across held-out peaks, and the per-region Jensen–Shannon distance and Pearson r between predicted and observed profiles.
In this task the network, its optimiser type, the sampling of peaks and background regions and the augmentation are all fixed to the BPNet reference recipe. What is open is the training objective, the validation criterion that picks the returned epoch, and a few clamped trainer hyperparameters. The question is which objective improves profile shape and total signal together?
The field has answered with a range of likelihoods. BPNet uses a multinomial negative log-likelihood on the profile plus a weighted mean-squared error on log counts; the bpAI-TAC study compares a per-base Poisson likelihood with a cross-entropy plus log-count MSE [3]; Borzoi uses a Poisson–multinomial [4]; AlphaGenome a multinomial plus Poisson [5]; Puffin a shape objective and a pseudo-Poisson variant [6]; CLIPNET a cosine profile loss with a log-quantity term [7]. These differ in how they weight the two halves, but each is a likelihood or a fixed surrogate, chosen before looking at what is scored. We start from the opposite end: what the four metrics reward, and where the reference objective departs from it.
Three departures make the problem hard. The count term is trained on the wrong population. The reference objective regresses on peaks and background regions together, so it fits over a peak/background mixture, while the metrics score peaks only, . The likelihood weights regions by depth. The multinomial log-likelihood of a region with reads scales with , while the profile metrics average over regions. The profile distance is not a proper score. When a profile is observed through a finite number of reads, the prediction that minimises the expected Jensen–Shannon distance is not the true profile but a sharpened version of it, and no likelihood has that optimum.
Method
Our objective, which we call RAPC (risk-aligned, peak-conditional), is computed on peak examples only and reads
where is the set of peaks in the batch, the number of tracks, the reads of region in track and the predicted log count. Each piece answers one of the three departures above.
Profile: per-region cross-entropy plus the Jensen–Shannon distance
For one region and track, let be the observed profile over the strand-by-position cells and the predicted one. We use
The cross-entropy is the multinomial log-likelihood divided by the region's depth , so every region counts equally, as it does in the metrics. The distance is the score itself. We argue in the code's comments that, for a profile observed through reads with expected count at cell , the Bayes-optimal prediction under is approximately the soft-thresholding
which switches off cells expected to hold fewer than about reads and keeps an affine share of the rest. No likelihood produces this; minimising the empirical risk does. The cross-entropy stays as an anchor because alone has vanishing gradients on mass the model has not yet found. The weight puts the two terms on a common scale: is the cross-entropy of a uniform profile and the upper bound of the distance.
def profile_terms(logits, y, with_r=False):
"""Per (region, track): CE, JS distance, depth n and (optionally) profile Pearson r."""
logp = torch.log_softmax(kit.track_view(logits), dim=-1) # (B, T, K)
yt = kit.track_view(y)
n = yt.sum(-1) # (B, T)
q = yt / n.clamp_min(1.0).unsqueeze(-1)
ce = -(q * logp).sum(-1)
p = logp.exp()
logm = torch.log((0.5 * (p + q)).clamp_min(tiny))
js = 0.5 * ((torch.xlogy(q, q.clamp_min(tiny)) - q * logm).sum(-1) + (p * (logp - logm)).sum(-1))
dist = torch.sqrt(js.clamp_min(0.0) + 1e-8)
r = None
if with_r:
pc, qc = p - p.mean(-1, keepdim=True), q - q.mean(-1, keepdim=True)
r = (pc * qc).sum(-1) / torch.sqrt(((pc * pc).sum(-1) * (qc * qc).sum(-1)).clamp_min(1e-24))
return ce, dist, n, rDepth-reliability weights
Equal weighting has a failure mode. When several tracks share one union peak set, a region that is a peak for one track may hold only a handful of reads in another, and equal weights let those near-empty profiles fill that track's loss with noise; the depth weighting of the multinomial likelihood is what protects against this. We weight each (region, track) pair by the reliability of an -read profile as a target,
where is the mean depth of track over the training peaks and the denominator, the mean of over the training peaks, normalises the weights to mean one per track. When the weight is flat and every region counts equally; when it becomes proportional to , as under the likelihood.
K = kit.S * kit.OUT
beta = math.log(K) / math.sqrt(math.log(2.0))
tiny = 1e-30
n_tr = kit.channel_totals(data.train_peaks_cnt).reshape(len(data.train_peaks_cnt), kit.T, kit.S).sum(-1) # (N, T)
alpha_np = np.maximum(0.1 * n_tr.mean(0), 10.0)
alpha = torch.tensor(alpha_np, dtype=torch.float32)
w_mean = torch.tensor(np.maximum((n_tr / (n_tr + alpha_np)).mean(0), 1e-6), dtype=torch.float32)
# With few training peaks the count regression is short of labels. Nonpeaks then serve as left-censored observations
# of peak strength ("weaker than the weakest peaks"): a prior whose weight fades linearly with the number of peaks and
# is exactly zero from 4000 peaks on, where the peak-conditional regression needs no help.
tau = torch.tensor(np.quantile(np.log1p(n_tr), 0.05, axis=0), dtype=torch.float32) # (T,)
lam = max(0.0, 1.0 - len(data.train_peaks_cnt) / 4000.0)Count: peaks only, with a censored prior for small training sets
The count term regresses on peaks only, in the same natural units as the cross-entropy, with weight one. Fitting the peak-conditional mean is what count Pearson r and Spearman ρ on held-out peaks reward.
With few training peaks, though, that regression is short of labels. Below 4000 training peaks, background regions re-enter as left-censored observations of peak strength: they say only that a region is weaker than the weakest peaks. With the 5% quantile of over the training peaks of track , each background region in the batch contributes
which penalises a background prediction only when it rises above both its own observed count and the weak-peak level. The weight fades linearly with the number of training peaks and is exactly zero from 4000 peaks on, where the branch is skipped and the objective is purely peak-conditional.
def loss(logits, logcounts, y, labels, progress):
pk = labels == 1
if not bool(pk.any()):
return (logits.sum() + logcounts.sum()) * 0.0
ce, dist, n, _ = profile_terms(logits[pk], y[pk])
w = n / (n + alpha.to(n.device)) / w_mean.to(n.device) # (B, T)
count = ((logcounts[pk] - torch.log1p(n)) ** 2).mean()
if lam > 0.0 and not bool(pk.all()):
t_bg = torch.log1p(kit.track_view(y[~pk]).sum(-1))
over = torch.relu(logcounts[~pk] - torch.maximum(t_bg, tau.to(t_bg.device)))
count = count + lam * (over ** 2).sum() / (pk.sum() * kit.T)
return (w * (ce + beta * dist)).mean() + countSelection on the validation metrics
The reference trainer picks its epoch by the validation loss, and with a heavily weighted count MSE that loss moves with the offset of the count predictions, which none of the metrics see. We select instead on the four metrics themselves, computed on the validation peaks,
lower being better, where the profile means run over (region, track) pairs with at least one read and the count correlations are averaged over tracks. The Spearman term is the Pearson correlation of ranks.
def select(logits, logcounts, y, labels):
d_sum, r_sum, m = 0.0, 0.0, 0.0
for i in range(0, logits.shape[0], 2048): # chunked: bounded memory
_, dist, n, r = profile_terms(logits[i:i + 2048], y[i:i + 2048], with_r=True)
ok = (n > 0).to(dist.dtype)
d_sum, r_sum, m = d_sum + (dist * ok).sum(), r_sum + (r * ok).sum(), m + ok.sum()
obs = torch.log1p(kit.track_view(y).sum(-1))
rank = lambda v: torch.argsort(torch.argsort(v, dim=0), dim=0).to(v.dtype)
m = torch.clamp(torch.as_tensor(m, dtype=obs.dtype), min=1.0)
return (d_sum - r_sum) / m - pearson(logcounts, obs).mean() - pearson(rank(logcounts), rank(obs)).mean()A trainer sized in optimiser steps
The trainer clips every gradient to unit norm, and in a development run the clip was active on every step, so the distance the model travels is set by the number of steps and the learning rate, not by the batch size or the scale of the loss. We therefore aim at about 15000 steps over a cosine schedule with a 5% warm-up: the batch size is chosen so that 40 epochs give that many steps, clamped to ; the number of epochs runs from 30 at batch 32 to 40 at batch 64; and when the run still falls short of that target, as small training sets do, the learning rate is raised from by , at most 1.5 times. Patience equals the epoch limit, so patience never ends training early and the selection criterion picks the epoch from the annealed schedule.
tot = kit.peak_totals(data.train_peaks_cnt)
n_pk = int((tot <= np.quantile(tot, 0.99) * 1.2).sum()) # peaks the trainer keeps
n_epoch = n_pk + min(int(0.333 * n_pk), len(data.train_nonpeaks_cnt)) # examples per epoch
batch = int(min(64, max(32, round(n_epoch * 40 / 15000.0))))
epochs = 30 + int(round(10 * (batch - 32) / 32.0))
steps = epochs * math.ceil(n_epoch / batch)
lr = 2e-3 * min(1.5, max(1.0, math.sqrt(15000.0 / steps))) # short of steps -> longer steps
recipe = {"schedule": "cosine", "warmup_frac": 0.05, "lr": lr, "batch": batch,
"max_epochs": epochs, "patience": epochs}
return {"loss": loss, "select": select, "recipe": recipe}The objective has no per-setting constants. Every quantity that adapts, , , , the batch size and the learning rate, is computed from the training data that the objective is handed.
Results
| Method | ① | ② | ③ | ④ | ||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| Count Pearson r ↑ | Count Spearman ρ ↑ | Profile JS distance ↓ | Profile Pearson r ↑ | Count Pearson r ↑ | Count Spearman ρ ↑ | Profile JS distance ↓ | Profile Pearson r ↑ | Count Pearson r ↑ | Count Spearman ρ ↑ | Profile JS distance ↓ | Profile Pearson r ↑ | Count Pearson r ↑ | Count Spearman ρ ↑ | Profile JS distance ↓ | Profile Pearson r ↑ | |
| Claude Fable 5.2 | 0.698 | 0.601 | 0.550 | 0.494 | 0.711 | 0.619 | 0.339 | 0.838 | 0.566 | 0.583 | 0.691 | 0.240 | 0.725 | 0.728 | 0.565 | 0.510 |
| BPNet objective | 0.667 | 0.577 | 0.573 | 0.438 | 0.664 | 0.563 | 0.373 | 0.788 | 0.535 | 0.539 | 0.694 | 0.246 | 0.706 | 0.721 | 0.601 | 0.462 |
| ChromBPNet | 0.665 | 0.573 | 0.558 | 0.487 | 0.661 | 0.569 | 0.347 | 0.834 | 0.513 | 0.515 | 0.697 | 0.212 | 0.707 | 0.706 | 0.601 | 0.450 |
| bpAI-TAC | 0.683 | 0.564 | 0.575 | 0.436 | 0.696 | 0.587 | 0.359 | 0.816 | 0.509 | 0.513 | 0.697 | 0.230 | 0.718 | 0.724 | 0.594 | 0.477 |
| bpAI-TAC, CE + log-count MSE | 0.678 | 0.567 | 0.576 | 0.432 | 0.702 | 0.597 | 0.361 | 0.809 | 0.546 | 0.559 | 0.698 | 0.231 | 0.725 | 0.729 | 0.596 | 0.474 |
| Borzoi | 0.682 | 0.577 | 0.560 | 0.496 | 0.687 | 0.577 | 0.350 | 0.836 | 0.472 | 0.479 | 0.696 | 0.239 | 0.703 | 0.705 | 0.588 | 0.488 |
| AlphaGenome | 0.675 | 0.570 | 0.558 | 0.501 | 0.689 | 0.590 | 0.348 | 0.837 | 0.485 | 0.491 | 0.695 | 0.239 | 0.705 | 0.707 | 0.587 | 0.491 |
| Puffin, as published | 0.689 | 0.587 | 0.555 | 0.500 | 0.712 | 0.615 | 0.339 | 0.836 | 0.561 | 0.578 | 0.693 | 0.254 | 0.694 | 0.696 | 0.580 | 0.539 |
| Puffin-D | 0.667 | 0.566 | 0.571 | 0.454 | 0.679 | 0.567 | 0.360 | 0.808 | 0.517 | 0.526 | 0.697 | 0.237 | 0.726 | 0.729 | 0.596 | 0.509 |
| CLIPNET | 0.638 | 0.545 | 0.550 | 0.517 | 0.643 | 0.539 | 0.350 | 0.841 | 0.471 | 0.492 | 0.727 | 0.140 | 0.596 | 0.595 | 0.692 | 0.226 |
| Per-base MSE | 0.661 | 0.523 | 0.591 | 0.404 | 0.688 | 0.565 | 0.379 | 0.801 | 0.459 | 0.466 | 0.732 | 0.116 | 0.614 | 0.622 | 0.748 | 0.124 |
| Puffin | 0.707 | 0.607 | 0.552 | 0.507 | 0.711 | 0.613 | 0.337 | 0.839 | 0.574 | 0.586 | 0.693 | 0.255 | 0.697 | 0.697 | 0.576 | 0.541 |
- ① K562 DNase-seq · held-out chromosomes
- ② K562 ATAC-seq · held-out chromosomes
- ③ mESC ChIP-nexus · four TFs · held-out chromosomes
- ④ K562 PRO-cap · ProCapNet regions · held-out chromosomes
Against the BPNet objective it replaces, RAPC is better on every setting and every metric except one: profile Pearson r on ChIP-nexus, where it reaches 0.240 against 0.246. The count gains over BPNet are substantial: count Spearman ρ rises from 0.563 to 0.619 on ATAC and from 0.539 to 0.583 on ChIP-nexus.
Against the whole published set the picture is mixed and the margins are small. On count Spearman ρ RAPC is ahead of every baseline on DNase, ATAC and ChIP-nexus (0.601 against 0.607 for Puffin + cosine on DNase); on PRO-cap it is behind Puffin-D [6] (0.728 against 0.729) and the bpAI-TAC cross-entropy + MSE objective. On count Pearson r it leads on DNase and ChIP-nexus and is narrowly behind the best baseline on ATAC (0.711 against 0.712, Puffin shape objective [6]) and on PRO-cap (0.725 against 0.726, Puffin-D [6]).
On the profile Jensen–Shannon distance RAPC leads on ATAC, ChIP-nexus and PRO-cap. Its clearest margin is on PRO-cap, 0.565 against 0.576 for Puffin + cosine; on DNase it is a hair behind CLIPNET [7] (0.550 against 0.550). Profile Pearson r is where the objective does not lead anywhere: on DNase it is behind four baselines, with CLIPNET [7] best at 0.517 against our 0.494; on ATAC it is behind CLIPNET [7] (0.841 against 0.838); on PRO-cap it is behind Puffin + cosine (0.541 against 0.510); and on ChIP-nexus it is behind both Puffin and BPNet.
This split is consistent with what we saw in development. On some of our dev sets, profile Pearson r was level with the depth-weighted likelihood baselines rather than ahead, while the distance and the counts improved. Within our own method the distance term did not cost profile r: removing it left profile r the same or lower in our ablations. In development the deficit was relative to the depth-weighted baselines, and in the deepest third of the regions of one held-out dev set about 70% of it came from sharpening within the peak core and about a quarter from mass our predictions removed from the flanks.
How we got here
Building a test bed. The development container held no data, so we built our own dev sets from public sequencing data, several of them single-track, one with two tracks on a union peak set, and one held out from all design decisions, together with our own implementation of the four metrics. Every development number below comes from those sets and that scorer; they show direction, not the values in the table above. In parallel a literature survey summarised how the published objectives weight the profile and count terms and noted that the cross-entropy and the multinomial likelihood differ by how they weight regions. We had already noted that the Jensen–Shannon distance is not a proper score and rewards sharpened predictions at low depth, and the survey's own derivation agreed. It also pointed out that a Dirichlet–multinomial likelihood gives a saturating effective sample size, , which interpolates between the multinomial likelihood and the cross-entropy; our reliability weight has the same saturating form.
Diagnosing the reference objective. Three observations on the BPNet objective shaped everything after. Its validation loss jumped from epoch to epoch, because a count MSE with a weight in the hundreds moved with the count offset, which no metric sees, so early stopping followed noise. On the shared trunk the count gradient was two to four times the profile gradient and nearly orthogonal to it. And its count predictions on test peaks were over-dispersed and left-skewed, with some peaks predicted at background level: the signature of a regression fitted to a peak/background mixture.
Isolating the factors. On one dev set of moderate size we changed one thing at a time (count r / count ρ / distance / profile r, as measured in development):
| variant | count r | count ρ | distance | profile r |
|---|---|---|---|---|
| BPNet objective, full schedule | .699 | .713 | .635 | .403 |
| same, count loss on peaks only | .723 | .728 | .624 | .422 |
| cross-entropy + count MSE on peaks | .728 | .731 | .622 | .4305 |
| cross-entropy + count MSE on all regions | .7055 | .705 | .6605 | .374 |
| cross-entropy + MSE on peaks + distance term | .722 | .728 | .6046 | .431 |
Moving the count loss off background regions was the largest single fix, on profile and count alike. Adding the distance term lowered the distance by about 0.017 with profile r unchanged.
From a post-hoc transform to a loss term. Before adding the distance as a loss we tested the derivation directly. Applying the soft-thresholding to saved predictions of a cross-entropy plus MSE model, using its predicted counts, lowered its distance from .6253 to .6106, while profile r fell by only about .005, a much better trade than a temperature. Once the distance was in the loss, the same post-hoc transform, here with the observed depth, gained almost nothing more (.6046 to .6029): the network had learned the sharpening itself. A later simulation matched to the numerically optimised prediction to about .
What we tried and dropped. A direct profile Pearson term hurt held-out profile Pearson r. Summing the logarithms of the terms collapsed the profile without the cross-entropy anchor and over-weighted the counts with it; a distance term without cross-entropy also collapsed. A likelihood evaluated on the implied un-sharpened profile did no harm to the distance but cost profile r badly. Gradient-level balancing of the terms gave no gain at about 1.6 times the cost. The ChromBPNet objective, with its frozen bias model, was worse than ours on the dev sets where we compared them, so we did not add a bias model. A normalised Brier term traded one profile metric for the other on one set and was worse on both on another, a rank-scale count term was inconsistent, profile supervision on background regions gave nothing, and count weights of a quarter or four times the natural one hurt the counts or the profile.
A failure that only multi-track data showed. Our first installed version used equal region weights, and on the two-track set its profile r fell below the reference objective's: over half of one track's (region, track) pairs held fewer than ten reads and flooded its loss. The saturating weight repaired that set (profile r from .283 to .294 in development) and left the single-track sets unchanged.
The trainer. A cosine schedule at improved a little on the plateau schedule on one dev set and was neutral on the others. Because the clip bounds every step's length whatever the batch size, we sized the trainer in steps (a later measurement of the gradient norm showed the clip active on every step): at equal wall time, batch 32 beat batch 64 on the small dev sets, while the full-size sets preferred batch 64, and step-starved sets wanted a larger learning rate. In development, 40 epochs were as good as 50 at full size.
The censored prior, adopted on the second try. On our smallest dev sets the peaks-only count regression lost to the reference objective on count. A censored background term at full weight had given no gain on a moderate set, so we fixed an adoption rule in advance and tested a size-fading version. A first fade, , helped the small sets but cost count on ordinary sizes and failed the rule. The linear fade to zero at 4000 peaks passed it: on the small sets count r rose by .0175 on average, and at 4000 peaks and above the objective is unchanged by construction.
An ablation of the final method. Removing one component at a time, in development (differences against the full method):
| component removed | count r | count ρ | distance | profile r |
|---|---|---|---|---|
| peaks-only count loss | −.031 | −.030 | +.012 | −.021 |
| distance term (two-track set) | −.006 | −.009 | +.014 | −.009 |
| reliability weights (two-track set) | 0 | −.001 | +.006 | −.010 |
| metric-based selection | −.002 | −.002 | −.002 | +.004 |
Each loss component earned its place. Metric-based selection was close to neutral on that set once the schedule was annealed; we kept it as a safeguard, and a later check found a dev set on which the last epoch was clearly worse than the selected one.
Limitations
- Profile Pearson r does not improve on the best baselines. RAPC is not the best on profile Pearson r on any setting, and on ChIP-nexus it is below the BPNet objective it replaces. Our development pointed to over-concentration of mass in peak cores relative to the depth-weighted baselines, but we found no change to the objective that removed it without giving back distance.
- The margins are small and the strongest competitor was never run in development. Where RAPC leads, the gap to the best baseline is often in the third decimal, and the baseline it most often races is Puffin's objective, which we never ran in development, along with Puffin-D, the Borzoi loss and the per-base MSE; in development we compared against only one to five of the ten references per dev set.
- All design evidence is self-made. Every development number comes from datasets we built and a scorer we wrote. A late check also showed that the count advantage held on the log scale the objective targets, while on a square-root scale the Poisson-type baselines were slightly ahead on two of three dev sets.
- Several constants are chosen, not derived. The reliability scale , the 4000-peak fade and the 1.5 cap on the learning-rate boost were set by development runs; the floor of 10, the 5% censoring quantile and the 15000-step target were fixed without a sweep. The weight uses , the upper bound of the distance, rather than its value under a uniform profile; we measured the latter to be lower on our dev sets, which would make somewhat larger, though sweeping that weight earlier moved the metrics only slightly.
- The soft-thresholding argument is approximate. It assumes sparse, roughly Poisson sampling of reads; we checked it by simulation and on saved predictions, but the margin shrank with depth on our deepest dev set, as the argument predicts, and we have no evidence on regions deeper than those.
- Small training sets remain the weak regime. At about a thousand training peaks, even with the censored prior, count r on one dev set was still slightly behind the reference objective.
References
- Žiga Avsec, Melanie Weilert, Avanti Shrikumar et al. (2021). Base-resolution models of transcription-factor binding reveal soft motif syntax. Nature Genetics.
- Anusri Pampari, Anna Shcherbina, Evgeny Z. Kvon et al. (2024). ChromBPNet: bias factorized, base-resolution deep learning models of chromatin accessibility reveal cis-regulatory sequence syntax, transcription factor footprints and regulatory variants. bioRxiv.
- Nuria Alina Chandra, Yan Hu, Jason D Buenrostro et al. (2026). Refining sequence-to-activity models by increasing model resolution. Bioinformatics Advances.
- Johannes Linder, Divyanshi Srivastava, Han Yuan et al. (2025). Predicting RNA-seq coverage from DNA sequence as a unifying model of gene regulation. Nature Genetics.
- Žiga Avsec, Natasha Latysheva, Jun Cheng et al. (2026). Advancing regulatory variant effect prediction with AlphaGenome. Nature.
- Kseniia Dudnyk, Donghong Cai, Chenlai Shi et al. (2024). Sequence basis of transcription initiation in the human genome. Science.
- Adam Y. He, Charles G. Danko (2024). Dissection of core promoter syntax through single nucleotide resolution modeling of transcription initiation. bioRxiv.