Technical Implementation of an AI English Speaking Partner: Architecture, Evaluation, and Low-Latency Design

    This article breaks down the technical stack required to build an AI English speaking practice partner, going beyond simple speech-to-text plus LLM response. It covers streaming incremental speech recognition with VAD and domain vocabulary biasing, phoneme-level pronunciation assessment across completeness, accuracy, fluency, and prosody, tiered grammar correction that separates hard errors from style differences, and task-based scenario dialogues. It also details a layered low-latency architecture with full-duplex interruption, handling of mixed-language speech and personalized voice parameters, and the data loop needed for evaluation and iteration.

    1. Why Speaking Practice Needs Its Own Technical Stack

    Automated correction of written English is relatively mature, but the spoken scenario is significantly harder. Speech signals contain many sources of uncertainty: accents, speaking rate, pauses, and background noise. Learners often speak while thinking, which produces self-corrections, repetitions, and incomplete sentences. On top of that, people are extremely sensitive to interaction latency. Once a response takes more than a few hundred milliseconds, the sense of conversation disappears and practice degrades into a mechanical question-and-answer pattern.

    For this reason, a usable AI English speaking partner cannot be a simple chain of “speech to text plus an LLM response.” It requires coordinated design across four layers: recognition, assessment, generation, and orchestration. Each is broken down below.

    2. Implementation Details of the Four Core Capabilities

    2.1 Real-Time Speech Recognition: From Whole-Utterance to Streaming Incremental Recognition

    Traditional offline recognition waits until the user finishes speaking before producing output, which cannot support interruptible interaction. In engineering practice, streaming recognition is typically used: audio is split into fixed-length frames, decoding happens while capture continues, and incremental results with timestamps are emitted. Key design points include:

    • Endpoint detection (VAD) determines when speech starts and stops, avoiding treating a pause as the end of an utterance.
    • Partial results and final results are separated. The interface first shows interim text, then commits it once it stabilizes.
    • Hot updates to the domain vocabulary inject the words and proper nouns learners practice most into recognition biasing, reducing the error rate on proper nouns.
    1. # Example: event loop skeleton for streaming recognition
    2. for event in stream_audio(mic, frame_ms=100):
    3. if event.type == "partial":
    4. ui.update_interim(event.text) # refresh interim text in real time
    5. elif event.type == "final":
    6. ui.commit(event.text, event.ts) # commit and move to assessment
    7. if event.speech_final:
    8. pipeline.evaluate(event.text, event.audio_ref)

    2.2 Pronunciation Assessment: From “Understandable” to “Measurable”

    Recognition only answers “what was said.” Pronunciation assessment answers “how well it was said.” The common industry approach feeds the audio together with the reference text into an acoustic model to obtain phoneme-level alignment, then computes multiple metrics:

    • Completeness: whether target phonemes were actually produced; skipped or swallowed sounds are flagged.
    • Accuracy: how far the produced phonemes deviate from the standard pronunciation.
    • Fluency: speaking rate, pause position and duration, and number of repetitions.
    • Prosody: whether stress and intonation sound natural.

    The engineering recommendation is to output phoneme-level timestamps so the frontend can link the waveform with phonetic symbols and highlight them together. This lets learners see which specific sound was wrong instead of receiving only a single overall score. An overall score tends to cause anxiety and carries little information; per-dimension feedback is what makes practice trainable.

    2.3 Grammar and Expression Correction: Distinguishing Errors from Style

    Spoken language contains many structures that are “acceptable but non-standard,” such as dropped subjects and spoken contractions. Marking all of them as errors would seriously disrupt the practice experience. A workable strategy is tiered handling:

    Level Criteria Feedback
    Hard error Tense, subject-verb agreement, part-of-speech errors Immediate prompt with a correction
    Soft issue Redundancy, repetition, limited expression variety Summarized suggestions after the turn ends
    Style difference Spoken contractions, ellipsis No prompt; recorded only

    At the same time, the system should preserve “more natural upgrade expressions”: when the learner’s output is already correct, offer one or two alternatives that native speakers use more commonly. This is most valuable for intermediate learners and above.

    2.4 Scenario Dialogue Practice: Task-Based Design Beats Free Chat

    Free chat drifts off topic easily and has low practice efficiency. A more effective approach organizes dialogue as scenario tasks with goals: airport check-in, interview self-introduction, academic discussion, customer service complaint, and so on. Each scenario includes a role setting, a task goal, a checklist of required expressions, and an exit condition. The system evaluates by goal achievement rather than by how much was said, which is what closes the practice loop.

    3. Low-Latency Interaction Architecture: Interruption Is the Key Dividing Line

    The core metric of natural spoken interaction is not model capability but end-to-end latency. A reference layered structure looks like this:

    1. Capture layer: microphone capture with noise reduction and echo cancellation, so speaker output is not recorded again.
    2. Recognition layer: streaming decoding that continuously emits interim results.
    3. Orchestration layer: intent detection, context management, and a state machine that decides whether interruption is allowed.
    4. Generation layer: text generation and speech synthesis using streaming synthesis, returning the first audio packet as early as possible.
    5. Playback layer: play while receiving, and stop playback immediately when the user starts speaking.

    Interruption relies on a full-duplex approach: keep listening for input while playing the system’s own voice. As soon as VAD determines the user has started speaking, abort synthesis and playback immediately and merge the user’s audio into the context. The state machine must clearly handle the difference between “the user just said hmm” and “the user is really cutting in,” usually by combining an energy threshold with a minimum speech duration filter.

    1. State transitions (simplified)
    2. Idle --user speaks--> Capturing --final--> Thinking --first audio packet--> Speaking
    3. Speaking --user starts speaking detected--> Interrupted --> Capturing
    4. Speaking --playback finished--> Idle

    4. Mixed-Language Input and Personalized Voice Parameters

    In real practice, learners often mix Chinese and English, for example saying “I can’t make this deadline.” The system needs automatic language identification and seamless switching: on the recognition side, allow the language to change mid-sentence; on the generation side, keep the voice consistent so a mid-way voice change does not feel disjointed. The engineering recommendation is to maintain a separate language model bias per language while sharing one set of voice and prosody parameters.

    For personalization, expose a set of general voice parameters for adjustment: speaking rate, pitch, volume, pause density, and sentence-final rising intonation strength. Defaults should be close to a “clear but natural” instructional style. Scenarios for beginners can lower the speaking rate and add pauses, while advanced scenarios can approach normal speed. Parameter changes should take effect immediately and stay consistent within a session, avoiding voice drift for the same role.

    5. Evaluation and Iteration: No Data Loop, No Results

    At least three categories of data should be collected: interaction latency distribution (first-packet latency, interruption response latency), recognition quality (error rate broken down by phoneme and scenario), and learning outcomes (score changes across repeated practice of the same scenario). In the early stage after launch, use shadow traffic to compare different parameter combinations, then ramp up gradually. Note that all voice data is sensitive personal information: collect the minimum by default, store it encrypted, define a clear retention period, and provide a deletion channel.

    6. Implementation Recommendations

    To build this capability in your own product, proceed in the order “close the loop first, optimize later”: first use streaming recognition plus general dialogue generation to get the scenario practice loop working, then fill in phoneme-level pronunciation assessment, interruptible full-duplex interaction, mixed-language input, and personalized parameters one by one. At the infrastructure level, container platforms can host elastic inference services, message queues can smooth traffic spikes, object storage can hold audio samples, and logging services with monitoring and alerting can ensure observability. Baidu AI Cloud offers corresponding product forms in these general capability categories, which can be combined as needed, avoiding the complexity of introducing too many components at once.