Many text classification problems ask for a path through a taxonomy rather than a single label: a book blurb is "Fiction", then "Fantasy", then "Urban Fantasy". Two families of neural models handle this today, and each pays a different price. Capsule networks represent each label as a small vector. In these networks the vector's length says "this label applies" and its direction records which properties of the input support that decision. They handle rare label combinations well. However, they need a separate transformation matrix for every input-capsule/label pair, they rerun an iterative voting loop at every layer, and they still need a hand-written cleanup step to stop a child label from firing without its parent. Recurrent models that read the taxonomy level by level avoid the parameter explosion and respect parent-child structure, but they pass only a scalar label embedding from one level to the next. As a result, the evidence behind the parent decision is thrown away before the child decision is made.
We propose a single small recurrent cell, shared across all levels of the tree, that turns each parent capsule into its children's capsules in one non-iterative pass. The parent's vector is the recurrent state. The child's length is the parent's length times a gate, so a child can never be more active than its parent. The question we test is whether carrying a vector-valued "reason" down the tree improves accuracy where it is hardest to get: deep levels and label combinations rarely or never seen in training. We test this while keeping parameter count flat in the number of labels and making hierarchy consistency hold by construction.
Core Claim
The claim has three parts, and each can fail separately. First, hierarchical consistency can be an architectural property rather than a post-processing rule. If the child length is defined as $\lVert v_c \rVert = \lVert v_p \rVert \cdot \sigma(g_c)$, where $v_p$ is the parent capsule vector, $v_c$ the child capsule vector, and $g_c$ a learned scalar score, then for any decision threshold a child cannot be predicted without its parent. Second, the per-label cost of a capsule classifier can drop to one embedding vector per label, like a flat classifier, if child votes come from a shared cell conditioned on the child's embedding instead of from per-label matrices. Third, the vector state carries information that a scalar parent embedding does not. This third part is the one that justifies capsules at all, and the experiments are built around an ablation that isolates it.
Relation to Prior Work
The two papers that motivate the gap sit on either side of it. Hierarchical Multi-label Classification of Text with Capsule Networks routes convolutional n-gram capsules directly to one capsule per taxonomy label. It initializes weights from label co-occurrence and fixes hierarchy violations afterward. It reports 74.37 F1 on the four-level BlurbGenreCollection and a gain of nearly 1.6 F1 over CNNs on unseen label combinations. That gain is the evidence that vector label representations help on rare structure. Its design is a single shallow routing stage with per-class transforms and external consistency repair. Our design replaces all three: routing is staged by depth, transforms are shared, and consistency is built in.
A Hierarchical Neural Attention-based Text Classifier supplies the traversal method we reuse. A BiLSTM (bidirectional LSTM, a recurrent network reading text in both directions) encodes the document. Then, at each level, the model re-reads the encoding with attention whose query is the predicted parent's embedding, and it masks labels from other levels. It reaches 77.46% on Web of Science with 34M parameters, against 5B for the per-node HDLTex. It passes a scalar parent embedding down the tree; we pass the parent capsule vector and make it the recurrent state.
Three papers combine capsules with recurrence without traversing a label tree. HE-AGCRCNN uses capsules inside the document encoder and imposes the taxonomy only through a distance-weighted margin loss built from random-walk label embeddings. HAC routes a hierarchy of receptive-field scales from a Bi-GRU into a flat label set. OCRA uses a recurrent decoder over object capsules for visual glimpses. None of them lets routing itself follow the taxonomy, and that is the contrast we target.
STAR-Caps supplies the routing method. It replaces iterative routing with single-pass attention plus straight-through binary gates and is shown on flat ImageNet classification; we apply it level by level inside a recurrence. Two papers constrain the design. Bonsai shows that deep trees propagate errors and favors shallow, wide trees. HD-CNN shows that conditional execution of fine branches gives 2.8x to 6.3x speedups. Following both, we expand only children of parents whose length clears a threshold, and we report error propagation explicitly rather than assuming the recurrence fixes it.
Research Program
The model has an encoder and a tree walker. The encoder is a BiLSTM, identical to the one in the attention-based classifier. The walker begins with a root capsule $v_0$ formed by attentive pooling. At level $k$, for each active parent $p$ and each of its children $c$, the walker does three things:
- It forms an attention query from $v_p$ and the child's embedding $e_c$, and reads a context vector $r_c$ from the encoder states.
- It computes the child's direction as $\mathrm{GRU}(r_c, v_p)$. A GRU is a gated recurrent unit, a recurrent cell that decides how much of its previous state to keep. Here $v_p$ plays the role of the hidden state.
- It sets the child's length with the gated product above.
The GRU, the attention, and the gate are shared across all levels and all labels, so the only per-label parameters are the embeddings $e_c$. Votes from encoder positions to child capsules use one STAR-Caps-style attentive pass rather than three iterations.
Training uses the capsule margin loss on every node in the gold subtree plus a sampled set of sibling negatives. For a fraction of steps, the gold parent is replaced by the predicted parent, so the walker learns to operate on its own mistakes. At inference, a parent's children are expanded only if the parent's length exceeds 0.5.
The analysis has three goals. We will measure how parameters and per-document compute grow with taxonomy depth and width. We will probe what the parent vector encodes, by checking whether it predicts which document spans the child attends to. We will also test whether direction or length carries the useful signal, by freezing one at a time.
Baselines
The naive reference is a flat BiLSTM with a single sigmoid output per label, trained with binary cross-entropy and followed by the standard parent-closure correction. It shows what any hierarchy machinery must beat. On WOS, the attention-based classifier reports this model's subtree adherence as 90.74%.
The strongest scalar competitor on taxonomy traversal is the parent-conditioned attention classifier of A Hierarchical Neural Attention-based Text Classifier. It reports 77.46% overall accuracy and 93.03% subtree adherence on WOS. The strongest capsule competitor is Hierarchical Multi-label Classification of Text with Capsule Networks, which reports 74.37 F1 and 71.73 recall on BGC. On RCV1 and EUR-Lex we compare against HE-AGCRCNN, which reports Micro-F1 0.778 and Macro-F1 0.513 on RCV1, and 0.688 and 0.330 on EUR-Lex.
The published numbers come from different encoders and preprocessing. We will therefore cite them but also reimplement the first two competitors on our encoder, with the same word embeddings, the same data splits, and the same hyperparameter search of 30 trials per method. Their parameter counts will be matched to ours within 10%. We will run three seeds and report mean and spread.
Three ablations isolate the proposal's ingredients. The decisive one is a scalar-state walker: identical in every respect, except that the recurrent state passed from parent to child is a scalar-gated label embedding rather than the capsule vector. This walker is essentially our version of parent-conditioned attention. A second ablation removes the length-product constraint and substitutes post-hoc correction. A third uses unshared per-level transforms, to measure what the sharing costs.
Counting as success means two things relative to the reimplemented baselines on matched encoders and parameters. The full model must beat the scalar-state walker by more than the seed spread on deepest-level F1 and on F1 for unseen label combinations on BGC. It must also match or exceed the reimplemented capsule baseline's overall BGC F1 while using fewer per-label parameters and zero consistency violations.
Why not just…?
Why not just use parent-conditioned attention with scalar embeddings? This is the real threat. It already avoids parameter explosion, already conditions children on parents, and already reports strong WOS results. If the scalar-state ablation matches the full model on deep levels and unseen combinations, then the capsule vector adds nothing, and we will report that as the finding. The only evidence that vectors might help is the 1.6 F1 unseen-combination gain in Hierarchical Multi-label Classification of Text with Capsule Networks. That gain was measured against CNNs, not against a recurrent tree walker, which is exactly why the matched ablation is the central experiment.
Why not just train a flat classifier and fix violations afterward? Post-hoc closure guarantees consistency, but it cannot share evidence between parent and child, and it tends to lose accuracy at deep levels. BGC results in the capsule HMC paper show flat CNN and LSTM baselines falling behind capsules as depth increases. Our per-level F1 curves on BGC will show whether that gap appears against our walker too. If it does not, the architectural consistency guarantee is merely a convenience, not a gain.
Why not just keep a standard capsule classifier with per-label transforms? On 146 BGC labels this may well be competitive. Its cost, however, grows with label count times the number of input capsules, and it repeats iterative routing. EUR-Lex, with roughly 4,000 labels, is where the comparison bites. We will report parameters, peak training memory, and wall-clock time per epoch there, with and without three-iteration routing. If the per-label design fits in memory and wins on accuracy, sharing is not justified at this scale.
Why not just use a shallow tree method like Bonsai? Bonsai trains very fast; it was reported 200x faster than DiSMEC on Amazon-3M. It is, however, a linear model over static features. We found no reported Bonsai result on EUR-Lex in the file, so we will run it ourselves on EURLex-4K. If it matches our Macro-F1, the neural walker is not worth its cost on that benchmark.
Proposed Experiments
The main benchmarks are BGC, chosen for depth and imbalance, and WOS, chosen for direct comparison with the attention classifier. RCV1 and EURLex-4K test larger label sets. DBpedia is excluded as uninformative, since flat HAC already reports 99.2% on it.
The metrics are micro and macro F1, F1 per level, F1 on test examples whose label set never appears in training, the rate of hierarchy violations before any correction, and the rate of propagated errors. A propagated error is a wrong child under a wrong parent. We also report parameters, training memory, and inference FLOPs as a function of the depth reached.
Two checks decide the outcome. The first is whether the vector state beats the scalar state on BGC deep levels and unseen combinations under matched budgets. The second is whether single-pass shared routing stays within about one F1 point of iterative per-label routing on EUR-Lex while cutting memory substantially. If the first check fails, the contribution narrows to a cheaper, consistency-guaranteed capsule classifier. If both fail, capsules should not be used for taxonomy traversal.
As a final robustness track, all methods will be run with a pretrained transformer encoder in place of the BiLSTM. No reported result was found on Lacuna for transformer encoders on these taxonomies, so this track shows whether any advantage survives a stronger reader.
References
- Hierarchical Multi-label Classification of Text with Capsule Networks
- A Hierarchical Neural Attention-based Text Classifier
- Hierarchical Taxonomy-Aware and Attentional Graph Capsule RCNNs for Large-Scale Multi-Label Text Classification
- Dynamically Route Hierarchical Structure Representation to Attentive Capsule for Text Classification
- Recurrent Attention Models with Object-centric Capsule Representation for Multi-object Recognition
- STAR-Caps: Capsule Networks with Straight-Through Attentive Routing
- Bonsai: diverse and shallow trees for extreme multi-label classification
- HD-CNN: Hierarchical Deep Convolutional Neural Networks for Large Scale Visual Recognition