The Hybrid Token-Efficient Routing Agent (HTERA) is a novel dual-model architecture designed to achieve high-performance, cost-effective, and mathematically precise natural language processing entirely optimized for restricted compute environments. Built for speed and architectural stability, the project implements a two-stage cognitive triage pipeline. At the edge, a custom 30-Million parameter Mini-BERT model acts as a low-latency gateway router, categorizing incoming instructions into four distinct operational complexity tiers within 6.42 milliseconds. For computational, logic, and mathematical queries, the pipeline routes traffic to a locally hosted, dynamically quantized INT8 Qwen-0.5B model. To guarantee absolute precision and eliminate neural network hallucinations, the local model operates as a Program-Aided Language (PAL) engine. Rather than computing math via raw attention weights, it dynamically synthesizes Python code scripts and executes them inside an isolated memory sandbox, capturing stdout for flawless arithmetic verification. For complex contextual analysis or security traps, the pipeline implements a strict JSON Truth Policy. If the local agent encounters data gaps or safety restrictions, it bypasses generation and immediately escalates the workload via a secure web proxy to the premium Fireworks API. Fully monitored via AgentOps, this hybrid architecture drops processing latencies, maintains zero CPU overhead, and achieves complete execution truth under a strict 30-second production SLA.
Category tags: