MODELCATALOG

Deploy & inference

Deploy & inference

Feature Store during inference

Keeps inference features consistent with those used during training.

Inputs

entity ID + request-time values

Outputs

typed/ordered feature vector for scoring

Core explanation

The endpoint does not magically query Feature Store; the serving workflow retrieves the required features and passes them into the model.

01

Mental model

What this means before worrying about syntax.

An incoming entity or transaction identifier can be used to retrieve current online features, construct the model payload and invoke the endpoint.

  • Feature Store sits upstream of endpoint invocation.
  • Online feature lookup is part of the latency/availability path.
  • The endpoint needs feature values in the exact schema/order expected by the model.
Lifecycle position
request ID -> online feature lookup -> feature vector -> endpoint -> prediction
02

Implementation anatomy

The sequence you would actually build or configure.

  1. 1

    Receive entity/transaction ID.

  2. 2

    GetRecord latest online features.

  3. 3

    Join multiple feature groups in the application if needed.

  4. 4

    Combine with request-time fields.

  5. 5

    Validate schema/order.

  6. 6

    Invoke endpoint and log feature/model context.

Objects / terms worth remembering
Online Storerecord identifierfeature vectorEndpoint
03

Concrete example

A real model-development or production flow.

1

Request: card_id, merchant_id, amount, timestamp

↓
2

Get card tx_count_5m, avg_amount_30d, account_age

↓
3

Get merchant_risk_score

↓
4

Assemble ordered feature vector

↓
5

Invoke fraud endpoint

↓
6

Return probability

04

Implementation lab

Concrete code, data manipulation and configuration for this lifecycle step.

01

Retrieve, type-cast, order and invoke

python

Real systems must enforce names, types and order. A list in the wrong order can produce a valid response that is semantically wrong.

import boto3

runtime = boto3.client("sagemaker-feature_store-runtime")

resp = runtime.get_record(
    FeatureGroupName="card-behavior-features",
    RecordIdentifierValueAsString=card_id,
)

raw = {
    x["FeatureName"]: x["ValueAsString"]
    for x in resp["Record"]
}

feature_order = [
    "tx_count_5m",
    "amount_sum_1h",
    "avg_amount_30d",
    "merchant_risk_score",
]

feature_vector = [
    float(raw[name])
    for name in feature_order
]

prediction = endpoint.invoke(data={
    "features": feature_vector
})
02

Missing/stale feature policy

python

The fallback policy is part of the model-serving contract and should be observable.

def feature_or_fallback(features, name, default, max_age_seconds):
    item = features.get(name)

    if item is None:
        return default, "missing"

    if item["age_seconds"] > max_age_seconds:
        return default, "stale"

    return item["value"], "online"

Design decisions that matter

  • Fallback for missing/stale features.
  • Freshness SLA.
  • Latency budget per lookup.
  • Which values should be request-time rather than stored.

Common failure modes

  • Feature order/type mismatch can produce plausible but wrong predictions.
  • Latest online values can cause training-serving skew if training snapshots were not point-in-time correct.
  • Real-time joins are typically application/client-side.

Production readiness check

Items to close before treating this step as production-ready.

✓ lookup latency✓ freshness✓ missing-feature policy✓ schema/order✓ training parity✓ request correlation