Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions docs/changelog/130336.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
pr: 130336
summary: "[EIS] Rename the elser 2 default model and the default inference endpoint"
area: Machine Learning
type: bug
issues: []
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ public void testGetDefaultEndpoints() throws IOException {
}

assertInferenceIdTaskType(allModels, ".rainbow-sprinkles-elastic", TaskType.CHAT_COMPLETION);
assertInferenceIdTaskType(allModels, ".elser-v2-elastic", TaskType.SPARSE_EMBEDDING);
assertInferenceIdTaskType(allModels, ".elser-2-elastic", TaskType.SPARSE_EMBEDDING);
assertInferenceIdTaskType(allModels, ".multilingual-embed-v1-elastic", TaskType.TEXT_EMBEDDING);
assertInferenceIdTaskType(allModels, ".rerank-v1-elastic", TaskType.RERANK);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do we need to remove v from the text embedding and rerank default endpoint names too?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nope, we'll only do the adjustment for ELSER to be en par with the ML node

}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ public void enqueueAuthorizeAllModelsResponse() {
"task_types": ["chat"]
},
{
"model_name": "elser-v2",
"model_name": "elser_model_2",
"task_types": ["embed/text/sparse"]
},
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -193,7 +193,7 @@ public void testRemoves_DefaultChatCompletion_V1_WhenAuthorizationDoesNotReturnA
{
"models": [
{
"model_name": "elser-v2",
"model_name": "elser_model_2",
"task_types": ["embed/text/sparse"]
},
{
Expand Down Expand Up @@ -222,7 +222,7 @@ public void testRemoves_DefaultChatCompletion_V1_WhenAuthorizationDoesNotReturnA
service.defaultConfigIds(),
containsInAnyOrder(
new InferenceService.DefaultConfigId(
".elser-v2-elastic",
".elser-2-elastic",
MinimalServiceSettings.sparseEmbedding(ElasticInferenceService.NAME),
service
),
Expand Down Expand Up @@ -255,7 +255,7 @@ public void testRemoves_DefaultChatCompletion_V1_WhenAuthorizationDoesNotReturnA

PlainActionFuture<List<Model>> listener = new PlainActionFuture<>();
service.defaultConfigs(listener);
assertThat(listener.actionGet(TIMEOUT).get(0).getConfigurations().getInferenceEntityId(), is(".elser-v2-elastic"));
assertThat(listener.actionGet(TIMEOUT).get(0).getConfigurations().getInferenceEntityId(), is(".elser-2-elastic"));
assertThat(
listener.actionGet(TIMEOUT).get(1).getConfigurations().getInferenceEntityId(),
is(".multilingual-embed-v1-elastic")
Expand All @@ -277,7 +277,7 @@ public void testRemoves_DefaultChatCompletion_V1_WhenAuthorizationDoesNotReturnA
{
"models": [
{
"model_name": "elser-v2",
"model_name": "elser_model_2",
"task_types": ["embed/text/sparse"]
},
{
Expand All @@ -302,7 +302,7 @@ public void testRemoves_DefaultChatCompletion_V1_WhenAuthorizationDoesNotReturnA
service.defaultConfigIds(),
containsInAnyOrder(
new InferenceService.DefaultConfigId(
".elser-v2-elastic",
".elser-2-elastic",
MinimalServiceSettings.sparseEmbedding(ElasticInferenceService.NAME),
service
),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -106,9 +106,9 @@ public class ElasticInferenceService extends SenderService {
static final String DEFAULT_CHAT_COMPLETION_MODEL_ID_V1 = "rainbow-sprinkles";
static final String DEFAULT_CHAT_COMPLETION_ENDPOINT_ID_V1 = defaultEndpointId(DEFAULT_CHAT_COMPLETION_MODEL_ID_V1);

// elser-v2
static final String DEFAULT_ELSER_MODEL_ID_V2 = "elser-v2";
static final String DEFAULT_ELSER_ENDPOINT_ID_V2 = defaultEndpointId(DEFAULT_ELSER_MODEL_ID_V2);
// elser-2
static final String DEFAULT_ELSER_2_MODEL_ID = "elser_model_2";
static final String DEFAULT_ELSER_ENDPOINT_ID_V2 = defaultEndpointId("elser-2");
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't love this mismatch, but I imagine there are some considerations you're keeping in mind. Does changing it have backwards compatibility ramifications? Trying to think what the impact is, but can't figure it out 😅

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm with you, it doesn't look great. But the goal here is to be consistent with how things are called in the ML node, at least for ELSER. The model is called .elser_model_2 and the inference endpoint is .elser-2-elasticsearch. If we expect people to migrate with less confusion, it's good if the names are similar.

Now, the name of the reranker is .rerank-v1. That's how we got here...

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

backwards compatibility

These endpoints are not released yet, so we have the luxury of being able to change the name still.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ahh, gotcha. Thanks for the clarification!


// multilingual-text-embed
static final String DEFAULT_MULTILINGUAL_EMBED_MODEL_ID = "multilingual-embed-v1";
Expand Down Expand Up @@ -174,13 +174,13 @@ private static Map<String, DefaultModelConfig> initDefaultEndpoints(
),
MinimalServiceSettings.chatCompletion(NAME)
),
DEFAULT_ELSER_MODEL_ID_V2,
DEFAULT_ELSER_2_MODEL_ID,
new DefaultModelConfig(
new ElasticInferenceServiceSparseEmbeddingsModel(
DEFAULT_ELSER_ENDPOINT_ID_V2,
TaskType.SPARSE_EMBEDDING,
NAME,
new ElasticInferenceServiceSparseEmbeddingsServiceSettings(DEFAULT_ELSER_MODEL_ID_V2, null, null),
new ElasticInferenceServiceSparseEmbeddingsServiceSettings(DEFAULT_ELSER_2_MODEL_ID, null, null),
EmptyTaskSettings.INSTANCE,
EmptySecretSettings.INSTANCE,
elasticInferenceServiceComponents,
Expand Down Expand Up @@ -213,7 +213,6 @@ private static Map<String, DefaultModelConfig> initDefaultEndpoints(
DenseVectorFieldMapper.ElementType.FLOAT
)
),

DEFAULT_RERANK_MODEL_ID_V1,
new DefaultModelConfig(
new ElasticInferenceServiceRerankModel(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,4 @@ public static boolean isValidModel(String model) {
return model != null && VALID_ELSER_MODEL_IDS.contains(model);
}

public static boolean isValidEisModel(String model) {
return ELSER_V2_MODEL.equals(model);
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -1243,7 +1243,7 @@ public void testDefaultConfigs_Returns_DefaultEndpoints_WhenTaskTypeIsCorrect()
"task_types": ["chat"]
},
{
"model_name": "elser-v2",
"model_name": "elser_model_2",
"task_types": ["embed/text/sparse"]
},
{
Expand All @@ -1270,7 +1270,7 @@ public void testDefaultConfigs_Returns_DefaultEndpoints_WhenTaskTypeIsCorrect()
is(
List.of(
new InferenceService.DefaultConfigId(
".elser-v2-elastic",
".elser-2-elastic",
MinimalServiceSettings.sparseEmbedding(ElasticInferenceService.NAME),
service
),
Expand Down Expand Up @@ -1306,7 +1306,7 @@ public void testDefaultConfigs_Returns_DefaultEndpoints_WhenTaskTypeIsCorrect()
service.defaultConfigs(listener);
var models = listener.actionGet(TIMEOUT);
assertThat(models.size(), is(4));
assertThat(models.get(0).getConfigurations().getInferenceEntityId(), is(".elser-v2-elastic"));
assertThat(models.get(0).getConfigurations().getInferenceEntityId(), is(".elser-2-elastic"));
assertThat(models.get(1).getConfigurations().getInferenceEntityId(), is(".multilingual-embed-v1-elastic"));
assertThat(models.get(2).getConfigurations().getInferenceEntityId(), is(".rainbow-sprinkles-elastic"));
assertThat(models.get(3).getConfigurations().getInferenceEntityId(), is(".rerank-v1-elastic"));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -188,13 +188,13 @@ private static Map<String, DefaultModelConfig> initDefaultEndpoints() {
),
MinimalServiceSettings.chatCompletion(ElasticInferenceService.NAME)
),
"elser-v2",
"elser-2",
new DefaultModelConfig(
new ElasticInferenceServiceSparseEmbeddingsModel(
defaultEndpointId("elser-v2"),
defaultEndpointId("elser-2"),
TaskType.SPARSE_EMBEDDING,
"test",
new ElasticInferenceServiceSparseEmbeddingsServiceSettings("elser-v2", null, null),
new ElasticInferenceServiceSparseEmbeddingsServiceSettings("elser-2", null, null),
EmptyTaskSettings.INSTANCE,
EmptySecretSettings.INSTANCE,
ElasticInferenceServiceComponents.EMPTY_INSTANCE,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,21 +19,7 @@ public void testIsValidModel() {
assertTrue(org.elasticsearch.xpack.inference.services.elasticsearch.ElserModels.isValidModel(randomElserModel()));
}

public void testIsValidEisModel() {
assertTrue(
org.elasticsearch.xpack.inference.services.elasticsearch.ElserModels.isValidEisModel(
org.elasticsearch.xpack.inference.services.elasticsearch.ElserModels.ELSER_V2_MODEL
)
);
}

public void testIsInvalidModel() {
assertFalse(org.elasticsearch.xpack.inference.services.elasticsearch.ElserModels.isValidModel("invalid"));
}

public void testIsInvalidEisModel() {
assertFalse(
org.elasticsearch.xpack.inference.services.elasticsearch.ElserModels.isValidEisModel(ElserModels.ELSER_V2_MODEL_LINUX_X86)
);
}
}
Loading