CertSafari
    Databricks Certified Machine Learning Associate· Lessons

    Domain 1 · Lesson 9/48

    Batch scoring with feature store tables using score_batch

    Score a model using features from a feature store table.

    15 min read
    2.11% of exam
    6 sources
    Published 22 Oct 2026
    Docs as of 17 Oct 2026

    What you will be able to do

    • Call fe.score_batch with a DataFrame of lookup keys and predict the columns it returns
    • Explain why score_batch fails on a model logged with a plain MLflow flavor or used with the wrong client
    • Override a packaged feature and supply extra non-feature-store columns at scoring time
    • Prepare a scoring DataFrame for a time series feature table and handle missing lookup keys
    • Choose between score_batch, mlflow.pyfunc and Model Serving for a feature store model

    Key concept

    Automatic feature lookup at scoring time — A model logged through the feature store client carries the list of features it was trained on and the tables and keys they came from. When it scores, it uses that list to fetch the features itself, so the caller only has to send the primary keys.

    1.Why a feature store model needs only keys to score

    Scoring a model that was trained on feature table data raises one practical problem: the new records do not have the derived feature columns. A batch of tomorrow's orders has a customer_id and a product_id, not total_purchases_30d. Without a feature store, you would rebuild those columns by hand by joining the feature tables onto the batch before calling predict(). That is the same join logic written a second time, and it can drift from the version used in training.

    The feature store removes that second join. When you train with a training set and log the model through the client, the model keeps a record of each feature it used and which table and key each one came from. This is covered in fe.log_model: packaging feature metadata with the model, and it is the reason scoring needs only the primary keys: the model already knows where everything else lives. In batch, it reads the values from the offline Delta feature tables and joins them onto your rows before the model runs.

    That record exists only if the model went through the feature store client's log_model. A scikit-learn model trained on a TrainingSet.load_df() DataFrame but logged with mlflow.sklearn.log_model is just a scikit-learn model. It has the same weights but no feature references. Give score_batch a keys-only DataFrame for that model and the call fails, because nothing tells it which tables to join. Training on feature store data does not attach the metadata. Logging with the client does.

    The client also has to match. Feature tables in Unity Catalog go through FeatureEngineeringClient (fe), and the legacy Workspace Feature Store goes through FeatureStoreClient (fs). This split is explained in FeatureEngineeringClient vs legacy FeatureStoreClient. Every documented example pairs them the same way: fe.log_model is scored with fe.score_batch, and fs.log_model with fs.score_batch. Call score_batch on the type of client that logged the model.

    Checkpoint 1 of 9· Check yourself

    A data scientist builds a training set with fe.create_training_set, trains a scikit-learn model on training_set.load_df(), and logs it with mlflow.sklearn.log_model. Later they call fe.score_batch on that model with a batch DataFrame that has only customer_id and product_id. What happens?

    Checkpoint 2 of 9· Exam question

    A team trained a scikit-learn model using a DataFrame produced by TrainingSet.load_df(), but at the end of the notebook they logged it using mlflow.sklearn.log_model(model, "model") instead of the Feature Engineering client's logging method. When they later call fe.score_batch() against a batch DataFrame containing only lookup keys, the call fails. What is the most likely cause?

    Sources123

    2.Calling score_batch and reading its output

    score_batch takes two arguments: a model_uri that points to the logged or registered model, and df, a Spark DataFrame with the lookup keys. It reads the feature metadata stored with the model, fetches each required feature from its table using the keys in df, scores the model, and returns one DataFrame. That DataFrame keeps all of your input columns, adds a column for each looked-up feature, and adds a prediction column.

    Batch scoring a Unity Catalog feature store model from keys alonepython
    fe = FeatureEngineeringClient()
    
    # batch_df has columns 'customer_id' and 'product_id'
    predictions = fe.score_batch(
        model_uri=model_uri,
        df=batch_df
    )
    
    # The 'predictions' DataFrame has these columns:
    # 'customer_id', 'product_id', 'total_purchases_30d', 'category', 'prediction'

    Because the feature columns stay in the output, you can audit a batch afterwards: a strange prediction can be traced to the exact feature values that produced it, in the same row. Some approaches look similar but are not the scoring path. You could join the feature table with Spark SQL or pandas.merge and then call predict(), but that rebuilds the join by hand. You could call create_training_set again on the batch, but that API builds a training dataset. It is not a scoring call. score_batch is the method that turns keys into predictions.

    Checkpoint 3 of 9· Fill the gap

    batch_df holds only the lookup keys for a model logged with fe.log_model. Which method fills the blank so the call returns the looked-up features plus a prediction column?

    fe = FeatureEngineeringClient()
    
    # batch_df has columns 'customer_id' and 'product_id'
    predictions = fe. ? (
        model_uri=model_uri,
        df=batch_df
    )
    
    # The 'predictions' DataFrame has these columns:
    # 'customer_id', 'product_id', 'total_purchases_30d', 'category', 'prediction'

    Checkpoint 4 of 9· Exam question

    A ML engineer at a retail company trained and logged a model using FeatureEngineeringClient.log_model(), embedding feature lookup metadata from a Unity Catalog feature table. Now they need to generate predictions for a new batch of records that lack the derived feature columns used during training. Which approach lets them generate predictions without manually joining the feature table into the batch DataFrame?

    Sources34

    3.Overriding features and adding columns from outside the store

    A column in the scoring DataFrame that has the same name as a packaged feature replaces the lookup for that feature. score_batch does not raise a duplicate-column error and does not overwrite your values. It uses the values you supplied and fetches only the features that are still missing. Suppose a model was packaged with account_creation_date and num_lifetime_purchases. If you score a DataFrame with customer_id and account_creation_date, only num_lifetime_purchases is read from the feature table.

    Supplying a custom value for one packaged featurepython
    # batch_df has columns ['customer_id', 'account_creation_date']
    predictions = fe.score_batch(
      model_uri='models:/ban_prediction_model/1',
      df=batch_df
    )

    Overrides are useful when a fresher value exists than the one in the table, such as a velocity computed by a streaming job seconds ago. The risk runs the other way. A column left over in the batch with a feature's name will quietly replace the table value, and nothing warns you.

    Features that never came from the store follow a stricter rule. A model can be trained on a mix of feature table columns and ordinary columns, for example a browser column passed through create_training_set without being excluded. The feature store has no table to read browser from, so the scoring DataFrame has to include it next to the keys.

    What the scoring DataFrame must or may contain
    Column kindExampleAt score_batch time
    Lookup keycustomer_id, product_idRequired; used to fetch packaged features
    Packaged feature, not suppliednum_lifetime_purchasesLooked up from the feature table
    Packaged feature, suppliedaccount_creation_dateYour value is used; no lookup for it
    Non-feature-store training columnbrowserRequired; there is no table to read it from

    Checkpoint 5 of 9· Check yourself

    Before calling fe.score_batch, an engineer adds a fresh account_creation_date column to batch_df, next to customer_id. The model was logged with fe.log_model and packaged with account_creation_date and num_lifetime_purchases. How does score_batch treat the batch?

    Checkpoint 6 of 9· Check yourself

    A model was trained on total_purchases_30d, looked up by customer_id, and on a browser column that was passed through create_training_set and not excluded. It was logged with fe.log_model. Which batch DataFrame is the minimum that fe.score_batch can score?

    Checkpoint 7 of 9· Exam question

    A fraud detection model was trained using features from a Unity Catalog feature table, including a transaction_velocity feature. Before calling fe.score_batch(), an engineer added their own precomputed transaction_velocity column to the batch DataFrame using a faster streaming aggregation rather than relying on the feature table. What happens when score_batch() runs?

    Sources3

    4.Time series lookups and keys that are not in the table

    A model trained on a time series feature table needs a timestamp, not just an ID. These are time series feature tables (timeseries column in the primary key), and they are joined point in time. For each row, the feature value is the one that was valid at that row's timestamp. score_batch repeats the same point-in-time lookup when it scores, using the metadata packaged with the model. So the scoring DataFrame must include a timestamp column with the same name and DataType as the timestamp_lookup_key used in training. Any lookback window set for training also applies to batch inference. On a Photon-enabled cluster, passing use_spark_native_join=True to FeatureEngineeringClient.score_batch speeds up the lookup. This requires databricks-feature-engineering 0.6.0 or above.

    A key that has no matching row in the feature table does not stop the job. The missing feature comes back empty. With fe.score_batch the empty value is always NaN. Model Serving behaves differently: it returns None when none of the request's lookup keys exist and NaN when only some are missing. A model that runs both in batch and behind an endpoint should therefore handle both None and NaN, rather than relying on how batch scoring happens to fill the gap.

    Checkpoint 8 of 9· Check yourself

    Training used a FeatureLookup on a time series feature table with timestamp_lookup_key='event_ts', a TimestampType column. Now the team wants to run fe.score_batch on a new batch. What does batch_df need to contain?

    Sources53

    5.score_batch compared with pyfunc and Model Serving

    score_batch is one of three ways to score a feature store model, and all three can do the lookup. Plain MLflow is the second. Batch inference with mlflow.pyfunc and spark_udf also works on a model logged by the feature store client: mlflow.pyfunc predict fetches the features from the store and joins them with any values you pass in, as long as you supply the primary keys. It has two limits. It needs MLflow 2.11 or above, and it does not support models that use time series feature tables. For those models, use score_batch.

    Real-time serving is the third path. When a feature store model is deployed with Model Serving, the endpoint reads every required feature from the online store, not the offline Delta tables. The difference is explained in Offline feature tables vs online store. As in batch, querying a real-time serving endpoint for this kind of model means the request carries only the lookup keys. You override a feature by putting its value in the request payload, and the value must match the data type the model expects.

    Choosing a scoring path for a model logged with the feature store client
    PathWhere features come fromTime series feature tablesOverride a feature
    fe.score_batchOffline feature tablesSupported (point-in-time lookup)Add the column to df
    mlflow.pyfunc predictFeature StoreNot supportedValues provided at inference are joined
    Model Serving endpointOnline storeLatest value usedInclude it in the API payload

    Checkpoint 9 of 9· Match them up

    Match each way of scoring a model logged with fe.log_model to how it handles feature lookup.

    Tap a term, then the definition that fits it.

    Sources365

    Sources

    (6)

    Every claim above is drawn from one of these pages, quoted as it was written on the date shown.

    1. 1.
      “In batch inference, feature values are retrieved from the offline store and joined with new data prior to scoring.”
      ↩︎ Why a feature store model needs only keys to score
      “The caller only needs to provide the primary key of the features used in the model”
      ↩︎ Key concept
      “To package a model with feature metadata, use FeatureEngineeringClient.log_model (for Feature Engineering in Unity Catalog) or FeatureStoreClient.log_model (for Workspace Feature Store).”
      ↩︎ Exam trap 1
      “To package a model with feature metadata, use FeatureEngineeringClient.log_model (for Feature Engineering in Unity Catalog) or FeatureStoreClient.log_model (for Workspace Feature Store).”
      ↩︎ Checkpoint
    2. 2.
      “To work with feature tables in Unity Catalog, use FeatureEngineeringClient. To use Workspace Feature Store, you must use FeatureStoreClient.”
      ↩︎ Why a feature store model needs only keys to score
    3. 3.
      “If the model at model_uri is packaged with the features, the FeatureStoreClient.score_batch()”
      ↩︎ Why a feature store model needs only keys to score
      “The DataFrame returned by score_batch() augments batch_df with”
      ↩︎ Calling score_batch and reading its output
      “To use custom feature values for scoring, include them in the DataFrame passed to FeatureEngineeringClient.score_batch”
      ↩︎ Overriding features and adding columns from outside the store
      “At inference, the DataFrame used in FeatureStoreClient.score_batch must include the browser column.”
      ↩︎ Overriding features and adding columns from outside the store
      “For offline applications using fe.score_batch, the returned value for a missing feature is NaN.”
      ↩︎ Time series lookups and keys that are not in the table
      “If none of the provided lookup keys exist, the value is None.”
      ↩︎ Time series lookups and keys that are not in the table
      “mlflow.pyfunc.predict retrieves feature values from Feature Store and also joins any values provided at inference time.”
      ↩︎ score_batch compared with pyfunc and Model Serving
      “Batch inference with MLflow requires MLflow version 2.11 and above.”
      ↩︎ score_batch compared with pyfunc and Model Serving
      “the API looks up only the num_lifetime_purchases feature from Feature Store and uses the provided custom account_creation_date column values”
      ↩︎ Exam trap 2
      “At inference, the DataFrame used in FeatureStoreClient.score_batch must include the browser column.”
      ↩︎ Exam trap 3
      “Models that use time series feature tables are not supported. To do batch inference with time series feature tables, use score_batch.”
      ↩︎ Exam trap 4
      “the API looks up only the num_lifetime_purchases feature from Feature Store and uses the provided custom account_creation_date column values for model scoring”
      ↩︎ Checkpoint
      “Models that use time series feature tables are not supported. To do batch inference with time series feature tables, use score_batch.”
      ↩︎ Checkpoint
    4. 4.
      “score_batch uses the feature metadata stored with the model to automatically compute point-in-time correct features for inference, ensuring consistency with training.”
      ↩︎ Calling score_batch and reading its output
    5. 5.
      “must contain a timestamp column with the same name and DataType as the timestamp_lookup_key of the FeatureLookup”
      ↩︎ Time series lookups and keys that are not in the table
      “For faster lookup performance when Photon is enabled, pass use_spark_native_join=True to FeatureEngineeringClient.score_batch.”
      ↩︎ Time series lookups and keys that are not in the table
      “The lookback window is applied during training and batch inference.”
      ↩︎ Time series lookups and keys that are not in the table
      “During online inference, the latest feature value is always used, regardless of the lookback window.”
      ↩︎ score_batch compared with pyfunc and Model Serving
      “must contain a timestamp column with the same name and DataType as the timestamp_lookup_key”
      ↩︎ Checkpoint
    6. 6.
      “All features required by the model (logged with FeatureEngineeringClient.log_model or FeatureStoreClient.log_model) are automatically looked up from online stores for model scoring.”
      ↩︎ score_batch compared with pyfunc and Model Serving
      “include the feature values as a part of the API payload”
      ↩︎ score_batch compared with pyfunc and Model Serving

    Ready to test yourself?

    Practise the 7 questions on this subdomain.

    Spotted a mistake, or was something unclear? Tell us.