Source-linked AI summary

Going Beyond Neural Network Feature Similarity: The Network Feature Complexity and Its Interpretation Using Category Theory

Yiting Chen, Zhanpeng Zhou, Junchi Yan

arXiv:2310.06756v2cs.LGcs.AI

TL;DR

Because feature similarity does not specify when distinct features are equivalent, the paper defines functional equivalence and feature complexity, interprets them through category theory, and measures complexity with IFM. Experiments find many mergeable functionally equivalent features and report IFM’s pruning potential without fine-tuning; experiments are limited to image classification.

  • Problem

    Feature similarity offers an unclear account of when features in distinct networks count as equivalent, despite networks with different random initializations often achieving similar test performance.

    Source: §1 · pp. 1–2
  • Method

    The paper defines functionally equivalent features and feature complexity, interprets them using category theory, and proposes Iterative Feature Merging (IFM) to identify and merge equivalent features.

    Source: §1 · p. 2
  • Results

    Experiments find that DNNs learn many functionally equivalent features that can be merged or removed with little impact on performance, alongside several empirical patterns in feature complexity.

    Source: §1 · pp. 2–3
  • Takeaways & Limitations

    IFM shows potential for pruning pre-trained models without fine-tuning and is described as network-structure- and data-agnostic.

    Source: §7 · p. 11

    Experiments cover only image classification, and without proactively changing network structure or training, IFM’s parameter reduction is limited on difficult tasks such as ImageNet classification.

    Source: §7 · p. 11

Abstract

from arXiv · show

The behavior of neural networks still remains opaque, and a recently widely noted phenomenon is that networks often achieve similar performance when initialized with different random parameters. This phenomenon has attracted significant attention in measuring the similarity between features learned by distinct networks. However, feature similarity could be vague in describing the same feature since equivalent features hardly exist. In this paper, we expand the concept of equivalent feature and provide the definition of what we call functionally equivalent features. These features produce equivalent output under certain transformations. Using this definition, we aim to derive a more intrinsic metric for the so-called feature complexity regarding the redundancy of features learned by a neural network at each layer. We offer a formal interpretation of our approach through the lens of category theory, a well-developed area in mathematics. To quantify the feature complexity, we further propose an efficient algorithm named Iterative Feature Merging. Our experimental results validate our ideas and theories from various perspectives. We empirically demonstrate that the functionally equivalence widely exists among different features learned by the same neural network and we could reduce the number of parameters of the network without affecting the performance.The IFM shows great potential as a data-agnostic model prune method. We have also drawn several interesting empirical findings regarding the defined feature complexity.

1 Introduction

The paper extends feature similarity to functional equivalence, using it to define feature complexity as a measure of feature redundancy. It interprets the definitions through category theory and proposes Iterative Feature Merging (IFM) to find and merge functionally equivalent features.

1 Introduction

  • Earlier feature-similarity measures allow transformations such as permutation or affine transformation, but exact zero-distance equivalence is said to be rare, limiting actionable identification of features to merge.The paper also notes that its feature definition and method concern input-agnostic properties learned by the network, unlike prior measures commonly based on dataset feature maps.Source: §1 · p. 2
  • Functional equivalence extends feature similarity by treating features as equivalent when their outputs are equivalent under certain transformations, enabling a feature-complexity metric for network redundancy.The paper describes feature complexity as corresponding to the most compact representation of a network.Source: §1 · pp. 2–3
  • The category-theoretic account models network structure as a category and a network as a functor, with functional equivalence represented through natural transformations.More than one natural transformation between a functor and itself indicates feature redundancy.Source: §1 · pp. 2–3
  • IFM merges functionally equivalent features, and experiments report that many can be merged or removed with little impact on network performance.The authors describe IFM as a potential pruning method that does not require fine-tuning or changes to network training.Source: §1 · pp. 2–3
  • Linear mode connectivity is a sufficient condition for features learned by two different networks to be functionally equivalent.The category-theoretic interpretation represents this equivalence as a natural transformation between network functors.Source: §1 · pp. 2–3
  • The reported empirical findings are that larger networks tend to learn more functionally equivalent features, higher feature complexity accompanies better performance in networks of the same structure, and complexity rises then falls across layers.For image classification, groups of functionally equivalent features may correspond to specific high-level semantics.Source: §1 · p. 3

2 Preliminaries

The preliminaries introduce layer-wise network notation and basic category-theory concepts used to formalize the paper's approach.

2.1 Notations

  • For the MLP notation, each layer's feature map is computed from the preceding layer using its weights, bias, and activation; permuting parameters also permutes features while preserving the network output.The network is written as a composition of layer functions, with the input treated as the first layer's input.Source: §2.1 · p. 3

2.2 Category Theory

  • Category theory describes objects and arrows with identity and composition, while functors map objects and arrows between categories while preserving that structure.A natural transformation assigns arrows between functors' mapped objects so that the resulting diagrams commute.Source: §2.2 · pp. 3–4

3 Definition of Neural Network Feature Complexity

The section formalizes feature complexity through category theory: network structures are categories, and parameterized networks are represented by functors. It defines functional equivalence through natural isomorphisms and feature complexity through a partial order.

3.1 Category Theory View of Neural Networks

  • A network structure is represented as a category whose objects are feature shapes and whose arrows are transformations; training selects a parameterized functor.Source: §3.1 · p. 4

3.2 Definition of Functionally Equivalent Feature from the Category View

  • Features are functionally equivalent when the corresponding network functors are naturally isomorphic, with invertible transformations relating features across the networks.This permits replacing one network’s feature maps with those of the other through invertible linear transformations; the condition is strong.Source: §3.2 · pp. 4–5
  • If two parameter settings can be linearly connected after a feature permutation, the networks have functionally equivalent features.The paper states this as Proposition 3.2; its subsequent setup assumes the natural transformations are permutations.Source: §3.2 · p. 5

3.3 Definition of Feature Complexity based on Equivalent Feature

  • Self-transformations induce a partial order among layer features; feature complexity is the maximum number of features that are not equivalent.Source: §3.3 · p. 5

4 Measuring Neural Network Feature Complexity

The section measures feature complexity by matching feature-associated weights and iteratively merging features with small weight distances. The merging adjusts the affected layer weights to produce an approximately functionally equivalent network.

4 Measuring Neural Network Feature Complexity

  • Figure 1 compares last-convolution-layer feature distances with test accuracy during interpolation after equivalent-feature swaps versus random swaps.Source: Figure 1 · p. 6
  • Feature weight matching compares weights corresponding to different features, while ignoring activation and normalization layers.Source: §4 · p. 6
  • Merging two features adjusts the weights in their layer and the following layer, yielding an approximately functionally equivalent network.Source: §4 · p. 6
  • IFM iteratively merges the features with the smallest weight distance in each layer to measure feature complexity.It combines feature weight matching with feature merging.Source: §4 · p. 6

5 Experiments

Experiments test whether functionally equivalent features occur in trained networks and whether merging them reduces parameters while retaining accuracy. They also examine how feature complexity varies across layers and what equivalent-feature groups represent.

5 Experiments

  • Experiments use VGG and ResNet models on CIFAR10 and ImageNet to assess equivalent features, iterative merging, and feature complexity.CIFAR10 models are trained for the experiments; ImageNet results use pretrained torchvision checkpoints.Source: §5 · p. 7, §5.2 · p. 7

5.1 Verifying the Existence of Equivalent Features

  • Among 512 VGG16 last-convolution features, the minimum normalized distance was 2e −15, and interpolation between equivalent-feature permutations hardly affected performance.The experiments used VGG16 trained on CIFAR10; random permutations swapping the same number of features served as a comparison.Source: §5.1 · p. 7

5.2 Iterative Feature Merging

  • On CIFAR10, iterative merging reduces parameters while accuracy changes with the number of merged features.The experiments vary β; Figure 2 plots testing accuracy against remaining-parameter percentage and parameter count, with the largest β selected above 95% of pre-merge accuracy.Source: §5.2 · p. 7, Figure 2 · p. 8

5.2.1 Iterative Feature Merging on CIFAR10

  • VGG16 retained 23.03% of its parameters at 91.78% testing accuracy, versus 93.51% before merging; ResNet18 shed up to 60% without significantly affecting accuracy.Larger models could reduce more parameters with a smaller testing-accuracy decrease; the β grid search selected the largest value above 95% of pre-merge accuracy.Source: §5.2.1 · pp. 7–8, Figure 2 · p. 8

5.2.2 Iterative Feature Merging on ImageNet

  • On ImageNet, merging reduced parameters by approximately 5% for VGG and 10% for ResNet50; ResNet50 v2 scored 80.86% top-1 accuracy versus 76.13% for v1 but degraded faster during merging.The paper suggests the faster decrease may indicate that v2 learns more diverse features, potentially explaining its superior performance.Source: §5.2.2 · pp. 8–9, Figure 3 · p. 8

5.2.3 The Potential of IFM for Pruning

  • On ResNet18/CIFAR10, IFM retained higher accuracy than INN across pruning ratios, without fine-tuning or access to training data; the authors report weaker effectiveness on ImageNet.The paper says INN changes the training procedure, while IFM can be applied to pretrained models; it attributes IFM's weaker ImageNet effectiveness to dataset complexity and higher feature complexity.Source: §5.2.3 · p. 9, Figure 4 · p. 9

5.3 Empirical Results on Feature Complexity

  • VGG feature complexity rises in early layers, peaks in the middle, and falls in later layers; the authors leave explanations for this pattern to future work.They offer forgetting or the composition of simple features into complex ones as possible explanations.Source: §5.3 · p. 9
  • Guided backpropagation groups of functionally equivalent VGG16 features respond similarly across images, with illustrated groups capturing truck cabins, wheels, and containers.The authors suggest this may allow semantics to be aligned with groups of equivalent features.Source: §5.3 · p. 9

6 Related Works

Related work studies feature similarity, connectivity between trained networks, category-theoretic views of machine learning, and network pruning. The paper positions functional equivalence and Iterative Feature Merging as contributions across these areas.

Feature Similarity

Linear Mode Connectivity

Category Theory in Machine Learning

  • The paper defines a category for network structure and a functor for network parameterization, offering a new category-theoretic perspective in machine learning.The passage contrasts this framing with prior works that define categories and functors from other perspectives.Source: §6 · p. 10

Model Compression and Network Pruning

  • IFM is presented as structured pruning that requires no data before or after pruning, unlike methods that require training or fine-tuning access.The passage contrasts IFM with prior pruning approaches and describes unstructured pruning as removing connections and structured pruning as removing weight groups such as filters or channels.Source: §6 · p. 11, Table 1 · p. 11

7 Conclusion and Outlook

The conclusion presents functional equivalence, feature complexity, and IFM as contributions supported by experiments on CIFAR10 and ImageNet. It notes limits to pruning on difficult tasks and the image-classification-only experimental scope, while the appendix introduces an algorithm listing for IFM.

7 Conclusion and Outlook

  • Experiments on CIFAR10 and ImageNet support IFM's effectiveness and insights about feature complexity, while the method shows potential for pruning pretrained models without fine-tuning.The conclusion describes fine-tuning as often needed in existing pruning methods.Source: §7 · p. 11
  • On difficult tasks such as ImageNet classification, IFM can reduce only a limited number of parameters; experiments in this work cover image classification alone.The authors identify both constraints as areas for further work and call for experiments across other network structures and tasks.Source: §7 · p. 11

A Algorithm for Iterative Feature Merging

  • The appendix presents Algorithm 1 as the detailed algorithm for IFM, taking network parameters and a hyperparameter β as inputs.The listed input specifies parameters θ for an L-layer network and β.Source: A Algorithm for Iterative Feature… · p. 16

B.1 Proof for Proposition 3.2

The proof section states definitions of LMC and LLFC, then considers their relationship through layer transformations and permutations. It treats linear and activation layers separately and connects permutation matrices to natural isomorphisms.

Definitions

  • LMC requires the loss along linear interpolation between two similarly performing networks to remain approximately constant.The definition quantifies this condition for every interpolation coefficient α in [0, 1].Source: §B.1 · p. 16
  • LLFC requires each layer's features to interpolate linearly between two networks for every input, layer, and interpolation coefficient.The definition applies to inputs in dataset D and layers l in [1, L].Source: §B.1 · p. 16

Proof strategy

  • The proof considers LMC-satisfying parameters and treats linear transformations in matrix form, with a separate case for activation layers such as ReLU.The displayed fragments indicate a derivation across the linear and activation-layer cases.Source: §B.1 · pp. 16–17

Permutation and natural isomorphism

  • For the linear-layer argument, the permutation matrices P^l define layerwise maps that the proof identifies with components of a natural isomorphism.The passage states that the permutation matrices are defined by π and that each τ_z^l is P^l.Source: §B.1 · p. 17

B.2 Proof for Theorem 3.3

The proof invokes a partial order on features and uses natural isomorphisms and chain arguments. Its presented steps rely on one-to-one correspondence and a maximal-element contradiction.

Proof argument

  • The proof invokes the partial order between features when considering multiple natural isomorphisms from Tθ to itself.The passage introduces this as the setting for the following argument.Source: §B.2 · p. 17
  • Because a natural isomorphism gives a one-to-one correspondence between features, the proof treats objects in the same chain as equal.This is stated as the basis for its chain argument.Source: §B.2 · p. 17
  • The proof then uses a maximal element of a chain to derive a contradiction with that element's membership in the chain.The remaining proof fragments refer to the maximal element and the contradiction.Source: §B.2 · p. 17

C Experiment Details

The experiment details specify model training and IFM settings, then report iteration timing and feature-weight distances across VGG16 layers.

C Experiment Details

  • CIFAR10 models train for 150 epochs with momentum 0.9, weight decay 1e−4, scheduled learning-rate reductions, and 50% random horizontal flips.VGG classifiers use one layer, while ResNet uses a 3×3 first-layer convolution; ImageNet models use PyTorch pretrained checkpoints.Source: C Experiment Details · p. 17
  • IFM grid-searches β over ten values from 0.01 to 0.2, and ResNet merging is restricted to its last two blocks.The listed β values are 0.01, 0.03, 0.05, 0.07, 0.1, 0.12, 0.14, 0.15, 0.18, and 0.2.Source: C Experiment Details · p. 17

D.1 Time Complexity of IFM

  • IFM iteration timing is averaged over 100 iterations, and its weight-matching distance computation is described as faster than model inference.The timing comparison covers different models and datasets and uses one GeForce RTX 2080Ti; no timing values are supplied here.Source: §D.1 · p. 18, Table 2 · p. 18

D.2 Weight Distance between Features

  • The weight-distance results cover the first 12 layers of VGG16 trained on CIFAR10, following an earlier result for its last convolution layer.The supplied labels include layers 9 through 12.Source: Figure 6 · p. 18, §D.2 · p. 18

D.3 Guided Backpropagation Results

Guided backpropagation results suggest that groups of functionally equivalent features can align with semantic concepts within and across classes. The reported examples come from middle VGG16 features.

D.3 Guided Backpropagation Results

  • Groups of functionally equivalent features may respond to legs shared by horses, cats, and dogs, linking a semantic pattern across classes.The authors note that most last-layer feature visualizations cover the whole image; these examples use middle VGG16 features.Source: §D.3 · p. 19, Figure 7 · p. 19
  • Other feature groups may represent distinct boat-related semantics, as illustrated by the VGG16 guided-backpropagation results.The reported visualizations are from middle-layer features.Source: §D.3 · p. 19, Figure 8 · p. 19
Loading 2310.06756v2…