← Back to Autonomy

Agentic AI Notes / Field guide / The pair

One inequality,
two regimes

Generalization and transfer are the same statement about error, separated by a single term: how different the new world is from the old one.

The unifying view

Slide the worlds apart

Generalization asks about new examples from the same world. Transfer asks about a different world and pays a price for the distance. Drag the worlds apart below and watch the bound grow the extra terms.

errornew ≤ errorold + ½ divergence + λ
Interactive · distance between worlds
source target
divergence d
0.00
regime
Generalization

At zero distance the divergence and joint terms vanish and you are left with the generalization bound: same world, new samples. Push the slider and the divergence term switches on, then the joint term \(\lambda\) starts to matter once the underlying rule itself may differ.

The middle ground

Where domain generalization lives

Between the two pages sits a third case: several related source worlds and a target you cannot see during training. You are not just generalizing within one world, and you cannot adapt to the target because it is not available yet. The move is to learn what is invariant across the source worlds, on the bet that a pattern stable across all of them is real structure rather than a per-world artifact.

The worked version, training a fault detector on three motor platforms and deploying on an unseen fourth, with leave-one-platform-out validation, lives on the transfer page.

Field guide

Transfer or train fresh?

Four gates, in order. Stop at the first one that decides the matter.

Do you already have plenty of labeled target data? yes Train or fine-tune directly on it. Transfer theory is moot. no Continue.
Is a related, well-labeled source world available? no Collect data or pretrain with self-supervision first. yes Continue.
Could one model plausibly do well in both worlds (small joint term λ)? no Transfer will not save you. Get a few target labels and rethink features. yes Continue.
Is the divergence between source and target large? yes Align features (adversarial, CORAL, or optimal transport), then transfer. no Fine-tune directly. It will most likely carry.

Field guide

Diagnose the failure

Match the symptom to the term that is biting.

Great on source, poor on target even after training.
divergence The worlds are too far apart. Align features and re-measure the A-distance.
Confident false alarms appear after alignment.
negative transfer The labels mean different things across worlds. Align by class and add a few target labels.
No model reaches good accuracy on both worlds at once.
joint term λ The underlying rule differs. Revisit features and labels; transfer cannot bridge it.
Great offline, poor on a brand-new unit of the same world.
generalization, not transfer A cross-validation leak. Split by unit, not by row.

Reference

Notation key

R(h), R̂(h)
True risk and measured (empirical) risk of a model h.
n(H)
Rademacher complexity: how well the model class fits pure noise.
dVC
VC dimension, a combinatorial measure of class capacity.
KL(Q∥P)
How far the learned solution moved from a data-independent prior (PAC-Bayes).
β
Algorithmic stability: how much one swapped training point changes the output.
I(S;h)
Mutual information between training set and model; memorization as leakage.
εS, εT
Error in the source world and the target world.
dHΔH
Divergence between source and target, measured through the model class.
λ
Best joint error: how well any single model could do in both worlds at once.
n / M
Sample size. M is the count of truly independent units, not rows.

The agentic lens

Why both matter for agents

An agent that has learned a skill faces both questions constantly. Generalization is whether its policy holds up on tasks it was not explicitly tuned on, drawn from the same kind of work. The honest test is to hold out whole task families, the agentic version of leaving out whole vehicles, rather than scoring on the very traces it was shaped by.

Transfer is what happens the moment the agent meets a new tool, API, or environment. In-context examples are fast transfer; turning a base model into a specialist is slow transfer. When a clearly capable agent stumbles on an unfamiliar tool, the three-term rule says to suspect the divergence between the new environment and the old, not the agent's raw ability.

One sentence to keep

The quantity that decides success in both regimes is the same: effective independent evidence relative to how far you have moved, across samples for generalization, across worlds for transfer.

The pair

Read the two monographs