WHISPER-FLOW · PERFORMANCE PLAN

Making whisper-flow faster

12 changes ranked by impact, and why each one ranks where it does.

4

high impact

5

medium impact

3

low impact

Impact scores are estimates from reading the code, not measurements.

WHERE THE TIME GOES

Nearly all the time is Whisper inference

Client mic

16 kHz PCM

Window

Segment.window

Whisper inference

nearly all of the server’s time

Results

partials, finals

64 ms chunks

Audio arrives from the client in small frames and joins the current window.

Every partial re-runs it

The loop sends the whole current window to Whisper again for each partial result.

The rest is tiny

WebSocket, JSON and numpy glue are negligible next to inference.

whisper-flow · performance plan

THE RANKING AT A GLANCE

12 changes, scored 0–10 for impact

1

Faster inference backend

10

2

Size the encoder to the audio

8

3

fp16 on CUDA (NVIDIA only)

8

4

Reuse the last partial as the final

7

5

Silero VAD, shorter silence wait

6

6

Pace re-transcription (shared servers)

6

7

Greedy decoding

5

8

Concurrency tuning (shared servers)

5

9

Distilled and quantized models

4

10

Preload and warm up

3

11

Slim results

2

12

Small CPU cleanups

1

Orange: high · blue: medium · grey: low. Scores marked NVIDIA-only or shared-server apply only there.

Estimates from reading the code, not measurements

BEFORE ANYTHING ELSE · STEP 0

Measure first, so every change can prove itself

Time per inference call

With the window length it covered, giving the real-time factor.

End of speech → final

The wait users feel after they stop talking.

Wait for a free model copy

Time spent in ModelPool.acquire() when sessions share a model.

Calls per utterance

How many inferences one utterance costs, and how many saw only silence.

0

/ 10 impact on its own: it speeds nothing up, but it’s how you check every score in this deck.

Report these from ./run.sh -benchmark, next to WER on LibriSpeech, before and after each change.

Also closes the open “logging and metrics” item in improvements.md

RANK 1 OF 12 · PLAN ITEM #1

A faster inference backend

TIME PER INFERENCE CALL (ILLUSTRATIVE)

openai-whisper · PyTorch · CPU fp32 (a Mac today)

whisper.cpp · Apple GPU via Metal · quantized

faster-whisper · CUDA fp16, or int8 on CPU

With no CUDA, today’s code runs on the CPU at full 32-bit precision, so on a Mac the GPU sits idle. Bar lengths are illustrative, not measured.

10

/ 10 impact

WHY IT RANKS HERE

Every inference call, partial and final, gets several times faster. No other change touches every call.

WHO BENEFITS

Everyone; most of all Macs, which run on the CPU today.

transcriber.py:91 · get_model, transcribe

Estimates from reading the code, not measurements

RANK 2 OF 12 · PLAN ITEM #3

Size the encoder to the audio

A 2.5-SECOND WINDOW

Today: encoder input padded to 30 s

With audio_ctx: about 3 s

0 s

10 s

20 s

30 s

30 s → about 3 s of encoder input

Encoder cost grows with its input length. Check WER on very short windows: too small a context can drop words.

8

/ 10 impact

WHY IT RANKS HERE

Short windows stop costing as much as 30-second ones, and most partials are short. It needs whisper.cpp (#1).

WHO BENEFITS

Everyone on the whisper.cpp backend.

whisper.cpp audio_ctx · set from the window length

Estimates from reading the code, not measurements

RANK 3 OF 12 · PLAN ITEM #2

fp16 on CUDA

A ONE-LINE CHANGE

# transcriber.py:125, today
fp16=False
# the change
fp16 = device == "cuda"

NVIDIA GPU

8

Half-precision math: typically close to 2× faster per call.

Mac or CPU only

0

No CUDA, so the setting is never used.

8

/ 10 on NVIDIA, 0 on a Mac

WHY IT RANKS HERE

A large gain per call for a one-line change, but only where there is an NVIDIA GPU.

WHO BENEFITS

NVIDIA servers only.

transcriber.py:125 · fp16=False

Estimates from reading the code, not measurements

RANK 4 OF 12 · PLAN ITEM #4

Reuse the last partial as the final

ONE UTTERANCE THAT ENDS BY SILENCE (ILLUSTRATIVE)

Today

After #4

Black: speech

Grey: 600 ms silence

Orange: extra full pass

Blue bar: final arrives

Today

Final = silence wait + one more inference

After #4

Final = silence wait only

7

/ 10 impact

WHY IT RANKS HERE

It removes one full inference from the end of every utterance: the wait after you stop talking, which users feel most.

WHO BENEFITS

Everyone.

streaming.py:220 · close_segment

Estimates from reading the code, not measurements

RANK 5 OF 12 · PLAN ITEM #7

A real voice-activity detector

SPEECH, THEN NOISE JUST ABOVE THE THRESHOLD

speech

background noise

Dashed: the volume threshold (500). Blue line: where a VAD model sees speech end.

Volume threshold: the noise never counts as silence, so the window grows toward the 64 s cap and each partial gets slower.

VAD model: the segment ends at the blue line, and a shorter silence wait becomes safe.

6

/ 10 impact

WHY IT RANKS HERE

It removes the worst case, where noise keeps a segment open and every partial slows down, and it lets finals come sooner.

WHO BENEFITS

Noisy rooms most; everyone a little.

streaming.py:70 · is_silent · WF_SILENCE_MS

Estimates from reading the code, not measurements

RANK 6 OF 12 · PLAN ITEM #6

Pace re-transcription

ONE UTTERANCE (ILLUSTRATIVE)

Audio

Today: a call on every loop tick

Paced: after 250 ms+ of new audio, none on silence

Blue: useful call

Orange: call that saw only silence

18 → 10 calls

for the same utterance

3 → 0 on silence

so the model is free for other sessions

6

/ 10 shared servers, 2 one user

WHY IT RANKS HERE

One speaking session keeps the model busy nonstop, so other sessions wait behind it. Pacing frees the model between useful calls.

WHO BENEFITS

Shared servers with several sessions.

streaming.py:243-264 · the transcribe loop

Estimates from reading the code, not measurements

RANK 7 OF 12 · PLAN ITEM #5

Greedy decoding

SAMPLING · TEMPERATURE 0.1 (TODAY)

N

add

a

test

for

the

commit

margin

N+1

add

the

test

for

a

commit

margin

setting

Committed: add

GREEDY · TEMPERATURE 0.0

N

add

a

test

for

the

commit

margin

N+1

add

a

test

for

the

commit

margin

setting

Committed: add a test for the commit

Blue: agreed and committed. Orange: first difference. Dashed: waits, after a difference or inside the commit margin.

5

/ 10 impact

WHY IT RANKS HERE

Sampling can word the same audio differently, so partials disagree. Greedy partials agree sooner: words commit, windows shrink, segments close.

WHO BENEFITS

Everyone.

transcriber.py:102 · temperature=0.1

Estimates from reading the code, not measurements

RANK 8 OF 12 · PLAN ITEM #9

Concurrency tuning

8 CPU CORES, 2 MODEL COPIES (A AND B)

Today: each copy starts a thread per core

A

B

A

B

A

B

A

B

A

B

A

B

A

B

A

B

16 threads on 8 cores: they take turns and slow each other down.

With 4 threads per copy

A

A

A

A

B

B

B

B

8 threads on 8 cores, one each. On a GPU, batch several sessions into one pass instead.

5

/ 10 shared servers, 0 one user

WHY IT RANKS HERE

Several model copies on one CPU each try to use every core and fight over them. It only matters once sessions run at the same time.

WHO BENEFITS

Shared servers.

transcriber.py:31-55 · ModelPool

Estimates from reading the code, not measurements

RANK 9 OF 12 · PLAN ITEM #8

Distilled and quantized models

WHAT EACH CHOICE TRADES

ModelSpeedAccuracy
tiny.en (default)fastestroughest, esp. on code identifiers
small, mediummuch slowerbetter
distil-small.en, distil-large-v3faster than the originalsclose to the originals
int8 / q5 quantizedfaster on CPU, less memorysmall cost

Quantized variants come with the backends from #1: ggml files for whisper.cpp, CTranslate2 models for faster-whisper.

4

/ 10 impact

WHY IT RANKS HERE

A big win for users who move up from tiny.en for accuracy, and nothing for the default setup, which already uses the fastest model.

WHO BENEFITS

Users on bigger models.

whisperflow/models · WF_MODEL

Estimates from reading the code, not measurements

RANK 10 OF 12 · PLAN ITEM #10

Preload and warm up

TIME TO THE FIRST PARTIAL (ILLUSTRATIVE)

First session on another model, today

Every later session

First session, with preload and warm-up at startup

Grey: model load

Orange: first-call warm-up (GPU)

Blue: a normal call

Startup already loads the default model. This adds WF_PRELOAD_MODELS and one dummy inference per model.

3

/ 10 impact

WHY IT RANKS HERE

Only the first session after a start, or the first switch to another model, gets faster. Every later session is unchanged.

WHO BENEFITS

The first session.

fast_server.py:44-49 · lifespan

Estimates from reading the code, not measurements

RANK 11 OF 12 · PLAN ITEM #11

Slim results

EACH PARTIAL TODAY (VALUES ILLUSTRATIVE)

{"is_partial": true,
 "data": {"text": "add a test",
  "segments": [{"id": 0, "seek": 0,
   "tokens": [50363, 751, 257, 1332, …],
   "words": [{"word": " add", "start": 0.0, …}, …],
   "avg_logprob": -0.21, "no_speech_prob": 0.01, …}],
  "language": "en"},
 "time": 182.4}

WHAT WHISPER-CODE READS

{"is_partial": true,
 "data": {"text": "add a test"}, "time": 182.4}

2

/ 10 impact

WHY IT RANKS HERE

Less JSON per partial. It matters only over slow remote links; on localhost the bytes are nothing next to inference.

WHO BENEFITS

Remote servers.

fast_server.py:167-172 · send_back_async

Estimates from reading the code, not measurements

RANK 12 OF 12 · PLAN ITEM #12

Small CPU cleanups

ONE LOOP CYCLE (PROPORTIONS ILLUSTRATIVE)

Whisper inference

Polling the queue every 10 ms

Re-summing chunk durations

window.pop(0) on a list

Each cleanup is a sliver next to one inference

1

/ 10 impact

WHY IT RANKS HERE

These cost microseconds; inference costs far more. Do them when you touch the code anyway.

WHO BENEFITS

Nobody noticeably.

streaming.py · loop, Segment

Estimates from reading the code, not measurements

WHAT TO PICK

The top three depend on your hardware

On a Mac

  • whisper.cpp on Metal (#1)
  • Size the encoder (#3)
  • Reuse the final (#4)

fp16 (#2) does nothing here: there is no CUDA.

On an NVIDIA server

  • fp16 on CUDA (#2)
  • Reuse the final (#4)
  • faster-whisper (#1)

The quickest win is a one-line change.

Most impact per hour

  • fp16 on CUDA (#2)
  • Reuse the final (#4)
  • Greedy decoding (#5)

A few small changes that cover a large share of the benefit.

The backend (#1) is the biggest gain and the most work.

Estimates from reading the code, not measurements

SUGGESTED ORDER

Measure, then the one-liners, then the loop, then the backend

0

Measure

Step 0, with metrics in the benchmark next to WER.

1

One-liners

fp16 on CUDA (#2) and greedy decoding (#5).

2

The loop

Reuse the final (#4) and pace calls (#6), both in streaming.py.

3

The backend

whisper.cpp / faster-whisper (#1), then audio_ctx (#3).

Full plan with file references: docs/performance/performance.md