← All articles

neural network trainingensemblesimage classificationbackpropagation

Training a network by repairing its weakest branch first

Some neural networks have several branches that each produce their own score for every class. The usual way to use them is to average the scores. We tried something different: during training, for each class we find the branch that is doing worst and send the learning signal through that branch. We call the method GuideBP.

The problem

A network that classifies images ends in a set of raw scores, one per class, called logits. Many designs produce several sets of logits. You can train three copies of the same network from different starting points, or attach extra classifiers to the middle of a deep network, or have one network look at different regions of the picture. The scores are then added or averaged before the loss is computed. The loss is a number that measures how wrong the network is.

Training works by backpropagation. The loss is traced backwards through the network, and each weight gets a gradient, a nudge telling it which way to move. With averaging, the gradient is split equally among all branches. A branch that already handles a class well still receives its share, and a weak branch gets no extra attention.

The idea

We wanted the learning to concentrate on what is still wrong. A team is as strong as its weakest player, and averaging works less well when one branch lags. So we compute a weakness score for every class score in every branch. For the true class, a branch is weaker the lower its score. For every wrong class, a branch is weaker the higher its score.

Three bar charts of class scores from three branches, with the true class highlighted, and a combined chart that takes the weakest value for each class.
For each class, the combined output takes the value from the branch that is weakest for it. Low scores on the true class and high scores on wrong classes count as weak.Source: Fig. 2 of the paper.

For each class we then pick the branch with the highest weakness and build a new set of logits from those picks. The loss is computed on this combined set. Because only the picked entries are in the loss, the gradient flows back through the weakest pathways only. Stronger pathways are left alone for that class and that example.

Two panels showing three network paths feeding an output layer. In the forward pass, logits are routed by weakness. In the backward pass, gradients flow only through the weaker paths.
Left: the forward pass routes the weakest logits to the output. Right: the backward pass sends gradients only along those weaker paths.Source: Fig. 1 of the paper.

How it works

After training there are two ways to make a prediction. In mean inference we simply average the branches' outputs. In strong inference we take, for each class, the branch with the least weakness. The true label is not known at test time, so the weakness is judged against a pseudo target built from the branches' own outputs.

We tried the method in four settings. M1 combines three ResNet18 networks, a standard image network. M2 uses GoogLeNet, which normally has extra classifiers that are cut away after training. We keep them, so they also take part at test time. M3 builds on a YOLOv3-style network and produces predictions for 16 regions of its internal feature maps. M4 combines 23 small networks that each read a different region of the input, following an earlier published design. Nothing was pre-trained and no data augmentation was used. The experiments cover 13 image datasets, from handwritten digits in several scripts to SVHN and CIFAR-10.

What we found

The paper's first observation is that at least one of the two inference modes always beat plain averaging. The accuracies below are means over the 13 datasets (Table 2), with GuideBP using mean inference.

  • M1, three ResNet18s: 97.54% with averaging, 98.01% with GuideBP. A single ResNet18 scored 97.31%.
  • M2, GoogLeNet with extra classifiers: 97.32% with averaging, 97.80% with GuideBP. Plain GoogLeNet scored 96.73%.
  • M3, feature regions: 94.75% with averaging, 95.78% with GuideBP.
  • M4, input regions: 95.61% with averaging, 96.52% with GuideBP.
Bar chart of the increase in accuracy over averaging for each of 13 datasets and their mean, shown for four setups M1 to M4.
Increase in accuracy over averaging the logits, using the better of the two inference modes, for each dataset and on the mean. The gain is small on MNIST, where accuracy was already very high.Source: Fig. 8 of the paper.

Which setting wins depends on the data (Table 2). M3 was best on the six CMATERdb handwriting sets and on Fashion-MNIST, whose images follow a fairly fixed template with little variation. M2 was best on four of the five MNIST-like sets and on SVHN. M1 was best on CIFAR-10, where objects of the same class vary a lot in position and shape, so the class has no fixed template.

Results in more detail

The paper's results table is wide, so we show it in two halves. Each row is a dataset. Within a setting, compare the usual averaging against GuideBP; for M1 and M2 the first column is the original single network, ResNet18 or GoogLeNet. The last row is the mean over the datasets.

Test accuracy of the ResNet18 setting (M1) and the GoogLeNet setting (M2) on each dataset, with the mean over datasets (%)
DatasetsM1: Single ResNet18M1: Average of 3 LogitsM1: Mean InferenceM2: Native GoogLeNetM2: Average of 3 LogitsM2: Mean Inference
CMATERdb 3.1.199.2099.5099.8096.7098.7099.30
CMATERdb 3.2.199.3099.4899.5097.5099.3599.50
CMATERdb 3.3.199.4099.4899.7098.4098.9099.60
CMATERdb 3.4.198.9099.1099.5097.2098.7099.60
CMATERdb 3.1.297.6797.8098.4098.0098.2398.33
CMATERdb 3.1.396.4096.7097.7096.9097.3297.67
MNIST99.6399.6399.7399.5899.5999.73
Fashion MNIST94.0094.2894.5094.3094.4594.50
notMNIST96.8097.0097.7397.1297.4297.73
Kannada-MNIST97.4097.6398.4096.6797.0298.60
Kuzushiji-MNIST96.6797.2098.0097.4097.6698.10
Svhn95.5095.6796.0095.8295.8596.20
Cifar1094.1994.5995.2091.9492.0292.50
Mean97.3197.5498.0196.7397.3297.80
A selection of the columns of Table 2: the strong-inference columns of M1 and M2 are left out. Mean Inference is GuideBP with averaging at test time. Source: Table 2 of the paper.

Take the Bangla digits (CMATERdb 3.1.1). Native GoogLeNet scored 96.70%. Keeping its extra classifiers and averaging them gave 98.70%, and GuideBP with mean inference gave 99.30% (Table 2). Harder data show the same direction. On the compound Bangla characters (CMATERdb 3.1.3), which have 199 classes and relatively few images per class, M1 went from 96.40% for a single ResNet18 to 96.70% with averaging, 97.90% with strong inference and 97.70% with mean inference (Table 2). On CIFAR-10, M1 scored 94.19%, 94.59% and 95.20% for single network, averaging and GuideBP with mean inference (Table 2).

The other two settings are in the next table. M4 combines the 23 small networks that each read a region of the input. On SVHN it scored 89.47% with averaging, 89.86% with strong inference and 91.33% with mean inference (Table 2).

Test accuracy of the feature-region setting (M3) and the input-region setting (M4) on each dataset, with the mean over datasets (%)
DatasetsM3: Average of 16 gridsM3: Strong InferenceM3: Mean InferenceM4: Average of 23 BranchesM4: Strong InferenceM4: Mean Inference
CMATERdb 3.1.198.7099.7099.8099.1099.4099.50
CMATERdb 3.2.199.4099.6099.8599.1099.3099.60
CMATERdb 3.3.199.3099.7099.9098.7099.1099.40
CMATERdb 3.4.199.0099.8099.8098.9099.2099.70
CMATERdb 3.1.298.5098.6398.9097.6797.8098.00
CMATERdb 3.1.397.2097.9097.7094.7096.3296.50
MNIST99.5599.6599.6599.2999.2599.40
Fashion MNIST92.2694.0194.6093.0992.4094.00
notMNIST97.0297.0997.3395.9896.0296.67
Kannada-MNIST96.6798.8598.5096.4098.5498.50
Kuzushiji-MNIST97.2097.6197.6796.0096.7797.20
Svhn84.1985.9486.4089.4789.8691.33
Cifar1072.8073.7775.0084.5384.6785.00
Mean94.7595.5695.7895.6196.0596.52
A selection of the columns of Table 2: the other columns are in the previous table. Average is the usual way of training; Strong and Mean are the two ways of using GuideBP at test time. Source: Table 2 of the paper.

The paper also compares the two ways of using GuideBP after training. Mean inference scored best on several datasets, and strong inference was better on some. Fig. 9 shows the difference per dataset. On Kannada-MNIST, for example, strong inference was ahead for M3, with 98.85% against 98.50% for mean inference (Table 2).

Bar chart of the difference between mean inference and strong inference for each of 13 datasets and their mean, shown for four setups M1 to M4. Most bars are above zero; a few, mainly on Kannada-MNIST, are below.
Mean-inference accuracy minus strong-inference accuracy. A bar above zero means mean inference scored higher; a bar below zero means strong inference won.Source: Fig. 9 of the paper.

Discussion

Why does it work? Plain averaging splits the learning signal equally, so a branch that lags still drags the combination down, as a team is as strong as its weakest player. GuideBP attends to the wrongest predictions first. We think this pushes the branches to perform at a similar level, which makes combining them more effective. Once training is over, the individual branches have fewer weaknesses, so even simple mean inference gets a boost. Unlike traditional ensembles, the networks do not have to be trained one by one.

GuideBP is a general way to combine the outputs of multi-branch networks, not a benchmark model. Because our four settings are upgrades of existing networks, they inherit those networks' drawbacks. M3, for instance, reached only 75.00% on CIFAR-10 and 86.40% on SVHN, against 95.20% and 96.00% for M1 (Table 2). We explain this by the variation inside a class: where objects vary a lot in position and shape, the feature regions cannot be exploited as effectively. A McNemar test, which checks whether two classifiers differ by more than chance, showed that apart from M1 the proposed models learned significantly different concepts from the baselines (Table 3). MNIST was the exception on the datasets, probably because accuracy there is already saturated.

In the conclusion we describe GuideBP as a viable alternative to averaging, ahead of it across 13 datasets, and the paper adds that it even reaches new benchmark scores on a few. Right now the method acts only on the output logits. The conclusion suggests that a similar approach might be adopted for inner layers in future work.

Sources

The figures and tables listed here are taken from the paper cited at the top of this page; the numbers quoted in the text come from it too.

  • Figures: Fig. 2, Fig. 1, Fig. 8, Fig. 9
  • Tables: Table 2: accuracy of every setting on each of the 13 datasets, with the mean over datasets; Table 3: McNemar test p-values comparing the proposed methods and the standard networks

Cite the paper

Swarnendu Ghosh, B Mandal, T Gonçalves, P Quaresma, M Nasipuri, N Das (2023). GuideBP: Guided Backpropagation in Multi-output Neural Networks by Channeling Gradients Through Weaker Logits. 4th International Conference on Frontiers in Computing and Systems (COMSYS 2023), pp. 165–183 · Springer.

BibTeX
@inproceedings{ghosh2023guidebp,
  author    = {Ghosh, Swarnendu and Mandal, B and Gon{\c c}alves, T and Quaresma, P and Nasipuri, M and Das, N},
  title     = {{GuideBP:} Guided Backpropagation in Multi-output Neural Networks by Channeling Gradients Through Weaker Logits},
  booktitle = {4th International Conference on Frontiers in Computing and Systems (COMSYS 2023)},
  pages     = {165--183},
  publisher = {Springer},
  year      = {2023},
  doi       = {10.1007/978-981-97-2611-0_12}
}