Abstract
Large Language Models (LLMs) offer state-of-the-art performance for text processing but are often too expensive for high-volume data streams. This paper proposes Online Cascade Learning, a framework that arranges models of increasing complexity into a cascade. By allowing smaller models to learn from the LLM's outputs in real-time, the system achieves LLM-level accuracy while reducing inference costs by up to 90%.
Introduction
The deployment of LLMs for real-time monitoring—such as detecting hate speech or fact-checking news—is frequently hindered by prohibitive inference costs. Traditional approaches like knowledge distillation or static cascades require large, pre-labeled datasets, which are often unavailable or become obsolete as data distributions shift in a streaming environment.
Online Cascade Learning addresses this by building a system that learns "on the fly." It adapts to evolving data streams without requiring human-labeled data, using the LLM itself as a real-time supervisor for smaller, more efficient models.
Methodology
The framework treats the inference process as an episodic Markov Decision Process (MDP), optimized via online imitation learning.
The system operates through four primary components:
- The Cascade: Queries are processed through a sequence of models ($m_1, m_2, \dots, m_N$), ranging from simple logistic regression to high-capacity LLMs like GPT-3.5.
- Deferral Policy: Each stage includes a "gatekeeper"—a small Multi-Layer Perceptron (MLP)—that assesses the confidence of the current model's prediction. If confidence falls below a threshold, the query is deferred to the next model in the sequence.
- Online Imitation Learning: When a query reaches the final LLM, its output is treated as the ground truth. This label is used to update the preceding smaller models and their deferral policies using Online Gradient Descent (OGD).
- Theoretical Foundation: The authors demonstrate that this approach is "no-regret," ensuring that performance converges to the optimal fixed cascade policy over time.
Experimental Evaluation
The framework was tested across four benchmarks representing different linguistic challenges: IMDB (sentiment), HateSpeech (imbalanced classification), ISEAR (emotion detection), and FEVER (fact-checking).
A key insight from the evaluation is the system's ability to handle distribution shifts. Because the learning is online, the system can adapt to changes in input length or topic. If the smaller models encounter unfamiliar patterns, the system temporarily increases deferrals to the LLM until the smaller models are updated and regain confidence.
Key Results
The experimental results highlight significant gains in both efficiency and performance.
- Cost Efficiency: On the HateSpeech dataset, the system reduced LLM inference costs by over 90% while maintaining accuracy and recall levels comparable to the standalone LLM.
- Performance Parity: In tasks like IMDB and ISEAR, the cascade eventually matched or slightly exceeded zero-shot LLM performance as the smaller models specialized in the specific stream distribution.
- Computational Overhead: The cost of updating the smaller models is negligible; training costs were estimated to be approximately 53 million times smaller than the inference cost of a single Llama-2-70B token.
Conclusion and Future Work
Online Cascade Learning provides a robust solution for deploying LLM-quality inference on high-volume streams at a fraction of the cost. While currently focused on classification, future research may explore extending this framework to generative tasks, where measuring confidence and "ground truth" is more complex. Additionally, the system's reliance on API-based LLMs currently limits the ability to fine-tune the "expert" model itself, representing another avenue for future development.
Summary updated