Skip to main content
QUICK REVIEW

[Paper Review] Controlling Computation versus Quality for Neural Sequence Models

Ankur Bapna, Naveen Arivazhagan|arXiv (Cornell University)|Feb 17, 2020
Topic ModelingComputer Science33 references13 citations
TL;DR

This paper proposes the Conditional Computation Transformer (CCT), a method that dynamically controls inference-time computation in Transformer models using learnable control networks. By training with different computation budgets via multi-task learning, CCT achieves competitive performance at full budget and significantly outperforms baselines under constrained budgets, enabling efficient, adaptive inference across input complexity and resource limits.

ABSTRACT

Most neural networks utilize the same amount of compute for every example independent of the inherent complexity of the input. Further, methods that adapt the amount of computation to the example focus on finding a fixed inference-time computational graph per example, ignoring any external computational budgets or varying inference time limitations. In this work, we utilize conditional computation to make neural sequence models (Transformer) more efficient and computation-aware during inference. We first modify the Transformer architecture, making each set of operations conditionally executable depending on the output of a learned control network. We then train this model in a multi-task setting, where each task corresponds to a particular computation budget. This allows us to train a single model that can be controlled to operate on different points of the computation-quality trade-off curve, depending on the available computation budget at inference time. We evaluate our approach on two tasks: (i) WMT English-French Translation and (ii) Unsupervised representation learning (BERT). Our experiments demonstrate that the proposed Conditional Computation Transformer (CCT) is competitive with vanilla Transformers when allowed to utilize its full computational budget, while improving significantly over computationally equivalent baselines when operating on smaller computational budgets.

Motivation & Objective

  • To address the inflexibility of standard Transformers, which use fixed computation per input regardless of input complexity or available resources.
  • To enable dynamic, on-the-fly adjustment of computation per example during inference, based on input difficulty and available computational budget.
  • To train a single model that can operate efficiently across multiple computation-quality trade-offs, without retraining for each budget.
  • To develop a differentiable training scheme that bridges the gap between soft gating during training and discrete inference-time decisions.
  • To extend conditional computation beyond decoder layers to include encoder and attention sub-networks, broadening applicability.

Proposed method

  • Introduces control networks per Transformer layer that output continuous values between 0 and 1 during training, using a sigmoid-activated gate function.
  • Uses stochastic soft gating during training: the output of each layer is a weighted sum of the full computation and the residual, controlled by the gate value.
  • Applies zero-mean Gaussian noise to the gate network’s pre-activation during training to encourage discrete behavior and improve generalization.
  • At inference, gates are thresholded at 0.5: if gate ≥ 0.5, the sub-network is executed; otherwise, it is skipped.
  • Trains the entire model end-to-end using a multi-task objective, where each task corresponds to a different target computation budget.
  • Applies the framework to both encoder and decoder sub-networks, including key-value projections in self-attention, enabling fine-grained control over computation.

Experimental results

Research questions

  • RQ1Can we train a single Transformer model to dynamically adjust its computation per input based on input complexity and available budget?
  • RQ2How does conditional computation via learnable control networks affect model quality and efficiency across different computation budgets?
  • RQ3Can we train such models end-to-end using differentiable soft gating, while still enabling discrete inference-time decisions?
  • RQ4Does the model learn to allocate computation efficiently across inputs of varying difficulty?
  • RQ5Can the proposed method be applied beyond decoder layers to other components like attention projections or encoder layers?

Key findings

  • The Conditional Computation Transformer (CCT) achieves performance on par with standard Transformers when given its full computational budget.
  • On smaller computational budgets, CCT significantly outperforms computationally equivalent baselines in both WMT English-French translation and BERT-style unsupervised representation learning.
  • Control network outputs reveal that the model learns to activate more complex sub-networks on harder inputs, demonstrating intelligent allocation of computation.
  • The model effectively learns to skip unnecessary computation on easier examples, reducing inference cost without significant quality loss.
  • The multi-task training objective enables a single model to generalize across multiple computation budgets, supporting on-demand inference.
  • Visualization shows that key-value sub-networks are selectively activated on tokens that correspond to structurally complex parts of the translation, indicating meaningful computation control.

Read this paper

Open the full text in the Nubint reader and ask about any passage as you read.

Read this paper on Nubint

This review was generated by AI from the original paper. Please check the paper before citing it.