Dynamic Routing Between Capsules

A capsule architecture represents entities with vectors and uses iterative routing-by-agreement to connect part predictions to higher-level entities.

Metadata

FieldValue
PaperDynamic Routing Between Capsules
AuthorsSara Sabour, Nicholas Frosst, Geoffrey E. Hinton
Year2017
VenuearXiv preprint
arXiv1710.09829
Statusverified

Question

Convolutional networks encode local patterns and build larger receptive fields through depth, pooling, and shared filters. The paper argues that a scalar activation does not explicitly represent the pose or instantiation parameters of an entity. It proposes capsules: groups of neurons whose vector activity represents both whether an entity exists and how it is instantiated.

The second question is how lower-level parts should send evidence to higher-level entities. Instead of using a fixed pooling or convolutional aggregation, capsules use an iterative routing-by-agreement mechanism.

The architecture changes the aggregation rule:

Main Claim

The paper introduces a multi-layer capsule system in which lower-level capsules make predictions for higher-level capsules. Higher-level capsules become active when their incoming predictions agree, and the vector orientation represents instantiation parameters while vector length represents entity presence.

The bounded claim is:

The reported experiments show strong behavior on the tested digit-recognition tasks, including overlapping digits. They do not establish that capsules universally outperform CNNs or that vector orientation is a complete disentangled pose representation.

Architecture Contract

ItemContract
Inputfeature maps or lower-level capsule vectors
Unitcapsule vector representing entity activity and parameters
Predictiontransformed lower-level capsule vote for each parent capsule
Routingiterative agreement-based coupling coefficients
Nonlinearitysquash function controls capsule length
Outputclass/entity capsules and optional reconstruction
Trainingdiscriminative margin loss, optionally reconstruction regularization

Let be a lower-level capsule. A transformation matrix produces its prediction for parent capsule :

The parent capsule combines votes using coupling coefficients :

and outputs a squashed vector :

Capsule State

The capsule vector has two intended semantic roles:

QuantityIntended meaning
probability-like presence of entity
direction of instantiation parameters such as pose
components of learned pose/entity coordinates, not guaranteed human labels

The squash function is:

For small , the output is short; for large , the length approaches one while preserving direction.

The norm should be interpreted as an activation statistic under the model’s training objective, not as a calibrated probability unless separately calibrated.

Routing by Agreement

The routing algorithm begins with logits that represent the initial preference for sending capsule to parent . Coupling coefficients are normalized over possible parents:

The votes are aggregated and squashed:

Agreement between a vote and the current parent output updates the routing logits:

After a fixed number of iterations, the final is passed to the next layer or class head.

The iterative loop is an algorithm inside a neural layer:

  1. initialize routing logits;
  2. normalize couplings over parent capsules;
  3. aggregate transformed votes;
  4. squash parent vectors;
  5. update logits from vote-output agreement;
  6. repeat for a fixed number of routing iterations.

This is different from ordinary feed-forward convolution, where aggregation weights are fixed by learned kernels and spatial connectivity.

Transformation and Pose Sharing

If a lower-level capsule represents a part under a transformation, the matrix maps its pose-like vector into a parent prediction. The intended inductive bias is that parts contribute consistent predictions to a whole even when their local appearance changes.

However, the transformation matrices are learned parameters, not a guarantee of exact group equivariance. A capsule vector can encode pose-related information without satisfying:

for a known transformation group . If exact symmetry matters, compare capsules with equivariant architectures and state the group/action explicitly.

Loss

The class capsule length can be trained with a margin loss. For class and target :

The total classification loss is:

An optional reconstruction decoder regularizes the active capsule to retain information about the input:

The reconstruction term changes the representation pressure. A comparison that removes it must state whether the observed difference comes from routing, reconstruction, or both.

Architecture Flow

The high-level flow is:

The first convolutional layers still provide local feature extraction. Capsules replace some later scalar feature aggregation with vector-valued entities and iterative routing.

Evidence

ClaimEvidence typeBoundary
capsule vectors can represent entity activity and parametersvector norm/orientation design and reconstruction behaviorsemantic meaning of dimensions is not guaranteed
routing-by-agreement can connect parts to wholesiterative vote agreement mechanismrouting may be unstable or expensive in other settings
overlapping digit recognition improves under the reported setupMNIST-style experimentsnarrow vision task and baseline protocol
dynamic routing is a useful architecture primitiveproposed layer and ablationsnot evidence of universal superiority over CNNs or attention

The paper is valuable as an architecture proposal and a failure/alternative point in the history of visual representation learning. It should not be read as a settled replacement for convolution or Transformer backbones.

Ablation and Reading Questions

QuestionWhat it isolates
Does removing routing reduce performance?value of agreement-based connectivity
How many routing iterations are used?iterative compute versus one-pass aggregation
Are transformation matrices shared?pose transfer bias versus parameter capacity
Is reconstruction enabled?representation regularization versus classifier loss
Are comparisons parameter- and compute-matched?routing benefit versus extra operations
Does performance survive larger image and object complexity?task scaling beyond overlapping digits

For a reproduction, log capsule dimensions, number of routing iterations, coupling entropy, transformation sharing, squash implementation, margin parameters, and reconstruction weight.

Complexity and Systems Trade-offs

If there are lower-level capsules, parent capsules, capsule dimension , and routing iterations, transforming and comparing all votes can cost roughly:

before accounting for spatial grouping and batching. This can be much more expensive than a single fixed convolutional aggregation.

PropertyBenefitCost or risk
vector-valued entitiesretains activity and pose-like informationlarger feature state
learned routinginput-dependent part-to-whole assignmentiterative latency
agreement scoresencourages consistent votessensitive to scale and initialization
reconstructionregularizes information retentionadds objective and decoder capacity
local capsule connectivitycontrols computationmay miss long-range entity relations

The routing loop is part of the inference cost. Treating it as a free interpretation layer understates the architecture’s systems burden.

Relation to Other Architectures

ArchitectureRelation
CNNscalar local features and fixed learned aggregation
Pointer Networksattention selects input positions; capsules route part votes to parent entities
Set Transformerpermutation-aware attention over sets without capsule pose vectors
Equivariant GNNsexplicit group transformation laws when symmetry is required
Transformercontent-based token mixing with a feed-forward layer stack

Capsules and attention both use input-dependent interactions, but their contracts differ. Routing by agreement aggregates transformed vector votes; attention computes normalized query-key scores and value mixtures.

Limitations

  • Dynamic routing adds iterative computation and can be difficult to scale.
  • A vector orientation is not automatically a disentangled or equivariant pose representation.
  • Coupling coefficients can be unstable, diffuse, or dominated by initialization and normalization choices.
  • Results on overlapping digits do not establish broad visual or multimodal superiority.
  • The margin and reconstruction losses are part of the method and complicate architecture-only comparisons.
  • The model does not specify a general method for hierarchical entities of arbitrary depth.
  • Routing behavior can be post-hoc interpreted too strongly; agreement is a learned score, not a proof of part-whole causality.

Implementation Checklist

  • Define capsule shape as (batch, capsule_count, capsule_dim) at every layer.
  • Keep prediction transforms and coupling coefficients separate in logs.
  • Check coupling normalization over the intended parent axis.
  • Monitor routing entropy and vote-output agreement across iterations.
  • Test routing with and without reconstruction under matched compute.
  • State whether transformation matrices are shared spatially or by capsule type.
  • Compare against a parameter- and FLOP-matched CNN baseline.
  • If claiming geometric behavior, specify the transformation group and test equivariance directly.

Why It Matters

Capsules provide a concrete alternative to the assumption that every feature should be a scalar activation:

Even when a project does not use capsule layers, the paper is useful for asking whether a model should represent objects, parts, poses, and relations explicitly rather than relying only on pooled scalar features.

Read it after LeNet-5 and ResNet, then compare its routing idea with attention and geometric equivariance.

Connections