JADE LABS
ARTICLE

How We Built a Real-Time Language Tutor (Technical Deep-Dive)

How We Built a Real-Time Language Tutor: A Technical Deep-Dive

A learner sits down, opens a browser tab, and tries to say "I went to the market yesterday" in Spanish. They say "Yo fui al mercado ayer." Correct. Then they try again with a more complicated sentence, mix up the preterite and imperfect, and say something that translates roughly to "I was going to the market yesterday for one specific time." The tutor catches it within a second, explains the distinction, and asks them to try again with a new prompt. No teacher was harmed in the making of this interaction — it ran entirely in a browser, with no human on the other end.

That loop — speak, get heard, get corrected, try again — is what Jade Labs' Language Lab is built around. This post explains how we built it: the architecture, the decisions, the trade-offs, and where we deliberately left things simple rather than clever.

The Problem with Most Language Software

Duolingo is genuinely good at building a daily habit and introducing vocabulary. Rosetta Stone has polished audio and a structured curriculum. Pimsleur's spaced-repetition audio format has decades of research behind it. None of them talk back in a way that adapts to what you specifically said in the last ten seconds.

That gap — between passive exposure and active correction — is where most learners stall. You can recognise a conjugation pattern without being able to produce it under pressure. The only way to close that gap is to produce language, have it evaluated, and receive feedback tightly coupled to what you just said. That requires a system that listens, understands, and responds in near-real time, inside a normal browser session.

High-Level Architecture

The system has four main layers:

  • Audio capture and streaming — browser microphone input, chunked and sent to the server
  • Speech-to-text (STT) — transcription with timing metadata
  • Language evaluation — grammatical analysis, error classification, and response generation
  • Text-to-speech (TTS) and UI feedback — spoken response and inline annotation

Each layer has its own failure modes and latency budget. The hardest constraint is human patience: if correction comes more than two to three seconds after the learner stops speaking, the feedback loop feels broken. Everything in the design is optimised around that window.

Audio Capture: Keeping It in the Browser

We use the Web Audio API and `MediaRecorder` with Opus encoding. Opus was the right call for a few reasons: it performs well at low bitrates (we target 24 kbps for voice), the browser support is broad, and it degrades gracefully on flaky connections.

The tricky part is voice activity detection (VAD). We need to know when the learner has finished a phrase without making them press a button. Pressing a button feels like using a walkie-talkie; it kills the conversational feel immediately.

We run a lightweight VAD model in a Web Worker using ONNX Runtime Web. The model watches energy levels and zero-crossing rates across 20 ms frames and emits a "speech ended" signal when it detects a pause of roughly 600 ms after active speech. 600 ms was chosen after testing with learners at different fluency levels — beginners pause longer mid-phrase while searching for words, and 600 ms gave us the best balance between cutting them off and making the system feel sluggish.

One important detail: we do not stream audio continuously. We accumulate audio into utterance-sized chunks bounded by VAD signals and send complete utterances. Streaming word-by-word would give us faster first-word transcription but would complicate the evaluation layer significantly, because grammar errors often only become visible at the end of a phrase.

Speech-to-Text: Accuracy Over Speed, Within Reason

We evaluated three STT approaches:

1. Browser-native Web Speech API — fast, zero server cost, but accuracy drops significantly on accented or learner speech, and it gives no timing metadata or confidence scores

2. Whisper (OpenAI) — excellent accuracy, including on non-native speech, but latency on the server-side API is too variable for our two-second budget at peak load

3. A fine-tuned Whisper variant running on our own inference infrastructure — this is what we use

We fine-tuned on corpora of non-native speech — specifically learner data where the speaker is making the kinds of errors we want to catch. A system trained only on fluent native speakers will sometimes "correct" a learner's error during transcription, normalising the text before the evaluation layer ever sees it. That is precisely wrong: we need to know what the learner actually said, errors included.

The fine-tuning data came from publicly available learner corpora (the ICSI MRDA corpus, the EF-Cambridge Open Language Database, and several others) plus synthetic data generated by having native-speaker TTS models introduce controlled errors.

We run inference on A10G GPUs behind an internal load balancer. p95 latency for a five-second utterance is around 800 ms. That leaves us roughly 1,200 ms for the evaluation layer and TTS response — tight, but achievable.

Language Evaluation: Where Most of the Work Lives

Transcription gives us a string. The evaluation layer turns that string into a diagnosis and a pedagogically useful response.

Error Classification

We classify errors along several dimensions:

  • Morphological — wrong verb ending, incorrect agreement (gender, number, person)
  • Syntactic — word order, missing obligatory elements (articles, auxiliaries)
  • Lexical — wrong word choice, false cognate
  • Phonological — flagged separately, see below

For each error, we want to know three things: what the learner said, what the target form is, and what the most likely cause of the error is. The last part matters because the same surface error can have different causes. Writing "yo soy cansado" when the target is "yo estoy cansado" is a ser/estar confusion — a conceptual gap. Writing "yo estoy cansada" when the speaker is male is a gender agreement slip — probably a production error rather than a conceptual one. The correction for each should be different.

We use a fine-tuned language model for this classification. The model takes the transcript, the conversation context (what prompt was given, what the expected form is), and outputs a structured error report with error spans, error types, and a confidence score per error. We do not surface corrections below a confidence threshold of roughly 0.7, because flagging uncertain errors annoys learners and damages trust in the system.

Generating the Correction

The correction itself is generated by a second model pass. We constrain the correction to be:

  • Short — one or two sentences maximum
  • Specific — it references what the learner said, not a generic rule
  • Actionable — it ends with a prompt for the learner to try again

We explicitly do not generate long explanations on the first error. If the learner makes the same error type twice in a session, the system escalates to a slightly longer explanation. Three times, and it offers a worked example. This mirrors what a human tutor actually does — you don't lecture on the pluperfect the first time someone makes a tense error.

Phonological Feedback

Pronunciation is evaluated separately from grammar. We extract phoneme-level alignments from the STT output and compare against a canonical pronunciation model for the target language. We flag pronunciation errors only when they are likely to impede comprehension — we do not flag accent features that are consistent across utterances, because that is not error correction, that is harassment.

This is an area where we are honest about current limitations. Phoneme alignment models are less accurate for learner speech than for native speech, and the boundary between "accent" and "error" is genuinely contested in linguistics. We err on the side of flagging less rather than more.

Text-to-Speech: The Tutor's Voice

The tutor needs to sound like a competent speaker, not a robot. We use a neural TTS system (based on a VITS-family architecture) with voices recorded by human speakers of the target language. We maintain separate voice models per language rather than a single multilingual model, because multilingual TTS tends to have degraded prosody in each individual language.

Response audio is generated server-side and streamed back as soon as the first 200 ms of audio is ready. The UI plays it progressively, so the learner starts hearing the response before the full clip has been synthesised.

The Conversation Loop

All of this — VAD, STT, evaluation, TTS — is orchestrated by a state machine that runs partly on the server and partly in the browser. The browser state machine handles UI state (listening, processing, speaking, waiting for retry). The server state machine handles conversation context (what prompt was given, what errors have occurred, what the session objectives are).

The two communicate over a WebSocket connection. We chose WebSockets over HTTP polling for the obvious latency reasons, but also because we wanted to push partial feedback to the browser as soon as any layer completes — rather than waiting for the full pipeline to finish before sending anything.

For example, when STT finishes, we immediately send the transcript to the browser so the learner can see what the system heard. If there is a transcription error (the system mishears something), the learner can flag it before the evaluation response arrives. This transparency builds trust — it makes clear that the system heard them and is processing, not just pausing for no reason.

Certification: Why Performance-Based Assessment Is Harder Than It Sounds

The Language Lab issues certificates based on demonstrated ability, not completion. A learner cannot pass by clicking through lessons. They have to hold a spoken conversation at the required level, which means the evaluation system has to make a summative judgement, not just flag individual errors.

We score sessions on three dimensions:

  • Grammatical accuracy — error rate weighted by error severity
  • Fluency — speech rate, pause frequency, self-repair frequency
  • Task completion — did the learner successfully communicate what the prompt required

These three scores are combined with weights that vary by course level. At A1 level, task completion is weighted heavily and accuracy less so — a beginner who successfully conveys meaning with imperfect grammar is doing the right thing. At B2 level, the weights shift toward accuracy and fluency.

The certification threshold is set conservatively. We would rather have learners retake a session than issue a certificate for performance that does not reflect the stated level. That is a deliberate product decision: the certificate should mean something.

What We Deliberately Did Not Build

A few things we considered and rejected:

Gamification beyond the basics. Streaks and badges are fine. Elaborate point systems start competing with the actual learning for the learner's attention.

Real-time word-by-word transcription in the UI. It is technically possible and looks impressive. It also makes learners self-conscious in a way that hurts fluency. Watching words appear as you speak is distracting.

Fully automated curriculum generation. The conversation topics and grammar targets are curated by humans. The AI handles evaluation and response, not curriculum design. Automated curriculum tends to produce locally coherent but globally incoherent progressions.

Lessons That Generalise

Building this system taught us things that informed how we approached other labs.

The core insight is that hands-on learning requires a tight feedback loop more than it requires comprehensive content. The Typing Tutor catches finger errors the moment they happen. The Aeronautics Lab flags a wrong radio call in the pattern. The Science Lab reads your titration data and tells you if your endpoint was early. The mechanism is different in each case, but the architecture is the same: you do the thing, the system observes it, correction arrives before you have moved on.

Content without feedback is a textbook. Feedback without content is a quiz. The combination — structured tasks, real-time observation, specific correction — is what produces the kind of practice that actually transfers to performance outside the lab.

Where to Go From Here

If you want to see how this works in practice rather than in a technical document, the Language Lab is the most direct way. You will speak, be heard, be corrected, and either pass the spoken exam or not — there is no other outcome. The certificate reflects what you can actually do.

Open a session, pick a target language, and try to describe what you did yesterday. The system will have opinions about your conjugation.

Stop reading. Start doing.
66 courses, 702 modules, an AI instructor per subject. Buy one lab and keep it, or take everything for $19/mo.
BROWSE ALL LABS THE FULL ACADEMY