Models with Conditional Computation Learn Suboptimal Solutions

Muqeeth Mohammed, Haokun Liu, Colin Raffel

TL;DR

Neural networks with conditional computation (like Mixture-of-Experts) can be more efficient by only activating parts of the network for each input. However, current methods for training these "smart routing" systems often lead to suboptimal performance compared to simpler, hand-designed routing. This paper shows that these issues stem from gradient estimation problems and suggests that a small amount of supervision can significantly improve learned routing.

What Problem Does This Paper Address?

Modern neural networks are getting larger and larger, leading to massive computational costs. Conditional computation offers a way to decouple model size from computational cost by allowing different parts of the network (subnetworks or "experts") to be activated for different inputs. This is achieved through a "router" that decides which expert(s) to use. While promising, models with learned routing often underperform simpler, fixed routing strategies. The authors hypothesize that this performance gap is due to the difficulty of training the discrete routing decisions using standard gradient estimation techniques. They aim to understand why learned routing fails and explore ways to improve it.

Methods

The core of the paper is an experimental investigation into different gradient estimation techniques for training conditional computation models. They compare several standard methods:

  • REINFORCE: A reinforcement learning-based approach that treats routing as an agent's action and uses the model's prediction loss as a reward. It's known for high variance.
  • Straight Through Gumbel-Softmax (ST-Gumbel): A technique that approximates discrete sampling with a continuous, differentiable distribution, allowing gradients to flow through.
  • Top-k: A simpler approach where the router selects the top-k experts with the highest probabilities.

To benchmark these learned routing methods, they introduce and use three heuristic routing strategies that don't require training a router:

  • Tag Routing: Routes inputs based on pre-defined tags (e.g., dataset ID, domain).
  • Hash Routing: Uses a fixed hashing function to assign inputs to subnetworks.
  • Monolithic Routing: A baseline where only one subnetwork is used, effectively disabling conditional computation.

A key experimental contribution is demonstrating that supervising the router with a small amount of ground-truth tag information (using a standard cross-entropy loss) can significantly improve learned routing performance.

Datasets

The experiments were conducted across three distinct scenarios:

  • Discrete Autoencoders for Synthetic Images (DAE-Syn): A custom dataset where images are generated from four categorical variables (alphabet identity, location, foreground/background color). This allows for direct mapping of these variables to "tags" for routing.
  • T5 with Adapters for GLUE (T5-GLUE): Fine-tuning a T5-small model on the GLUE benchmark, a collection of nine natural language understanding tasks. Here, the dataset of each example is used as the tag.
  • ResNet with Adapters for DomainNet (Res-Dom): Fine-tuning a ResNet18 model on the DomainNet dataset, an object recognition task with six distinct domains. The domain of each image serves as the tag.

Key Insights and Ideas

  • Gradient Estimation is the Bottleneck: The paper strongly suggests that the primary reason learned routing underperforms heuristic routing is the difficulty in accurately estimating gradients for discrete routing decisions.
  • Heuristic Routing is King (for now): Hand-designed routing strategies consistently outperform learned routing across all tested scenarios and gradient estimators.
  • Supervision is a Game-Changer: Even a tiny amount of supervision (e.g., 1% of data with tag annotations) can dramatically improve learned routing performance, sometimes even matching or exceeding heuristic routing.
  • "Tag+" Routing Advantage: For GLUE, a specific heuristic ("Tag+") that routes two related tasks (MNLI and RTE) to the same subnetwork performed slightly better than the best learned routing, even with supervision, suggesting that learned methods might struggle to discover such nuanced relationships.
  • Top-k's Unique Property: The Top-k estimator, which scales the subnetwork output by its probability (making it not strictly discrete), showed slightly better performance in one scenario, hinting that its continuous nature might be beneficial.

Key Results

  • In all three experimental settings (DAE-Syn, T5-GLUE, Res-Dom), learned routing consistently underperformed heuristic routing strategies like "Tag Routing."
  • The best learned routing scheme underperformed heuristic routing by 0.8% in T5-GLUE and 1.0% in Res-Dom.
  • Adding supervision for routing decisions significantly boosted performance. On DAE-Syn and T5-GLUE, learned routing with supervision matched the performance of "Tag Routing."
  • In T5-GLUE, with just 1% of training examples supervised, the Top-k estimator achieved performance (81.9%) that nearly matched the "Tag+" heuristic (82.0%).
  • Hash routing and monolithic routing were consistently the worst-performing methods, indicating that learned routing, despite its flaws, is at least better than random or no routing.

Limitations and Future Work

  • Limited Scope of Gradient Estimators: The study only evaluated a few common gradient estimators. Other, potentially more advanced, techniques might yield different results.
  • Small Models and Few Tasks: The experiments used relatively small models and a limited number of tasks/domains. Scaling up to larger models or more complex multi-task scenarios could reveal different challenges.
  • Example-Level Routing: All models used example-level routing. The paper suggests that routing at the token or task level might behave differently and warrants further investigation.
  • Discoverability of Tags: For the Res-Dom dataset, tag supervision only partially closed the gap, suggesting that the domain tags might not be easily reconstructible from the input alone, making them harder for learned routing to discover.
  • Future Work: The authors propose further research into developing better conditional computation mechanisms and training techniques, particularly focusing on improving gradient estimation and exploring more sophisticated routing strategies. The finding that minimal supervision is effective also opens avenues for semi-supervised or weakly-supervised routing.

Summary updated

BibTeX
@inproceedings{mohammed2022models,
  author = {Muqeeth Mohammed and Haokun Liu and Colin Raffel},
  title = {{Models with Conditional Computation Learn Suboptimal Solutions}},
  booktitle = {ICBINB @ NeurIPS},
  year = {2022},
  url = {https://openreview.net/forum?id=s9wWlWOUVF9},
}
Figure