TL;DR
ElasticLM introduces "compute elasticity" to language models, allowing them to dynamically adjust their size and complexity on-the-fly based on real-time request volume. By training a single model that contains an ensemble of parameter-sharing "SubLMs," it avoids the rigid latency-performance tradeoffs of traditional static models, ensuring high accuracy during low traffic and low latency during traffic spikes.
What Problem Does This Paper Address?
Deploying large-scale pretrained language models (LMs) is a balancing act. While huge models offer peak performance, they are often too slow for real-time applications. Conversely, compressed models (via knowledge distillation) offer lower latency but at a permanent cost to accuracy.
The authors identify a critical flaw in this "static tradeoff": real-world traffic is highly variable. * During traffic peaks: A large model causes request queues to explode, leading to unacceptable latency. * During traffic lulls: A small, compressed model provides sub-optimal results even though there is plenty of idle compute capacity to run a better one.
As illustrated in Figure 1, a static model—whether large or small—is "inadequate" for at least one of these scenarios.
Methods
The authors propose ElasticLM, which consists of three core components:
- Elastic Structure: Instead of one fixed architecture, ElasticLM is designed as an ensemble of nested SubLMs. These SubLMs share parameters; a smaller SubLM is simply a subset of a larger one. The authors use structured pruning (removing specific attention heads and feedforward neurons) based on an "Expressive Score" derived from Taylor expansion to determine which parts of the model are most vital.
- Elastic Optimization: To ensure every possible SubLM performs well, the authors use a "once-for-all" training approach. During each optimization step, they traverse and update all defined SubLMs simultaneously using task-agnostic distillation from a large teacher model.
- Elastic Schedule: This is the runtime controller. It monitors the instant queue size ($g$) and a constant latency constraint ($T$). If the queue grows, the scheduler automatically shifts to a smaller, faster SubLM to keep latency under the threshold.
The framework is further specialized for Information Retrieval (IR) as ElasticDenser (for dual-encoder retrieval) and ElasticRanker (for cross-encoder reranking).
Datasets
The authors evaluated ElasticLM across several standard benchmarks:
- Language Understanding: The GLUE benchmark (SST-2, MRPC, STS-B, QQP, MNLI, QNLI, RTE).
- Information Retrieval: Natural Questions (NQ), TriviaQA, and MS MARCO (both Passage and Document ranking).
- Pretraining/Distillation: 35 million examples from Wikipedia.
Key Insights and Ideas
- Parameter Sharing is Key: By nesting SubLMs, the model only occupies the memory of its largest version while providing the flexibility of many smaller ones.
- Pruning as Initialization: The authors found that initializing the elastic structure by pruning a teacher model (like BERT or Condenser) is significantly more effective than random initialization.
- Asymmetric Elasticity in IR: For retrieval tasks, the authors kept the passage encoder at maximum size (since passages are encoded offline) and only made the query encoder elastic. This maintains high retrieval quality without adding online latency.
- Controllable Compute: Unlike "Early Exiting" methods that depend on the complexity of the input text, ElasticLM is controllable based on the system state (the request stream).
Key Results
- Competitive Performance: In offline evaluations, ElasticLM matched or outperformed state-of-the-art static baselines like TinyBERT and MiniLM at equivalent FLOP counts. For example, ElasticLM30% achieved a GLUE score of 85.7, significantly better than MiniLM at a similar scale.
- Robustness to Load: In online simulations, while static large models saw their latency "explode" as concurrency increased to 100, ElasticLM successfully adjusted its structure to maintain stable latency within the defined constraints.
- IR Specialization: ElasticDenser10% outperformed its static counterpart by a 1.9 absolute margin on MS MARCO, proving that the elastic optimization process itself can act as a powerful regularizer.
Limitations and Future Work
The authors acknowledge that their online simulation is somewhat simplified, as it waives the processing time for the actual passage search and focuses primarily on query encoding.
Future work aims to:
- Integrate ElasticDenser and ElasticRanker into a complete, end-to-end IR pipeline.
- Test the system under more complex, real-world multi-node concurrency scenarios.
- Explore adapting the elastic framework to other specialized LMs beyond BERT-style encoders.
Summary updated