statembed vs model2vec

Model: minishlab/potion-base-8M · Rust: Criterion mean time per call; Python: mean of timed samples (lower is better) · bars scaled per table · green = faster than model2vec-rs.

Rust

Single text, no normalization

Inputmodel2vec-rsstatembedstatembed + rayonSpeedup vs model2vec-rs
statembed, statembed + rayon
short
11.8 µs
1.7 µs
1.8 µs
6.9× · 6.5×
medium
19.8 µs
3.2 µs
3.4 µs
6.2× · 5.9×
long
63.4 µs
11.1 µs
11.6 µs
5.7× · 5.5×
extra-long
465.6 µs
140.3 µs
139.0 µs
3.3× · 3.4×

Single text, with L2 normalization

Inputmodel2vec-rsstatembedstatembed + rayonSpeedup vs model2vec-rs
statembed, statembed + rayon
short
11.7 µs
1.9 µs
1.9 µs
6.2× · 6.1×
medium
19.8 µs
3.3 µs
3.3 µs
5.9× · 6.0×
long
63.2 µs
11.4 µs
11.4 µs
5.6× · 5.5×
extra-long
465.9 µs
140.4 µs
138.6 µs
3.3× · 3.4×

Batch, no normalization

Inputmodel2vec-rsstatembedstatembed + rayonSpeedup vs model2vec-rs
statembed, statembed + rayon
16 texts
1.14 ms
360.5 µs
457.2 µs
3.2× · 2.5×
64 texts
4.57 ms
1.45 ms
1.82 ms
3.1× · 2.5×
256 texts
18.29 ms
5.84 ms
7.31 ms
3.1× · 2.5×

Batch, with L2 normalization

Inputmodel2vec-rsstatembedstatembed + rayonSpeedup vs model2vec-rs
statembed, statembed + rayon
16 texts
1.15 ms
369.8 µs
457.5 µs
3.1× · 2.5×
64 texts
4.58 ms
1.47 ms
1.83 ms
3.1× · 2.5×
256 texts
18.33 ms
5.91 ms
7.35 ms
3.1× · 2.5×

Python

model2vec (Python) vs statembed-py, mean time per call.

Single text, no normalization

Inputmodel2vecstatembed-pySpeedup vs model2vec
statembed-py
short
22.9 µs
3.3 µs
6.9×
medium
30.7 µs
4.7 µs
6.5×
long
68.3 µs
12.0 µs
5.7×
extra-long
428.3 µs
131.7 µs
3.3×

Single text, with L2 normalization

Inputmodel2vecstatembed-pySpeedup vs model2vec
statembed-py
short
26.0 µs
3.5 µs
7.4×
medium
33.8 µs
4.9 µs
7.0×
long
73.0 µs
12.7 µs
5.7×
extra-long
427.8 µs
134.2 µs
3.2×

Batch, no normalization

Inputmodel2vecstatembed-pySpeedup vs model2vec
statembed-py
16 texts
1.05 ms
377.9 µs
2.8×
64 texts
4.13 ms
1.49 ms
2.8×
256 texts
16.30 ms
6.03 ms
2.7×

Batch, with L2 normalization

Inputmodel2vecstatembed-pySpeedup vs model2vec
statembed-py
16 texts
1.07 ms
395.3 µs
2.7×
64 texts
4.26 ms
1.51 ms
2.8×
256 texts
16.86 ms
6.08 ms
2.8×

Source: Rust m2vec_benchmark and embed_benchmark (the latter with and without --features rayon); Python statembed-py/benches/bench_vs_model2vec.py.