DEV Community

Cover image for My interview copilot only hears the end of the question
Alex DevOps engineer
Alex DevOps engineer

Posted on

My interview copilot only hears the end of the question

Two weeks ago I wrote about AlterEgo DevOps. It's a copilot for job interviews. It listens to the interviewer, searches notes I wrote about my own projects, and shows three or four short hints on a second screen. I answer. It only reminds me.

Back then the whole pipeline had never run on real audio. Now it has. I expected the problem to be speed. The real problem: the copilot often hears only the end of the question.

What happens

The first real session showed it straight away. The panel showed на этот диск? — "onto this disk?". That was the tail of a sentence. The start of the sentence had already gone by. The copilot then wrote four confident hints about those three words.

A wrong hint is worse than no hint. You read it before you start to doubt it.

How a question travels

Three terms first:

  • Deepgram is the speech-to-text service. It turns audio into text as the person speaks.
  • Endpointing is how long Deepgram waits in silence before it decides the speaker has finished. I set it in milliseconds.
  • speech_final is the flag Deepgram sends when that silence has passed. My code treats it as "the question is complete".

So the pipeline is: audio → Deepgram → wait for speech_final → search my notes → ask the language model (Groq) → show hints.

Why it hears only the end

I found two reasons. The first I fixed. The second I found while writing this article.

Reason one: people pause mid-sentence. Endpointing was 500 ms. But people often pause for longer than that while they are still talking. Deepgram saw the pause, sent speech_final, and the copilot answered half a question.

Reason two: the code keeps only the last piece. Deepgram doesn't send a long sentence in one message. It sends it in pieces. Each finished piece is marked is_final. Only the last piece also carries speech_final.

My code never looks at is_final. It treats every message without speech_final as a draft for the screen, and it acts on the text of the speech_final message alone. That text is only the last piece.

To check this, I replayed one question through the real transcribe() function — the same code the app runs. The messages were shaped like Deepgram's, with a question I wrote for the test:

Deepgram sends the question in three finished pieces; the pipeline treats only the last piece as the question

The model gets "How would you prove they work?". It never learns that "they" means backups nobody has ever restored.

The screen hides this too. While the interviewer talks, the panel shows each piece in place of the one before:

The panel shows only the latest piece of what it heard

When the question "arrives", it's only the tail:

The question card holds only the last piece of the question

Both panel screenshots are the real interface. The input is the replayed test question, not a recording, because the copilot stores no transcripts on purpose.

Why it understands the question poorly

Even a whole question reaches the model alone. The prompt has two parts: fragments from my notes and the current question. Earlier turns of the conversation aren't in it. So a follow-up like "and what about CI?" arrives without the question it follows.

What I've tried

Longer endpointing. I raised it from 500 ms to 1 000 ms. Now you can change it with DEEPGRAM_ENDPOINTING_MS, because the right value depends on who is speaking. The cost is half a second on every question. A hint about the right subject that comes later is better than a hint about the wrong subject that comes sooner.

A filter for things that aren't questions. speech_final means "they stopped talking", not "they asked something". Interviews are full of "right", "mhm", "got it". Each of those used to start a search and a model call. That wasted the rate limit, which is about six calls a minute. It could also cancel the hints for the real question. Now a turn goes to the model only if it has a question mark, a question word, or at least six words. Everything else shows up dimmed with a reason, so I can see that nothing was lost.

Neither fix touches reason two. A longer wait makes fewer pieces, but a long question still arrives as several.

What is still open

  • Join the pieces. Collect every is_final piece until speech_final and send the whole thing. This is the obvious next fix. It hasn't been written or measured yet.
  • Give the model the conversation. Add the last turn or two to the prompt, so a follow-up has its context. That costs tokens, and the free tier allows 8 000 a minute.
  • Test on a real conversation. The pipeline has run on real audio, but it hasn't yet survived a full real interview.

The rest, briefly

Speed came in worse than planned. From the end of a question to the first hint takes about 1.5–1.8 s, against a target of 800 ms. The single biggest part is the 1 000 ms endpointing wait, which I raised on purpose. The search over my notes takes just 9–18 ms.

Two other lessons. A five-second idle timeout in httpx, the HTTP library, made almost every question open a new connection. Keeping the connection open saved about 420 ms per question. And my search test said 12 out of 12. It only checked that the right file came back, not the right paragraph. Measured by paragraph, the score was 6 of 12, and the fixes since then raised it to 10.

About the author

I'm Alex — a DevOps engineer. AlterEgo DevOps is my own project: a copilot that reads my own notes back to me while I answer. I write about the engineering decisions behind what I build — especially the ones measurement talked me out of.

Have you built anything on streaming speech-to-text? How do you decide when the speaker has really finished? Tell me in the comments.

Top comments (0)