Two models on one 8 GB GPU: making the LLM wait for the TTS after every sentence stopped my voice assistant from stuttering

I wanted ESP32 voice-assistant boards running the open-source xiaozhi firmware to hold real conversations fully offline, served from a laptop with an RTX 4060 Laptop GPU (8 GB) and 16 GB of RAM. I tested it with an M5Stack Atom EchoS3R and a Stack-chan; it isn’t tied to one board. The pipeline is the usual one: VAD and ASR on the CPU, then an LLM (Gemma 4 E4B, QAT q4_0, on llama.cpp) writes the answer while a voice-cloning TTS (Qwen3-TTS 1.7B, F16 GGUF) speaks it sentence by sentence.

Fitting both models into 8 GB was the first problem. Getting them to share it was the real one.

Before and after, live recording

(One live run of each, played at 2x speed, so the numbers in the clip differ from the averages in the table below.)

What went wrong when both ran at once

On its own, the TTS needs about 0.6 seconds to generate 1 second of audio (a real-time factor, RTF, of about 0.6), so it stays ahead of playback. When the LLM was decoding on the same GPU, the RTF of the first sentence rose to 1.1 to 1.6: generating it took longer than playing it, so the audio buffer ran dry. My guess, which I haven’t confirmed with a profiler, is that the TTS decodes frame by frame with many small kernels, and each step ends up waiting behind the LLM’s work.

In my tests, throttling the LLM (to 20 and then 14 tok/s) and changing the GPU scheduling priority in Windows didn’t help.

What worked: taking turns

So I stopped running them in parallel. The LLM writes one sentence and pauses. The TTS synthesizes that sentence alone, at full speed. Then the LLM continues. The LLM decodes at about 61 to 64 tok/s, so writing a sentence takes it far less time than speaking it, and the audio stays ahead for the whole answer.

The cost: the LLM spends most of its time waiting. In the runs below, it finished writing at about 54 s instead of about 12 s, inside an answer that plays for 65 to 84 s. That is fine for speech, because the listener is still hearing the answer anyway, but it is not a free speedup.

Two measurements, under different conditions

  1. The full standalone server pipeline, step by step, with playback stalls estimated by the server against the device’s 0.3 s prebuffer (not measured at the speaker). Same story-telling question at every step (a Chinese prompt and a Chinese cloned voice), sent as text, so first audio excludes VAD and ASR. All four steps were measured in one sitting. Each row averages 3 runs (range in brackets), so read it as orders of magnitude. A “stall” is any moment the buffer ran empty, even for 0.01 s, so the totals say more than the counts.
Setup First audio Stalls during the answer
PyTorch TTS on GPU, LLM on CPU 4.4 s (3.5 to 6.0) 4.59 s total, 48 to 60 stalls
Native C++ TTS on GPU, LLM on CPU 5.3 s (5.2 to 5.4) 0.05 s total, 0 to 2 stalls
Both on GPU, running at once 3.9 s (3.8 to 4.1) 2.84 s total, 9 to 17 stalls
Both on GPU, taking turns 2.3 s (1.9 to 2.7) 0.09 s total, 0 to 1 stalls

Switching to the native engine removed almost all of the stutter on its own, but first audio was no better (5.3 s against 4.4 s, and the baseline varied from 3.5 to 6.0 s). The PyTorch TTS process alone used about 8.9 GB of RAM on this 16 GB machine when I checked it earlier, so don’t read that row as a general PyTorch-versus-native comparison. Moving the LLM to the GPU made the first word come sooner but brought the stalls back. Taking turns made the first word come even sooner and removed that regression. The stalls left in the last row (0.13 and 0.14 s, in two of the three runs) came about 0.2 s after the first word; none came later in the answer.

  1. A controlled test that changes only the scheduling. No device: a simulated player with a 0.5 s buffer, Japanese prompts, the GPU left idle for 10 s before each run, and the same question and seed in both modes, so the generated text is identical. 6 runs per mode. Running at once: 6 of 6 runs stalled (median 2.27 s). Taking turns: 0 of 6.

The two tests use different playback-buffer assumptions, so their stall numbers aren’t directly comparable.

Fitting into 8 GB

The TTS runs on a patched C++ engine (based on qwen3-tts.cpp). Two patches matter most: deduplicating the Q/K/V weights saves 488 MiB of VRAM, and keeping the text embedding table on the CPU saves another 594 MiB. With both models loaded, the card shows 7,448 of 8,188 MiB in use; about 6.8 GB of that is the two models and the rest is the desktop.

Limits

  • One machine (RTX 4060 Laptop, Windows 11). Windows only for now: on Linux, CI only builds the CPU version of the C bridge and checks its ABI; the CUDA engine and the full pipeline have never run there.
  • The LLM side doesn’t support tool calling yet.
  • You don’t need a board: it also runs as a local LLM + TTS HTTP service.

Code, all the numbers, and the 32 pitfalls I hit along the way (Apache-2.0): https://github.com/korexil/gpu-duet

Two questions for anyone who has tried something similar:

  1. Is there a better way to let two CUDA processes share one consumer GPU on Windows? MPS isn’t available there, and changing the WDDM priority did nothing for me.
  2. If you run a similar LLM + TTS stack on a different card, does taking turns still beat running in parallel?

For now, from what I could find so far about running two independent CUDA processes on Windows:


Short answer to the two questions

1. Is there a better way to share a native-Windows GPU between two independent CUDA processes? I could not find an off-the-shelf Windows mechanism that gives one process a reliable TTS playback deadline while another continuously submits LLM decoding work. NVIDIA’s MPS documentation lists Linux and QNX support, not native Windows. CUDA stream priorities are scheduling hints, not real-time deadlines or guaranteed immediate preemption. NVIDIA’s Best Practices Guide describes separate CUDA contexts as time-sliced. That makes scheduling interference plausible, but does not by itself identify which device or host-side delay dominates in your test.

For the configuration you measured, keeping both model services loaded while explicitly taking turns on GPU-intensive generation looks like a sound practical baseline. This does not stop audio playback while the LLM runs: the device can keep playing previously generated PCM. I would not replace this working design with MPS, a single-process integration, or GPU partitioning without a measurable benefit that justifies the additional work.

2. Would turn-taking still win on a different GPU? Not necessarily. The useful test is whether TTS, while the LLM is generating, can deliver the needed PCM before the playback buffer runs out, including the slowest relevant chunks. If it does so reliably, overlap may let the LLM finish the answer sooner. If it misses those deadlines, turn-taking can give a better listening experience even if complete text generation takes longer. GPU model, VRAM size, and average TTS real-time factor alone do not determine the result. The first-to-second PCM interval, cold starts, long answers, and dedicated-memory residency all matter.

The paired benchmark already provides a useful reference: the matched plain and turns runs used identical generated text for each question/seed pair. In the long-sentence condition, predicted playback gaps appeared in 6/6 runs without turn-taking and 0/6 with it. Those are predicted underruns with the project’s simulated 0.5-second playback buffer, not a direct microphone or speaker measurement, and not a result on another GPU. The broader improvement from roughly 4.59 seconds to 0.09 seconds of estimated gaps also involved changes in the TTS engine and LLM placement; it should not all be attributed to scheduling alone. The results and measurement notes keep the two comparisons separate.

Practical default

I would retain the current sentence-level cooperative handoff as the reference behavior for this Windows/8 GB setup. Both services stay loaded; the application yields GPU-heavy generation to TTS when a speech segment needs synthesizing. That directly addresses the observed stuttering without making an OS-level GPU priority guarantee a dependency. The unsuccessful LLM token-rate limits and WDDM priority experiment are already documented, so simply repeating those would add little.

If further tuning would be useful, the least expensive informative step is one short timestamped PCM trace, not a CUDA rewrite. Record when the first few PCM reads arrive and how much audio each contains, preferably alongside TTS begin/end and LLM pause/resume events. If the trace covers the first predicted gap, it can help distinguish startup buffering, synthesis pacing, and handoff timing. If the result is already smooth enough, this is optional rather than homework.

A compact decision guide for another GPU

Can the required GPU allocations remain resident in dedicated memory?
  No / uncertain / shared-memory spill observed:
    Stabilize memory residency first; the scheduling comparison is confounded.

  Yes:
    Compare concurrent LLM+TTS against cooperative turn-taking,
    using the same text, TTS setup, and playback-buffer rule.

    Does concurrent TTS deliver PCM before the playback buffer empties?
      Yes, with margin across cold starts and long answers:
        Concurrent operation is worth considering. Compare text finish
        time, audible startup, longest gap, and interruption behavior.

      No, or only particular chunks miss their deadline:
        Retain turn-taking as the reliability baseline. Find the first
        missed deadline and distinguish startup, handoff, synthesis,
        delivery, and memory causes before changing the scheduler.

There is a small separate question about the roughly 0.13–0.14-second early estimated gaps in two final-stage standalone runs. If these are perceptible on the actual device, a first-PCM timeline or a small buffer-sensitivity check could be informative. It is not necessary to establish the value of the existing turn-taking result.

The following details are optional background and reproducibility notes for someone testing another GPU or attempting to locate the remaining latency.

1. What Windows/CUDA can and cannot control

Residency, concurrency, and deadlines are different properties

Fitting two model services into an 8 GB GPU requires a budget for resident weights, KV caches, compute buffers, contexts, and other processes. Parts deliberately kept in CPU RAM belong in a separate budget. It does not mean that their CUDA work receives fair latency or executes concurrently in a way useful to speech. Even if sampled GPU utilization looks moderate, the next TTS step might still miss its playback deadline. Conversely, reducing overlap can improve continuity without reloading either model, and the audio device can keep consuming buffered output while the GPU works on the next part of the response.

In this setup, TTS alone is reported at RTF around 0.6; concurrently decoding with the LLM raises the first sentence to roughly 1.1–1.6. That strongly supports interference under overlap at the observed application boundary. It does not locate the dominant cause among context scheduling, kernel launch/occupancy, synchronization, bandwidth, CPU stalls, and clocks.

NVIDIA’s Best Practices Guide makes context time-slicing plausible, not demonstrated here. CUDA stream priority is no hard deadline; Windows CPU or WDDM priority is another mechanism again. The already unsuccessful throttling and priority experiments do not need repeating without new evidence.

Why MPS is not the missing Windows flag

NVIDIA’s MPS deployment guide explicitly restricts MPS to Linux and QNX. MPS can sometimes increase cross-process concurrency on a supported OS, but switching this working Windows assistant to Linux would entail revalidating the native qwen3-tts.cpp build, llama.cpp, model conversion, Python bridge, audio and board transport, memory use, and startup timing. Even an MPS-enabled setup still needs end-to-end PCM deadline measurements. I would treat Linux/MPS as a separate research branch, not the default fix here.

A coordinated single-process execution policy could offer finer control, but integrating native engines introduces allocator, context, crash-isolation, cancellation, and maintenance costs. CUDA Green Contexts permit explicitly managed resource subsets on supported configurations. They do not transparently isolate arbitrary existing Windows CUDA processes, and a smaller GPU partition might also slow the TTS itself.

Practical hierarchy for the current arrangement:

  1. Preserve the measured cooperative turn-taking and dedicated-memory residency.
  2. Measure and, if justified, refine the handoff boundary or initial buffering without changing the engines.
  3. Consider bounded overlap only if a trace shows consistent spare deadline margin and there is a reason to finish text sooner.
  4. Consider a shared-process scheduler, Green Contexts, a different OS, or a second accelerator only as explicitly costed architecture alternatives.

The useful optimization target is continuous playback with acceptable response time, not simultaneous kernel execution for its own sake.

2. What the published experiments establish

A clean scheduling comparison versus a multi-change progression

The benchmark description separates sentence length and GPU turn-taking in a 2-by-2 design. There are three questions with two seeds per question, tested in plain and turns modes. The harness resets the llama-server prompt cache before each run, alternates the modes, and uses an idle interval so cold clocks are represented. In the captured run records, all 12 matching prompt/seed pairs produced identical answer text across the two scheduling modes. That is a valuable control: changing the amount of text would otherwise change both speech duration and the opportunity for stalls.

The reported median results are:

Condition First-audio estimate Total predicted gap Runs with gaps
Long sentences, no turn-taking 3.20 s 2.27 s 6/6
Long sentences, turn-taking 1.83 s 0 s 0/6
Short sentences + 0.9 s pause, no turn-taking 2.62 s 0.48 s 4/6
Short sentences + pause, turn-taking 1.42 s 0 s 0/6

The short-sentence condition changes utterance length and the TTS pause policy as well as the text produced. It is useful as a second factor in the study, but the cleanest estimate of scheduling comes from comparing plain and turns within the same sentence-length condition. The long-sentence benchmark produced roughly 67–118 seconds of audio; some short-sentence runs were far shorter. The project’s pitfall log notes that an early single successful short-answer result did not survive repeated longer trials. That is a useful reminder: testing only the first few seconds can hide a buffer deficit that accumulates over a longer answer.

The separate four-stage standalone pipeline comparison starts with PyTorch TTS on GPU and LLM on CPU, then changes engine and LLM placement before introducing turn-taking. It reports about 4.4 to 2.3 seconds for its first-PCM-oriented time metric and 4.59 to 0.09 seconds of estimated gaps. That shows substantial end-to-end progress, but the experiment answers a broader question than the paired scheduling benchmark. It does not isolate turn-taking as the cause of every improvement, and the two studies use different buffering and measurement boundaries. Keeping them separate makes the successful work easier, not harder, to reproduce.

What remains unmeasured

For a portable comparison, record the RTX 4060 Laptop 8 GB / Windows 11 / 16 GB RAM baseline, Gemma 4 E4B QAT q4_0 via llama.cpp, and Qwen3-TTS 1.7B through the patched GGUF engine, together with driver, exact model/engine revisions, audio buffering, and context configuration. See the project’s measurements.

3. Why the audio buffer, not average GPU utilization, decides continuity

Think in playable seconds

A TTS service produces PCM in increments. Each increment contains some duration of future playback; the speaker consumes available duration at one second per second. If arrivals are bursty, the queue can reach zero even if average generation across the answer is faster than playback. What matters is the earliest time the next required audio becomes playable, relative to the accumulated headroom at that moment.

A useful conceptual quantity is the amount of playable audio remaining in the queue after each arrival. On arrival, add that chunk’s audio duration; between arrivals, subtract elapsed playback time. A predicted underrun occurs if the queue empties before the next portion arrives. This requires timestamps and audio durations; a count of chunks by itself is insufficient, since one chunk might be 80 ms and the next two seconds. Initial buffering, intentional inserted silence, tail processing, and device-side consumption also affect the observation.

Consider a simple illustrative sequence, not measured data from this laptop:

Time (s)   Arriving PCM   Playable audio remaining
0.0        0.50 s         0.50 s; playback starts
0.2        0.80 s         1.10 s
1.0        0.20 s         0.50 s
1.8        1.00 s         buffer had emptied before this arrival

Even though a later burst could bring the overall average back above real time, there was a real playback deadline miss. Conversely, a slow inter-chunk computation need not be audible if earlier PCM provided enough headroom. This is why an inter-chunk gap is not automatically an audible gap: both the interval and the buffer state matter.

RTF is informative but not sufficient

RTF is approximately generation wall time divided by output audio duration. For a comparable interval, RTF below 1 means the measured synthesis was faster than the duration of its generated audio. A value above 1 means the producer is slower than playback on that interval. However, one whole-sentence RTF value can conceal a particularly late first block, an uneven codec window, or a long end-of-sentence step. Conversely, even a locally slow chunk need not cause an audible gap if earlier chunks supplied enough headroom. Use the actual arrival series to determine a deadline miss.

Startup and sustained continuity are different subproblems

If all significant gaps occur near the beginning, the first-produced-audio policy and startup buffering deserve attention. If gaps appear only later in long answers, the system may be slowly consuming earlier headroom, or may hit specific chunk-size/codec-window boundaries. If they coincide with LLM resume, a control handoff or GPU scheduling delay becomes more plausible. If stalls appear after PCM was already emitted by TTS, investigate transport, the consumer queue, or device playback before editing CUDA scheduling.

These distinctions give an inexpensive interpretation route for another GPU’s data. A fast model is not automatically a smooth streamer, and a good streaming result is not evidence that every CUDA resource-sharing problem was solved. The real comparison is a particular implementation delivering a particular PCM time series under a stated buffering rule.

4. A practical comparison on another GPU

For someone with a different card, I would reuse the existing paired benchmark harness before inventing a new test. The question is not which GPU reaches the highest token/s number in isolation; it is which scheduling policy satisfies the voice output’s continuity requirement for a comparable answer.

A small, useful comparison would have the following properties:

  • Comparable pairs. Use identical question, seed, text, voice, language, model revisions, quantization, TTS parameters, and buffer rule. Verify text hashes; identical seeds alone may not imply identical text because cache state can change results.
  • Comparable GPU state. Note cold/warm clocks; alternate test order. Check for duplicate TTS processes or unrelated GPU users.
  • Comparable buffers. The simulator assumes 0.5 s startup buffering, while the standalone sender estimates 0.3 s. Do not silently combine their timing metrics.
  • Stable residency. Capture dedicated and shared GPU memory. The published 7,448 / 8,188 MiB is whole-card usage, not weights alone; caches and desktop processes matter.
  • Useful output metrics. Record audio duration, first-audio endpoint, LLM completion, longest and total gaps, and whether any runs had gaps. A handful of matched long answers may be more informative than peak GPU utilization.

A compact community result could look like this (fields only, no invented results):

GPU / VRAM / power limit / driver / OS:
LLM model + quantization + llama.cpp revision:
TTS engine + model revision + voice prompt:
Dedicated/shared GPU memory during the run:
Cold/warm policy; text hash; answer audio duration:
Playback model / initial buffer / metric definitions:

mode    first-audio-s   text-done-s   gap-total-s   worst-gap-s
plain   ...             ...           ...           ...
turns   ...             ...           ...           ...

If available: first PCM time, first-to-next PCM interval,
number of runs with gaps, and the location of the worst gap.

The minimum experiment does not require changing the model or collecting hundreds of runs. A different GPU tests how well the policy transfers, not necessarily the same Windows scheduling mechanism: drivers, OS, kernels, and available resources may differ. A well-specified result remains valuable without claiming a universal winning scheduler.

5. Small timing traces and measurement boundaries

A low-cost check before a GPU profiler

The TTS HTTP service emits PCM, and the existing comparison simulator already associates receive times with PCM read sizes. Consequently, a small trace can expose the earliest missed deadline without a new engine, a CUDA build, or an external benchmarking framework.

If a diagnosis would be useful, timestamp only the first few chunks and the interval around the first underrun in one or two runs. Useful events, in order of increasing instrumentation effort, include:

  1. Monotonic timestamp when a PCM read completes, plus byte count, sample format and its playable duration.
  2. Sentence ID, TTS request acceptance, first PCM emitted by TTS, and synthesis completion.
  3. LLM sentence handoff and continuation events, if the suspected stall coincides with resuming LLM decode.
  4. PCM enqueue, optional tail-hold release, and outbound audio-frame send, if the standalone device path is the subject.
  5. Receiver/playback timestamp, only if actually measurable; do not substitute a server event and call it an acoustic observation.

For 24 kHz, mono, signed 16-bit PCM, audio_s = bytes / 48000. This assumes uncompressed PCM and counts samples as playable duration, not elapsed wall time. A compact line-oriented trace could use a shape such as:

run,mode,sentence,event,monotonic_s,pcm_bytes,pcm_audio_s
01,plain,0,tts_start,...,0,0
01,plain,0,pcm_received,...,...,...
01,plain,0,pcm_received,...,...,...
01,plain,0,tts_done,...,0,0
01,plain,0,llm_resume,...,0,0

These are column names and placeholders, not measurements. Within one host, monotonic times from processes using a shared OS clock basis can be compared; record the clock source. Across PCs, boards, or unsynchronized time domains, align clocks or compare durations recorded by the same observer; an ESP32’s timestamps are not automatically interchangeable with Python’s time.monotonic().

With this trace it becomes possible to replay different simulated buffer policies. Start playback when the chosen amount of audio has accumulated, subtract playable seconds as time elapses, add audio as it arrives, and mark each interval of depletion. Keep the treatment of initial silence, added sentence pauses, short final blocks, and rebuffering explicit. The earlier aggregate-only benchmark records cannot, by themselves, reconstruct an accurate new buffer sweep because their per-read arrival sequence was not retained in the summary. New tracing would provide that missing evidence.

Two different ‘first audio’ numbers in the existing project

There is a subtle but useful measurement boundary here. In the standalone session code, the first-audio observation is taken when the server’s session loop receives its first PCM event. Further processing occurs before outbound packets are sent, including an intentional waveform tail-hold mechanism. The tail_hold_ms value controls retained waveform duration, not an automatically equal wall-clock delay. The ESP32’s acoustic first sound happens downstream of this observation.

In the PCM simulator, first_audio_s instead means enough PCM has arrived to meet the 0.5-second threshold; it is not the first byte or acoustic onset. A full read(2880) represents 60 ms of 24 kHz mono s16 audio. The standalone Pacer models 60 ms sends with a five-frame (300 ms) prebuffer, but cannot see the physical receiver’s queue.

None of this negates the observed improvement. It means that a new comparison should label its timing endpoint, especially if initial response is part of the optimization. First TTS PCM, first server send, first device decode and first audible non-silent sample are different milestones. A slightly slower reported server timestamp can even accompany more continuous physical playback, depending on how buffering and shaping are arranged.

If the remaining small startup gaps matter

The final standalone stage has two estimated early gaps of roughly 0.13 and 0.14 seconds, with the later part of those long answers remaining smooth. This pattern suggests an inexpensive conditional check: examine the first PCM events first, then compare buffer assumptions such as 5, 7, and 9 frames (300, 420 and 540 ms at 60 ms/frame). Measure the predicted shortfall and the selected first-audio endpoint, rather than assuming more prebuffer is free or creates an exactly proportional delay. The Pacer schedules outbound frames using its own clock; changing its prebuffer parameter does not by itself measure the ESP32’s actual internal playback latency.

If no one can hear the residual event, the benefit of chasing it may be small. If it is audible and only the first segment is affected, it may be possible to improve startup pacing without altering the successful GPU handoff policy at all.

Cooperative handoff is not a GPU mutex

The paced llama.cpp provider streams short token batches (default 16), yields after a sentence terminator or the token limit (default 48), and consults the TTS /health endpoint. It uses the busy flag and an increasing started counter to detect that a sentence was accepted; there is a bounded pickup wait and a bounded TTS wait. If status collection fails, this path intentionally avoids waiting indefinitely. This is cooperative timing, not a cross-process CUDA mutual-exclusion primitive. A delayed splitter, timeout, or unavailable health endpoint may permit some overlap, depending on the integration.

The standalone service has a related but distinct control path: its worker naturally obtains further LLM text only after completing the current TTS segment, so it is already serialized at the relevant boundary without requiring the same /health polling loop. For a future extension, it is important to measure the specific integration being discussed rather than treating both paths as identical implementations.

These are architectural details for understanding behavior, not evidence that the observed benchmark was invalid or that a new bug is present. If logs ever show overlapping LLM and TTS work in a supposedly protected segment, the handoff state machine is a sensible first place to inspect before moving down to CUDA kernels.

6. If a CUDA-level cause becomes the question

A PCM trace establishes where the application first observes lateness. If the objective becomes distinguishing device queueing from host synchronization, context switching, launch overhead, or clock behavior, Nsight Systems is a suitable next step. A useful short window includes LLM decode, TTS’s first two PCM emissions, and any handoff. Compare CUDA API submission with kernel activity, CPU waits and WDDM scheduling where supported. A delayed kernel launch and a kernel that was submitted promptly but waited on the GPU imply different follow-ups.

Nsight Systems documents --cuda-trace-scope=system-wide and WDDM tracing, but same-user, privilege, and launch-after-collection-start conditions matter when observing two separate processes. Verify the installed version’s help and GPU support before selecting flags; system-wide trace collection may not see processes launched too early or under another user. Keep profiling windows short and compare against an unprofiled run because tracing can perturb timing. This is optional: a profiler is unnecessary if the purpose is simply selecting the scheduling policy that already gives smooth audio.

7. Related reports worth separating by mechanism

The following cases suggest diagnostics, not an established common root cause:

  • vLLM-Omni #4913 reports Qwen3-TTS chunk 0 being only 80 ms long, followed by a much later chunk under concurrent requests, with some measured intervals slower than real time. That stack includes an Ascend NPU/fork, not the same Windows CUDA engines. It illustrates why first-to-next chunk timing can matter more than a satisfactory average RTF.
  • vLLM-Omni #2568 describes periodic gaps associated with multi-request codec-window scheduling and compares batching/placement options. That is a different concurrent-TTS workload. Its transferable idea is to test whether late chunks have a pattern tied to a processing boundary; it is not proof of the GPU context hypothesis here.
  • faster-qwen3-tts PR #78, merged in March 2026, added a queue-backed persistent audio player because blocking playback of each chunk could prevent a pull-based generator from producing the next one. This is a useful counterexample: apparent generation stutter can be introduced by consumer code even when GPU production is sufficiently fast. The original project’s PCM simulator has a different structure.
  • Pipecat #5572 documents how a TTS speaking-pause gate can delay upstream control frames and therefore defer subsequent LLM inference or tool replies. It illustrates a future interaction concern, not an explanation for the published audio underrun measurements. The associated PR #5573 proposes a direction-aware change; check its status before treating it as a released fix.

Across those distinct reports, the useful common practice is to timestamp generation, delivery, and consumption separately. Similar audible symptoms can come from different boundaries. A link should be useful because it suggests something measurable, not because both issues happen to mention TTS or stuttering.

8. Conditional edge cases and a reusable takeaway

The current result does not require solving every future voice-agent concern. Still, if the project grows, the important conditions change. An additional model, voice prompt, or process may trigger Windows dedicated-to-shared GPU memory migration; check residency again before blaming scheduling. Cold GPU clocks can affect the first segment even when sustained throughput is healthy. More aggressive overlap can improve full-text latency but damage TTS deadline margin. Longer initial buffering can protect playback but may affect responsiveness; measure the precise output endpoint, not just an internal counter.

Interruptions, tool calls, multiple clients, cancellation, and new sentence-splitting rules introduce control-flow requirements beyond this paired benchmark. In particular, protecting the TTS synthesis lane need not mean blocking upstream tool results or cancellation events until playback ends. Those are future design branches, not defects established by the current tests.

For future readers, I would preserve four things together: the exact software/hardware and model revisions, an unambiguous PCM/playback timing definition, paired plain versus turns runs with matching generated text, and the earliest missed deadline. The reproducible benchmark already supplies much of that foundation. The source paths linked here are pinned to project commit ef55f3b90aaa0f72a0e6bc4de8cf4e0d74d56eba so a later change on main is not mistaken for the code that produced the reported measurements.

In short, the current turn-taking result is useful on its own. Whether another GPU should overlap LLM and TTS is an audio-deadline experiment, not a verdict based on GPU utilization; identifying the precise Windows CUDA bottleneck is a separate, optional investigation.

Thank you for reading the code this carefully. The handoff details and the two different “first audio” endpoints were both right, and the PCM trace you suggested was worth running, so I ran it.

What I recorded. The standalone server now also logs, per answer, when each sentence goes to the TTS, every PCM block with its duration, and each batch of frames released to the Pacer after the tail hold. Three answers each for “both on the GPU at once” and “taking turns”, same question as before. Replaying the Pacer on the recorded release times gives the same number of gaps the server reported in every run, totals within 0.011 s, so the replay below is usable.

On your answer to my first question (sharing the GPU on Windows). The trace agrees with the time-slicing picture, at least at the application boundary. Running at once, the first PCM arrives 2.3 to 2.5 s after the TTS request instead of 1.0 to 1.2 s, the first sentence runs at a wall-clock RTF of about 1.5, and every gap falls in the first 13 s, while the LLM is generating or just after it finishes; none come later in the 64 to 73 s answers. I haven’t located the cause below that, so I’ll keep turn-taking rather than chase MPS or a single-process design.

On your answer to the second (another GPU). Your deadline framing gives a number that is easy to compare across cards: how long a player would have to wait before starting to get zero gaps. On this card it is 0 to 0.12 s when taking turns and 1.9 to 3.4 s when running at once. I also replayed 5, 7 and 9 frames of prebuffer, but those come out identical by construction: the prebuffer only limits how far ahead the server sends, and the gap estimate assumes playback starts with the first frame. So that replay can’t tell whether a bigger buffer helps on the board; the start delay is the variable that matters. I’ve put your results template in the write-up so someone with a different card can fill it in.

The small early gap. It turned out to be the tail hold, not the GPU. The TTS delivers its first 1.0 to 1.2 s of audio as one burst, never more than the 1.2 s tail_hold_ms, so no frame goes out until the next block arrives about 0.19 s later. In one of the three turn-taking runs only a single 60 ms frame was released at that point and the board ran dry for 0.13 s; the other two released several frames and had a 0.01 s gap and none. Replaying the first segment as if PCM could be sent on arrival, none of the three has a gap and the first frame comes 0.19 s earlier. (The config comment saying the hold doesn’t delay first audio was wrong; it is fixed now.)

Endpoints, as you pointed out: “first frame” is the server sending its first audio frame; the board’s own buffering and decoding come after that and aren’t measured.

Traces, the replay script and the write-up: gpu-duet/bench/results/traces-2026-10-16 at main · korexil/gpu-duet · GitHub

I may try releasing held audio when the board would otherwise run dry, or padding less silence in the TTS so the hold can shrink, and will re-run the same traces if I do.

A correction to the per-sentence RTF figures in my previous reply and in the write-up it linked, and the follow-up I promised.

Correction. The pcm events in those traces were published when the server’s event loop took each block off the queue, and after the first frame that loop runs at playback pace, so blocks that arrived early were stamped late. The RTF figures in the linked write-up (first sentence 0.96–0.98 when taking turns, median 0.84–0.89 either way; my post itself said “about 1.5” for running at once) came out of that and are too high. With the events stamped at arrival (three fresh runs each): first sentence 1.33–1.47 running at once against 0.61–0.62 when taking turns; later sentences about 0.6 either way, which matches the engine’s own RTF of 0.6. The concurrent first-sentence figure (1.49–1.51) was close, which fits the explanation: when audio arrives slower than playback, the dequeue time tracks arrival. Other things changed between the two measurements as well (see below), so the dequeue explanation is the most likely one, not a controlled comparison.

The tail hold is gone. Instead of holding back 1.2 s to trim the TTS’s padded silence, the server now asks the TTS for the pause it wants per sentence (a pause field on the request). The first frame leaves with the first PCM block: 1.77–1.96 s in three runs (it used to wait for the second block, 0.19 s later), and the 0.13 s gap that one of the three runs had at the start is gone (none of the three has one now). In the one matched pair I compared (same question at temperature 0, same answer text), the pause and silence statistics match, and in one blind comparison I couldn’t tell the two apart.

The interrupt case, which your reply listed as something to compare. Button abort 2 s into an answer, new question at once, with a TTS 500 or a hang injected on the new answer’s first sentence (events now carry an answer id). One run per case. Nothing of the old answer appears after the new question and the device gets no old frames after the abort in any of the three. In the clean run the new answer’s first TTS request waits the normal 1 s (0.98 s; the slot was free). With the 500, the new answer ends 25 ms after the failed request. With the hang, it is cut off by the read timeout, now 10 s instead of 60. An abort that lands before a sentence’s first block (the worker is blocked in the read until it arrives, or until the timeout if the TTS is hung) isn’t covered.

Traces, the fixture and the write-ups: gpu-duet/bench/results at main · korexil/gpu-duet · GitHub (traces-2026-10-18, interrupt-2026-10-18).