v5.6.0
📦 sentence-transformersView on GitHub →
✨ 2 features🐛 10 fixes⚡ 1 deprecations🔧 11 symbols
Summary
This minor release focuses on correctness and robustness, fixing silent scoring bugs related to chat-template truncation and improving stability for hard-negative mining and GIST losses. It also introduces MPS support and restores TSDAE functionality on recent `transformers` versions.
Migration Steps
- If you rely on loading local custom code via directory paths, ensure you add `trust_remote_code=True` to your loading call to avoid warnings and future errors.
- If you were manually opting out of chat-template suffix restoration by passing `processing_kwargs={\"chat_template\": {\"restore_suffix\": False}}`, note that this setting is now required to opt out of the fix.
- If using GIST losses with distributed training and margins, verify loss stability, though the fix should resolve previous `+inf` loss issues.
✨ New Features
- Added Apple Silicon (MPS) support for cached losses (`CachedMultipleNegativesRankingLoss` and `CachedGISTEmbedLoss`).
- Restored weight tying functionality for TSDAE (`DenoisingAutoEncoderLoss`) when using `transformers` v5+ by implementing a custom tying routine.
🐛 Bug Fixes
- Fixed a silent scoring bug in causal-LM rerankers and last-token-pooling embedders when input truncation dropped the chat template's trailing suffix; the suffix is now restored after truncation.
- Corrected the sign-independent relative margin calculation in `mine_hard_negatives` and `GISTEmbedLoss` when positive pair similarities are negative.
- Fixed distributed positive masking in GIST losses when `gather_across_devices=True` and `margin > 0`, preventing `+inf` loss on GPUs beyond the first rank.
- Implemented memory-bounded hard-negative mining when `use_faiss=False` by batching over the query axis, preventing OOM errors on large corpora.
- Fixed learning-to-rank loss logits being cast to float32, preventing dtype mismatches when models use bf16/fp16.
- Prevented overriding explicit `device_map` placement during model loading when the `device` argument is also provided; a warning is issued if both are present.
- Fixed an issue where single-key multimodal input dictionaries (e.g., `{"image": img}`) were incorrectly rejected by single-modality models; they are now treated as bare modality inputs.
- Improved error messages for unsupported multimodal inputs, providing clearer guidance on how to proceed (e.g., encoding modalities separately).
- Guarded distributed APIs in `get_device_name` to prevent crashes on PyTorch builds where `torch.distributed` is present but unavailable (e.g., some ROCm/CPU-only builds).
- Fixed OpenVINO static quantization export when using optimum-intel 2.0 / OpenVINO 2026 due to stricter Hub validation of calibration dataset IDs.
Affected Symbols
⚡ Deprecations
- Loading local custom code (e.g., via a local directory path) without explicitly setting `trust_remote_code=True` now issues a `FutureWarning`. From v6.0, this will require `trust_remote_code=True` to load custom code, aligning behavior with Hugging Face Transformers.