AI Dictionary of Terms

Self-Supervised Learning

A machine learning paradigm where models learn from unlabeled data by creating their own supervision signals through pretext tasks — the foundational training approach behind modern language models like BERT and GPT.

The Simple Version

Imagine learning a language by reading millions of books, with some words blacked out. Your task is to guess the missing words. You’re not being told the answers — you’re figuring them out from context.

That’s self-supervised learning. The model creates its own training labels from the data itself. For language models, common pretext tasks include:

Detailed Explanation

Self-supervised learning addresses the bottleneck of labeled data. Instead of requiring humans to label millions of examples, the model generates labels automatically from the structure of the data.

Key Pretext Tasks for Language:

1. Masked Language Modeling (MLM):

2. Causal Language Modeling (CLM):

3. Span Corruption:

Why It Works:

Self-Supervised vs. Other Paradigms:

Key Characteristics

Business Context

Self-supervised learning is the engine behind modern foundation models:

Strategic Importance:

Enterprise Applications:

Real-World Analogy

Learning to drive by watching millions of hours of driving videos. You’re not being told “this is a stop sign” or “this is a red light” — you’re figuring out the patterns yourself from the visual data. By the time you get behind the wheel, you have a deep understanding of driving dynamics.

Code Example

# Masked Language Modeling (BERT-style self-supervised learning)
from transformers import BertForMaskedLM, BertTokenizer

model = BertForMaskedLM.from_pretrained("bert-base-uncased")
tokenizer = BertTokenizer.from_pretrained("bert-base-uncased")

# Input with masked tokens
text = "The cat sat on the [MASK] and the dog chased the [MASK]."
inputs = tokenizer(text, return_tensors="pt")

# Model predicts masked tokens
outputs = model(**inputs)
logits = outputs.logits

# Find masked positions
mask_token_indices = (inputs.input_ids == tokenizer.mask_token_id).nonzero(as_tuple=True)

# Get predictions for each mask
for idx in mask_token_indices[1]:
    token_logits = logits[0, idx, :]
    predicted_token_id = token_logits.argmax().item()
    predicted_token = tokenizer.decode([predicted_token_id])
    print(f"Mask at position {idx}: {predicted_token}")
# Likely predictions: "mat", "cat"

Common Misconceptions

Sources & Further Reading