# The port against the original, on one machine
What was asked: redo the benchmarks of the original's README for the Rust
port. What could be done, and what could not.
The charts are drawn by [`build_charts.py`](build_charts.py) from
[`results.jsonl`](results.jsonl), in the look of the repository's own board
charts; the same numbers are in the tables below.
## The VIBE boards cannot be redone
The original README ranks systems on Inworld VIBE (0.768 for the Voice
Isolator, 0.718 for its realtime model). Those boards cannot be recomputed
here, or anywhere outside Inworld: "The eval set and the score files are not
distributed, so the boards cannot be recomputed outside Inworld"
([`bench/README.md`](../../bench/README.md)). The way a new system gets a
score is a wrapper sent to Inworld
([`bench/WRAPPER_CONTRACT.md`](../../bench/WRAPPER_CONTRACT.md)); none was
sent for this port.
What can be checked here is whether the port is the same system as the
original, and how fast each runs. Both were measured with the original
package itself installed beside the port.
## Set-up
- Machine: AMD Ryzen 7 7800X3D (8 cores, 16 threads), 31 GB of memory, AMD
Radeon RX 7900 XT, Windows 11.
- Original: the package of this repository (`src/inworld`, at commit
`c73b3fa`) on Python 3.11.9 with PyTorch 2.15.0, the CPU build (8 threads,
its default), float32. No GPU build of PyTorch was installed, so there is no
figure for the original on a GPU; its README lists NVIDIA GPUs as its tested
hardware.
- Port: the release build of `rust/voice-isolator-rs`, on the CPU (16
threads, its default) and on the RX 7900 XT through ROCm/HIP 7.2, float32.
- Same checkpoints (`denoiser.safetensors`, `denoiser_realtime.safetensors`),
same input files, look-ahead 0, every default left alone.
- One run of each row: a first pass, then warm passes (two to five; one for
the slowest rows) and their median.
## Is it the same system?
Each render of the port was compared, sample by sample, with the original
package's render of the same file ([`parity.py`](parity.py)).
| Mode | Clip | Port on | Largest difference | Difference under the signal |
|---|---|---|---|---|
| offline | 3 s of speech with hiss | CPU | 1.2e-7 | 134.9 dB |
| offline | 3 s | RX 7900 XT | 1.8e-7 | 133.5 dB |
| offline | 10.77 s (`demo/examples/sample_14.wav`) | CPU | 1.8e-7 | 135.2 dB |
| offline | 10.77 s | RX 7900 XT | 1.8e-7 | 133.8 dB |
| streaming, 500 ms pushes | 3 s | CPU | 1.5e-7 | 132.7 dB |
| streaming | 3 s | RX 7900 XT | 1.6e-7 | 132.2 dB |
| streaming | 10.77 s | CPU | 2.1e-7 | 133.4 dB |
| streaming | 10.77 s | RX 7900 XT | 1.8e-7 | 133.0 dB |
The renders agree to float32 round-off: the difference sits 132 to 135 dB
under the signal. A system that puts out the same audio is scored the same,
so the original's VIBE scores describe this port's output as well. They were
measured by Inworld on the Python package, not on this port.
This is a second check beside the port's golden tests, which compare with
the renders of Inworld's training reference kept in `tests/fixtures`.
The two light engines of the port are another matter. DeepFilterNet3 is on
the denoising board at 0.510, scored by Inworld from release v0.5.6 through
its Python package; the port runs the same release's ONNX export through its
authors' Rust library, and the two renders were not compared. DTLN is not on
the boards.
## Speed
### The original's own speed test
[`bench/scripts/speedtest.py`](../../bench/scripts/speedtest.py), unmodified,
in its synthetic mode (three seconds of noise from a fixed seed, a cold pass
and three warm ones through the public `isolate`), and the port on the same
clip through the same procedure (`examples/bench_speed.rs`).
| Mode | | Cold pass | Warm median | Times real time |
|---|---|---|---|---|
| offline | original, CPU | 7.66 s | 7.65 s | 0.4 |
| | port, CPU | 3.65 s | 3.65 s | 0.8 |
| | port, RX 7900 XT | 0.46 s | 0.16 s | 18.6 |
| streaming | original, CPU | 7.16 s | 7.12 s | 0.4 |
| | port, CPU | 6.80 s | 6.43 s | 0.5 |
| | port, RX 7900 XT | 0.70 s | 0.39 s | 7.6 |
### Speech clips, with memory
[`orig_render.py`](orig_render.py) for the original and
`examples/bench_speed.rs` for the port: the same program on each side.
Streaming is a stream fed 500 ms at a time and flushed. Memory is the peak
working set of the process ([`run_guarded.ps1`](run_guarded.ps1)); for the GPU
rows it does not count the card's own memory.
| Mode | Clip | | Warm median | Times real time | Peak memory |
|---|---|---|---|---|---|
| offline | 3 s | original, CPU | 7.94 s | 0.38 | 3.0 GB |
| | | port, CPU | 3.73 s | 0.80 | 0.8 GB |
| | | port, RX 7900 XT | 0.16 s | 18.5 | 0.4 GB |
| offline | 10.77 s | original, CPU | 43.9 s | 0.25 | 7.1 GB |
| | | port, CPU | 19.4 s | 0.55 | 1.6 GB |
| | | port, RX 7900 XT | 0.92 s | 11.7 | 0.4 GB |
| streaming | 3 s | original, CPU | 8.13 s | 0.37 | 1.0 GB |
| | | port, CPU | 6.63 s | 0.45 | 0.5 GB |
| | | port, RX 7900 XT | 0.40 s | 7.5 | 0.3 GB |
| streaming | 10.77 s | original, CPU | 34.9 s | 0.31 | 1.8 GB |
| | | port, CPU | 28.3 s | 0.38 | 1.3 GB |
| | | port, RX 7900 XT | 1.73 s | 6.2 | 0.3 GB |
### What the numbers say
- **Offline on the CPU the port is about 2.3 times as fast** as the original
(19.4 s against 43.9 s for 10.77 s of audio) in a quarter of the memory
(1.6 GB against 7.1 GB).
- **Streaming on the CPU the port is about 1.2 times as fast** (28.3 s
against 34.9 s). In the first run of this comparison it was twice as slow
(64.0 s): its CPU backend had been written for correctness. The changes
that closed the gap, each measured against a control, are in
[`../optimisation/PLAN.md`](../optimisation/PLAN.md); the earlier lines are
kept in `results.jsonl`, marked `before_cpu_optimisation`.
- **On the CPU neither runs in real time**, offline or streaming.
- **The port on the RX 7900 XT runs both modes faster than real time** (12 to
19 times offline, 6 to 8 times streaming). This is not a like-for-like
comparison with the original, which was run on the CPU only; it is what the
port adds on this machine: a GPU path that needs neither Python nor
PyTorch.
## Not measured
- The original on a GPU.
- Anything about quality beyond the equality of the renders: no VIBE score,
no listening test.
- Other machines, other clips than these three, half precision.
## Run it again
```powershell
# the original, in a Python that has torch, torchaudio, numpy, soundfile, safetensors and src/ on its path
python orig_render.py ..\..\models\denoiser.safetensors offline in.wav original.wav 2
python ..\..\bench\scripts\speedtest.py --model ..\..\models\denoiser.safetensors --synthetic 3 --repeat 3 --device cpu
# the port (from rust\voice-isolator-rs)
cargo run --release --example bench_speed -- offline rocm:0 in.wav port.wav 2
# the two renders
python parity.py original.wav port.wav
# the charts, from results.jsonl
python build_charts.py
```
The raw lines of every run are in [`results.jsonl`](results.jsonl).