Inspiration

What it does

How we built it

Challenges we ran into

Accomplishments that we're proud of

What we learned

What's next for ChronoEdge: Closed-Loop Telemetry Hybrid AI Governor

Inspiration

While working on embedded firmware and hardware-level projects, I noticed how often AI coding assistants freeze inside RF-shielded labs, on trains, or over congested campus Wi-Fi—a problem known as "Lie-Fi", where a device shows full signal bars while packets stall for 1,500–2,000 ms. Static PREFER_ON_DEVICE or PREFER_IN_CLOUD settings fail in these conditions: cloud-only requests hang, while naive local execution overflows smaller on-device context windows on large RTL or C++ files. I built ChronoEdge (https://chronoedge-hybrid-ai.web.app) as a zero-server closed-loop telemetry governor that dynamically balances on-device Chrome Built-in AI (Gemini Nano) and Cloud Gemini 2.0 Flash (Firebase AI Logic).

What It Does

Before every inference request, ChronoEdge samples real-time client network and memory telemetry and routes the workload across three execution paths:

  1. LOCAL_NANO (Zero-Egress Edge Offload): Compact queries ($S_{\text{local}} \ge 0.35$) and degraded networks ($\text{RTT} > 500\text{ ms}$) run directly on-device via Chrome's LanguageModel API with $0\text{ KB}$ cloud egress, keeping proprietary C++ and SystemVerilog code on the user's machine.
  2. CLOUD_GEMINI (Elastic Cloud Escalation): Heavy multi-module RTL and Clock-Domain Crossing (CDC) audits ($>750\text{ tokens}$) escalate to Cloud Gemini via firebase/ai (GoogleAIBackend) whenever RTT is healthy.
  3. COMPRESSED_LOCAL_NANO (Context-Safe Fault Recovery): Under true offline states, severe Lie-Fi, or a cloud timeout ($>8\text{ s}$), ChronoEdge strips verbose comments and debug logs while preserving hardware register and module declarations so Gemini Nano completes the diagnostic safely without context overflow.

Mathematical Routing Policy

ChronoEdge tracks an Exponential Moving Average (EMA) of measured local latency $L_{\text{measured}}$:

$$\text{EMA}{\text{new}} = 0.7 \cdot \text{EMA}{\text{old}} + 0.3 \cdot L_{\text{measured}}$$

Using network $\text{RTT}$, client memory pressure $M \in [0, 1]$, payload token volume $T$, and target latency budget $B_{\text{ms}}$, it computes a continuous local feasibility score:

$$S_{\text{local}} = 0.45 \cdot \min\left(1.5, \frac{B_{\text{ms}}}{\max(50, \text{EMA}_{\text{local}})}\right) + 0.30 \cdot (1 - M) - 0.40 \cdot \min\left(1.0, \frac{T}{1000}\right)$$

How I Built It

  • On-Device Runtime: Integrated Chrome Built-in AI (LanguageModel.availability() and LanguageModel.create()) with live model-readiness checks.
  • Cloud Inference & Security: Connected Firebase AI Logic (GoogleAIBackend with gemini-2.0-flash), protected in production with Firebase App Check (reCAPTCHA Enterprise), and hosted on Firebase Hosting.
  • Telemetry HUD & Validation: Built in React, TypeScript, and Vite with a live Scheduler Decision Trace HUD, a one-click Lie-Fi fault simulator ($1850\text{ ms}$ RTT), and a 4-gate automated Node.js test suite (node test.mjs).

Challenges & What I Learned

  • Catching "Lie-Fi" Beyond navigator.onLine: Standard browser online checks return true even when packets stall. Adding an active sub-second fetch RTT probe allowed the governor to detect high latency before a cloud call could hang.
  • Tail-Latency Recovery: Combining an $8\text{ s}$ cloud timeout guard with structural code pruning ensured that sudden Wi-Fi drops mid-audit fall back cleanly to local Gemini Nano.
  • Key Takeaway: Effective hybrid AI is invisible to the end user—combining live hardware telemetry, cryptographic client attestation, and graceful degradation delivers fast, reliable assistance without custom backend infrastructure.

Built With

Share this project:

Updates

Submission history