TAED: Trajectory-Aligned Encoder--Decoder Distillation for Detection Transformers

Zilong He, Zhangchi Hu, Hebei Li, Yijun Pan, Yifan Zhao, Xiangyu Yu, Yansong Peng, Xinghao Wang, Dongsheng Jiang, Xiaoyan SunarXiv 2026

Imagine you’re a master painter (the "Teacher") trying to mentor an apprentice (the "Student"). You’re both looking at a complex landscape. You might start by detailing a majestic oak tree in the foreground, while your apprentice, overwhelmed by the scene, starts sketching a tiny bird in the distance. If you try to correct their brushstrokes by telling them how to paint a leaf, but they are currently focused on a feather, your advice is worse than useless—it’s confusing.

This is the fundamental struggle in distilling knowledge for Detection Transformers (DETRs). A new paper, TAED, proposes a clever way to make sure the teacher and student are finally looking at the same thing at the same time.

TL;DR

TAED (Trajectory-Aligned Encoder–Decoder Distillation) fixes the "mismatched query" problem in object detection distillation. By pairing teacher and student predictions based on their spatial origin in the image rather than their arbitrary rank, it allows a small model to follow the precise refinement "trajectory" of a larger model, leading to significant accuracy boosts with zero extra cost at inference time.

What Problem Does This Paper Address?

Modern object detectors like DETRs use "queries"—mathematical probes that search the image for objects. In many high-performing DETRs, these queries are initialized based on the "top-K" most promising spots found by the model's encoder.

The problem? A big, smart "Teacher" model and a small, compact "Student" model rarely agree on which spots are the "top-K." If you try to supervise the student by matching their #1 query to the teacher's #1 query, you often end up pairing a query looking at a car with one looking at a tree. This "rank-based" supervision is noisy and unreliable.

Previous fixes involved adding "auxiliary queries" (extra work during training) or complex matching algorithms that don't quite capture the iterative refinement process that happens inside a DETR's decoder.

Comparison of query correspondence in existing methods vs. TAED.

Methods

The authors introduce TAED, which stands on three main pillars:

  1. Encoder Feature Distillation: Before even talking about objects, they align the "vision" of both models. They use normalized multi-scale features to ensure the student’s internal representation of the image is as close to the teacher's as possible.
  2. Source-Indexed Query Alignment: This is the "Aha!" moment. Instead of pairing queries by their rank (1st, 2nd, 3rd...), they pair them by their source index—the specific pixel location in the feature map where the query was born. If both models picked a proposal from the same spot, they get paired.
  3. Trajectory-Aligned Localization Distillation: Once paired, the student doesn't just look at the teacher's final answer. It follows the teacher's "trajectory"—the step-by-step refinement of the bounding box across all decoder layers.

Crucially, they include a Quality Gate. If the teacher is actually doing a worse job than the student on a specific object, or if they aren't even looking at the same ground-truth object, the supervision is skipped.

The TAED framework overview, showing how queries are aligned by source and refined through the decoder.

Datasets

The researchers evaluated TAED on the gold standard for object detection:

  • COCO (Common Objects in Context): Specifically the train2017 set for training and val2017 for evaluation.
  • Objects365: Used as a massive pre-training source for some of the stronger teacher models to see if a "smarter" teacher yields a better student (spoiler: it does).

Key Insights and Ideas

  • Spatial Origin is King: In DETRs, where a query comes from (its "source index") is a much more reliable anchor for distillation than its confidence rank.
  • Refinement is a Journey: Detection isn't a one-shot guess; it's an iterative process. By replacing the student's targets with the teacher's intermediate predictions (Layer-wise target replacement), the student learns the logic of how to refine a box, not just the final destination.
  • The Teacher Isn't Infallible: The "Quality Gate" acknowledges that even a great teacher can have "off" moments. Filtering for pairs where the teacher has a clear advantage (a higher IoU with the real object) prevents the student from learning the teacher's mistakes.

Key Results

TAED delivers impressive "free" gains across various DETR families:

  • DINO-R18: Jumped by 2.5 AP (Average Precision) on COCO.
  • Deformable DETR-R18: Improved by 1.7 AP.
  • Real-Time Efficiency: On cutting-edge models like D-FINE and ECDet, TAED narrowed the gap between compact models and their massive counterparts significantly. For example, an ECDet-M model distilled with TAED approached the performance of a much larger RT-DETRv4-L model while using far fewer parameters.

Qualitatively, the results are striking. In cases where a baseline student might completely "miss" a keyboard or draw a messy box around a tie, the TAED-distilled student produces tight, accurate boxes that mirror the teacher's precision.

Figure 3. Qualitative comparison. Predictions are shown for the D-FINE-X† teacher, D-FINE-L (DEIM) baseline, and TAED-distilled student. Dashed yellow boxes denote GT; solid boxes denote predictions. IoU is computed against the highlighted GT box.

Limitations and Future Work

The main constraint of TAED is that it requires the teacher and student to have compatible encoder feature layouts. Because the alignment relies on "source indices" (specific grid locations), you can't easily use a teacher with a completely different feature map resolution or architecture than the student.

The authors note that extending this native-query alignment to detectors with incompatible feature grids is the next frontier for this research.

Summary updated

Abstract

Distilling localization knowledge into compact detection transformers (DETRs) requires consistent teacher-student query correspondence across decoder layers. However, in DETRs with encoder-based query selection, the teacher and student select top-K proposals independently. Same-rank queries can originate from different spatial locations and correspond to different objects, making rank-based layer-wise supervision unreliable. To address this problem, we propose Trajectory-Aligned Encoder-Decoder Distillation (TAED), a framework for knowledge transfer between DETRs of different capacities. Encoder feature distillation matches normalized multi-scale features to strengthen student representations and increase the number of teacher-student query pairs from the same encoder locations. Source-indexed query alignment pairs native queries from the same encoder locations and retains pairs associated with the same object for which the teacher provides reliable and more accurate final localization than the student. Trajectory-aligned localization distillation maintains these correspondences and uses teacher proposals and corresponding decoder-layer box predictions to guide student refinement, without introducing additional queries. On COCO, TAED improves DINO-R18 and two-stage Deformable DETR-R18 by 2.5 and 1.7 AP, respectively. Further gains on D-FINE and ECDet demonstrate applicability to recent real-time DETRs at no additional inference cost.
BibTeX
@misc{he2026taed,
  author = {Zilong He and Zhangchi Hu and Hebei Li and Yijun Pan and Yifan Zhao and Xiangyu Yu and Yansong Peng and Xinghao Wang and Dongsheng Jiang and Xiaoyan Sun},
  title = {{TAED: Trajectory-Aligned Encoder--Decoder Distillation for Detection Transformers}},
  year = {2026},
  eprint = {2611.30326},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/2611.30326},
}
Figure