Skip to content

Commit d7abb82

Browse files
authored
fix: refresh LLMAsJudgeEvaluator allowed evaluator models (#5987)
* fix: refresh LLMAsJudgeEvaluator allowed evaluator models The hardcoded _ALLOWED_EVALUATOR_MODELS list in sagemaker/train/constants.py had gone stale: several entries were EOL on Bedrock and current judge models were missing, so LLMAsJudgeEvaluator rejected every currently usable model at client-side validation. Re-sync the allowlist (model IDs and per-region availability) with the Bedrock Console judge-model selector, cross-checked against the Bedrock user guide supported-evaluator-models list. Adds Claude Sonnet 4 / 4.5, Claude Haiku 4.5, Claude Opus 4.5, and Nova 2 Lite / Micro / Premier, and widens the region lists for existing models to match the source of truth. Update the docstring examples and unit tests that pinned the previous default judge model (Claude 3.5 Sonnet v1), which is now only available in ap-northeast-1. * fix: drop claude-3-5-haiku-20241022 from evaluator allowlist Remove anthropic.claude-3-5-haiku-20241022-v1:0 from the LLM-as-Judge evaluator allowlist and update the unit and integration tests that referenced it as the judge model.
1 parent 78bb11e commit d7abb82

5 files changed

Lines changed: 34 additions & 16 deletions

File tree

‎sagemaker-train/src/sagemaker/train/constants.py‎

Lines changed: 17 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -58,15 +58,25 @@ def get_sagemaker_hub_name() -> str:
5858
"qwen.qwen3-235b-a22b-2507-v1:0": ["us-west-2", "ap-northeast-1"]
5959
}
6060

61-
# Allowed evaluator models for LLM as Judge evaluator with region restrictions
61+
# Allowed evaluator models for LLM as Judge evaluator with region restrictions.
62+
#
63+
# Source of truth: the Bedrock Console judge-model regional
64+
# allowlist.cross-checked against
65+
# https://docs.aws.amazon.com/bedrock/latest/userguide/evaluation-judge.html#evaluation-judge-supported
6266
_ALLOWED_EVALUATOR_MODELS = {
63-
"anthropic.claude-3-5-sonnet-20240620-v1:0": ["us-west-2", "us-east-1", "ap-northeast-1"],
64-
"anthropic.claude-3-5-sonnet-20241022-v2:0": ["us-west-2"],
65-
"anthropic.claude-3-haiku-20240307-v1:0": ["us-west-2", "us-east-1", "ap-northeast-1", "eu-west-1"],
66-
"anthropic.claude-3-5-haiku-20241022-v1:0": ["us-west-2"],
67-
"meta.llama3-1-70b-instruct-v1:0": ["us-west-2"],
6867
"mistral.mistral-large-2402-v1:0": ["us-west-2", "us-east-1", "eu-west-1"],
69-
"amazon.nova-pro-v1:0": ["us-east-1"]
68+
"meta.llama3-1-70b-instruct-v1:0": ["us-west-2", "us-east-1"],
69+
"anthropic.claude-3-haiku-20240307-v1:0": ["us-west-2", "us-east-1", "ap-northeast-1", "eu-west-1"],
70+
"anthropic.claude-sonnet-4-20250514-v1:0": ["us-west-2", "us-east-1", "ap-northeast-1", "eu-west-1"],
71+
"anthropic.claude-haiku-4-5-20251001-v1:0": ["us-west-2", "us-east-1", "ap-northeast-1", "eu-west-1"],
72+
"anthropic.claude-sonnet-4-5-20250929-v1:0": ["us-west-2", "us-east-1", "ap-northeast-1", "eu-west-1"],
73+
"anthropic.claude-opus-4-5-20251101-v1:0": ["us-west-2", "us-east-1", "ap-northeast-1", "eu-west-1"],
74+
"amazon.nova-pro-v1:0": ["us-west-2", "us-east-1", "ap-northeast-1", "eu-west-1"],
75+
"amazon.nova-2-lite-v1:0": ["us-west-2", "us-east-1", "ap-northeast-1", "eu-west-1"],
76+
"amazon.nova-micro-v1:0": ["us-west-2", "us-east-1", "ap-northeast-1", "eu-west-1"],
77+
"amazon.nova-premier-v1:0": ["us-west-2", "us-east-1"],
78+
"anthropic.claude-3-5-sonnet-20240620-v1:0": ["ap-northeast-1"],
79+
"anthropic.claude-3-5-sonnet-20241022-v2:0": ["ap-northeast-1"],
7080
}
7181

7282
SM_RECIPE = "recipe"

‎sagemaker-train/src/sagemaker/train/evaluate/llm_as_judge_evaluator.py‎

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -110,7 +110,7 @@ class LLMAsJudgeEvaluator(BaseEvaluator):
110110
# Both formats work - with or without 'Builtin.' prefix
111111
evaluator = LLMAsJudgeEvaluator(
112112
base_model="llama-3-3-70b-instruct",
113-
evaluator_model="anthropic.claude-3-5-sonnet-20240620-v1:0",
113+
evaluator_model="anthropic.claude-sonnet-4-20250514-v1:0",
114114
dataset="s3://my-bucket/my-dataset.jsonl",
115115
builtin_metrics=["Correctness", "Helpfulness"], # Prefix optional
116116
mlflow_resource_arn="arn:aws:sagemaker:us-west-2:123456789012:mlflow-tracking-server/my-server",
@@ -144,7 +144,7 @@ class LLMAsJudgeEvaluator(BaseEvaluator):
144144
# Example evaluating only custom model (skip base model)
145145
evaluator = LLMAsJudgeEvaluator(
146146
base_model="llama-3-3-70b-instruct",
147-
evaluator_model="anthropic.claude-3-5-sonnet-20240620-v1:0",
147+
evaluator_model="anthropic.claude-sonnet-4-20250514-v1:0",
148148
dataset="s3://my-bucket/my-dataset.jsonl",
149149
builtin_metrics=["Correctness"], # Prefix optional
150150
evaluate_base_model=False,
@@ -776,7 +776,7 @@ def evaluate(self):
776776
777777
evaluator = LLMAsJudgeEvaluator(
778778
base_model="llama-3-3-70b-instruct",
779-
evaluator_model="anthropic.claude-3-5-sonnet-20240620-v1:0",
779+
evaluator_model="anthropic.claude-sonnet-4-20250514-v1:0",
780780
dataset="s3://my-bucket/my-dataset.jsonl",
781781
builtin_metrics=["Correctness", "Helpfulness"],
782782
s3_output_path="s3://my-bucket/output"

‎sagemaker-train/tests/integ/train/test_llm_as_judge_base_model_fix.py‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,7 @@
7070
ACCOUNT_ID = "729646638167"
7171

7272
TEST_CONFIG = {
73-
"evaluator_model": "anthropic.claude-3-5-haiku-20241022-v1:0",
73+
"evaluator_model": "anthropic.claude-sonnet-4-20250514-v1:0",
7474
"dataset_s3_uri": f"s3://sagemaker-{REGION}-{ACCOUNT_ID}/model-customization/eval/gen_qa.jsonl",
7575
"builtin_metrics": ["Completeness", "Faithfulness"],
7676
"custom_metrics_json": json.dumps([CUSTOM_METRIC_DICT]),

‎sagemaker-train/tests/integ/train/test_llm_as_judge_evaluator.py‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,7 @@
7272

7373
TEST_CONFIG = {
7474
"model_package_arn": "arn:aws:sagemaker:us-west-2:729646638167:model-package/sdk-test-finetuned-models/1",
75-
"evaluator_model": "anthropic.claude-3-5-haiku-20241022-v1:0",
75+
"evaluator_model": "anthropic.claude-sonnet-4-20250514-v1:0",
7676
"dataset_s3_uri": "s3://sagemaker-us-west-2-729646638167/model-customization/eval/gen_qa.jsonl",
7777
"builtin_metrics": ["Completeness", "Faithfulness"],
7878
"custom_metrics_json": json.dumps([CUSTOM_METRIC_DICT]),

‎sagemaker-train/tests/unit/train/evaluate/test_llm_as_judge_evaluator.py‎

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@
3131
DEFAULT_MODEL_PACKAGE_GROUP_ARN = "arn:aws:sagemaker:us-west-2:123456789012:model-package-group/test-group"
3232
DEFAULT_BASE_MODEL_ARN = "arn:aws:sagemaker:us-west-2:aws:hub-content/SageMakerPublicHub/Model/llama3-2-1b-instruct/1.0.0"
3333
DEFAULT_ARTIFACT_ARN = "arn:aws:sagemaker:us-west-2:123456789012:artifact/test-artifact"
34-
DEFAULT_EVALUATOR_MODEL = "anthropic.claude-3-5-sonnet-20240620-v1:0"
34+
DEFAULT_EVALUATOR_MODEL = "anthropic.claude-sonnet-4-20250514-v1:0"
3535

3636

3737
@patch('sagemaker.train.common_utils.model_resolution._resolve_base_model')
@@ -847,13 +847,21 @@ def test_llm_as_judge_evaluator_with_mlflow_names(mock_artifact, mock_resolve):
847847
@patch('sagemaker.core.resources.Artifact')
848848
def test_llm_as_judge_evaluator_valid_evaluator_models(mock_artifact, mock_resolve):
849849
"""Test LLMAsJudgeEvaluator with valid evaluator models."""
850+
# Models available in us-west-2 per the regional allowlist. The Claude 3.5
851+
# Sonnet v1/v2 models are intentionally omitted here — they are only allowed
852+
# in ap-northeast-1 (see test_llm_as_judge_evaluator_region_restriction).
850853
valid_models = [
851-
"anthropic.claude-3-5-sonnet-20240620-v1:0",
852-
"anthropic.claude-3-5-sonnet-20241022-v2:0",
853854
"anthropic.claude-3-haiku-20240307-v1:0",
854-
"anthropic.claude-3-5-haiku-20241022-v1:0",
855+
"anthropic.claude-sonnet-4-20250514-v1:0",
856+
"anthropic.claude-haiku-4-5-20251001-v1:0",
857+
"anthropic.claude-sonnet-4-5-20250929-v1:0",
858+
"anthropic.claude-opus-4-5-20251101-v1:0",
855859
"meta.llama3-1-70b-instruct-v1:0",
856860
"mistral.mistral-large-2402-v1:0",
861+
"amazon.nova-pro-v1:0",
862+
"amazon.nova-2-lite-v1:0",
863+
"amazon.nova-micro-v1:0",
864+
"amazon.nova-premier-v1:0",
857865
]
858866

859867
mock_info = Mock()

0 commit comments

Comments
 (0)