Lecture L6

Ablation Study — what does each piece of the model actually do?

An ablation study answers the question: 'If I take this part out, does the model get worse?' It is the cleanest way to prove which design choices matter. This lecture walks through ours, chart by chart, in plain English.

What-if analysisControlled experimentMacro-F1Per-class metricsComponent removalReproducibility
1

What is an ablation study?

Plain English first.

Imagine you bake a cake with flour, sugar, eggs, butter, and vanilla. You want to know which ingredient matters most. You bake five cakes: the full recipe, and four variants — each one with exactly one ingredient removed. You taste them and rank the results. The ingredient whose removal ruins the cake the most is the most important.

An ablation study in deep learning is exactly the same idea: train the model many times, each time removing or replacing one component (a skip connection, the focal loss, the Siamese pre-image branch…). Compare scores. The biggest drop reveals the most important component. The word "ablation" literally means "removal".

An ablation = remove one piece at a time, measure the dropFull modelEncoderSkipFocalDiceF1 = 0.71− Skip connectionsEncoderFocalDiceF1 = 0.58− Focal lossEncoderSkipDiceF1 = 0.49− Dice lossEncoderSkipFocalF1 = 0.62The piece whose removal causes the biggest drop is the most important component.
Step 1 — Pick a baseline. The full model with every component in place.
Step 2 — Remove one piece. Keep everything else identical (same data, same training, same seed).
Step 3 — Re-train and re-score. Compare the drop in metric to rank importance.
Why this matters
Without an ablation, we cannot claim a design choice is "necessary" — we can only say the model works. Ablations turn engineering intuition into evidence.
2

The experimental setup

Same data, same training, only one thing changes per run.

SettingValueWhy fixed
DatasetxBD (train / val / hold-out test)Identical evaluation across all runs
Image size1024 × 1024 patches → 224 × 224Match the encoder's pre-trained input
OptimiserAdamW, lr = 1e-4, cosine scheduleSame for every variant — fair comparison
Epochs60 with early stoppingLong enough to converge, short enough to repeat
Loss (baseline)Focal(γ=2) + Dice + class weightsEach ablation removes ONE term
Random seedFixed (42)Reproducible — different runs are not just noise
MetricMacro-F1 over 4 damage classesTreats rare classes equally to the common one

The golden rule. Only one thing changes between two runs. If you change two things at once (e.g. remove skip and drop focal loss), you can no longer tell which change caused the drop.

3

Figure A — Which architecture wins overall?

Macro-F1 on the held-out test set.

Macro-F1 on xBD test set (higher = better)0.000.250.500.751.000.62ResNet-50U-Net0.66ViT-B/16U-Net0.71SiameseResNet-500.74SiameseViT-B/16Macro-F1

How to read it. Four bars, four architectures. The taller the bar, the better the model.

  • ResNet-50 U-Net (0.62) — a strong CNN baseline. Good at local texture, weaker on global context.
  • ViT-B/16 U-Net (0.66) — replacing the CNN encoder with a Vision Transformer adds long-range attention; +0.04 over ResNet.
  • Siamese ResNet-50 (0.71) — feeding pre- AND post-disaster images through twin ResNets gives the network a "before vs after" view; +0.09 over the same encoder alone.
  • Siamese ViT-B/16 (0.74) — the best of both: global attention + change detection. Winner.

Take-away. Both ideas help independently and they stack — Siamese alone adds ~0.09, ViT alone adds ~0.04, doing both adds 0.12 (= 0.74 − 0.62).

4

Figure B — Where do the gains actually come from?

Per-class F1 — the average can hide the rare classes.

Per-class F1 — where do the gains actually come from?0.000.250.500.751.000.860.880.890.91No damage0.310.380.460.51Minor0.420.490.580.62Major0.690.740.810.84DestroyedResNet-50 U-NetViT-B/16 U-NetSiamese ResNet-50Siamese ViT-B/16

How to read it. Each cluster of 4 bars is one damage class. The 4 colours are the 4 architectures.

  • No-damage bars are all tall (~0.86–0.91). Every model handles the easy class well.
  • Minor damage is by far the hardest (0.31 → 0.51). Going from ResNet-only to Siamese ViT improves it by +0.20 — a 65% relative gain.
  • Destroyed bars are high (0.69 → 0.84). Visually obvious in satellite imagery, so easier even for weaker models.
Why this chart matters
The overall bar chart (Figure A) hides the fact that the gains concentrate on the rare, hard classes. This is exactly what we hoped for when we added Focal Loss and Siamese pre/post comparison — and the per-class chart proves it.
5

Figure C — Component ablation: pull out one piece, see what breaks

Holding the architecture fixed (Siamese ViT), what does each component contribute?

Component ablation — remove one piece, measure Macro-F10.000.250.500.751.00Full model (baseline)0.74− Skip connections0.61Δ -0.13− Focal loss (CE instead)0.55Δ -0.19− Dice loss0.68Δ -0.06− Class weights0.59Δ -0.15− Siamese (single image)0.52Δ -0.22− Deep supervision0.70Δ -0.04Macro-F1 →

How to read it. The top green bar is the full baseline. Every bar below it has one component removed; the number on the right (Δ) shows how much Macro-F1 fell.

Removed componentF1ΔPlain-English interpretation
— (baseline)0.74Everything in place.
Siamese (single image)0.52−0.22Biggest drop. Comparing pre vs post is the single most important idea — without it the network has to guess what was there before.
Focal loss → plain CE0.55−0.19Almost as bad. Without focal, easy background pixels dominate the loss and rare damage classes get ignored.
Class weights0.59−0.15Removes the per-class rebalancing — Minor damage collapses to near-zero recall.
Skip connections0.61−0.13Decoder can no longer recover sharp building boundaries → blurry masks.
Dice loss0.68−0.06Smaller drop. Dice mainly improves boundary quality; CE+focal already gets the classification right.
Deep supervision0.70−0.04Smallest drop — speeds up training and helps a little, but the model still works without it.
6

What you should take away

Three lessons from the ablation.

  1. Ranking importance. For this problem the importance order is: Siamese > Focal > Class weights > Skip connections > Dice > Deep supervision. Knowing this order tells future engineers which knobs to protect when they simplify the model for deployment.
  2. Look at per-class metrics. Macro-F1 is a single number that already weighs classes equally, but the per-class chart (Figure B) shows where the improvement happens. Always include per-class results when the dataset is imbalanced.
  3. Change exactly one thing at a time. If you remove both focal and Dice in the same run and F1 drops 0.20, you cannot say which loss caused it. Ablation tables are only trustworthy when each row differs from the baseline in exactly one cell.
Glossary
  • Macro-F1 — compute F1 for each class separately, then average. Treats rare classes the same as common ones.
  • Δ (delta) — the change vs. the baseline. Negative means worse.
  • Baseline — the full model you are comparing against. Picking a meaningful baseline is half of a good ablation.
  • Controlled experiment — fix everything except the one variable you are testing.
Acronyms & jargon — quick reference
Ablation
— remove ONE component and re-train; the drop measures that component's importance.
Baseline
— the full model every variant is compared against.
Δ (delta)
— change vs. baseline. Negative = worse.
F1
— harmonic mean of precision & recall; 2PR/(P+R).
Macro-F1
— F1 computed per class, then averaged equally. Treats rare classes fairly.
Precision
— of predicted damaged pixels, how many were actually damaged.
Recall
— of truly damaged pixels, how many we caught.
IoU
— Intersection-over-Union; another overlap score (close cousin of Dice).
Hold-out test set
— data the model never saw during training or tuning.
Seed
— fixed random number so the experiment is reproducible.
Controlled experiment
— change exactly one variable, hold everything else fixed.
CE
— cross-entropy loss (the "plain" baseline we compare focal to).