Back

case study NUYDA

End-to-end voice-to-RAG pipeline: from speech input to spoken response — covering ASR, embeddings, vector retrieval, LLM reasoning, safety guardrails, and TTS, with answers grounded in real documents in under a second.

Project

Nuyda — Voice-Powered RAG AI System Nuyda — Voice-Powered RAG AI System screen Nuyda — Voice-Powered RAG AI System mobile

Nuyda — Voice-Powered RAG AI System

Tech Stack

PythonWhisperFAISSGPT-4o-miniLangGraphNeMo GuardrailsEdge TTSVue.jsMapLibre GL

Problem

  • LLMs hallucinate — they make up answers when they don’t know something, producing untrustworthy responses and factual errors.
  • LLMs have a knowledge cutoff — they can’t answer questions about recent or private domain documents.
  • Speech adds latency — ASR + LLM + TTS each add 200–800ms, pushing total latency past 2–3 seconds and breaking natural conversation.
  • ASR errors propagate — misheard words become wrong queries, so retrieval fails and the LLM gets bad context.
  • Vector DB queries are slow — 50–300ms per retrieval blows the 200ms budget for natural voice flow.
  • No safety guardrails — LLMs can output harmful or PII content, creating compliance risk and user harm.
  • Cloud-only isn’t always viable — privacy, offline, and cost concerns block deployment in sensitive environments.

Solution

  • Wrapped RAG in a voice interface: speech-to-text → query embedding → retrieve + rerank → LLM with safety filter → streaming text-to-speech.
  • Two-pass endpointing triggers RAG on the 240ms interim transcript instead of waiting 800ms for the final transcript — saving ~560ms of perceived latency.
  • Predictive semantic cache pre-fetches likely follow-up chunks in the background (Slow Thinker / Fast Talker dual-agent) for sub-millisecond retrieval on cache hits.
  • Streaming TTS speaks LLM tokens as they arrive (110ms first-token-to-speech) with barge-in so users can interrupt mid-response.
  • Layered safety: input filtering before RAG plus output filtering with PII detection across 23 categories and 20+ languages — deployable cloud, on-device, or hybrid.

Result

~500ms Voice Response

Cache-hit turns answer in roughly half a second end-to-end — fast enough for natural conversation.

316x Retrieval Speedup

Predictive FAISS semantic cache serves 75% of follow-ups in <1ms instead of 110ms vector DB round-trips.

Grounded Zero Hallucination

Every answer is retrieved from real document chunks first — the LLM says “I don’t know” when context is missing.