MLCrack

    DEEP LEARNING · INTERVIEW QUESTION

    What is domain adaptation? Compare different approaches.

    🔴 advanced · Training & Optimization

    Hint: Think about distribution shift between source and target domains.

    Answer

    Domain adaptation handles the case where training (source) and deployment (target) data distributions differ. Approaches:

    Interview reasoning

    1. Discrepancy-based: minimize domain discrepancy (MMD, CORAL — align feature distributions).

    2. Adversarial: domain-adversarial neural networks (DANN) — learn features that are discriminative for the task but invariant across domains. A domain classifier tries to distinguish domains; the feature extractor fools it.

    3. Self-training: train on source, pseudo-label confident target predictions, retrain.

    4. Few-shot domain adaptation: use a few target labels. Types by target labels: unsupervised DA (no target labels), semi-supervised DA (few target labels), fully supervised DA (many target labels). Real-world examples: adapting models from synthetic to real images, English NLP models to other languages, hospital A's medical data to hospital B.

    Domain adaptation targets a change between source and deployment data while preserving the task definition where possible. Reweighting assumes suitable support; feature alignment assumes aligning distributions does not erase task information; fine-tuning needs trustworthy target labels. Diagnose the type of shift before selecting a remedy.

    Worked example. A model trained on bright factory images faces dimmer new cameras; representative target-label fine-tuning can be compared with normalization and adaptation baselines.

    Validation

    Report source and target quality, held-out devices/time periods and ablations under equal target-label budgets.

    Common pitfalls

    Matching marginal representations can mix different classes and worsen performance. Unsupported target regions cannot be repaired by reweighting source data alone.