Change8

v5.1.0

📦 sentence-transformers
6 features🐛 1 fixes🔧 2 symbols

Summary

Version 5.1.0 adds ONNX and OpenVINO backends for SparseEncoder, a new n‑tuple‑scores format for hard‑negative mining, multi‑GPU gathering, TrackIO support, and updated documentation.

Migration Steps

  1. Install the new version with the appropriate extra, e.g., `pip install sentence-transformers[onnx]` for ONNX or `pip install sentence-transformers[openvino]` for OpenVINO.
  2. If you rely on the default Torch backend, no code changes are required.
  3. To use the new backends, pass `backend=\"onnx\"` or `backend=\"openvino\"` when initializing `SparseEncoder`.
  4. Ensure that your model repository contains an exported ONNX/OpenVINO model file, or let the library export it automatically and then call `model.push_to_hub` or `model.save_pretrained` to cache it.
  5. When using `mine_hard_negatives`, set `output_format=\"n-tuple-scores\"` to get the new format; existing code using the default format will continue to work.

✨ New Features

  • Added ONNX and OpenVINO backends for SparseEncoder models, enabling up to 2x‑3x speedups with optimization and quantization.
  • Introduced a new `backend` keyword argument to `SparseEncoder` allowing values "torch" (default), "onnx", or "openvino".
  • Implemented a new "n-tuple-scores" output format for `mine_hard_negatives`, returning query, answer, multiple negatives and a list of scores.
  • Enabled automatic gathering across devices for multi‑GPU training without extra code.
  • Added TrackIO support for experiment tracking.
  • Provided updated MTEB documentation.

🐛 Bug Fixes

  • Various small bug fixes and improvements.

🔧 Affected Symbols

SparseEncodermine_hard_negatives