use case · basics · variable-length RoPE O(T) scaling · WASM q8 · 28.18 MB

Inside Moonshine Tiny: Variable-Length RoPE vs 30s Padding

Whisper encoders pad every audio input to 30 seconds (480,000 samples) before running self-attention. Moonshine Tiny uses rotary position embeddings (RoPE, partial_rotary_factor: 0.9) over the true utterance length — slice one recording from 2 s → 11 s below to watch real inference latency scale linearly instead of paying a flat 30-second tax.

1 · Moonshine Tiny worker (28.18 MB q8 WASM)

2 · Empirical sub-clip scaling sweep (2s, 4s, 6s, 8s, 11s)

Initialise Moonshine Tiny above to run the live sub-clip latency sweep.

2s vs 11s latency–
Linear slope–
Linearity (R²)–
2s vs 30s pad saved–
NaN count–
Measured inference time, real-time factor, and transcript per sub-clip length
Sub-clip Samples @ 16 kHz Whisper 30s pad waste Measured ms Speedup Tokens Transcript
Run the empirical scaling sweep above to inspect real per-slice timings.

3 · Inspect transcription & regression code

Show the code · worker.js — transcribe() (variable-length audio + real NaN/RTF measurement)
Show the code · moonshine-tiny-core.mjs — computeLinearScalingStats() (OLS latency regression)