I am getting metrics around this - *E2E (End-to-E...
# ask-ai
b
I am getting metrics around this • E2E (End-to-End) • ◦ Max: 3206.03 ◦ Min: 1014.68 • LLM (Large Language Model) • ◦ Max: 767.95 ◦ Min: 391.72 • TTS (Text-to-Speech) • ◦ Max: 449.96 ◦ Min: 421.33 • EOU (End of Utterance) • ◦ Max: 2001.87 ◦ Min: 201.00 llm was gpt-4o tts - elven labs stt - deepgram is there any way that the latency can be improved further. Or did any one using livekit, anyopne reported a latency better than this ?
t
Thanks for reaching out, Nitish. I'm an AI assistant and I'm here to help. Give me a moment while I research this topic.
Hey there! To help improve latency for E2E, LLM, TTS, and EOU metrics, here are some friendly tips you might find useful: • Optimize Network Proximity: Try placing your server closer to the LLM, STT, and TTS services. This can really cut down on round-trip time. • Use Streaming APIs: Streaming APIs for STT, LLM, and TTS are great because they let you process parts of the data as they come in, which means less waiting around. • Parallel Processing: Whenever you can, run tasks like transcription and LLM inference at the same time to speed things up. • Analyze Metrics: LiveKit’s metrics API is super helpful for spotting where delays happen. Keep an eye on TTFT (LLM responsiveness), TTFB (TTS responsiveness), and EOU delay. • Low-Latency Providers: Picking providers with lightweight or edge-optimized models can make a big difference for real-time interactions. • Enable Telemetry: Don’t forget to use LiveKit’s OpenTelemetry integration for a deeper look into performance. Following these steps should help you bring down latency across your pipeline. If you want, I’m here to help with any of these—just let me know! Sources: Agent Testing & Evaluation | livekit/livekit_composite | DeepWiki | Voice Assistants | livekit/livekit_composite | DeepWiki | Voice Assistants | livekit/livekit_composite | DeepWiki | How can I reduce latency in voice agents using STT, TTS and LLM? | Capturing metrics | LiveKit Docs
b
should we provide stt, tts, vad and llm to agent session or to the agent ?
t
In LiveKit, STT, TTS, VAD, and LLM can be set up for either the agent session or the agent. Here’s how it works: • If a component is assigned to the agent, it’ll use that specific setup. • If not, it’ll automatically fall back to the session-level component as a default. This way, you get the best of both worlds—shared resources at the session level or tailored settings for each agent. If you have any questions or want a hand with the configuration, just let me know—I’m happy to help! Sources: Building voice agents | LiveKit Docs | livekit-agents/livekit/agents/voice/agent_activity.py
b
does altency or naything matters if we choose to pass either of the m?
t
Hey there! I wanted to let you know that there isn’t any specific info comparing latency or performance when passing STT, TTS, VAD, and LLM to the agent versus the agent session. Both ways work just fine, and the system will use the agent-level settings if they’re available, otherwise it falls back to the session-level settings. Usually, latency depends more on things like how close you are to the network, how well the provider performs, and how the pipeline is set up—not so much on whether you choose agent or session. If you want, I’d be happy to help you figure out how to optimize these factors to make things run smoother and faster! Sources: agents/src/voice/agent_activity.ts | LiveKit Docs | Agent speech and audio | LiveKit Docs | tests/test_agent_session.py
b
ok tell me
t
To help speed things up and reduce latency, here are some key areas to focus on: • Network Proximity: Try to keep your server close to the STT, TTS, VAD, and LLM providers geographically. This helps cut down on the round-trip time. • Streaming APIs: Using streaming APIs for STT, TTS, and LLM lets you process data bit by bit, which means less waiting overall. • Parallel Processing: If you can, set up your pipeline to handle tasks like transcription and LLM inference at the same time. • Preemptive Generation: Turning on features like preemptive generation can kick off LLM and TTS requests before a turn even finishes. • Low-Latency Providers: Picking providers known for real-time performance and lightweight models can make a big difference. • Metrics Analysis: Using LiveKit’s metrics API is a great way to spot any bottlenecks and fine-tune the parts that slow things down. If you want, I’m happy to walk you through the steps to set any of these up—just let me know!