Back to blog
Thesis

Regularization in CNNs: Looking Inside the Network

How my thesis treated regularization as a change in representation geometry, not just a better validation curve.

Adam MaltoniPublished on 18 July 2026, 09:0021 min read
Radar plot comparing CNN regularizers across evaluation metrics

Most regularization explanations eventually collapse into one plot: the training curve keeps going down, the validation curve stops improving, and the gap between them is called overfitting. That picture is useful, but it hides the object that I actually wanted to study in my TFG: the internal representation learned by the network.

The question behind the thesis was:

When two CNNs reach similar validation accuracy, are they internally organizing information in the same way?

The answer was no. Regularization did not only change the final score. It changed how activations spread, compressed, saturated, and reacted to perturbations. The project became an attempt to make that difference measurable.

That sounds obvious now, but it was not how I started. My first instinct was to make the standard regularization comparison, rank the methods by validation accuracy, and write the discussion around that table. The more checkpoints I inspected, the less satisfying that felt. Some models were accurate but internally sharp. Others were not top-ranked on clean validation, yet survived parameter noise much better. The thesis became interesting only when I stopped treating accuracy as the whole story and started treating the network as a system with hidden state.

The setup: keep the model boring on purpose

The point of the project was not to build a state-of-the-art classifier. I wanted a CNN large enough to overfit, but simple enough that changes in behavior could be attributed to the regularizer rather than to architectural tricks.

The architecture stayed fixed across experiments:

input image
  -> conv1: 3x3 conv, 32 channels, ReLU, 2x2 max-pool
  -> conv2: 3x3 conv, 64 channels, ReLU, 2x2 max-pool
  -> conv3: 3x3 conv, 128 channels, ReLU, 2x2 max-pool
  -> flatten
  -> fc1: 128 hidden units, ReLU
  -> fc2: class logits

For CIFAR-10 and SVHN, this means the last convolutional tensor is 4x4x128, then flattened into 2048 features before the 128-dimensional dense representation. The baseline model could reach almost perfect training accuracy on CIFAR-10 after 60 epochs, which is exactly what I needed: a model with enough capacity to memorize.

I compared seven regularization strategies:

  • L1 penalty.
  • L2 penalty.
  • Dropout.
  • Early stopping.
  • Gaussian noise injection during training.
  • Data augmentation.
  • Batch normalization.

The datasets were CIFAR-10, SVHN, CIFAR-100, and FashionMNIST. Each one stressed the setup differently: CIFAR-10 was the main analysis domain, SVHN was more homogeneous, CIFAR-100 exposed capacity limits, and FashionMNIST produced a near-ceiling regime where most methods were already strong.

Why validation accuracy was too small a lens

Validation accuracy tells you whether the classifier got the labels right. It does not tell you whether the network used a compact representation, a chaotic one, or a collapsed one. In the thesis I treated hidden activations as empirical objects that can be collected and measured.

For each trained checkpoint, I loaded the model in evaluation mode and registered forward hooks on three layers:

  • conv1, the early feature extractor.
  • conv3, the deeper convolutional representation.
  • fc1, the dense latent space right before classification.

The hook-based pipeline looked like this:

for each dataset:
  for each regularization method:
    for each hyperparameter value:
      train for 60 epochs, saving checkpoints
      for selected epochs:
        load checkpoint in eval mode
        run validation data through the model
        capture conv1, conv3, and fc1 activations
        convert activations into comparable metrics

Dropout was disabled at extraction time and batch normalization used its learned statistics, so the captured activations reflected the trained inference-time model.

The key design decision was to use the same baseline ranges when discretizing activations. I divided the observed activation range into bins and represented each example by an ordered vector of bin ids. This preserved neuron identity better than a global histogram would. Two states that merely have the same count of activated neurons should not automatically be treated as the same internal state.

Three internal signals

The thesis used three main activation metrics.

Unique activation percentage measured how many different discretized states appeared in a validation pass:

unique_pctg = number of unique activation-state vectors / number of validation examples

If this value is too low, many inputs collapse into the same internal code. If it is too high, the model may be representing every input too specifically.

Shannon entropy measured how concentrated the activation histogram was:

H = - sum over bins p_i log(p_i)

Low entropy means activations concentrate in a few bins. High entropy means they are more spread out.

Dispersion ratio compared the standard deviation of a regularized model's activations against the unregularized baseline:

dispersion_ratio = activation_std_regularized / activation_std_baseline

This is useful because raw dispersion is layer- and dataset-dependent. A ratio below one means the regularizer compressed the activation distribution relative to the baseline.

These metrics are not magic. They are intentionally simple. Their value is that they let you talk about regularization as representation geometry rather than only as a validation-score intervention.

What the accuracy results said first

The external results were unsurprising at a high level but important as the reference point. Data augmentation and batch normalization gave the strongest validation accuracy improvements across the evaluated domains. Dropout and L2 were generally in the middle. Gaussian noise, early stopping, and L1 were weaker or sometimes barely better than the baseline.

On CIFAR-10, for example, the best methods in the report were:

MethodValidation accuracyfc1 unique statesfc1 entropyfc1 dispersion ratio
Data augmentation0.78589.22%1.780.46
BatchNorm0.77084.30%1.530.41
Dropout0.72737.23%1.170.29
L20.71497.93%2.090.57
Baseline0.69499.98%2.871.06

The generalization gap also told an important story. On CIFAR-10, the baseline, L2, and Gaussian noise models reached train accuracy near 1.0 while keeping a gap around 0.30. Data augmentation reduced that gap to around 0.09. Batch normalization still had a larger gap around 0.23, suggesting that part of its value came from stabilizing optimization rather than simply preventing memorization.

But the most interesting part was what happened when accuracy and internal structure were read together.

The intermediate zone

The main pattern was that strong models tended to live in an intermediate range of internal diversity, especially in fc1. Too little diversity looked like compression or underuse of the representation. Too much diversity looked like memorization or noisy specialization.

This is why the baseline was not just "bad because its validation accuracy was lower." It also produced almost maximal unique-state percentages and high entropy in fc1 on CIFAR-10. It used many distinct internal states, but that diversity did not translate into better generalization. In contrast, data augmentation and batch normalization compressed the activation distribution while preserving enough representational variety to classify well.

Dropout was especially interesting. It did not win the clean validation ranking, but it produced a much more compressed fc1 representation and later showed strong parameter robustness. That distinction matters: if all you read is accuracy, dropout looks merely okay. If you inspect the internal geometry and perturbation behavior, it becomes a qualitatively different regularizer.

Time matters too

The thesis did not only inspect the final checkpoint. It tracked the temporal evolution of internal states across 60 epochs. In many cases, validation accuracy rose quickly in the first 10 epochs and then saturated, while internal diversity kept growing afterward.

SVHN made this especially visible. The baseline and Gaussian noise models reached around 90% validation accuracy early, but their unique-state percentages continued increasing until the end of training. Data augmentation grew more slowly and ended with a much smaller generalization gap.

That is a useful diagnostic idea: after a certain point, more training can keep making the representation more complicated without giving meaningful validation improvements. The network is still changing internally, but not necessarily in a way that helps generalization.

Robustness changed the ranking

The thesis included two perturbation experiments.

First, I added Gaussian noise to validation images while keeping model weights fixed. This tested degradation under noisy inputs. Here the story was not "the best clean model is the most robust." In fact, Data Augmentation and BatchNorm, which were strong under clean validation, degraded sharply under intense pixel-level Gaussian noise. On CIFAR-10 at input noise sigma = 0.2, Data Augmentation retained about 49.7% of its clean accuracy and BatchNorm retained about 34.9%, while the baseline and L2 retained around 71.3% and 69.0%.

That does not mean the baseline is better. It means that robustness depends on the perturbation. Data augmentation was trained with crop and horizontal flip invariances, not with arbitrary pixel Gaussian noise. A method can improve clean generalization while remaining fragile to a different family of corruption.

Second, I added Gaussian noise directly to the weights of conv1, conv3, and fc1. This was a practical proxy for the geometry of the learned minimum. If a small parameter perturbation destroys accuracy, the model likely sits in a sharper region of the loss surface.

This is where dropout stood out. At weight noise sigma = 0.15, dropout had consistently strong retention across layers and datasets. On CIFAR-10 it retained 83.1% in conv1, 77.5% in conv3, and 86.1% in fc1. BatchNorm, despite its strong clean performance, collapsed more strongly in convolutional layers, with CIFAR-10 retentions of 51.2% in conv1 and 42.0% in conv3.

The radar plot below is the compact version of that tension. Each axis is normalized inside the dataset, so it should not be read as an absolute measurement scale. It is a profile view: validation accuracy, robustness to data noise, robustness to weight noise in conv1/conv3/fc1, and consistency across layers. The useful part is not that it crowns one winner. The useful part is that it makes the shape of each regularizer visible.

The profile I used can be thought of as a small multi-objective vector per regularizer and dataset:

v_method,dataset =
  [
    val_acc,
    retention_data_noise_sigma_0.20,
    retention_weight_noise_conv1_sigma_0.15,
    retention_weight_noise_conv3_sigma_0.15,
    retention_weight_noise_fc1_sigma_0.15,
    inter_layer_consistency
  ]

normalized_axis_value =
  15 + 85 * (x - min_axis) / (max_axis - min_axis)

The floor at 15 keeps a weak method visible without pretending it is zero, and the per-axis min-max scaling keeps the radar from mixing raw percentages with heterogeneous robustness measurements.

Radar charts comparing regularizers across accuracy, data-noise robustness, weight-noise robustness, and inter-layer consistency on CIFAR-10, SVHN, CIFAR-100, and FashionMNIST.

The plot made one thing hard to ignore: no method fills the star. Data augmentation pushes clean accuracy strongly, especially in the image datasets where augmentation matches the task invariances, but it does not dominate every robustness axis. Dropout is less glamorous in the accuracy table, yet its weight-noise footprint is consistently large. BatchNorm has a strong profile in several domains but can become brittle when the perturbation is applied to convolutional parameters. L2 often keeps a wide internal state space, which can look healthy in entropy terms but does not automatically mean better generalization.

I like this visualization because it prevents the lazy sentence "regularizer X is best." It forces the follow-up: best under which axis, on which dataset, and against which perturbation?

The lesson is not that BatchNorm is bad. The lesson is that the same method can be excellent for optimization and fragile under parameter perturbation. That difference is invisible if the only column in the spreadsheet is validation accuracy.

The practical takeaway

By the end of the project, I no longer thought of regularization as a ranked list of techniques. I thought of it as a set of biases with different failure modes.

Data augmentation was the best choice when the priority was clean-image validation performance. Dropout was the strongest candidate when parameter stability mattered. L2 and even the baseline could look relatively resilient under stochastic input noise, although they sacrificed clean performance. BatchNorm was powerful but sharp in the convolutional feature extractor.

That conditional answer is less tidy than a leaderboard, but it is closer to how I would actually use the results. If I were training a small vision model for a setting where the input distribution is clean and augmentation captures the expected invariances, I would start with augmentation. If I cared about compression, pruning, noisy deployment weights, or small hardware perturbations, I would look again at dropout and not dismiss it just because it lost the clean validation race. If a model showed high entropy, high unique-state percentage, and a large gap, I would treat that as a warning sign rather than as "rich representation" by default.

So the thesis answer to "which regularizer is best?" was deliberately conditional:

if the priority is clean accuracy:
  data augmentation is usually strongest
if the priority is flatness / parameter robustness:
  dropout is more attractive
if the priority is input-noise retention:
  inspect L2 and baseline-like behavior carefully
if the dataset is too easy or too hard for the architecture:
  accuracy may hide the regularizer's internal effect

The main result was not a new regularizer. It was a measurement argument: internal activation metrics can act as diagnostics for under- and over-regularization. They do not replace validation accuracy, but they explain things that accuracy compresses away.

What I would extend

The first extension would be to repeat the protocol on deeper architectures such as ResNet-18 or VGG-16. The second would be to study combinations of regularizers, since real models rarely use one method in isolation. The third would be to compare representation similarity using CKA, to test whether two regularizers with different metrics actually learn structurally similar spaces.

The longer-term idea is an automatic diagnostic tool: train a model, extract activations, compute entropy, dispersion, and unique-state curves, and flag representations that look collapsed or overly dispersed before relying only on late validation behavior.

That was the value of the thesis for me. It turned the CNN from a black box that emits an accuracy number into a dynamic system whose internal states can be measured, compared, and questioned.