Skip to content

[8.x] Set default similarity for Cohere model to cosine (#125370) #125427

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Mar 21, 2025

Conversation

jimczi
Copy link
Contributor

@jimczi jimczi commented Mar 21, 2025

Backport of #125370 to 8.x

Cohere embeddings are expected to be normalized to unit vectors, but due to floating point precision issues,
our check ({@link DenseVectorFieldMapper#isNotUnitVector(float)}) often fails.
This change fixes this bug by setting the default similarity for newly created Cohere inference endpoint to cosine.

Closes elastic#122878
@jimczi jimczi added >bug :ml Machine learning backport auto-merge-without-approval Automatically merge pull request when CI checks pass (NB doesn't wait for reviews!) v8.19.0 labels Mar 21, 2025
@jimczi jimczi changed the title Set default similarity for Cohere model to cosine (#125370) [8.x] Set default similarity for Cohere model to cosine (#125370) Mar 21, 2025
@elasticsearchmachine elasticsearchmachine merged commit 8a66a0c into elastic:8.x Mar 21, 2025
15 checks passed
@jimczi jimczi deleted the backport_125370_8x branch March 21, 2025 20:08
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
auto-merge-without-approval Automatically merge pull request when CI checks pass (NB doesn't wait for reviews!) backport >bug :ml Machine learning v8.19.0
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants