EXPERIMENT_041 // HYBRID.LOCAL/CLOUD.DATA-SENSITIVITY.ROUTER

Hybrid Local/Cloud Data-Sensitivity Router

Types a question and a rule-based classifier decides, by data sensitivity alone rather than cost or latency, whether a local model or a cloud model answers it, then shows the full decision trace: what was flagged, why, and which model actually responded.

TEXT INPUTCREATED 2026.09.07BETA

LOADING EXPERIMENT...

Perplexity's Hybrid Compute on Mac (GA, 2026-09-01) starts a task in the cloud, flags sensitive content with an open-sourced classifier, and hands off to a local model — routing by sensitivity, never cost or latency. This experiment builds that same shape of decision as a generalisation of a gate this fleet already runs: the Dana/DeepSeek residency check, today a static repo allowlist, not a real-time classifier. Type a question and a rule-based classifier (email, SSN, credit-card, phone, API-key, account-number, address, and confidentiality-marker patterns) decides whether a local model (via local-mcp-service over Ollama) or a cloud model (Anthropic via @diabolicallabs/llm-client) answers it — the classifier's verdict is the only input to that decision, and the decision trace makes that visible rather than leaving it implicit.

HOW IT WORKS

A rule-based classifier, not a keyword blocklist

classifier.ts runs eight independent regex-based rules — email, US SSN shape, credit-card number (validated with a Luhn checksum to cut false positives on ordinary long digit runs), phone number, API-key/credential patterns, account-number references, street addresses, and explicit confidentiality markers. Every input gets a human-readable reason regardless of verdict; a clean input still returns "No sensitivity patterns matched — routed to cloud" rather than an empty result. Perplexity's own open-sourced classifier (PII-Tracer, a 0.6B-parameter model on Hugging Face) was evaluated and not reused — its licence could not be conclusively confirmed in this build, and even a permissive one would need a separate model-serving runtime this Next.js stack doesn't have; the brief explicitly sanctions rule-based patterns as the fallback regardless.

The route guard is the only thing that can pick cloud

selectRoute() takes nothing but the classifier's verdict — sensitive routes local, clean routes cloud, with no cost or latency signal anywhere in its input type. orchestrator.ts is the single module that imports both the local and cloud clients, and an automated test battery mocks both at the module boundary and asserts the cloud client's mock is called zero times across every flagged fixture — a structural proof about which function ran, not just about the response shape.

Two genuine routes, one honest degrade path

The local leg calls local-mcp-service's gateway over plain HTTP to a self-hosted Ollama model (gemma-mini); the cloud leg calls Anthropic's claude-haiku-4-5 through @diabolicallabs/llm-client, matching this repo's existing lazy-singleton client pattern. If the local service is unreachable, the UI shows a labelled degraded state — the EXP_017 partial-failure pattern — and the flagged input is never silently rerouted to cloud instead.

Recorded on the public deployment, live in local dev

The public deployment can't reach a local Ollama instance, so it never offers a live input box — it renders two real decision traces (one flagged→local, one clean→cloud), both captured live on 2026-09-07 by scripts/capture-dsr-traces.ts against a running local-mcp-service instance and the real Anthropic API, each carrying a visible RECORDED badge and its capture note. Live mode — an actual text box calling the real classify-and-route route — exists only behind a build-time env flag for local development; there's no runtime toggle a deployed-page visitor could use to relabel a recorded answer as live.

WHAT THIS PROVES

A routing decision can make its own criterion visible instead of implying it: every reason shown in the UI traces back to one of eight named rules, and an automated test proves structurally — not just by inspection — that a flagged input's text never reaches the cloud client function, which is the generalisation this experiment set out to demonstrate over the fleet's own static-allowlist residency gate.

Honest recorded-vs-live labelling doesn't require faking anything: both recorded traces on the deployed page are real model outputs from a real local session, not placeholder content, and the same capture script that produced them can be re-run at any time the local or cloud environment changes.

← BACK TO PLAYGROUND

SYSTEM.INT // 2026 LABS_CORE v2.111.0

LATENCY: STATUS: NOMINAL