Abstract
Processing massive, real-time streaming transcripts (e.g., live e-commerce) presents a significant challenge for Large Language Models (LLMs) due to context window limitations, high costs, and varying model strengths. We present Role-RL, a framework that decomposes long-context processing into specialized roles and uses reinforcement learning to dynamically assign the optimal LLM to each sub-task. By matching model "personalities" to specific requirements, Role-RL achieves a 93.2% average recall while reducing operational costs by approximately 80% compared to monolithic high-tier model deployments.
Introduction
The rise of 24/7 streaming content—from live shopping to automated news—creates a bottleneck for real-time information extraction. Standard LLMs often suffer from the "lost in the middle" phenomenon in long documents and are frequently too slow or expensive for continuous processing. Furthermore, the rapid proliferation of models (GPT-4, Claude, Llama, etc.) makes manual pipeline optimization a moving target, as each model possesses unique strengths in reasoning, formatting, or efficiency.
Methods
Role-RL addresses these challenges through a two-pronged approach: an Online Long-context Processing (OLP) pipeline and a Reinforcement Learning-based Role Manager.
The OLP pipeline splits the input stream into semantic chunks and processes them through six specialized roles:
- Topic Finder & Locator: Identifies and timestamps specific subjects.
- Topic Locator: Finds the exact indices for identified topics.
- Relationship Checker: Manages redundancy by merging or deleting topics.
- Content Organizer: Summarizes content into structured aspects (e.g., Price, Description).
- Format Checker & Chunk Splitter: Ensures clean output and manages transitions between chunks to prevent context loss.
The Role Manager is a Q-learning agent that selects the best LLM for each role from a pool. It is guided by an Advisory Board of high-performing models that evaluate "worker" outputs. The agent optimizes a reward function $R = \text{accuracy} - (\text{cost} \times k_1) - (\text{latency} \times k_2)$, ensuring the system finds the most cost-effective model that maintains high accuracy.
Datasets and Task Description
The system was evaluated on OLP-MINI, a new benchmark of 600 live e-commerce transcripts from TikTok and Alibaba. The task involves extracting structured product details from raw transcripts.
Additional testing on the LongBench dataset (MultiNews and LSHT) demonstrated the framework's generalizability across different languages and domains.
Key Results and Insights
- Efficiency and Accuracy: Role-RL achieved a 93.2% recall on OLP-MINI while slashing costs by 79.4%. On LongBench, the OLP pipeline improved recall by 53.6 percentage points over standard techniques.
- Model Specialization: The RL agent successfully identified "sweet spots"—for instance, delegating Relationship Checking to smaller models like Llama-3-8b, which performed comparably to GPT-4o at a fraction of the cost.
- Rapid Adaptation: The system effectively "promotes" models like Claude-3-Opus to complex tasks while delegating simpler formatting tasks to more efficient models within a few hundred rounds of learning.
Conclusion
While Role-RL significantly optimizes long-context processing, the use of an Advisory Board for evaluation still incurs some overhead. Future work will explore periodic board consultation and expanding roles to handle multimodal inputs like direct video and audio streams.
Summary updated