Express Model Validation

Lightweight express validation of a candidate model against a holdout test set. Used for fast shadow-mode evaluation before promoting to production traffic.
{
  "Comment": "Lightweight express validation of a candidate model against a holdout test set. Used for fast shadow-mode evaluation before promoting to production traffic.",
  "StartAt": "SetValidationContext",
  "States": {
    "SetValidationContext": {
      "Type": "Pass",
      "Parameters": {
        "modelName.$": "$.modelName",
        "modelVersion.$": "$.modelVersion",
        "algorithm.$": "$.algorithm",
        "datasetId.$": "$.datasetId",
        "dataSource.$": "$.dataSource",
        "targetColumn.$": "$.targetColumn",
        "taskType.$": "$.taskType",
        "requestedBy.$": "$.requestedBy",
        "performanceThreshold.$": "$.performanceThreshold",
        "validationMode": "SHADOW",
        "shadowTrafficPercent": 5,
        "deploymentStrategy": "CANARY"
      },
      "Next": "ExpressIngestHoldoutData"
    },
    "ExpressIngestHoldoutData": {
      "Type": "Task",
      "Resource": "${IngestTrainingDataFunctionArn}",
      "Retry": [
        {
          "ErrorEquals": [
            "States.ALL"
          ],
          "IntervalSeconds": 3,
          "MaxAttempts": 2,
          "BackoffRate": 2
        }
      ],
      "Catch": [
        {
          "ErrorEquals": [
            "States.ALL"
          ],
          "Next": "ValidationFailed"
        }
      ],
      "Next": "ExpressPreprocessHoldout"
    },
    "ExpressPreprocessHoldout": {
      "Type": "Task",
      "Resource": "${PreprocessFeaturesFunctionArn}",
      "Retry": [
        {
          "ErrorEquals": [
            "States.ALL"
          ],
          "IntervalSeconds": 3,
          "MaxAttempts": 2,
          "BackoffRate": 2
        }
      ],
      "Catch": [
        {
          "ErrorEquals": [
            "States.ALL"
          ],
          "Next": "ValidationFailed"
        }
      ],
      "Next": "ExpressEvaluateCandidate"
    },
    "ExpressEvaluateCandidate": {
      "Type": "Task",
      "Resource": "${EvaluateModelFunctionArn}",
      "Retry": [
        {
          "ErrorEquals": [
            "States.ALL"
          ],
          "IntervalSeconds": 3,
          "MaxAttempts": 2,
          "BackoffRate": 2
        }
      ],
      "Catch": [
        {
          "ErrorEquals": [
            "States.ALL"
          ],
          "Next": "ValidationFailed"
        }
      ],
      "Next": "WaitForShadowComparison"
    },
    "WaitForShadowComparison": {
      "Type": "Wait",
      "Seconds": 2,
      "Next": "RouteByValidationResult"
    },
    "RouteByValidationResult": {
      "Type": "Choice",
      "Choices": [
        {
          "Variable": "$.evaluation.meetsThreshold",
          "BooleanEquals": true,
          "Next": "ExpressDeployShadowEndpoint"
        }
      ],
      "Default": "ValidationFailed"
    },
    "ExpressDeployShadowEndpoint": {
      "Type": "Task",
      "Resource": "${DeployModelEndpointFunctionArn}",
      "Retry": [
        {
          "ErrorEquals": [
            "States.ALL"
          ],
          "IntervalSeconds": 5,
          "MaxAttempts": 2,
          "BackoffRate": 2
        }
      ],
      "Catch": [
        {
          "ErrorEquals": [
            "States.ALL"
          ],
          "Next": "ValidationFailed"
        }
      ],
      "Next": "NotifyValidationResult"
    },
    "NotifyValidationResult": {
      "Type": "Task",
      "Resource": "${NotifyTrainingStatusFunctionArn}",
      "Retry": [
        {
          "ErrorEquals": [
            "States.ALL"
          ],
          "IntervalSeconds": 2,
          "MaxAttempts": 2,
          "BackoffRate": 2
        }
      ],
      "Next": "ValidationPassed"
    },
    "ValidationPassed": {
      "Type": "Succeed"
    },
    "ValidationFailed": {
      "Type": "Fail",
      "Error": "ValidationFailed",
      "Cause": "Candidate model did not pass express shadow-mode validation. Promotion to production traffic blocked."
    }
  }
}
JSON
Expand
100%

AI teams can use patterns like this to build reliable, compliant, and scalable automation for payment systems and can test and refine these flows locally with Thrubit to reduce cloud cost and speed up iteration.