CAST logo

CAST: Training a Student Expert via
Semi-Supervised Foundation Model Distillation

1 Texas A&M University
*Corresponding author
CVPR 2026 Workshop·Open Access

Headline Results

A ~11× smaller student that surpasses its adapted VFM teacher on instance segmentation.

+11.9
maskAP over zero-shot VFM teacher
Cityscapes
+8.6
maskAP over zero-shot VFM teacher
ADE20K
+3.4
maskAP over adapted teacher
Cityscapes (10% labels)
11×
smaller than the 568M-parameter
composite VFM teacher

TL;DR

CAST is a three-stage semi-supervised knowledge distillation framework that compresses large pre-trained vision foundation models (Grounding-DINO + SAM2, 568M params) into a compact 52M-parameter student expert (DINOv2-S + DPT-S + Mask2Former-style decoder) for instance segmentation.

The pipeline runs Teacher Adaptation → Knowledge Transfer → Student Refinement, with an instance-aware pixel-wise contrastive loss that fuses mask and class predictions to mine hard negatives — enforcing sharp inter-instance margins even when only 5–10% of pixels are labeled.

The result: a ~11× smaller student that beats its adapted teacher by +3.4 / +1.5 maskAP on Cityscapes / ADE20K, and runs 4.6× faster at ~3× lower latency.

CAST three-stage framework overview

The CAST pipeline: adapt the VFM teacher, distill a compact student, then refine on labels to remove residual pseudo-label bias.

Overview

Vision foundation models (VFMs) such as Grounding-DINO, SAM2, and DINOv2 deliver strong open-set recognition, but their scale — and their generic pre-training — make them costly to deploy and sub-optimal on specialized downstream tasks like instance segmentation under tight label budgets.

We address this with a stage-wise SSKD pipeline built on two ideas:

  1. Contrastive Calibration. We adapt the VFM teacher via self-training, but inject a pixel-wise contrastive head that sharpens mask boundaries — not just pseudo-labels.
  2. Debiased, Instance-Aware Sampling. During both adaptation and distillation, we mine hard negatives through a joint mask-/class-probability embedding, focusing repulsion on informative inter-instance pairs.

The two ideas compose into three concise stages:

1Teacher Adaptation

Adapt the VFM (Grounding-DINO + SAM2) to the target domain using labels, pseudo-labels, and pixel-wise contrastive regularization. Lsup + Lsemi + Lpxl.

2Knowledge Transfer

Freeze the adapted teacher and distill into a 52M student (DINOv2-S + DPT-S + Mask2Former-style decoder) using a unified objective over labeled and unlabeled data.

3Student Refinement

Fine-tune the student on labeled data only to correct residual bias from the pseudo-labels — sharpens decision boundaries for the target domain.

A key insight: the same contrastive objective is maintained across both teacher adaptation and student distillation, aligning teacher and student embeddings in a shared instance-aware feature space.

Method: Instance-Aware Pixel-Wise Contrastive Loss

Standard supervised and pseudo-label losses enforce correct masks, but do not explicitly model pixel-level feature relationships. We add a NT-Xent contrastive loss on weak/strong augmented views to better exploit both labeled and unlabeled images.

Pixel-wise contrastive loss

For an anchor pixel (b, p), the positive pair is the same spatial location in the other view; negatives are R hard-negative pixels sampled by our instance-aware sampler:

Lpxl = − (1/BN) Σb,p log   exp(s+b,p) / [ exp(s+b,p) + Σr exp(sb,p,r) ]

Debiased, instance-aware negative sampling

We construct a per-pixel sampling distribution by fusing mask and class predictions into a joint pseudo-probability embedding y[b,p] = [Pm[b, 1:K, p]  |  Fc[b, p, 1:C+1]], where Fc[b,p,c] = Σk Pm[b,k,p] Pc[b,k,c] is the expected class distribution at the pixel.

The dissimilarity score sdeb((b,p),(b′,q)) = max(0, 1 − ⟨ỹ[b,p], ỹ[b′,q]⟩) is large when two pixels likely belong to different instances — precisely the pairs that should be repelled. For each anchor we then sample R negatives proportionally to sdeb.

Theoretical insight

Under a mild negative-sampling guarantee that the probability a sampled negative is a true inter-instance pixel satisfies p > 0.5:

Proposition 3.1 (Expected Margin Growth). One gradient update on Lpxl increases the expected inter-instance margin Δemp by ε = Θ(p · λpxl) > 0.

This expectation holds even when pseudo-labels are imperfect, provided negatives are sampled by our instance-aware strategy. Empirically we observe p > 0.9 and an approximately linear increase of Δemp with λpxl.

Empirical Validation

We monitor the empirical margin Δemp = NegMean − PosMean and the false-negative rate (FNR, where p = 1 − FNR) every 10k iterations on Cityscapes. The negative-sampling guarantee is satisfied with a wide margin: p > 0.9 throughout training, and the margin grows approximately linearly with λpxl — consistent with Proposition 3.1.

Empirical margin, FNR, and contrastive loss over training iterations
Figure 3. Empirical margin, FNR, and contrastive loss over training iterations.

Unified Training Framework

Teacher adaptation, student distillation, and student refinement are special cases of a single unified objective:

J(θ; Dl, Du; λsemi, λpxl) = Lsup(Dl) + λsemi · Lsemi(Du) + λpxl · Lpxl(Dl ∪ Du)

Where Lsup enforces ground-truth supervision on labeled data, Lsemi transfers pseudo-label knowledge on unlabeled data, and Lpxl imposes pixel-wise contrastive regularization across both sets. The coefficients λsemi and λpxl balance these signals and turn on/off between stages.

Teacher adaptation — two stages

  1. Fine-tune pretrained VFM weights θT0 on labeled data only — with contrastive regularization: θT′ = argminθ J(θ; Dl, ∅; 0, λpxl).
  2. Generate pseudo-labels ŷju = fθ′T(xju) on unlabeled data, then re-initialize from θT0 and train on both labeled and pseudo-labeled data: θT″ = argminθ J(θ; Dl, Du; 1, λpxl).

This two-stage procedure yields a teacher that is better aligned with the target domain and produces pseudo-labels that are both more accurate and more spatially consistent.

Knowledge transfer

With the adapted teacher θT frozen, we train the student on the same unified objective: θs* = argminθs J(θs; Dl, Du; λsemi, λpxl). The contrastive signal continues to align teacher and student embeddings throughout distillation.

Student refinement

Finally, fine-tune the student on labeled data only to reduce residual pseudo-label bias and sharpen decision boundaries: θs† = argminθ J(θ; Dl, ∅; 0, 0), initialized from θs*.

Main Results

We evaluate on Cityscapes and ADE20K with 10% labeled data. The teacher is a fused Grounding-DINO-Large + SAM2-L ensemble (568M params); the student is DINOv2-S + DPT-S + Mask2Former-style decoder (52M params, ≈9% of the teacher).

Table 1. Main results on Cityscapes and ADE20K (10% labels). * = adapted methods. Blue: best / second-best. Teacher: 568M. Student: 52M.
Method Data Regime Cityscapes ADE20K
maskAP maskAP50 maskAP maskAP50
Teacher Adaptation (568M)
Zero-shot VFMNone (pretrained)22.042.38.118.2
Supervised fine-tuningLabeled only28.753.414.223.5
Self-training*Labeled+Unlabeled29.754.914.623.6
Unbiased Teacher*Labeled+Unlabeled29.854.914.823.7
CAST (ours)Labeled+Unlabeled30.556.615.224.5
Student Distillation (52M)
Supervised fine-tuningLabeled only21.138.713.924.2
PAISLabeled+Unlabeled22.944.910.318.3
Guided distillationLabeled+Unlabeled30.852.914.223.8
Vemulapalli et al.*Unlabeled only24.445.65.19.3
Depth-GuidedLabeled+Unlabeled30.952.9
S4MLabeled+Unlabeled33.356.7
CAST (knowledge transfer)Labeled+Unlabeled32.256.516.127.4
CAST (student refinement)Labeled only33.958.716.728.0

The refined CAST student achieves the best maskAP on both datasets while being roughly 11× smaller than the composite VFM teacher. The teacher-adaptation variant also tops every baseline, suggesting pixel-wise contrastive regularization improves pseudo-label quality and feature discrimination.

Efficiency at a Glance

The CAST student is not only more accurate — it is dramatically more efficient. 90.8% fewer parameters, 77.3% lower FLOPs, 78.1% lower latency, and 4.6× higher FPS on the same hardware.

Efficiency comparison (log scale)
Figure 2. Efficiency comparison (log scale).
−90.8%
Parameters
568M → 52M
−77.3%
FLOPs
880G → 200G
−78.1%
Latency
350.87 ms → 76.92 ms
4.56×
FPS speedup
2.85 → 13.0
Performance-complexity radar chart
Figure 7. CAST variants — accuracy vs. efficiency radar (normalized).

Ablation Studies

Loss components

Pseudo-label supervision (Lsemi) and pixel-wise contrastive regularization (Lpxl) are complementary: adding both yields the best student (32.2 maskAP on Cityscapes, +11.1 over supervised-only).

Table 2. Effect of loss terms on Cityscapes (10% labels).
Method Lsup Lsemi Lpxl Teacher Student
(a) Sup. only28.721.1
(b) + Pseudo29.730.7
(c) + Pixel loss29.627.5
(d) (b)+(c) — CAST30.532.2

Training stages

All three stages are necessary. Removing teacher adaptation costs −8.2 maskAP; removing student refinement costs −1.7; removing distillation entirely costs −12.8.

Table 3. Effect of training stages on Cityscapes (10% labels).
Variant Teacher Adapt. Distill. Student FT maskAP
Full pipeline33.9
No student FT32.2
No teacher adapt.25.7
Distillation only23.8
No distill. (Sup.)21.1

Negative-sampling strategy

Fusing mask and class predictions for negative sampling outperforms either cue alone — confirming that the two sources of information are complementary for identifying informative inter-instance negatives.

Table 4. Ablation of negative-sampling strategies on Cityscapes.
Method maskAP (%) maskAP50 (%)
Uniform29.450.2
Mask-Only30.655.0
Class-Only31.155.3
Fusion (CAST)32.256.5

Student architecture

DINOv2-S encoder + DPT decoder head offers the best accuracy/efficiency trade-off among the backbones and heads evaluated.

Table 5. Student architecture ablation on Cityscapes. Top: encoder (fixed DPT decoder). Bottom: decoder (fixed DINOv2-S encoder).
EncodermaskAPmaskAP50Params (M)
ResNet5025.549.324
SAM2-S22.139.235
DINOv2-S30.754.922
DecodermaskAPmaskAP50Params (M)
FPN28.952.418
DPT30.754.922

Scalability with label budget

CAST consistently outperforms prior SSKD baselines across all label fractions on Cityscapes. At 5% labels it achieves 30.7 maskAP — substantially above PAIS (18.0) and Guided Distillation (23.0). At 30% labels it reaches 40.4 maskAP, beating the strongest baseline (S4M, 37.8) by +2.6 maskAP.

Table 6. Scalability across label fractions on Cityscapes.
Fraction Teacher Adapt. Distillation CAST (refined) PAIS Guided dist. S4M
5%29.429.230.718.023.030.1
10%30.532.233.922.930.833.3
30%33.338.540.432.835.637.8

Conclusion

We presented CAST, a semi-supervised knowledge distillation pipeline that combines self-training, instance-aware pixel-wise contrastive learning, and supervised refinement to transfer knowledge from large vision foundation models into compact student experts.

The resulting student is ~11× smaller than the teacher while surpassing the adapted teacher by +3.4 maskAP on Cityscapes and +1.5 maskAP on ADE20K. The instance-aware negative-sampling scheme has a theoretical guarantee on the expected inter-instance margin (Proposition 3.1) and is empirically validated with p > 0.9 throughout training.

Future work includes simplifying the multi-stage pipeline, evaluating on additional domains (medical, remote sensing), and extending the framework to broader efficient perception settings — including open-vocabulary and video scenarios.

BibTeX

@InProceedings{Taghavi_2026_CVPR,
    author    = {Taghavi, Pardis and Liu, Tian and Li, Renjie and Langari, Reza and Tu, Zhengzhong},
    title     = {Training a Student Expert via Semi-Supervised Foundation Model Distillation},
    booktitle = {Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition (CVPR) Workshops},
    month     = {June},
    year      = {2026},
    pages     = {3620-3630}
}

Acknowledgments

Portions of this research were conducted with the advanced computing resources provided by Texas A&M High Performance Research Computing. We thank the Grounding-DINO, SAM2, DINOv2, and DPT teams for releasing their models and code.

× Enlarged figure