Building a Full-Duplex Real-Time Voice Interaction Architecture: Design and Engineering Practice

    Full-duplex voice interaction lets a system listen and speak simultaneously, replacing the rigid turn-taking of traditional voice assistants. This article breaks down the core architecture of a full-duplex real-time voice model, covering the streaming audio pipeline, the duplex scheduler, interruption handling, the continuous decision-making loop, model tiering with graceful degradation, gray-scale release, and operational governance. It also includes representative pseudocode for the decision loop and practical guidelines for latency budgets, observability, and capacity planning.

    Building a Full-Duplex Real-Time Voice Interaction Architecture: Design and Engineering Practice

    Real-time voice interaction is evolving from the half-duplex “push to talk, take turns” model toward full-duplex operation, where the system listens and speaks at the same time. Full duplex does not simply mean chaining speech recognition, a language model, and speech synthesis into a pipeline. Instead, the system continuously receives an audio stream, continuously produces speech output, and makes interaction decisions at any moment—whether to speak, keep listening, pause, yield to an interruption, or invoke a tool. These systems impose much higher demands on latency, state management, concurrent scheduling, and exception handling. This article walks through the core architecture and engineering practices of a real-time voice interaction model, from the decision loop all the way to multi-platform gray-scale release.

    1. Problem Definition: Why Full Duplex Is Harder

    Traditional voice conversations rely on strict turn control: the user finishes speaking, the system recognizes the utterance, generates a reply, and synthesizes speech. This approach is simple to implement, but the interaction feels noticeably delayed, and it struggles when users add clarifications, corrections, or interruptions mid-stream. A full-duplex system must listen and speak concurrently, continuously assessing the interaction state while the audio stream keeps arriving.

    The core challenges include:

    1. Low-latency decision making: The system must make multiple interaction decisions per second instead of waiting until an utterance ends. Decisions that come too slowly make responses feel sluggish, while overly frequent decisions add computational overhead.
    2. State consistency: States such as listening, thinking, speaking, paused, interrupted, and tool-calling can switch rapidly. The system must keep the audio input, conversation context, output queue, and tool call results consistent with each other.
    3. Interruption and recovery: Users may inject new information while the system is speaking. The system must recognize the intent to interrupt, stop or fade out current output, and switch to listening or replanning.
    4. Resource elasticity: Audio stream characteristics vary widely across users, devices, and network conditions. The system must allocate compute per session dynamically and degrade smoothly under high load.

    A full-duplex real-time voice interaction model is therefore not just a matter of model capability—it is a combined problem of audio stream processing, scheduling strategy, state machines, and engineering governance.

    2. Core Components of a Full-Duplex Architecture

    A production-ready full-duplex voice interaction system typically consists of these modules: audio capture and encoding, streaming speech understanding, conversation context management, an interaction decision engine, speech generation and output, a tool-calling gateway, session state storage, and monitoring and alerting. The modules are connected through streaming message passing, forming a continuously running session loop.

    2.1 The Audio Stream Pipeline

    The audio pipeline continuously feeds audio chunks captured on the device into the system and continuously pushes system-generated speech chunks back to the device. To reduce end-to-end latency, the pipeline should use chunked transmission and incremental processing rather than waiting for complete utterances. On the engineering side, you need to handle common issues such as sample rate, encoding format, jitter buffering, network packet loss, and echo cancellation.

    On the server side, incoming audio chunks flow into the streaming understanding module, which produces incremental features or intermediate results. These results do not need to wait for final transcripts—they can be passed to the decision engine as early as possible. Based on current voice activity, context, and output state, the decision engine determines the next action.

    2.2 The Duplex Scheduler

    The duplex scheduler is the central nervous system of a full-duplex architecture. It maintains session states such as “listening,” “speaking,” “output paused,” and “waiting for tool results,” and executes the corresponding actions on each state transition. Crucially, the scheduler should not treat “whether to speak” as a one-time judgment. It should be a continuous decision process: within every short time window, the scheduler evaluates whether to keep producing output, whether to yield the turn, and whether the current speech has been interrupted.

    A common design is an event-driven state machine. Voice activity events, user interruption events, model output events, tool return events, and timeout events all trigger state transitions. The state machine needs clearly defined priorities—for example, user interruptions generally take precedence over continuing output, and a failed tool call should fall back to a safe scripted response or trigger replanning.

    2.3 Handling Interruptions

    Interruption handling is central to the full-duplex experience. While outputting speech, the system must keep listening. When it detects that the user has started speaking and the intent is likely to interject, it should quickly stop or fade out the current output, retain the already-generated context, and enter the listening state. The interruption strategy must avoid false triggers: ambient noise, short interjections, and echo can all be mistaken for user interruptions. In practice, you can combine voice activity detection, short-term confidence scores, contextual semantics, and configurable conservative policies to balance response speed against the false-interruption rate.

    3. Designing the Interaction Decision Loop

    The interaction decision loop can be abstracted as a continuous “perceive—evaluate—act” process. In each decision window, the system reads the latest audio features, conversation context, output queue state, and tool state, and emits an action. The action space typically includes: keep listening, start speaking, continue speaking, pause output, interrupt current output, invoke a tool, and end the session.

    3.1 Decision Dimensions and Priorities

    The decision engine must weigh multiple signal categories: whether the user is speaking, whether the user’s utterance is complete, whether the current output has already conveyed the key information, whether any tool calls are pending, whether the network is congested, and whether the device supports simultaneous playback. In terms of priority, safety and correctness come before fluency: when tool results have not returned, the system must not fabricate them; when the user clearly interrupts, stopping output takes precedence.

    3.2 Latency Budget for Multiple Decisions Per Second

    “Multiple decisions per second” means the decision window is typically a few hundred milliseconds or less. To meet this latency budget, the decision engine should stay lightweight, and complex reasoning can run asynchronously. For example, a fast policy decides whether to continue output or yield the turn, while heavier semantic planning completes in the background and updates the context. The system also needs timeouts and fallback actions to prevent a blocked module from freezing the session.

    The following pseudocode illustrates the general logic of the decision loop. It is illustrative only and does not refer to any specific interface:

    1. while session.active:
    2. audio_chunk = read_stream(session.audio_input)
    3. features = extract_features(audio_chunk)
    4. context = load_context(session.id)
    5. decision = policy.evaluate(
    6. features=features,
    7. context=context,
    8. output_state=session.output_state,
    9. tool_state=session.tool_state
    10. )
    11. switch decision.action:
    12. case LISTEN:
    13. continue_reading()
    14. case SPEAK:
    15. stream_speech(decision.content)
    16. case PAUSE:
    17. pause_output()
    18. case INTERRUPT:
    19. stop_output()
    20. enter_listening()
    21. case TOOL_CALL:
    22. invoke_tool_async(decision.tool_request)
    23. case END:
    24. close_session()

    The loop highlights two points. First, decisions are based on continuously arriving streaming input, not complete turns. Second, action execution must be asynchronous and cancellable, so output can be stopped quickly when the user interrupts.

    4. Model Tiering and Resource Strategy

    To serve different user scales and device conditions, real-time voice interaction systems usually offer a standard model tier and a lightweight tier. The standard tier targets scenarios with higher quality and latency requirements, while the lightweight tier serves resource-constrained or cost-sensitive scenarios. Tiering is not a simple model swap—it involves routing, degradation, and keeping the experience consistent.

    4.1 Routing and Degradation

    The routing layer selects a model version based on user entitlements, device capability, network quality, and current load. Under high load, the system can switch some sessions to the lightweight tier, reduce the decision frequency, shorten output chunks, or skip non-essential tool calls. Degradation strategies should preserve interaction semantics as much as possible—for example, interruption and pause still work, but with lower speech naturalness or a shorter context window.

    4.2 Multi-Platform Coverage and Gray-Scale Release

    Real-time voice capabilities typically need to cover both web and mobile clients. Devices differ in audio capture, playback, background switching, and network recovery behavior, so releases should follow a gray-scale (canary) strategy: validate decision latency, interruption rates, and session completion rates on a small traffic slice first, then gradually expand. During gray-scale rollout, monitor end-to-end latency, time to first audio packet, interruption response time, tool call success rate, abnormal stream disconnection rate, and user-initiated termination rate.

    On general-purpose cloud infrastructure, the workload can be carried with standard cloud services such as object storage, message queues, container platforms, and logging and monitoring—for example, the generic services offered by Baidu AI Cloud. Session recordings and diagnostic samples can go into object storage, streaming events can be decoupled through a message queue, service instances can run on a container platform, and logs with alerting can surface latency jitter and abnormal stream drops.

    5. Opening Service APIs and Engineering Governance

    When real-time voice interaction is exposed as a service API, the interface design should revolve around the “session” rather than the “single request.” Typical capabilities include creating a session, continuously uploading audio chunks, continuously receiving speech chunks, sending interruption signals, querying session status, and closing the session. The streaming transport protocol needs to support bidirectional communication, backpressure control, and timeout-based cancellation.

    For engineering governance, establish the following mechanisms:

    1. Session-level tracing: Assign a unique identifier to each session and record decision actions, state transitions, and tool call chains, making it easier to locate latency spikes and anomalies.
    2. Observability: Collect metrics such as first-packet latency, decision time, interruption response time, output interruption rate, and tool call failure rate, and set alert thresholds for each.
    3. Security and compliance: Classify and manage audio data, text context, and tool call parameters, define retention periods and access permissions, and keep sensitive information out of logs.
    4. Capacity planning: Full-duplex sessions are long-lived, streaming, and compute-intensive. Estimate resources based on concurrent session count, audio duration, and decision frequency, and leave headroom for traffic spikes.
    5. Fallback strategy: When the model service or a tool service fails, the system should degrade to half-duplex mode or deliver a safe prompt, avoiding sessions that hang without response.

    6. Best Practices and Summary

    When building a full-duplex real-time voice interaction model, follow the principles of “state machine first, lightweight decisions, cancellable actions, observable gray-scale rollout.” Start by clearly defining session states and transition conditions, then implement the streaming audio pipeline and asynchronous action execution. The decision engine should prioritize low latency and explainability, pushing complex semantic planning to the background. Interruption, pause, and tool calls must all support cancellation and timeout mechanisms. At release time, validate the experience incrementally through small-traffic gray-scale rollout and multi-dimensional monitoring.

    Overall, the competitiveness of a real-time voice interaction model comes not only from the quality of speech understanding and generation, but also from full-duplex scheduling, low-latency engineering, and stable operations. Only by embedding model capabilities within a well-defined session state machine and an observable service framework can “listen while speaking” evolve from a demo into large-scale deployment.