zero shot learning
**Zero-Shot Learning (ZSL)** is the **ability to recognize or perform tasks on classes or scenarios not seen during training** — by leveraging semantic descriptions, attributes, or language embeddings that connect seen and unseen categories.
**Classical Zero-Shot Learning**
- Seen classes: Trained with labeled examples.
- Unseen classes: No training examples — described only by attributes or text.
- Example: Model trained on horses and zebras + knows "a tiger is a large striped feline" → recognizes tigers.
- Semantic space: Attribute vectors (striped, 4-legged, carnivore) or word embeddings link visual and semantic information.
**How ZSL Works**
1. Train visual-semantic embedding: Map images to semantic space.
2. Unseen class defined by semantic description (attributes or text embedding).
3. Inference: Nearest-neighbor in semantic space → predicted class.
**ZSL in Modern LLMs (In-Context Learning)**
- GPT-style zero-shot: "Classify this email as spam or not-spam: [email]"
- No fine-tuning, no examples — just task description.
- CLIP zero-shot classification: Match image embedding to text "a photo of a [class]" embeddings.
- Tested on 27 datasets — competitive with supervised baselines on many.
**Generalized ZSL (GZSL)**
- Standard ZSL: Test only on unseen classes.
- GZSL: Test on seen + unseen classes — more realistic but harder.
- Problem: Model bias toward seen classes — predicts seen class even when unseen is correct.
- Solution: Calibrated stacking, class-balanced sampling.
**Few-Shot vs. Zero-Shot**
| Aspect | Zero-Shot | Few-Shot |
|--------|-----------|----------|
| Examples | None | K examples (K=1,5,10) |
| Difficulty | Harder | Easier |
| Flexibility | Maximum | Less flexible |
| Use case | Novel domains | Quick adaptation |
**Transfer Learning Context**
- Foundation models enable broad zero-shot: GPT-4, Claude, Gemini answer arbitrary questions.
- Emergent ZSL: Appears to emerge from scale — small models can't zero-shot; large ones can.
Zero-shot learning is **a benchmark for true generalization** — models that can correctly handle descriptions of things they've never seen demonstrate conceptual understanding rather than pattern memorization, representing a key threshold in AI capability.