Skip to content

v0.6.1 — pad-to-longest ONNX batching (~90x short-query encode)

Choose a tag to compare

@Cloto-dev Cloto-dev released this 12 Jul 13:52
aa2893a

Fixed

All three local ONNX providers (jina-v5-nano, bge-m3, MiniLM) padded every batch to a fixed ONNX_MAX_SEQ_LEN (default 2048), so every forward pass cost the full max length regardless of input size. Batches are now padded to their longest sequence:

metric 0.6.0 0.6.1
short query encode p50 ~617 ms ~7 ms (~90x)
batch document encode ~0.5 docs/s ~460 docs/s

Embeddings are unchanged — pooling honors the attention mask, so pad rows never contribute (parity verified to cosine 1.0, max element diff 3.7e-7). Truncation caps are unchanged.

Measured end-to-end through CPersona do_recall (real HTTP encode): recall p50 at 10k memories = 51 ms (local scan) / 30 ms (remote matrix search), versus a ~620 ms floor before the fix.

Adds tests/test_onnx_padding.py regression tests (they need the model assets on disk and self-skip in CI).

PR: #7