Under the hood ยท the private pipeline

Watch your message flow through 12 stages

Every Pro request runs the same guarded path โ€” redacted, routed, answered, scored. Follow the packet as it moves, see what runs in parallel, and how each answer quietly makes the next one better.

Packet:๐Ÿ“ฅ raw input
You paste into Lyra chat โ†’
โ€œMy name is John Smith, email john@acme.com โ€” summarise this quarter's sales.โ€
๐Ÿ“Ž receipt.jpg ยท image inputmultimodal โ€” coming to chat
โ‘  Ingress โ€” always first
๐Ÿ›ก๏ธ
01PII Guard
Presidio

Names, emails, cards โ†’ redacted before anything else touches the text

โ‘ก Safety gate
๐Ÿšฆ
02Safety Check
LLM-Guard

Prompt-injection & unsafe content gate โ€” blocks here or proceeds

โ‘ข Pre-flight โ€” runs in parallel
These four kick off together on the cleaned text
โ‡„run concurrently
โšก
03Semantic Cache
Redis

Seen a near-identical ask? Return instantly, skip the model entirely

๐Ÿ—œ๏ธ
04Token Compress
LLMLingua

Prunes the prompt ~2โ€“3ร— โ€” fewer tokens, lower cost, faster

๐Ÿง 
05Memory Inject
Mem0 + Chroma

Pulls your relevant past context so the answer knows you

๐Ÿงญ
06Model Router
LiteLLM

Classifies intent โ†’ picks the cheapest capable model (local vs cloud)

โ‘ฃ Generate
๐Ÿค–
07LLM Inference
Ollama / Cloud

The actual generation โ€” the one expensive step on the hot path

โœ“ Your answer is delivered here
Everything below runs in the background โ€” you never wait for it
โ‘ค Deliver โ€” your answer arrives here
๐Ÿงน
08PII Scrub Output
Presidio

Scrubs any personal data out of the reply โ€” then it's yours

โ‘ฅ Learn โ€” async, after you're answered
Off the hot path โ€” you never wait for these
โ‡„deferred ยท async write-back
โœ…
09Response Validation
Ragas โ†’ QV-RMasync

Scores quality โ†’ the reward signal that trains the whole pipeline

๐Ÿ’พ
10Memory Store
Chromaasync

Saves this turn so future answers keep your context

๐Ÿ“ฅ
11Cache Store
Redisasync

Caches the answer so the next similar ask is instant

๐Ÿ“’
12Audit Log
Postgresasync

Immutable, PII-free record โ€” model, cost, quality, versions

Speed by design

Parallel where it can be, deferred where it should be

Not every stage waits its turn. The hot path is kept short โ€” the write-back tail is pushed off it entirely.

๐Ÿ”’
1 step is truly blocking-first
PII redaction (Stage 1) must run before anything else sees the text. Non-negotiable โ€” it's the privacy guarantee.
โ‡„
4 pre-flight stages run concurrently
Cache lookup, Compress, Memory inject and Route all read the same cleaned text โ€” they fan out in parallel instead of queuing.
๐Ÿค–
1 expensive step: inference
The model call is the real cost on the hot path. A cache hit or a local route can skip or shrink it.
๐Ÿ“ค
You get your answer at Stage 8
After the output scrub, the reply is yours. Perceived latency ends here.
โ™ป๏ธ
4 write-tail stages go async
Validate, Memory-store, Cache-store and Audit run after delivery โ€” fire-and-forget, off your critical path.
Net effect: you wait for redaction โ†’ parallel pre-flight โ†’ one model call โ†’ output scrub. The four scoring/storage stages happen after you already have your answer.
It learns from itself

A reward model at Stage 9

Response validation isn't just a pass/fail. It emits a quality score โ€” the reward signal that tunes routing, caching and compression, blending reinforcement learning with supervised human calibration.

โ™ป๏ธ
Reinforcement
Every answer becomes a reward

Stage 9 scores each finished run (task-completion, grounding, safety, persona-fit, conciseness). That composite reward is fed back as a bandit signal to the Router (which model to pick), the Cache (spot quality drops on a hit) and Compress (how hard to prune).

๐ŸŽ“
Supervised
Humans set the gold standard

A calibrated set of 200 human-rated transcripts anchors the scorer. Lowest-confidence runs + every hard-fail are routed to a review UI; corrections flow back into the gold set and a weekly LoRA refresh distils the judge into a fast on-box scorer.

๐Ÿ›ก๏ธ
Hard-fail override
Safety can't be averaged away

Any tier violation, PII leak past scrub, or hallucinated action zeroes the reward and pages a human โ€” it never quietly averages into a 'good enough' score.

โœ… Stage 9 ยท quality.scoredโ”€โ”€โ–ถ๐Ÿงญ Router rewardโšก Cache quality-gate๐Ÿ—œ๏ธ Compress arm
๐Ÿ‘ค Human review ยท 200 gold setโ”€โ”€โ–ถ๐Ÿ” Weekly LoRA refreshโ”€โ”€โ–ถโšก Fast on-box scorer

Runs async on PII-scrubbed transcripts only ยท every score is auditable (model + rubric version + input hash)

Private by construction, smarter every day

Local is free forever. Pro adds the full guarded pipeline.