Keep max_new_tokens: 440 on Transformers.js 4.3.2 and pin the seek-loop condition it avoids

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
Lucas WintherandClaude Opus 5.5 committed 2026-10-29 22:59:35 +01:00
1 parent cd9aa48b83
commit 9f1d58c0b7
4 files changed
+41 -6

No files matched your search

+27
View File
@@ -1292,3 +1292,30 @@ cannot be re-measured here. What the upgrade changes on that side, from the
"WASM (on-device, N threads)" with N > 1).
5. **Safari 26 (macOS/iOS):** what the footer reports for "auto"; if WebGPU,
check speed and output.
## D-WS1b — D-021's `max_new_tokens: 440` is still needed on Transformers.js 4.3.2
**Status:** Accepted (2026-10-29) — re-test of D-021 part 3, which stands unchanged
**Source:** 4.3.2's `WhisperForConditionalGeneration.generate()` still takes
the seek loop on exactly D-021's condition,
`generation_config.return_timestamps && !kwargs.max_new_tokens`
(`src/models/whisper/modeling_whisper.js`); `_generate_with_seek` is
unchanged. `tests/transformers-runtime.test.ts` now pins that line, so a
future bump that changes it fails the fast suite and prompts a re-measure.
**Measured** (tiny.en q8 — the catalog WASM default — on onnxruntime-node,
CPU, 16-core shared machine, same harness for both versions; pipeline options
as the worker: 30 s chunks, 5 s stride, `return_timestamps`; 888 s
`en_alien.opus`, 44 windows):
| Transformers.js | `max_new_tokens` | generate passes | wall-clock | WER |
|---|---|---|---|---|
| 4.2.0 | 440 | 44 | 54.7 s | 0.315 |
| 4.2.0 | unset (seek loop) | 83 | 66.6 s | 0.447 |
| 4.3.2 | 440 | 44 | 55.5 s | 0.315 |
| 4.3.2 | unset (seek loop) | 84 | 119.7 s | 0.449 |
Pass counts and WER are deterministic and reproduce D-021 (80 passes,
0.447 vs 0.315); wall-clock is noisy here (other workstreams' light jobs
share the CPU), so read it only as "the seek loop is slower", not as a
version-to-version speed comparison.
**Decision:** keep `max_new_tokens: 440` in `src/worker/inference.worker.ts`
and in `tests/live-real-model.test.ts`.