github doobidoo/mcp-memory-service v10.40.4
v10.40.4 — fix(quality): handle shape (1, 1) cross-encoder logits in ONNX ranker

latest release: v10.41.0
6 hours ago

Special Thanks

A sincere thank you to @thewusman2025 for filing issue #764, doing the root-cause analysis, and delivering a clean patch. This fix would not have happened without their contribution.

Fixed

[#764] Quality scorer: ONNX cross-encoder scalar logits no longer silently return 0.5 placeholder score

The cross-encoder scoring path in ONNXRankerModel.rerank() assumed logits always had shape (N,). When the ONNX model produces a single candidate pair it outputs shape (1, 1) instead, causing a TypeError on the logits[i] index access. The outer except Exception handler swallowed the error and fell back to a neutral 0.5, making every candidate appear equal — effectively disabling quality-boosted search ranking for any rerank call with a single candidate.

Root cause: logits was a 2-D tensor when only one pair was scored; logits[0] returned a length-1 array rather than a scalar, and logits[1] raised IndexError for the second candidate onward.

Fix: Added logits = logits.squeeze() before the loop, making the ranker shape-agnostic for both single-pair and multi-pair inputs.

(PR #765, resolves #764)

Full Changelog

See CHANGELOG.md for the complete entry.

Don't miss a new mcp-memory-service release

NewReleases is sending notifications on new releases.