Task-Aligned Assignment

Task-Aligned Assignment is the sample-selection half of Task Alignment Learning (TAL), a dynamic label-assignment strategy.

  • Paper: Feng, Zhong, Gao, Scott, Huang, TOOD: Task-aligned One-stage Object Detection, ICCV 2021, arXiv:2108.07755.
  • What it decides: for each ground-truth object, which anchor points become positive training samples.
  • Core idea: the decision uses a single scalar that fuses classification confidence and localization quality, rather than geometry alone.
  • Used by: PP-YOLOE, YOLOv6, YOLOv8, YOLOv10 and YOLO11; it is also the mechanism YOLOv10’s NMS-free dual-head training is built on top of.

The problem: task misalignment

A one-stage detector emits, at every anchor point, a classification score and a box. These two heads are trained independently but are consumed jointly: NMS ranks boxes by classification score and keeps the top one per cluster. Nothing in the training objective ties the two together, so the anchor with the highest class score is frequently not the anchor with the best-localized box. NMS then keeps a confident, badly-placed box and suppresses a diffident, well-placed one — a loss of AP that no amount of extra capacity fixes, because it is an artifact of the training signal.

Label assignment is where this can be repaired, because assignment decides what “positive” means. The strategies TAL displaced were all task-agnostic in the relevant sense:

  • Anchor-IoU thresholds (RetinaNet, YOLOv3): positive if a prior box overlaps the GT above a fixed threshold. Purely geometric, and dependent on hand-tuned anchor shapes.
  • Center priors (FCOS, YOLOX’s center sampling): positive if the anchor point lies inside the GT box or a shrunk central region. Geometric again, and blind to whether the model is actually predicting that object well at that location.
  • ATSS: adaptive per-object IoU threshold from the mean+std of candidate IoUs. Dynamic, but still driven only by localization statistics of priors, not predictions.
  • OTA / SimOTA (YOLOX): assignment as optimal transport with a cls+reg cost — genuinely prediction-aware, but the full Sinkhorn formulation is expensive; SimOTA approximates it with a dynamic- heuristic.

TAL keeps OTA’s insight that assignment should depend on the model’s current predictions for both tasks, but replaces the transport problem with a single ranking metric that costs one element-wise product.

The alignment metric

For a ground-truth object with class and box , and a candidate anchor with predicted class- score and predicted box :

and set the relative pull of the two tasks. Because both factors are multiplicative and in , is high only when both are high — an anchor cannot buy its way into the positive set with confidence alone or overlap alone. Raising well above (the universal choice: against –) makes the metric localization-dominated, with the classification score acting as a tie-breaker among well-localized candidates.

The same metric is then reused as a soft classification target, which is what actually closes the misalignment loop: the network is trained to predict a high class score exactly where the box is good, so the score it emits at inference is a usable proxy for localization quality and NMS’s ranking becomes meaningful.

classification score s → IoU(b̂, b) → 0 1 1 t = 0.05 t = 0.2 top-k by t = s^0.5 · u^6 → positives top-k by score alone — what NMS ranks by at inference

The three dashed-but-grey candidates on the right are the failure TAL is aimed at: confident predictions with mediocre boxes. A score-only criterion promotes them; the multiplicative metric does not, and the soft targets derived from it actively push their scores back down.

The algorithm

Per image, per ground-truth object:

  1. Candidate restriction. Keep only anchor points whose centre falls inside the GT box. This is a cheap spatial prior that stops the metric from selecting a well-scoring anchor on the other side of the image.
  2. Score all candidates with , using the detached current predictions (assignment must not backpropagate).
  3. Top- selection. Keep the highest- candidates as positives for that object. is fixed, unlike SimOTA’s per-object dynamic .
  4. Conflict resolution. An anchor selected by several ground truths is awarded to the one it overlaps most (highest IoU), so every anchor has at most one target.
  5. Soft targets. Positives get a classification target of (below) instead of 1; everything else is background.
for each gt g:
    C  = {anchors a : center(a) inside box(g)}          # spatial prior
    t  = score(a, class(g))**alpha * IoU(box(a), box(g))**beta   for a in C
    P_g = topk(t, k)                                    # positives for g
resolve: a assigned to argmax_g IoU(box(a), box(g)) if |{g : a in P_g}| > 1
targets: cls(a) = onehot(class(g)) * t_hat(a, g);  box(a) = box(g)

Normalizing the soft target

Raw values are tiny — with , an IoU of 0.8 contributes — so using directly as a BCE target would suppress all positive gradient. TAL rescales, per ground-truth object, so that the largest soft target equals that object’s best achieved IoU:

The best-aligned anchor for an object thus receives a target equal to its IoU (approaching 1 as the model improves), and the remaining positives receive proportionally less. The relative ordering within an object is preserved, while the absolute scale stays calibrated to localization quality — which is precisely what makes the class score readable as a confidence in the box.

Where enters the losses

is used twice:

  • Classification: BCE against the soft target rather than a hard 1 (TOOD additionally applies a focal-style modulation ). This is what teaches the score head to report localization quality.
  • Regression: each positive’s box loss (CIoU, and DFL where used) is weighted by , concentrating localization gradient on the anchors that are already well aligned rather than spreading it over marginal positives.

Both are normalized by over the batch, so the loss scale does not drift as the number and quality of positives changes during training.

TOOD pairs TAL with T-Head, a task-decomposed head that computes task-specific features from a shared stack and spatially aligns the classification and regression outputs via learned offsets. The two are separable, and the YOLO family adopted only TAL — the assignment strategy is where most of the reported gain lives (TOOD’s ablation: TAL contributes the larger share of the +3.3 AP over the ATSS baseline).

Hyperparameters

top-IoU used
TOOD (paper)1.06.013IoU
Ultralytics TaskAlignedAssigner default1.06.013CIoU
YOLOv8 / YOLO11 detection loss0.56.010CIoU, clamped ≥ 0
YOLOv10 o2m head0.56.010CIoU
YOLOv10 o2o head0.56.01CIoU

Verified against ultralytics/utils/tal.py and ultralytics/utils/loss.py (v8.3.75): the class signature carries TOOD’s defaults, but v8DetectionLoss instantiates it as TaskAlignedAssigner(topk=10, alpha=0.5, beta=6.0). Note the implementation feeds CIoU (not plain IoU) into both the metric and the normalization, clamped at zero since CIoU’s penalty terms can go negative. RotatedTaskAlignedAssigner swaps in ProbIoU and a parallelogram-based inside-box test for the OBB task.

Relation to NMS-free training in YOLOv10

YOLOv10’s “consistent dual assignments” is a direct exploitation of this metric’s structure. Both of its heads run the same assigner; the one-to-one head is simply topk = 1, and the consistency condition is

Since and is monotone for , the two heads produce an identical ranking of candidates. The single sample the o2o head trains on is therefore guaranteed to be the o2m head’s top-ranked sample, and the supervision the two branches send back into the shared backbone agrees instead of conflicting. That property is a consequence of the metric being a pure power product — an additive cost like OTA’s would not give it for free.

Practical notes and limitations

  • Cold start. At initialization the class scores are noise, so ranks candidates essentially at random and early assignments are unstable. The weighting mitigates this (IoU is informative earlier than the score), and PP-YOLOE addresses it explicitly by running a static ATSS assigner for the first few epochs before switching to TAL.
  • Fixed . Every object gets the same number of positives regardless of size or crowding, unlike SimOTA’s dynamic ; the spatial prior in step 1 is what prevents small objects from being handed distant candidates.
  • Cost. The metric is dense tensors, which is the memory hot-spot of the loss on crowded images — the Ultralytics implementation catches OutOfMemoryError and recomputes the assignment on CPU.
  • Not a free lunch for the o2o setting. With the metric must pick the single right anchor from the start, and this is where YOLOv10’s remaining ~1 AP gap on small models shows up.
  • Interaction with . Because makes the metric steeply localization-dominated, TAL behaves close to an IoU-ranked assigner in mid-training; its distinctive contribution is less the selection than the soft target it exports to the classification loss.

See also

  • All Articles
  • YOLOv8 — the first mainstream YOLO to make TAL its only assigner (topk 10, α 0.5, β 6.0), paired with DFL box regression.
  • YOLOv10 — reuses the same assigner twice with a consistent metric to train an NMS-free one-to-one head.
  • DETR — the alternative answer to the same question: Hungarian matching gives exactly one positive per object by construction, at the cost of slow convergence.
  • Implementing Research Papers