"You spent a week teaching me to embed the world with no labels. Now you want to know if I learned anything. Fair. Hand me twenty labels and stand back."
An Empirically Minded AI Agent
Prerequisites
This section closes the loop on the objectives built earlier in the chapter: contrastive learning (Section 17.2), masked reconstruction (Section 17.3), and the cross-device pretraining of Section 17.6. You should be comfortable with logistic regression and \(k\)-nearest-neighbors as classifiers, cosine similarity on unit vectors, and the metrics of Appendix F. Above all you need the subject-wise, leakage-safe splitting discipline from Chapter 5: every claim in this section is only as trustworthy as the split it was measured on.
The Big Picture
Pretraining produces a frozen encoder and a loss curve that went down. Neither tells you whether the representation is any good for the job you actually care about. Evaluation is where a self-supervised encoder earns its keep, and the field has settled on a small, sharp toolkit: freeze the encoder and fit a cheap classifier on top (a probe) to read out how linearly separable the learned features are; sweep the number of labels to draw a label-efficiency curve, the single most honest picture of what SSL bought you; and inspect the geometry of the embedding space directly with intrinsic metrics that need no labels at all. These three views answer three different questions: how usable is the representation, how much labeled data does it save, and has it quietly collapsed into a degenerate solution. Get the protocol right and you can compare objectives fairly. Get it wrong, usually by leaking a subject across the split, and you will ship an encoder that looks excellent in the notebook and fails on the next wrist it meets.
Linear probing: the standard readout
The canonical SSL evaluation freezes the pretrained encoder \(f_\theta\), discards the projection head used during pretraining, and trains a single linear layer (or a plain logistic regression) on top of the frozen embeddings using whatever labels you have. Accuracy of that linear probe is your headline number. The logic is deliberate: a linear readout cannot invent new features, so it measures whether the information a downstream task needs is already present and, crucially, linearly accessible in the frozen representation. If a two-line logistic regression separates activities from your embeddings, the encoder did the representational work; if it cannot, no amount of pretraining spin changes the verdict.
Why freeze rather than fine-tune for evaluation? Because fine-tuning entangles two things you want to measure separately: the quality of the pretrained features and the capacity of the network to adapt them. A mediocre representation can still reach high fine-tuned accuracy if the backbone is large and the labeled set is generous, which flatters a weak objective. The linear probe isolates the representation. In practice you report both: the linear-probe number for a clean comparison of objectives, and the fully fine-tuned number for the accuracy you would actually deploy. A large gap between them is diagnostic. It means the useful information is present but nonlinearly tangled, which is common for masked-reconstruction encoders and is exactly why Section 17.3 models often fine-tune better than they probe.
Key Insight
Linear-probe accuracy and fine-tune accuracy answer different questions, and their difference is itself a result. Contrastive objectives (Section 17.2) tend to produce linearly separable features, so they probe well and the gap is small. Masked-reconstruction objectives learn rich features that a linear head cannot fully unlock, so they probe worse but fine-tune well, and the gap is large. Reporting only one number hides which kind of encoder you have. Report both, and read the gap as "how nonlinear is the remaining work."
The label-efficiency curve: the number that matters
A single accuracy figure at one label budget is a snapshot; the story of self-supervision is a curve. Fix the frozen encoder, then fit the probe on \(m\) labeled examples per class for \(m \in \{1, 2, 5, 10, 20, 50, \dots\}\), and plot downstream accuracy against \(m\) on a log axis. Overlay the same curve for a randomly initialized encoder and for a fully supervised model trained from scratch on the same budgets. The vertical gap at small \(m\) is the payoff of pretraining, and the horizontal gap is even more interpretable: read off how many labels the pretrained encoder needs to match the from-scratch model's accuracy at, say, 100 labels per class. A good sensor SSL result looks like "the pretrained encoder reaches the supervised baseline's 200-label accuracy with 20 labels," a tenfold reduction in annotation cost.
This curve is the honest deliverable of Section 17.1's promise that labels are the bottleneck. It also exposes overclaiming: many objectives look identical at 500 labels per class, where everything saturates, and only separate in the 1-to-20 regime where the data is actually scarce. Always sweep down into the low-label regime; that is where SSL either delivers or does not.
import numpy as np
from sklearn.linear_model import LogisticRegression
from sklearn.metrics import accuracy_score
def label_efficiency_curve(Z_tr, y_tr, Z_te, y_te,
shots=(1, 2, 5, 10, 20, 50), seed=0):
"""Frozen embeddings in, accuracy-vs-labels curve out.
Z_* are L2-normalized encoder outputs; splits are SUBJECT-WISE."""
rng = np.random.default_rng(seed)
classes = np.unique(y_tr)
curve = []
for m in shots: # m labeled windows per class
idx = np.concatenate([
rng.choice(np.where(y_tr == c)[0], size=m, replace=False)
for c in classes])
clf = LogisticRegression(max_iter=2000, C=1.0)
clf.fit(Z_tr[idx], y_tr[idx]) # linear probe on m*|C| labels
acc = accuracy_score(y_te, clf.predict(Z_te))
curve.append((m, acc))
return curve
Z_tr and Z_te once, and the loop only refits a cheap linear head on progressively larger labeled subsets. The subjects in Z_te must never appear in Z_tr, or the curve lies. This is the measurement Lab 17 asks you to plot.The function above is the exact protocol behind Lab 17. Notice that the encoder runs once to produce embeddings; the expensive part of evaluation is therefore trivial, and you can afford to average every point over several random label draws to get error bars, which you should, because the 1-shot point in particular has enormous variance.
Right Tool: probing in a dozen lines, not a training loop
Written from scratch, a fair probe needs a frozen-forward pass, a per-shot subsampler, a classifier with regularization tuning, subject-grouped cross-validation, and averaged error bars: roughly 120 to 150 lines. With scikit-learn the whole thing collapses to LogisticRegression plus GroupKFold (for subject-wise folds) plus learning_curve, about 10 to 15 lines total, and scikit-learn handles the regularization path, the grouped splitting, and the averaging for you. For \(k\)-NN probing, KNeighborsClassifier(metric="cosine") replaces the entire nearest-neighbor bookkeeping. Reach for the library; spend your effort on getting the split right, which no library can do for you.
Label-free geometry: alignment, uniformity, and collapse
Sometimes you want to judge a representation before you have any labels at all, or diagnose why a probe underperforms. The embedding geometry itself carries signal. For contrastive encoders, Wang and Isola's decomposition gives two complementary intrinsic metrics on \(L2\)-normalized embeddings. Alignment measures how close positive pairs land:
$$\mathcal{L}_{\text{align}} = \mathbb{E}_{(x,x^{+})}\,\lVert f(x) - f(x^{+})\rVert^{2},$$
and uniformity measures how evenly embeddings spread over the hypersphere, penalizing clumping:
$$\mathcal{L}_{\text{unif}} = \log\,\mathbb{E}_{x,y}\,e^{-2\lVert f(x)-f(y)\rVert^{2}}.$$
A healthy encoder scores low on both: positives coincide (good alignment) yet the space is used fully (good uniformity). The pathology these metrics catch is dimensional collapse, where the encoder maps everything into a low-dimensional subspace or, in the worst case, a single point, because a degenerate constant embedding trivially minimizes a naive contrastive loss. You can quantify collapse directly by taking the singular values of the embedding covariance matrix and computing the effective rank or simply plotting the spectrum: a rapidly decaying spectrum with a handful of dominant directions signals collapse, even when the pretraining loss looks fine. This is the label-free early-warning system that a loss curve cannot provide, and it is why Section 17.5's relational objectives and negative-free methods invest so heavily in anti-collapse mechanisms.
Research Frontier: benchmarks and unified probes for sensor SSL
Sensor-time-series SSL long lacked the shared benchmark that ImageNet linear probing gave vision. That is changing. The MOMENT family ships a public "Time-Series Pile" and reports frozen-encoder probes across classification, imputation, and anomaly detection, and Google's Large Sensor Model (LSM) evaluates label-efficiency on population-scale wearable data. The current frontier is threefold: standardized subject-disjoint probing protocols so numbers are comparable across papers, intrinsic collapse metrics reported alongside accuracy so a good probe cannot hide a degenerate space, and probing under distribution shift rather than on held-out data from the same devices, which connects directly to Chapter 18 and the OOD evaluation of Chapter 66.
Probing fairly: the split is the experiment
Every metric above is meaningless without a leakage-safe split, and sensor data makes leakage unusually easy. If windows from one person land in both the probe-training and test sets, the probe can recognize the person rather than the activity, and your accuracy inflates by tens of points for reasons that will not survive contact with a new user. The rule is subject-wise (or device-wise) grouping: hold out whole subjects, never individual windows, using GroupKFold with the subject id as the group. The same discipline applies to the time axis; adjacent overlapping windows are near-duplicates, so a random split leaks a window's near-twin into test. This is the running leakage-safe thread of the book (Chapter 5), and it bites hardest exactly here, because a strong pretrained encoder is also a strong identity encoder and will happily exploit the shortcut you left open.
Beyond linear probing, two more readouts round out a fair evaluation. \(k\)-NN probing classifies a test embedding by the majority label of its nearest neighbors under cosine distance; it has zero trainable parameters, so it measures the raw geometry with no fitting at all and cannot overfit a small label set. Clustering purity, obtained by \(k\)-means on the embeddings and comparing clusters to true labels via normalized mutual information, tells you whether the classes are separated in the space even before any supervision. And to compare two encoders' internal representations (say, a contrastive and a masked model, or two layers of one model), centered kernel alignment (CKA) gives a single similarity score between representation matrices; it is the standard tool for asking "did these two objectives learn the same thing" and it appears again in the interpretability toolkit of Chapter 67.
Practical Example: a wrist tremor monitor that probed beautifully and failed the clinic
A clinical wearables team pretrained a contrastive encoder on 4,000 hours of unlabeled accelerometer data from a Parkinson's cohort, then linear-probed it to detect resting tremor. The probe hit 94 percent accuracy and the label-efficiency curve looked spectacular: 15 labeled minutes per patient matched the from-scratch model's several hours. They almost shipped it. A skeptical reviewer re-ran the probe with subject-wise GroupKFold instead of the original random split, and accuracy fell to 79 percent. The encoder had partly memorized per-patient movement idiosyncrasy, wristband fit, dominant hand, resting posture, and the random split let the probe read those out as a shortcut. Two fixes recovered a trustworthy 88 percent: strict patient-disjoint splitting, and adding an intrinsic collapse check that flagged the embedding spectrum as healthily full-rank so they knew the drop was leakage, not a degenerate space. The lesson is that the label-efficiency curve was never wrong about the objective; it was wrong about the split. The measurement, not the model, needed fixing.
Exercise
Take a contrastive encoder from Section 17.2 and a masked-reconstruction encoder from Section 17.3, both frozen. (1) Compute linear-probe and fine-tune accuracy for each and report the two gaps; predict, before running, which objective has the larger linear-to-fine-tune gap and explain why. (2) Plot both label-efficiency curves on the same axes with subject-wise folds and 5-seed error bars. (3) For each encoder, plot the singular-value spectrum of the embedding covariance and state whether either shows dimensional collapse. Which encoder would you deploy for a 30-label-per-class activity task, and does your answer depend on the label budget?
Self-Check
- Why does the community prefer a linear probe over a multilayer probe as the standard SSL benchmark, and what would a two-layer MLP probe measure instead?
- An encoder has excellent linear-probe accuracy but its embedding covariance spectrum is dominated by three singular values. Is anything wrong, and what would you check next?
- You random-split windows for probing and get 96 percent; subject-wise splitting gives 81 percent. Which number do you report to a customer, and what does the 15-point gap tell you about what the encoder learned?
Lab 17
pretrain a contrastive/masked encoder on unlabeled sensor windows; fine-tune with few labels and measure the label-efficiency curve.
Bibliography
Probing protocols and representation geometry
Defines the alignment and uniformity metrics used in this section; the foundational label-free lens for judging contrastive embeddings and detecting collapse.
Established the frozen-encoder linear-probe protocol as the standard SSL benchmark, along with the fine-tune-vs-probe comparison this section builds on.
Introduces centered kernel alignment for comparing internal representations across models and layers; the tool for asking whether two objectives learned the same thing.
Collapse and negative-free evaluation
Explains and diagnoses dimensional collapse via the embedding covariance spectrum, the label-free early-warning check recommended here.
A negative-free objective whose design and evaluation center on decorrelating embedding dimensions to prevent collapse; useful context for the geometry metrics.
Sensor and time-series self-supervised benchmarks
Ships a public time-series corpus and reports frozen-encoder probes across classification, imputation, and anomaly detection; a reference protocol for fair sensor-SSL evaluation.
Evaluates label-efficiency and transfer of a wearable-sensor SSL model at population scale; the modern instantiation of the label-efficiency-curve argument in this section.
A widely used sensor-SSL baseline whose evaluation reports linear-probe and few-label fine-tuning on activity and biosignal data, matching the protocol taught here.
Demonstrates how random versus subject-wise splitting changes reported accuracy in wearable HAR; the empirical backbone for this section's leakage warning.
What's Next
In Chapter 18, we take the frozen encoder you have now learned to trust and ask a harder question than "is it accurate": is it honest about what it does not know. Probing tells you the representation is usable; calibration and conformal prediction tell you when to believe a specific prediction it makes, how to attach guaranteed coverage to that belief, and when the safest output is to abstain. A label-efficient encoder that cannot flag its own uncertainty is not yet deployable, and that is the gap the next chapter closes.