Skip to content

Version 3.0.5

Version 3.0.5 fixes two numerical errors that could corrupt losses and training gradients. Public signatures and minimum supported Python, PyTorch, and NumPy versions are unchanged.

  • RankNContrastLoss preserves values and gradients when similarity or distance scores share a large common offset, including overflow caused by that offset at small temperatures. Its shift preserves small suffixes and does not increase finite score magnitudes (#815).
  • FastAPLoss computes float16 and bfloat16 histogram interpolation, counts, products, and reduction in float32. This prevents overflowing histogram products from returning an infinite loss for correctly separated classes. A caller-supplied float64 distance matrix retains its precision, including when embeddings have a lower precision (#816).

Nonempty low-precision FastAP losses now retain float32. Gradients still accumulate in the input dtype, and empty reductions keep their existing behavior. Widening histogram intermediates increases memory use: with 600 samples and the default 11 bin edges, the interpolation tensor uses about 15.8 MB instead of 7.9 MB. Float32 and float64 histogram storage is unchanged.

Contributors

Thanks to Afloat16 for both fixes and their independent value and gradient regression tests. The original contribution commits are preserved in this release.