4.3 Supervised and Unsupervised Paradigms
Fundamental Learning Paradigms in LLM Development
Understanding the core differences between supervised and unsupervised learning is essential for building effective language models. These paradigms form the foundation of modern LLM architectures and training strategies.
Supervised Learning: Learning with Guidance
Mathematical Foundation
Supervised learning aims to learn a mapping function f: X → Y from labeled training data:
The goal is to minimize the empirical risk:
Where L is the loss function measuring prediction error.
Key Characteristics for LLMs
Explicit Target Labels
Every input has a corresponding target output
Direct Error Feedback
Can compute exact loss between prediction and target
Task-Specific Performance
Optimized for specific downstream tasks
Data Efficiency
Can achieve good performance with less data
LLM Applications of Supervised Learning
Instruction Following
Training models to follow human instructions accurately.
Input (Instruction)
"Write a Python function to calculate factorial"
Target Output
def factorial(n):
if n <= 1:
return 1
return n * factorial(n-1)
Loss Calculation
Question Answering
Training models to extract or generate answers from context.
Context
The transformer architecture was introduced in the paper "Attention Is All You Need" by Vaswani et al. in 2017. It revolutionized natural language processing by relying entirely on attention mechanisms.
Question
When was the transformer architecture introduced?
Answer
Target: 2017
Span: [token_start: 23, token_end: 23]
Text Classification
Categorizing text into predefined classes.
Interactive Sentiment Classifier
Classification Results
Unsupervised Learning: Discovering Hidden Patterns
Mathematical Foundation
Unsupervised learning discovers hidden structure in data without explicit labels:
Common objectives include maximizing likelihood or minimizing reconstruction error:
Key Characteristics for LLMs
No Explicit Labels
Learning from raw, unlabeled text data
Self-Supervised Signals
Creates training signal from data structure
Representation Learning
Learns general-purpose representations
Massive Scale
Can leverage unlimited unlabeled data
Unsupervised Objectives in LLMs
{{obj.name}}
{{obj.description}}
Language Modeling Objective
Input Sequence: "The quick brown fox"
Training:
Masked Language Modeling
Original: "The transformer architecture is powerful"
Masked: "The [MASK] architecture is [MASK]"
Targets: "transformer", "powerful"
Interactive Masking
Masked:
Contrastive Learning
Learn representations by distinguishing similar and dissimilar examples.
Positive Pair (Similar)
"The cat sat on the mat"
"A cat was sitting on a mat"
Negative Pair (Dissimilar)
"The cat sat on the mat"
"Quantum physics explains particle behavior"
Paradigm Comparison Analysis
{{getCurrentMetric().name}}
{{getCurrentMetric().explanation}}
Practical Trade-offs in LLM Development
| Aspect | Supervised Learning | Unsupervised Learning | LLM Strategy |
|---|---|---|---|
| {{tradeoff.aspect}} | {{tradeoff.supervised}} | {{tradeoff.unsupervised}} | {{tradeoff.llm_strategy}} |
Hybrid Approaches: Best of Both Worlds
Modern LLM Training Pipeline
{{stage.name}}
Paradigm: {{stage.paradigm}}
{{stage.description}}
Future Directions
Few-Shot Learning
Combining small amounts of labeled data with large unsupervised pre-training for rapid task adaptation.
Multi-Modal Learning
Extending paradigms to include vision, audio, and other modalities alongside text.
Continual Learning
Combining supervised and unsupervised signals for continuous model improvement without forgetting.