Self-supervised learning на собеседовании Data Scientist
Карьерник — Duolingo для аналитиков: 10 минут в день тренируй SQL, Python, A/B, статистику, метрики и ещё 3 темы собеса. 1500+ вопросов в Telegram-боте. Бесплатно.
Содержание:
Зачем SSL
Labeled data дорогостоящие. SSL — учим representations на huge unlabeled corpora, потом fine-tune на small labeled.
Major successes:
- BERT — masked LM на text (миллиарды tokens).
- GPT — next token prediction.
- CLIP — text-image pairs (web-scale).
- SAM — image segmentation pre-train.
Pretext tasks
Synthetic tasks из data itself.
NLP examples:
- Masked LM (BERT). Predict missing word.
- Next sentence prediction (BERT, deprecated).
- Causal LM (GPT). Predict next token.
CV examples:
- Rotation prediction (which angle).
- Jigsaw puzzle.
- Colorization.
- Inpainting.
Современные methods обходят простые pretext tasks через contrastive / masked.
Contrastive
Idea. Same object — close в embedding space. Different — far.
SimCLR (2020).
- Take image x.
- Make 2 augmented views: x', x''.
- Encoder + projection head → embeddings.
- InfoNCE loss — same pair close, others far.
L = -log( exp(sim(x', x'')/τ) / Σ_other exp(sim(x', x_neg)/τ) )MoCo (2020). Memory bank для negatives — позволяет large batch effective без actual large batch memory.
Masked autoencoders
MAE (Masked Autoencoder, He 2022). Random mask 75% patches image. Encoder sees only visible patches. Decoder reconstructs masked.
Pros: simple, scales hugely. SOTA на ImageNet.
В NLP — это и есть BERT-style.
BYOL и DINO
BYOL (Bootstrap Your Own Latent). Без negative pairs.
Online network learns to predict target network output.
Target network — slow EMA copy of online.Surprising что работает (нет contrastive negatives), но empirical fact.
DINO. Self-distillation. Student matches teacher (EMA momentum). Self-attention учится attention maps без supervision — emergent semantic segmentation.
Применения
Foundation models. BERT, GPT, CLIP, DINO — все trained SSL на huge data.
Fine-tuning. Pretrain SSL → fine-tune на small labeled.
Few-shot learning. SSL representations enable learning from few examples.
Anomaly detection. Train SSL на normal, anomalies — high reconstruction error.
В практике — почти все production ML начинаются с pre-trained SSL backbone.
Связанные темы
- BERT vs GPT для DS
- Active learning для DS
- CLIP multimodal для DS
- CNN-архитектуры для DS
- Подготовка к собесу Data Scientist
FAQ
Это официальная информация?
Нет. Статья основана на работах Chen 2020 (SimCLR), He 2020 (MoCo), He 2022 (MAE).
Тренируйте Data Science — откройте тренажёр с 1500+ вопросами для собесов.