E-LANG: Energy-Based Joint Inferencing of Super and Swift Language Models

Mohammad Akbari, Amin Banitalebi-Dehkordi, Yong Zhang

Abstract

The pursuit of higher accuracy in Natural Language Processing (NLP) has led to the development of massive models like GPT-3 and T5-11B. However, their immense computational cost makes them impractical for real-time applications. We present E-LANG, a dynamic inference framework that routes inputs between a large "Super" model and a lightweight "Swift" model using energy-based scores. E-LANG achieves up to a 3.3x speedup on major benchmarks while maintaining or exceeding state-of-the-art accuracy.

Introduction

Modern NLP relies on gargantuan models that offer exceptional performance at the cost of high latency and FLOPs. Existing solutions like model compression (pruning, distillation) often result in permanent accuracy drops. Dynamic inference methods, such as early-exiting, typically require complex architectural changes and are often limited to specific tasks. E-LANG addresses these challenges with an architecture-agnostic routing mechanism that works for both encoder-only and encoder-decoder structures without retraining the primary heavy-duty models.

Methodology: Energy-Based Routing

The core innovation of E-LANG is its routing mechanism powered by Energy-Based Models (EBMs). Instead of relying on potentially misleading softmax confidence scores, E-LANG calculates the negative free energy of latent space representations. This "energy" indicates how well an input fits the distribution of the "Swift" model's training data.

The E-LANG architecture for dynamic inference routing.

Inputs with low energy (high likelihood) are deemed "easy" and processed by the Swift model. High-energy inputs are routed to the Super model. For encoder-decoder models like T5, a single linear "energy head" is added after the encoder, allowing routing decisions to be made before the expensive decoding phase. This approach treats both models as "black boxes," enabling flexible pairing of different model sizes.

Experimental Evaluation

E-LANG was evaluated on standard NLP benchmarks including GLUE (e.g., SST2, CoLA, MNLI), SuperGLUE (e.g., BoolQ, WiC, WSC), and WMT English-to-Romanian translation.

Key Results

E-LANG demonstrated significant efficiency gains across all tasks. Using T5-11B as the Super model and T5-Large as the Swift model, the system achieved a 3.3x average speedup on GLUE and 2.9x on SuperGLUE while matching the Super model's accuracy.

Performance vs. FLOPs across various GLUE and SuperGLUE tasks.

Notably, in tasks like QNLI and MRPC, the joint system outperformed the standalone Super model. This suggests the routing mechanism filters out "easy" samples where the larger model might otherwise over-complicate its reasoning and introduce errors. On the WMT EnRo task, E-LANG maintained BLEU scores with 1.4x fewer FLOPs. Real-world latency reductions were also observed, such as a 4.1x speedup on the WSC task.

Discussion and Future Work

While E-LANG provides a powerful "knob" for adjusting the accuracy-latency trade-off via the energy threshold ($t$), finding the optimal threshold currently requires validation data. Future work could extend this to multi-model routing hierarchies (e.g., Tiny -> Small -> Base -> Large -> Super) and explore ways to generalize the energy head across different tasks.

Conclusion

E-LANG offers a generic, efficient framework for scaling NLP inference. By leveraging energy-based scores for intelligent routing, it bridges the gap between the high performance of massive models and the practical requirements of real-world deployment.

Summary updated

BibTeX
@inproceedings{akbari2022e,
  author = {Mohammad Akbari and Amin Banitalebi-Dehkordi and Yong Zhang},
  title = {{E-LANG: Energy-Based Joint Inferencing of Super and Swift Language Models}},
  booktitle = {Annual Meeting of the Association for Computational Linguistics},
  year = {2022},
  doi = {10.18653/v1/2022.acl-long.359},
}
Figure